ooxml-core 1.35.0 → 1.36.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/automation/index.cjs +1290 -825
- package/dist/automation/index.mjs +1290 -825
- package/dist/visio/bevel-3d.d.ts +31 -4
- package/dist/visio/bevel-3d.d.ts.map +1 -1
- package/dist/visio/cff-author.d.ts +14 -0
- package/dist/visio/cff-author.d.ts.map +1 -0
- package/dist/visio/cff-masters.d.ts +11 -0
- package/dist/visio/cff-masters.d.ts.map +1 -1
- package/dist/visio/edit-commands.d.ts +7 -0
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-commands.d.ts +6 -0
- package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
- package/dist/visio/edit-instance-geometry.d.ts.map +1 -1
- package/dist/visio/edit-instance-recalculate.d.ts +6 -1
- package/dist/visio/edit-instance-recalculate.d.ts.map +1 -1
- package/dist/visio/edit-shape-create.d.ts.map +1 -1
- package/dist/visio/edit-stencil-connector.d.ts.map +1 -1
- package/dist/visio/edit-swimlane-stamp.d.ts +22 -0
- package/dist/visio/edit-swimlane-stamp.d.ts.map +1 -0
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +1338 -568
- package/dist/visio/index.d.ts +3 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +1331 -569
- package/dist/visio/model.d.ts +6 -2
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/path-segments.d.ts +25 -0
- package/dist/visio/path-segments.d.ts.map +1 -0
- package/dist/visio/shape-sections.d.ts +4 -3
- package/dist/visio/shape-sections.d.ts.map +1 -1
- package/dist/visio/solid-3d.d.ts +55 -0
- package/dist/visio/solid-3d.d.ts.map +1 -0
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/theme-solid.d.ts +21 -0
- package/dist/visio/theme-solid.d.ts.map +1 -0
- package/dist/visio/ui/data-visualizer-edits.d.ts +1 -0
- package/dist/visio/ui/data-visualizer-edits.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +1188 -571
- package/dist/visio/ui/index.mjs +1188 -572
- package/dist/visio/ui/org-chart-belt.d.ts +20 -0
- package/dist/visio/ui/org-chart-belt.d.ts.map +1 -0
- package/dist/visio/ui/org-chart-edit.d.ts +8 -1
- package/dist/visio/ui/org-chart-edit.d.ts.map +1 -1
- package/dist/visio/ui/org-chart-import.d.ts.map +1 -1
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1519,8 +1519,8 @@ function isSafePartName(name3) {
|
|
|
1519
1519
|
if (body.startsWith("/")) return false;
|
|
1520
1520
|
return !body.split("/").some((segment) => segment === "..");
|
|
1521
1521
|
}
|
|
1522
|
-
function declaredEntrySize(
|
|
1523
|
-
const data =
|
|
1522
|
+
function declaredEntrySize(entry4) {
|
|
1523
|
+
const data = entry4._data;
|
|
1524
1524
|
const size3 = Number(data?.uncompressedSize ?? 0);
|
|
1525
1525
|
return Number.isFinite(size3) && size3 > 0 ? size3 : 0;
|
|
1526
1526
|
}
|
|
@@ -1534,10 +1534,10 @@ function resolveLimits(limits) {
|
|
|
1534
1534
|
fail: (message, limit3, kind, actual) => create4 ? create4(message, { limit: limit3, kind, actual }) : new ZipLimitError(message, { limit: limit3, kind, actual })
|
|
1535
1535
|
};
|
|
1536
1536
|
}
|
|
1537
|
-
async function inflateEntryGuarded(
|
|
1537
|
+
async function inflateEntryGuarded(entry4, alreadyRead, limits) {
|
|
1538
1538
|
const chunks = [];
|
|
1539
1539
|
let size3 = 0;
|
|
1540
|
-
for await (const chunk of streamEntryGuarded(
|
|
1540
|
+
for await (const chunk of streamEntryGuarded(entry4, alreadyRead, limits)) {
|
|
1541
1541
|
chunks.push(chunk);
|
|
1542
1542
|
size3 += chunk.byteLength;
|
|
1543
1543
|
}
|
|
@@ -1551,10 +1551,10 @@ async function inflateEntryGuarded(entry3, alreadyRead, limits) {
|
|
|
1551
1551
|
return out;
|
|
1552
1552
|
}
|
|
1553
1553
|
var AHEAD = 8;
|
|
1554
|
-
async function* streamEntryGuarded(
|
|
1554
|
+
async function* streamEntryGuarded(entry4, alreadyRead, limits) {
|
|
1555
1555
|
const r = resolveLimits(limits);
|
|
1556
|
-
const declared = declaredEntrySize(
|
|
1557
|
-
const stream =
|
|
1556
|
+
const declared = declaredEntrySize(entry4);
|
|
1557
|
+
const stream = entry4.internalStream("uint8array");
|
|
1558
1558
|
const queue = [];
|
|
1559
1559
|
let size3 = 0;
|
|
1560
1560
|
let ended = false;
|
|
@@ -1584,7 +1584,7 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
|
|
|
1584
1584
|
if (size3 > declared || size3 > r.maxEntryBytes)
|
|
1585
1585
|
return fail4(
|
|
1586
1586
|
r.fail(
|
|
1587
|
-
`${r.label} part ${
|
|
1587
|
+
`${r.label} part ${entry4.name} inflates past its declared size`,
|
|
1588
1588
|
r.maxEntryBytes,
|
|
1589
1589
|
size3 > declared ? "declaredSize" : "maxEntryBytes",
|
|
1590
1590
|
size3
|
|
@@ -1647,15 +1647,15 @@ function guardZip(zip, limits = {}) {
|
|
|
1647
1647
|
entries.length
|
|
1648
1648
|
);
|
|
1649
1649
|
let declared = 0;
|
|
1650
|
-
for (const
|
|
1651
|
-
const original =
|
|
1652
|
-
if (!isSafePartName(
|
|
1650
|
+
for (const entry4 of entries) {
|
|
1651
|
+
const original = entry4.unsafeOriginalName;
|
|
1652
|
+
if (!isSafePartName(entry4.name) || original !== void 0 && !isSafePartName(original))
|
|
1653
1653
|
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
|
|
1654
|
-
if (
|
|
1655
|
-
const size3 = declaredEntrySize(
|
|
1654
|
+
if (entry4.dir) continue;
|
|
1655
|
+
const size3 = declaredEntrySize(entry4);
|
|
1656
1656
|
if (size3 > r.maxEntryBytes)
|
|
1657
1657
|
throw r.fail(
|
|
1658
|
-
`${r.label} part ${
|
|
1658
|
+
`${r.label} part ${entry4.name} exceeds the uncompressed part size limit`,
|
|
1659
1659
|
r.maxEntryBytes,
|
|
1660
1660
|
"maxEntryBytes",
|
|
1661
1661
|
size3
|
|
@@ -1671,15 +1671,15 @@ function guardZip(zip, limits = {}) {
|
|
|
1671
1671
|
);
|
|
1672
1672
|
const produced = /* @__PURE__ */ new Map();
|
|
1673
1673
|
let total2 = 0;
|
|
1674
|
-
for (const
|
|
1675
|
-
if (
|
|
1676
|
-
const inflateOriginal =
|
|
1677
|
-
|
|
1678
|
-
const previous = produced.get(
|
|
1679
|
-
const bytes = await inflateEntryGuarded(
|
|
1674
|
+
for (const entry4 of entries) {
|
|
1675
|
+
if (entry4.dir) continue;
|
|
1676
|
+
const inflateOriginal = entry4.async.bind(entry4);
|
|
1677
|
+
entry4.async = async (type, onUpdate) => {
|
|
1678
|
+
const previous = produced.get(entry4.name) ?? 0;
|
|
1679
|
+
const bytes = await inflateEntryGuarded(entry4, total2 - previous, limits);
|
|
1680
1680
|
if (bytes.byteLength > previous) {
|
|
1681
1681
|
total2 += bytes.byteLength - previous;
|
|
1682
|
-
produced.set(
|
|
1682
|
+
produced.set(entry4.name, bytes.byteLength);
|
|
1683
1683
|
}
|
|
1684
1684
|
switch (type) {
|
|
1685
1685
|
case "uint8array":
|
|
@@ -2281,8 +2281,8 @@ var MAX_DOCUMENT_PART_BYTES = 25 * 1024 * 1024;
|
|
|
2281
2281
|
// opc/zip-folders.ts
|
|
2282
2282
|
var entryNames = (zip) => new Set(Object.keys(zip.files));
|
|
2283
2283
|
function dropAddedFolders(zip, source3) {
|
|
2284
|
-
for (const [name3,
|
|
2285
|
-
if (
|
|
2284
|
+
for (const [name3, entry4] of Object.entries(zip.files))
|
|
2285
|
+
if (entry4.dir && !source3.has(name3)) delete zip.files[name3];
|
|
2286
2286
|
}
|
|
2287
2287
|
|
|
2288
2288
|
// docx/save-modified.ts
|
|
@@ -2347,7 +2347,7 @@ var RPR_ORDER = [
|
|
|
2347
2347
|
];
|
|
2348
2348
|
function orderChildren(parent, order) {
|
|
2349
2349
|
const elements2 = Array.from(parent.childNodes).filter(isElement);
|
|
2350
|
-
const rankOf = (name3) => order.findIndex((
|
|
2350
|
+
const rankOf = (name3) => order.findIndex((entry4) => typeof entry4 === "string" ? entry4 === name3 : entry4.includes(name3));
|
|
2351
2351
|
let previousRank = -1;
|
|
2352
2352
|
const ranked = elements2.map((element5, index5) => {
|
|
2353
2353
|
const rank7 = element5.namespaceURI === WORD_NS ? rankOf(element5.localName ?? "") : -1;
|
|
@@ -2355,7 +2355,7 @@ function orderChildren(parent, order) {
|
|
|
2355
2355
|
return { element: element5, index: index5, rank: rank7 >= 0 ? rank7 : previousRank + 0.5 };
|
|
2356
2356
|
});
|
|
2357
2357
|
const sorted2 = [...ranked].sort((a2, b) => a2.rank - b.rank || a2.index - b.index);
|
|
2358
|
-
if (sorted2.every((
|
|
2358
|
+
if (sorted2.every((entry4, index5) => entry4.element === elements2[index5])) return;
|
|
2359
2359
|
for (const { element: element5 } of sorted2) parent.appendChild(element5);
|
|
2360
2360
|
}
|
|
2361
2361
|
var SECTPR_ORDER = [
|
|
@@ -2969,7 +2969,7 @@ function trackMoveRange(item2, moves) {
|
|
|
2969
2969
|
const open2 = moves[range3.kind];
|
|
2970
2970
|
if (range3.start) open2.push({ name: getW(item2, "name") ?? id5, id: id5 });
|
|
2971
2971
|
else {
|
|
2972
|
-
const index5 = open2.findIndex((
|
|
2972
|
+
const index5 = open2.findIndex((entry4) => entry4.id === id5);
|
|
2973
2973
|
if (index5 >= 0) open2.splice(index5, 1);
|
|
2974
2974
|
}
|
|
2975
2975
|
return true;
|
|
@@ -3267,9 +3267,9 @@ function validItems(items) {
|
|
|
3267
3267
|
return items.flatMap((item2) => {
|
|
3268
3268
|
if (!item2 || typeof item2 !== "object") return [];
|
|
3269
3269
|
const { display, value: value3 } = item2;
|
|
3270
|
-
const [shown,
|
|
3271
|
-
const text9 = shown ??
|
|
3272
|
-
return text9 === void 0 ? [] : [{ display: text9, value:
|
|
3270
|
+
const [shown, entry4] = [entryText(display), entryText(value3)];
|
|
3271
|
+
const text9 = shown ?? entry4;
|
|
3272
|
+
return text9 === void 0 ? [] : [{ display: text9, value: entry4 ?? text9 }];
|
|
3273
3273
|
});
|
|
3274
3274
|
}
|
|
3275
3275
|
function validGlyph(glyph2) {
|
|
@@ -3446,8 +3446,8 @@ function topLevel(node4, container) {
|
|
|
3446
3446
|
return current;
|
|
3447
3447
|
}
|
|
3448
3448
|
function pruneEmptyControls(flat) {
|
|
3449
|
-
for (const
|
|
3450
|
-
let sdt =
|
|
3449
|
+
for (const entry4 of flat) {
|
|
3450
|
+
let sdt = entry4.sdt;
|
|
3451
3451
|
while (sdt) {
|
|
3452
3452
|
const content2 = sdtContent(sdt);
|
|
3453
3453
|
const parent = sdt.parentNode;
|
|
@@ -3460,13 +3460,13 @@ function pruneEmptyControls(flat) {
|
|
|
3460
3460
|
}
|
|
3461
3461
|
}
|
|
3462
3462
|
function placeBlocksById(doc, container, flat, blocks, nodes, anchor2) {
|
|
3463
|
-
const oldSet = new Set(flat.map((
|
|
3463
|
+
const oldSet = new Set(flat.map((entry4) => entry4.element));
|
|
3464
3464
|
const keptInOrder = nodes.filter((node4) => oldSet.has(node4));
|
|
3465
|
-
const documentOrder2 = flat.map((
|
|
3465
|
+
const documentOrder2 = flat.map((entry4) => entry4.element).filter((node4) => keptInOrder.includes(node4));
|
|
3466
3466
|
if (keptInOrder.some((node4, index5) => node4 !== documentOrder2[index5])) return false;
|
|
3467
3467
|
const outputSet = new Set(nodes);
|
|
3468
|
-
for (const
|
|
3469
|
-
if (!outputSet.has(
|
|
3468
|
+
for (const entry4 of flat)
|
|
3469
|
+
if (!outputSet.has(entry4.element)) entry4.element.parentNode?.removeChild(entry4.element);
|
|
3470
3470
|
pruneEmptyControls(flat);
|
|
3471
3471
|
let previous;
|
|
3472
3472
|
nodes.forEach((node4, index5) => {
|
|
@@ -3492,11 +3492,11 @@ function placeBlocksById(doc, container, flat, blocks, nodes, anchor2) {
|
|
|
3492
3492
|
function syncBlockControls(doc, flat, blocks, nodes) {
|
|
3493
3493
|
const bySdt = /* @__PURE__ */ new Map();
|
|
3494
3494
|
const dropped = /* @__PURE__ */ new Map();
|
|
3495
|
-
flat.forEach((
|
|
3496
|
-
const block = blocks[nodes.indexOf(
|
|
3497
|
-
if (!
|
|
3498
|
-
if (block.contentControl && !bySdt.has(
|
|
3499
|
-
dropped.set(
|
|
3495
|
+
flat.forEach((entry4) => {
|
|
3496
|
+
const block = blocks[nodes.indexOf(entry4.element)];
|
|
3497
|
+
if (!entry4.sdt || !block) return;
|
|
3498
|
+
if (block.contentControl && !bySdt.has(entry4.sdt)) bySdt.set(entry4.sdt, block);
|
|
3499
|
+
dropped.set(entry4.sdt, (dropped.get(entry4.sdt) ?? true) && !block.contentControl);
|
|
3500
3500
|
});
|
|
3501
3501
|
for (const [sdt, block] of bySdt) patchContentControl(doc, sdt, block.contentControl);
|
|
3502
3502
|
for (const [sdt, gone] of dropped) if (gone) unwrapContentControl(sdt);
|
|
@@ -3620,13 +3620,13 @@ function buildCommentsExtendedDocument(comments) {
|
|
|
3620
3620
|
);
|
|
3621
3621
|
const root = doc.documentElement;
|
|
3622
3622
|
comments.forEach((comment, index5) => {
|
|
3623
|
-
const
|
|
3624
|
-
|
|
3625
|
-
if (comment.resolved)
|
|
3623
|
+
const entry4 = doc.createElementNS(W15_NS, "w15:commentEx");
|
|
3624
|
+
entry4.setAttributeNS(W15_NS, "w15:paraId", paraIdFor(comment.id, index5));
|
|
3625
|
+
if (comment.resolved) entry4.setAttributeNS(W15_NS, "w15:done", "1");
|
|
3626
3626
|
const parentIndex = comments.findIndex((c2) => c2.id === comment.parentId);
|
|
3627
3627
|
if (parentIndex >= 0)
|
|
3628
|
-
|
|
3629
|
-
root.appendChild(
|
|
3628
|
+
entry4.setAttributeNS(W15_NS, "w15:paraIdParent", paraIdFor(comment.parentId, parentIndex));
|
|
3629
|
+
root.appendChild(entry4);
|
|
3630
3630
|
});
|
|
3631
3631
|
return doc;
|
|
3632
3632
|
}
|
|
@@ -3900,12 +3900,12 @@ function linearToSrgb255(linear) {
|
|
|
3900
3900
|
// color/hex-rgb.ts
|
|
3901
3901
|
function parseArgbHex(hex4) {
|
|
3902
3902
|
const clean6 = hex4.replace(/^#/, "");
|
|
3903
|
-
const
|
|
3904
|
-
if (!/^[0-9a-fA-F]{6}$/.test(
|
|
3905
|
-
return [0, 2, 4].map((i2) => parseInt(
|
|
3903
|
+
const rgb8 = clean6.length === 8 ? clean6.slice(2) : clean6;
|
|
3904
|
+
if (!/^[0-9a-fA-F]{6}$/.test(rgb8)) return void 0;
|
|
3905
|
+
return [0, 2, 4].map((i2) => parseInt(rgb8.slice(i2, i2 + 2), 16));
|
|
3906
3906
|
}
|
|
3907
3907
|
var clamp255 = (v) => Math.max(0, Math.min(255, v));
|
|
3908
|
-
var rgbToUpperHex = (
|
|
3908
|
+
var rgbToUpperHex = (rgb8) => `#${rgb8.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
|
|
3909
3909
|
|
|
3910
3910
|
// color/theme-palette.ts
|
|
3911
3911
|
function themePaletteVariantLuminance(variant) {
|
|
@@ -3914,9 +3914,9 @@ function themePaletteVariantLuminance(variant) {
|
|
|
3914
3914
|
return variant.kind === "lighter" ? { lumMod, lumOff: fraction } : { lumMod };
|
|
3915
3915
|
}
|
|
3916
3916
|
function applyThemePaletteVariant(hex4, variant) {
|
|
3917
|
-
const
|
|
3918
|
-
if (!
|
|
3919
|
-
const { h: h2, s, l } = rgbToHsl(
|
|
3917
|
+
const rgb8 = hexToRgbChannels(hex4);
|
|
3918
|
+
if (!rgb8) return hex4;
|
|
3919
|
+
const { h: h2, s, l } = rgbToHsl(rgb8.r, rgb8.g, rgb8.b);
|
|
3920
3920
|
const { lumMod, lumOff } = themePaletteVariantLuminance(variant);
|
|
3921
3921
|
const next = hslToRgb(h2, s, l * lumMod + (lumOff ?? 0), (value3) => Math.floor(value3 + 1e-6));
|
|
3922
3922
|
return `#${toHex(next.r)}${toHex(next.g)}${toHex(next.b)}`.toLowerCase();
|
|
@@ -4557,8 +4557,8 @@ function patchGrid(doc, node4, table4) {
|
|
|
4557
4557
|
function writeRestructuredTable(doc, table4, node4, base3, writeParagraph, replaceSlots2, writeNested) {
|
|
4558
4558
|
if (table4.rows.some((row3) => !row3.length || row3.some((cell2) => !cell2.paragraphs.length)))
|
|
4559
4559
|
throw new Error("Every table row needs a cell and every cell a paragraph.");
|
|
4560
|
-
const oldRows = flatRows(node4).map((
|
|
4561
|
-
const oldCells = oldRows.map((tr) => flatCells(tr).map((
|
|
4560
|
+
const oldRows = flatRows(node4).map((entry4) => entry4.element);
|
|
4561
|
+
const oldCells = oldRows.map((tr) => flatCells(tr).map((entry4) => entry4.element));
|
|
4562
4562
|
const cellById = /* @__PURE__ */ new Map();
|
|
4563
4563
|
const paragraphById = /* @__PURE__ */ new Map();
|
|
4564
4564
|
base3.rows.forEach(
|
|
@@ -4569,8 +4569,8 @@ function writeRestructuredTable(doc, table4, node4, base3, writeParagraph, repla
|
|
|
4569
4569
|
if (id5) cellById.set(id5, { tc, model: cell2, row: ri });
|
|
4570
4570
|
const flat = flatCellParagraphs(tc);
|
|
4571
4571
|
cell2.paragraphs.forEach((model2, pi) => {
|
|
4572
|
-
const
|
|
4573
|
-
if (
|
|
4572
|
+
const entry4 = flat[pi];
|
|
4573
|
+
if (entry4) paragraphById.set(model2.id, { element: entry4.element, model: model2 });
|
|
4574
4574
|
});
|
|
4575
4575
|
})
|
|
4576
4576
|
);
|
|
@@ -4601,7 +4601,7 @@ function writeRestructuredTable(doc, table4, node4, base3, writeParagraph, repla
|
|
|
4601
4601
|
const props = buildCellProperties(doc, cell2);
|
|
4602
4602
|
if (props) tc.insertBefore(props, tc.firstChild);
|
|
4603
4603
|
}
|
|
4604
|
-
const oldParagraphs = reuse ? flatCellParagraphs(tc).map((
|
|
4604
|
+
const oldParagraphs = reuse ? flatCellParagraphs(tc).map((entry4) => entry4.element) : [];
|
|
4605
4605
|
const owned = new Set(oldParagraphs);
|
|
4606
4606
|
const nextParagraphs = cell2.paragraphs.map((paragraph2) => {
|
|
4607
4607
|
const found = paragraphById.get(paragraph2.id);
|
|
@@ -4635,19 +4635,19 @@ function tableGrid(table4) {
|
|
|
4635
4635
|
const line3 = new Array(columns2);
|
|
4636
4636
|
let col = 0;
|
|
4637
4637
|
cells3.forEach((cell2, index5) => {
|
|
4638
|
-
const
|
|
4639
|
-
for (let k = 0; k <
|
|
4640
|
-
col +=
|
|
4641
|
-
placed.push(
|
|
4638
|
+
const entry4 = { cell: cell2, row: row3, index: index5, col, span: spanOf(cell2) };
|
|
4639
|
+
for (let k = 0; k < entry4.span; k++) line3[col + k] = entry4;
|
|
4640
|
+
col += entry4.span;
|
|
4641
|
+
placed.push(entry4);
|
|
4642
4642
|
});
|
|
4643
4643
|
rows.push(placed);
|
|
4644
4644
|
cover.push(line3);
|
|
4645
4645
|
}
|
|
4646
4646
|
const grid = { columns: columns2, rows, cover };
|
|
4647
|
-
for (const
|
|
4648
|
-
if (
|
|
4649
|
-
const above =
|
|
4650
|
-
if (!above || above.col !==
|
|
4647
|
+
for (const entry4 of rows.flat())
|
|
4648
|
+
if (entry4.cell.verticalMerge === "continue") {
|
|
4649
|
+
const above = entry4.row > 0 ? cover[entry4.row - 1]?.[entry4.col] : void 0;
|
|
4650
|
+
if (!above || above.col !== entry4.col || above.span !== entry4.span) return void 0;
|
|
4651
4651
|
if (!above.cell.verticalMerge) return void 0;
|
|
4652
4652
|
}
|
|
4653
4653
|
return grid;
|
|
@@ -4738,7 +4738,7 @@ function writeTable(doc, table4, node4, base3, writeParagraph, replaceSlots2, ne
|
|
|
4738
4738
|
(row3) => reshaped && row3.length !== width || row3.some((cell2) => !cell2.paragraphs.length)
|
|
4739
4739
|
))
|
|
4740
4740
|
throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
|
|
4741
|
-
const oldRows = flatRows(node4).map((
|
|
4741
|
+
const oldRows = flatRows(node4).map((entry4) => entry4.element);
|
|
4742
4742
|
const sourceById = /* @__PURE__ */ new Map();
|
|
4743
4743
|
base3?.rows.forEach(
|
|
4744
4744
|
(row3, ri) => row3.forEach((cell2, ci) => {
|
|
@@ -4770,7 +4770,7 @@ function writeTable(doc, table4, node4, base3, writeParagraph, replaceSlots2, ne
|
|
|
4770
4770
|
if (sourceRow !== void 0) usedRows.add(sourceRow);
|
|
4771
4771
|
rowSources.push(sourceRow);
|
|
4772
4772
|
const tr = sourceRow === void 0 ? makeW(doc, "tr") : expectDefined(oldRows[sourceRow], `table row ${sourceRow}`);
|
|
4773
|
-
const oldCells = flatCells(tr).map((
|
|
4773
|
+
const oldCells = flatCells(tr).map((entry4) => entry4.element);
|
|
4774
4774
|
patchRowProperties(
|
|
4775
4775
|
doc,
|
|
4776
4776
|
tr,
|
|
@@ -4797,7 +4797,7 @@ function writeTable(doc, table4, node4, base3, writeParagraph, replaceSlots2, ne
|
|
|
4797
4797
|
patchCellMargins(doc, tc, cell2.margins, source3?.model.margins);
|
|
4798
4798
|
patchCellVerticalAlignment(doc, tc, cell2.verticalAlign, source3?.model.verticalAlign);
|
|
4799
4799
|
const flatParagraphs = flatCellParagraphs(tc);
|
|
4800
|
-
const oldParagraphs = flatParagraphs.map((
|
|
4800
|
+
const oldParagraphs = flatParagraphs.map((entry4) => entry4.element);
|
|
4801
4801
|
const nextParagraphs = cell2.paragraphs.map((paragraph2) => {
|
|
4802
4802
|
const index5 = source3?.paragraphs.findIndex((p) => p.id === paragraph2.id) ?? -1;
|
|
4803
4803
|
return writeParagraph(
|
|
@@ -6273,10 +6273,10 @@ var APPLIED = /* @__PURE__ */ new Set([
|
|
|
6273
6273
|
]);
|
|
6274
6274
|
function resolveDrawingColor(color4, theme3, options2) {
|
|
6275
6275
|
const base3 = baseHex(color4, theme3);
|
|
6276
|
-
const
|
|
6277
|
-
if (!
|
|
6276
|
+
const rgb8 = base3 ? hexToRgbChannels(base3) : null;
|
|
6277
|
+
if (!rgb8) return void 0;
|
|
6278
6278
|
if (options2?.transformOrder === "document") {
|
|
6279
|
-
const value3 = orderedColorTransforms(
|
|
6279
|
+
const value3 = orderedColorTransforms(rgb8, color4.transforms);
|
|
6280
6280
|
const round6 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
|
|
6281
6281
|
return {
|
|
6282
6282
|
hex: `#${toHex(round6(value3.r))}${toHex(round6(value3.g))}${toHex(round6(value3.b))}`,
|
|
@@ -6286,9 +6286,9 @@ function resolveDrawingColor(color4, theme3, options2) {
|
|
|
6286
6286
|
)
|
|
6287
6287
|
};
|
|
6288
6288
|
}
|
|
6289
|
-
let { r, g: g2, b } =
|
|
6290
|
-
const find3 = (name3) => color4.transforms.find((
|
|
6291
|
-
const has = (name3) => color4.transforms.some((
|
|
6289
|
+
let { r, g: g2, b } = rgb8;
|
|
6290
|
+
const find3 = (name3) => color4.transforms.find((entry4) => entry4.name === name3)?.value;
|
|
6291
|
+
const has = (name3) => color4.transforms.some((entry4) => entry4.name === name3);
|
|
6292
6292
|
if (has("comp")) {
|
|
6293
6293
|
const hsl = rgbToHsl(r, g2, b);
|
|
6294
6294
|
({ r, g: g2, b } = hslToRgb((hsl.h + 180) % 360, hsl.s, hsl.l));
|
|
@@ -6339,7 +6339,7 @@ function resolveDrawingColor(color4, theme3, options2) {
|
|
|
6339
6339
|
return {
|
|
6340
6340
|
hex: `#${toHex(r)}${toHex(g2)}${toHex(b)}`,
|
|
6341
6341
|
alpha,
|
|
6342
|
-
unapplied: [...new Set(color4.transforms.map((
|
|
6342
|
+
unapplied: [...new Set(color4.transforms.map((entry4) => entry4.name))].filter(
|
|
6343
6343
|
(name3) => !APPLIED.has(name3)
|
|
6344
6344
|
)
|
|
6345
6345
|
};
|
|
@@ -8067,7 +8067,7 @@ function drawingEffectsXml(value3) {
|
|
|
8067
8067
|
// drawingml/drawing-shadow.ts
|
|
8068
8068
|
function resolveDrawingShadow(effects, theme3) {
|
|
8069
8069
|
const effect = parseDrawingEffects(effects)?.effects.find(
|
|
8070
|
-
(
|
|
8070
|
+
(entry4) => entry4.kind === "outerShadow"
|
|
8071
8071
|
);
|
|
8072
8072
|
return effect?.kind === "outerShadow" ? resolveDrawingOuterShadow(effect, theme3) : void 0;
|
|
8073
8073
|
}
|
|
@@ -9188,7 +9188,7 @@ function appendInSchemaOrder(parent, order, entries) {
|
|
|
9188
9188
|
const index5 = order.indexOf(name3);
|
|
9189
9189
|
return index5 < 0 ? order.length : index5;
|
|
9190
9190
|
};
|
|
9191
|
-
entries.map((
|
|
9191
|
+
entries.map((entry4, index5) => ({ entry: entry4, index: index5 })).sort((a2, b) => rank7(a2.entry.name) - rank7(b.entry.name) || a2.index - b.index).forEach(({ entry: entry4 }) => parent.appendChild(entry4.node));
|
|
9192
9192
|
}
|
|
9193
9193
|
function setBoolean(element5, name3, value3) {
|
|
9194
9194
|
if (value3 !== void 0) element5.setAttribute(name3, value3 ? "1" : "0");
|
|
@@ -15939,9 +15939,9 @@ function gd14(name3, formula2) {
|
|
|
15939
15939
|
return { name: name3, formula: formula2, args: parts.slice(1) };
|
|
15940
15940
|
}
|
|
15941
15941
|
function parseGdTable(table4) {
|
|
15942
|
-
return table4.trim().split(/[\n;]/).filter((
|
|
15943
|
-
const sep =
|
|
15944
|
-
return gd14(
|
|
15942
|
+
return table4.trim().split(/[\n;]/).filter((entry4) => entry4.length > 0).map((entry4) => {
|
|
15943
|
+
const sep = entry4.indexOf("|");
|
|
15944
|
+
return gd14(entry4.slice(0, sep), entry4.slice(sep + 1));
|
|
15945
15945
|
});
|
|
15946
15946
|
}
|
|
15947
15947
|
var GEAR9_GD_TABLE = `
|
|
@@ -19296,9 +19296,9 @@ function isContentType(nodeType) {
|
|
|
19296
19296
|
function buildDataModel(nodes, connections2) {
|
|
19297
19297
|
const flat = [];
|
|
19298
19298
|
collectNodes(nodes, void 0, flat);
|
|
19299
|
-
const content2 = flat.filter((
|
|
19300
|
-
const contentIds = new Set(content2.map((
|
|
19301
|
-
const docId = content2.find((
|
|
19299
|
+
const content2 = flat.filter((entry4) => isContentType(entry4.node.nodeType));
|
|
19300
|
+
const contentIds = new Set(content2.map((entry4) => entry4.node.id));
|
|
19301
|
+
const docId = content2.find((entry4) => entry4.parentId && !contentIds.has(entry4.parentId))?.parentId ?? "__doc__";
|
|
19302
19302
|
const doc = { id: docId, type: "doc", children: [] };
|
|
19303
19303
|
const byId2 = /* @__PURE__ */ new Map([[docId, doc]]);
|
|
19304
19304
|
const cxnByChild = /* @__PURE__ */ new Map();
|
|
@@ -19607,9 +19607,9 @@ function parseAlgorithm(element5) {
|
|
|
19607
19607
|
function parseShape2(element5) {
|
|
19608
19608
|
const adj = {};
|
|
19609
19609
|
const adjList = element5.children.find((child11) => child11.name === "adjLst");
|
|
19610
|
-
for (const
|
|
19611
|
-
if (
|
|
19612
|
-
adj[Number(
|
|
19610
|
+
for (const entry4 of adjList?.children ?? []) {
|
|
19611
|
+
if (entry4.name === "adj") {
|
|
19612
|
+
adj[Number(entry4.attrs.idx)] = Number(entry4.attrs.val);
|
|
19613
19613
|
}
|
|
19614
19614
|
}
|
|
19615
19615
|
const type = element5.attrs.type;
|
|
@@ -19724,8 +19724,8 @@ function parseStatement(element5, state) {
|
|
|
19724
19724
|
};
|
|
19725
19725
|
case "varLst": {
|
|
19726
19726
|
const vars = /* @__PURE__ */ Object.create(null);
|
|
19727
|
-
for (const
|
|
19728
|
-
vars[
|
|
19727
|
+
for (const entry4 of element5.children) {
|
|
19728
|
+
vars[entry4.name] = entry4.attrs.val ?? "";
|
|
19729
19729
|
}
|
|
19730
19730
|
return { kind: "varLst", vars };
|
|
19731
19731
|
}
|
|
@@ -20188,7 +20188,7 @@ function applyConstraint(node4, constraint) {
|
|
|
20188
20188
|
}
|
|
20189
20189
|
if (FONT_TYPES.has(constraint.refType)) {
|
|
20190
20190
|
for (const target3 of targets) {
|
|
20191
|
-
target3.deferred = target3.deferred.filter((
|
|
20191
|
+
target3.deferred = target3.deferred.filter((entry4) => entry4.source !== constraint);
|
|
20192
20192
|
target3.deferred.push({
|
|
20193
20193
|
source: constraint,
|
|
20194
20194
|
type: constraint.type,
|
|
@@ -23491,17 +23491,17 @@ function equalise(sizes, starts, groups, caps) {
|
|
|
23491
23491
|
function resolveEngineFonts(entries, metrics) {
|
|
23492
23492
|
const { groups, caps } = buildLinks(entries);
|
|
23493
23493
|
const starts = /* @__PURE__ */ new Map();
|
|
23494
|
-
for (const
|
|
23495
|
-
starts.set(
|
|
23494
|
+
for (const entry4 of entries) {
|
|
23495
|
+
starts.set(entry4.node, nodeFontBounds(entry4.node).start);
|
|
23496
23496
|
}
|
|
23497
23497
|
let resolved = /* @__PURE__ */ new Map();
|
|
23498
23498
|
for (let round6 = 0; round6 < 4; round6++) {
|
|
23499
23499
|
const previous = resolved;
|
|
23500
23500
|
const refSize = (ref) => previous.get(ref) ?? starts.get(ref);
|
|
23501
23501
|
const sizes = /* @__PURE__ */ new Map();
|
|
23502
|
-
for (const
|
|
23503
|
-
const bounds3 = nodeFontBounds(
|
|
23504
|
-
sizes.set(
|
|
23502
|
+
for (const entry4 of entries) {
|
|
23503
|
+
const bounds3 = nodeFontBounds(entry4.node);
|
|
23504
|
+
sizes.set(entry4.node, fitNodeFontPt(entry4.node, entry4.text, bounds3, metrics, refSize));
|
|
23505
23505
|
}
|
|
23506
23506
|
equalise(sizes, starts, groups, caps);
|
|
23507
23507
|
resolved = sizes;
|
|
@@ -23604,30 +23604,30 @@ function nodeTextFor(node4, ids, literal5, nodeById, fitNode = node4) {
|
|
|
23604
23604
|
|
|
23605
23605
|
// diagram/engine/engine-fonts.ts
|
|
23606
23606
|
var PX_PER_PT4 = 96 / 72;
|
|
23607
|
-
function nodeTextOf(
|
|
23608
|
-
const ids = sourceIdsOf(
|
|
23609
|
-
for (const id5 of
|
|
23607
|
+
function nodeTextOf(entry4, nodeById) {
|
|
23608
|
+
const ids = sourceIdsOf(entry4.node);
|
|
23609
|
+
for (const id5 of entry4.mergedIds ?? []) {
|
|
23610
23610
|
if (!ids.includes(id5)) {
|
|
23611
23611
|
ids.push(id5);
|
|
23612
23612
|
}
|
|
23613
23613
|
}
|
|
23614
23614
|
return nodeTextFor(
|
|
23615
|
-
|
|
23615
|
+
entry4.node,
|
|
23616
23616
|
ids,
|
|
23617
|
-
|
|
23617
|
+
entry4.rendered.literalText ?? entry4.rendered.text,
|
|
23618
23618
|
nodeById,
|
|
23619
|
-
|
|
23619
|
+
entry4.textNode ?? entry4.node
|
|
23620
23620
|
);
|
|
23621
23621
|
}
|
|
23622
23622
|
function applyEngineFonts(collected, nodeById, fontName) {
|
|
23623
23623
|
const texts = /* @__PURE__ */ new Map();
|
|
23624
23624
|
const txBySource = /* @__PURE__ */ new Map();
|
|
23625
|
-
for (const
|
|
23626
|
-
const text9 = nodeTextOf(
|
|
23625
|
+
for (const entry4 of collected) {
|
|
23626
|
+
const text9 = nodeTextOf(entry4, nodeById);
|
|
23627
23627
|
if (!text9) {
|
|
23628
23628
|
continue;
|
|
23629
23629
|
}
|
|
23630
|
-
const fitNode =
|
|
23630
|
+
const fitNode = entry4.textNode ?? entry4.node;
|
|
23631
23631
|
texts.set(fitNode, text9);
|
|
23632
23632
|
const first3 = sourceIdsOf(fitNode)[0];
|
|
23633
23633
|
if (first3 && fitNode.alg.type === "tx" && !txBySource.has(first3)) {
|
|
@@ -23833,7 +23833,7 @@ function runEngineLayout(smartArtData, containerBounds, nodes, palette, style4)
|
|
|
23833
23833
|
smartArtData.colorTransform?.roleColors
|
|
23834
23834
|
);
|
|
23835
23835
|
applyEngineFonts(collected, nodeById, smartArtData.themeMinorFont);
|
|
23836
|
-
const rendered = [...collected.map((
|
|
23836
|
+
const rendered = [...collected.map((entry4) => entry4.rendered), ...connectors2];
|
|
23837
23837
|
if (rendered.length === 0 || !rendered.every(isFiniteGeometry)) {
|
|
23838
23838
|
return void 0;
|
|
23839
23839
|
}
|
|
@@ -24115,15 +24115,15 @@ function reconcileRegion(items, desired) {
|
|
|
24115
24115
|
}
|
|
24116
24116
|
let insertionOffset = 0;
|
|
24117
24117
|
for (let affectedIndex = 0; affectedIndex < affected.length; affectedIndex++) {
|
|
24118
|
-
const
|
|
24118
|
+
const entry4 = affected[affectedIndex];
|
|
24119
24119
|
const isLast = affectedIndex === affected.length - 1;
|
|
24120
|
-
const take2 = isLast ? insertion.length - insertionOffset : Math.min(
|
|
24120
|
+
const take2 = isLast ? insertion.length - insertionOffset : Math.min(entry4.removed, insertion.length - insertionOffset);
|
|
24121
24121
|
const allocated = insertion.slice(insertionOffset, insertionOffset + Math.max(0, take2));
|
|
24122
24122
|
insertionOffset += Math.max(0, take2);
|
|
24123
|
-
const original = texts[
|
|
24123
|
+
const original = texts[entry4.index];
|
|
24124
24124
|
setItemText(
|
|
24125
|
-
items[
|
|
24126
|
-
original.slice(0,
|
|
24125
|
+
items[entry4.index],
|
|
24126
|
+
original.slice(0, entry4.start) + allocated + original.slice(entry4.end)
|
|
24127
24127
|
);
|
|
24128
24128
|
}
|
|
24129
24129
|
}
|
|
@@ -24138,13 +24138,13 @@ function atoms(paragraphs) {
|
|
|
24138
24138
|
const result2 = [];
|
|
24139
24139
|
for (let paragraph2 = 0; paragraph2 < paragraphs.length; paragraph2++) {
|
|
24140
24140
|
for (let item2 = 0; item2 < paragraphs[paragraph2].items.length; item2++) {
|
|
24141
|
-
const
|
|
24142
|
-
const text9 = itemText(
|
|
24141
|
+
const entry4 = paragraphs[paragraph2].items[item2];
|
|
24142
|
+
const text9 = itemText(entry4);
|
|
24143
24143
|
if (text9 !== void 0) {
|
|
24144
24144
|
for (let character = 0; character < text9.length; character++) {
|
|
24145
24145
|
result2.push({ kind: "text", paragraph: paragraph2, item: item2, character });
|
|
24146
24146
|
}
|
|
24147
|
-
} else if (
|
|
24147
|
+
} else if (entry4.kind === "tab" || entry4.kind === "break") {
|
|
24148
24148
|
result2.push({ kind: "item", paragraph: paragraph2, item: item2 });
|
|
24149
24149
|
}
|
|
24150
24150
|
}
|
|
@@ -25247,7 +25247,7 @@ function diagramNodesInTreeOrder(data) {
|
|
|
25247
25247
|
nodes.sort(
|
|
25248
25248
|
(a2, b) => (order.get(a2.node.id) ?? Number.MAX_SAFE_INTEGER) - (order.get(b.node.id) ?? Number.MAX_SAFE_INTEGER) || a2.index - b.index
|
|
25249
25249
|
);
|
|
25250
|
-
return treeOrderDiagramNodes(nodes.map((
|
|
25250
|
+
return treeOrderDiagramNodes(nodes.map((entry4) => entry4.node));
|
|
25251
25251
|
}
|
|
25252
25252
|
|
|
25253
25253
|
// diagram/edit/node-edit.ts
|
|
@@ -25562,7 +25562,7 @@ function ensure(parent, name3, namespace = NS.dgm) {
|
|
|
25562
25562
|
}
|
|
25563
25563
|
function writeDiagramFormatDefinition(source3, change) {
|
|
25564
25564
|
if (!(change.kind === "colors" ? DIAGRAM_COLOR_ENTRIES : DIAGRAM_STYLE_ENTRIES).some(
|
|
25565
|
-
(
|
|
25565
|
+
(entry4) => entry4.id === change.value
|
|
25566
25566
|
))
|
|
25567
25567
|
throw new RangeError("Unknown SmartArt format preset.");
|
|
25568
25568
|
const template2 = change.kind === "colors" ? buildFabricatedColorsXml(change.value) : buildFabricatedQuickStyleXml(change.value);
|
|
@@ -25578,7 +25578,7 @@ function writeDiagramFormatDefinition(source3, change) {
|
|
|
25578
25578
|
root.setAttribute("uniqueId", `urn:ooxml-core/${change.kind}/${change.value}`);
|
|
25579
25579
|
for (const label2 of children(root, "styleLbl", NS.dgm)) {
|
|
25580
25580
|
const name3 = label2.getAttribute("name") ?? "";
|
|
25581
|
-
const model2 = children(fresh, "styleLbl", NS.dgm).find((
|
|
25581
|
+
const model2 = children(fresh, "styleLbl", NS.dgm).find((entry4) => entry4.getAttribute("name") === name3) ?? children(fresh, "styleLbl", NS.dgm)[0];
|
|
25582
25582
|
if (change.kind === "colors") {
|
|
25583
25583
|
for (const listName of ["fillClrLst", "linClrLst", "txFillClrLst"]) {
|
|
25584
25584
|
const list3 = ensure(label2, listName);
|
|
@@ -26589,12 +26589,12 @@ function captureDiagramPictures(model2, dataXml2, dataParts, drawing) {
|
|
|
26589
26589
|
id5 = `ooxmlDiagramPicture${index5}`;
|
|
26590
26590
|
parts[id5] = part;
|
|
26591
26591
|
}
|
|
26592
|
-
const
|
|
26592
|
+
const entry4 = { ...source3, fill: remapFill(source3.fill, id5) };
|
|
26593
26593
|
const existing = pictures.findIndex(
|
|
26594
|
-
(item2) => item2.nodeId ===
|
|
26594
|
+
(item2) => item2.nodeId === entry4.nodeId && (item2.role === entry4.role && item2.styleLabel === entry4.styleLabel || !item2.role && !item2.styleLabel && item2.fill.relId === entry4.fill.relId)
|
|
26595
26595
|
);
|
|
26596
|
-
if (existing < 0) pictures.push(
|
|
26597
|
-
else pictures[existing] =
|
|
26596
|
+
if (existing < 0) pictures.push(entry4);
|
|
26597
|
+
else pictures[existing] = entry4;
|
|
26598
26598
|
};
|
|
26599
26599
|
const root = parseXml(dataXml2).documentElement;
|
|
26600
26600
|
const saved2 = root.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "picture");
|
|
@@ -26765,9 +26765,9 @@ function applyDiagramRoleColors(shape2, role, index5, minorFont) {
|
|
|
26765
26765
|
function diagramLayoutData(input2) {
|
|
26766
26766
|
const original = input2.source?.dataXml ? parseDiagramDataModel(input2.source.dataXml) : void 0;
|
|
26767
26767
|
const nodes = input2.nodes.map((node4) => {
|
|
26768
|
-
const point3 = original?.nodes.find((
|
|
26768
|
+
const point3 = original?.nodes.find((entry4) => entry4.modelId === node4.id);
|
|
26769
26769
|
const presentation = original?.points.find(
|
|
26770
|
-
(
|
|
26770
|
+
(entry4) => entry4.type === "pres" && entry4.presAssocId === node4.id
|
|
26771
26771
|
);
|
|
26772
26772
|
const customLayout = point3?.customLayout ?? presentation?.customLayout;
|
|
26773
26773
|
const styleRole = point3?.presStyleLabel ?? presentation?.presStyleLabel;
|
|
@@ -26788,7 +26788,7 @@ function diagramLayoutData(input2) {
|
|
|
26788
26788
|
});
|
|
26789
26789
|
const connections2 = nodes.map((node4, index5) => {
|
|
26790
26790
|
const connection = original?.connections.find(
|
|
26791
|
-
(
|
|
26791
|
+
(entry4) => entry4.destId === node4.id && (!entry4.type || entry4.type === "parOf")
|
|
26792
26792
|
);
|
|
26793
26793
|
return {
|
|
26794
26794
|
...connection,
|
|
@@ -26913,7 +26913,7 @@ function previewDiagramLayout(input2) {
|
|
|
26913
26913
|
result2.nodes.forEach((node4, index5) => {
|
|
26914
26914
|
const shape2 = drawing2.shapes[index5];
|
|
26915
26915
|
if (!shape2 || node4.kind !== "rect" || node4.literalText !== void 0) return;
|
|
26916
|
-
const label2 = quickStyle?.labels.find((
|
|
26916
|
+
const label2 = quickStyle?.labels.find((entry4) => entry4.name === node4.styleLabel);
|
|
26917
26917
|
if (label2) {
|
|
26918
26918
|
shape2.style = label2;
|
|
26919
26919
|
shape2.has3d = label2.requires3d ?? label2.hasShape3d;
|
|
@@ -26923,7 +26923,7 @@ function previewDiagramLayout(input2) {
|
|
|
26923
26923
|
if (node4.layoutRole) shape2.sourceLayoutRole = node4.layoutRole;
|
|
26924
26924
|
if (node4.styleLabel) shape2.sourceStyleLabel = node4.styleLabel;
|
|
26925
26925
|
if (node4.foldedNodeIds?.length) shape2.foldedNodeIds = node4.foldedNodeIds;
|
|
26926
|
-
const sourceNode = data.nodes.find((
|
|
26926
|
+
const sourceNode = data.nodes.find((entry4) => entry4.id === node4.nodeId);
|
|
26927
26927
|
if (input2.formatScheme && label2?.fill?.index && !sourceNode?.style?.fillColor && shape2.fill?.kind === "solid") {
|
|
26928
26928
|
const fill2 = resolveThemeFillStyle(
|
|
26929
26929
|
input2.formatScheme,
|
|
@@ -26932,10 +26932,10 @@ function previewDiagramLayout(input2) {
|
|
|
26932
26932
|
);
|
|
26933
26933
|
if (fill2) shape2.fill = fill2;
|
|
26934
26934
|
}
|
|
26935
|
-
const direct = originalModel?.nodes.find((
|
|
26935
|
+
const direct = originalModel?.nodes.find((entry4) => entry4.modelId === node4.nodeId);
|
|
26936
26936
|
const sourceIds = [node4.nodeId, ...node4.foldedNodeIds ?? []];
|
|
26937
26937
|
const textNodes = sourceIds.flatMap((id5) => {
|
|
26938
|
-
const source3 = input2.nodes.find((
|
|
26938
|
+
const source3 = input2.nodes.find((entry4) => entry4.id === id5);
|
|
26939
26939
|
return source3 ? [source3] : [];
|
|
26940
26940
|
});
|
|
26941
26941
|
if (textNodes.length) shape2.text = diagramPreviewText(textNodes, node4.fontSize);
|
|
@@ -26949,7 +26949,7 @@ function previewDiagramLayout(input2) {
|
|
|
26949
26949
|
colors?.labels.find((label3) => label3.name === node4.styleLabel),
|
|
26950
26950
|
Math.max(
|
|
26951
26951
|
0,
|
|
26952
|
-
input2.nodes.findIndex((
|
|
26952
|
+
input2.nodes.findIndex((entry4) => entry4.id === contextNodeId)
|
|
26953
26953
|
),
|
|
26954
26954
|
input2.minorFont
|
|
26955
26955
|
);
|
|
@@ -27209,7 +27209,7 @@ async function resolveDiagramDrawingPart(hostPart, dataRelId, drawingExtensionRe
|
|
|
27209
27209
|
const entries = await host.readRelationshipEntries(diagramRelationshipsPart(dataPath));
|
|
27210
27210
|
if (!entries) return void 0;
|
|
27211
27211
|
const drawing = entries.find(
|
|
27212
|
-
(
|
|
27212
|
+
(entry4) => (!drawingExtensionRelId || entry4.id.trim() === drawingExtensionRelId) && entry4.type.endsWith("/diagramDrawing")
|
|
27213
27213
|
);
|
|
27214
27214
|
const id5 = drawing?.id.trim() ?? "";
|
|
27215
27215
|
const target3 = drawing?.target.trim() ?? "";
|
|
@@ -27428,13 +27428,13 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
27428
27428
|
diagramRelationshipsPart(drawingResolution.path)
|
|
27429
27429
|
);
|
|
27430
27430
|
const pictures = (entries ?? []).filter(
|
|
27431
|
-
(
|
|
27431
|
+
(entry4) => entry4.type.endsWith("/image") && entry4.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry4.target)
|
|
27432
27432
|
);
|
|
27433
27433
|
if (pictures.length)
|
|
27434
27434
|
drawing.pictureParts = Object.fromEntries(
|
|
27435
|
-
pictures.map((
|
|
27436
|
-
|
|
27437
|
-
host.resolvePath(drawingResolution.path,
|
|
27435
|
+
pictures.map((entry4) => [
|
|
27436
|
+
entry4.id,
|
|
27437
|
+
host.resolvePath(drawingResolution.path, entry4.target)
|
|
27438
27438
|
])
|
|
27439
27439
|
);
|
|
27440
27440
|
} catch {
|
|
@@ -27458,8 +27458,8 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
27458
27458
|
const entries = await host.readRelationshipEntries(diagramRelationshipsPart(owner));
|
|
27459
27459
|
pictureParts = Object.fromEntries(
|
|
27460
27460
|
(entries ?? []).filter(
|
|
27461
|
-
(
|
|
27462
|
-
).map((
|
|
27461
|
+
(entry4) => entry4.type.endsWith("/image") && entry4.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry4.target)
|
|
27462
|
+
).map((entry4) => [entry4.id, host.resolvePath(owner, entry4.target)])
|
|
27463
27463
|
);
|
|
27464
27464
|
} catch {
|
|
27465
27465
|
issues.push({
|
|
@@ -27971,8 +27971,8 @@ function hexToRgb(hex4) {
|
|
|
27971
27971
|
];
|
|
27972
27972
|
}
|
|
27973
27973
|
function rgbToHex(r, g2, b) {
|
|
27974
|
-
const
|
|
27975
|
-
return `#${
|
|
27974
|
+
const clamp5 = (v) => Math.max(0, Math.min(255, Math.round(v)));
|
|
27975
|
+
return `#${clamp5(r).toString(16).padStart(2, "0")}${clamp5(g2).toString(16).padStart(2, "0")}${clamp5(b).toString(16).padStart(2, "0")}`;
|
|
27976
27976
|
}
|
|
27977
27977
|
function tint(hex4, amount) {
|
|
27978
27978
|
const [r, g2, b] = hexToRgb(hex4);
|
|
@@ -28373,20 +28373,20 @@ function resolveChartStyleDefinition(style4, resolve3) {
|
|
|
28373
28373
|
for (const name3 of CHART_STYLE_PARTS) {
|
|
28374
28374
|
const source3 = style4.entries[name3];
|
|
28375
28375
|
if (!source3) continue;
|
|
28376
|
-
const
|
|
28376
|
+
const entry4 = {};
|
|
28377
28377
|
for (const key2 of ["fontSize", "bold", "italic", "underline"]) {
|
|
28378
28378
|
const value3 = source3[key2];
|
|
28379
|
-
if (value3 !== void 0) Object.assign(
|
|
28379
|
+
if (value3 !== void 0) Object.assign(entry4, { [key2]: value3 });
|
|
28380
28380
|
}
|
|
28381
28381
|
const line3 = fillColor(source3.line?.fill) ?? (source3.lineRef?.color && resolve3(source3.lineRef.color));
|
|
28382
28382
|
const fill2 = fillColor(source3.fill) ?? (source3.fillRef?.color && resolve3(source3.fillRef.color));
|
|
28383
28383
|
const color4 = (source3.textColor && resolve3(source3.textColor)) ?? (source3.fontRef?.color && resolve3(source3.fontRef.color));
|
|
28384
|
-
if (color4 !== void 0)
|
|
28385
|
-
if (line3 !== void 0)
|
|
28386
|
-
if (fill2 !== void 0)
|
|
28384
|
+
if (color4 !== void 0) entry4.color = color4;
|
|
28385
|
+
if (line3 !== void 0) entry4.lineColor = line3;
|
|
28386
|
+
if (fill2 !== void 0) entry4.fillColor = fill2;
|
|
28387
28387
|
if (source3.line?.widthEmu !== void 0 && source3.line.widthEmu > 0)
|
|
28388
|
-
|
|
28389
|
-
if (Object.keys(
|
|
28388
|
+
entry4.lineWidth = source3.line.widthEmu / 12700;
|
|
28389
|
+
if (Object.keys(entry4).length) out[name3] = entry4;
|
|
28390
28390
|
}
|
|
28391
28391
|
return Object.keys(out).length ? out : void 0;
|
|
28392
28392
|
}
|
|
@@ -28622,13 +28622,13 @@ function writeChartAxisFormatting(root, formatting) {
|
|
|
28622
28622
|
let changed = false;
|
|
28623
28623
|
for (const part of ["categoryAxis", "valueAxis"]) {
|
|
28624
28624
|
const axis = nodes[part];
|
|
28625
|
-
const
|
|
28626
|
-
if (!axis || !
|
|
28625
|
+
const entry4 = formatting.entries[part];
|
|
28626
|
+
if (!axis || !entry4) continue;
|
|
28627
28627
|
for (const [name3, flag5, value3, successors] of [
|
|
28628
28628
|
[
|
|
28629
28629
|
"delete",
|
|
28630
|
-
|
|
28631
|
-
|
|
28630
|
+
entry4.axisVisible,
|
|
28631
|
+
entry4.axisVisible ? "0" : "1",
|
|
28632
28632
|
[
|
|
28633
28633
|
"axPos",
|
|
28634
28634
|
"majorGridlines",
|
|
@@ -28648,8 +28648,8 @@ function writeChartAxisFormatting(root, formatting) {
|
|
|
28648
28648
|
],
|
|
28649
28649
|
[
|
|
28650
28650
|
"tickLblPos",
|
|
28651
|
-
|
|
28652
|
-
|
|
28651
|
+
entry4.labelsVisible,
|
|
28652
|
+
entry4.labelsVisible ? "nextTo" : "none",
|
|
28653
28653
|
[
|
|
28654
28654
|
"spPr",
|
|
28655
28655
|
"txPr",
|
|
@@ -28669,7 +28669,7 @@ function writeChartAxisFormatting(root, formatting) {
|
|
|
28669
28669
|
]) {
|
|
28670
28670
|
if (flag5 === void 0) continue;
|
|
28671
28671
|
const key2 = name3 === "delete" ? "axisVisible" : "labelsVisible";
|
|
28672
|
-
const revealingAxis = name3 === "tickLblPos" &&
|
|
28672
|
+
const revealingAxis = name3 === "tickLblPos" && entry4.axisVisible === true && previous?.entries[part]?.axisVisible === false;
|
|
28673
28673
|
if (flag5 === previous?.entries[part]?.[key2] && !revealingAxis) continue;
|
|
28674
28674
|
let node4 = first(axis, name3, NS.c);
|
|
28675
28675
|
const old = node4?.getAttribute("val");
|
|
@@ -29697,12 +29697,12 @@ var LEGEND = /* @__PURE__ */ new Set(["legendPos", "legendEntry", "layout", "ove
|
|
|
29697
29697
|
function parseLegend(context, element5) {
|
|
29698
29698
|
reportUnmodelled(context, element5, LEGEND);
|
|
29699
29699
|
const entries = children(element5, "legendEntry", NS.c).map(
|
|
29700
|
-
(
|
|
29700
|
+
(entry4) => assignDefined(
|
|
29701
29701
|
{},
|
|
29702
29702
|
{
|
|
29703
|
-
index: cNumber(context,
|
|
29704
|
-
deleted: cBool(context,
|
|
29705
|
-
txPr: textProperties(
|
|
29703
|
+
index: cNumber(context, entry4, "idx"),
|
|
29704
|
+
deleted: cBool(context, entry4, "delete"),
|
|
29705
|
+
txPr: textProperties(entry4)
|
|
29706
29706
|
}
|
|
29707
29707
|
)
|
|
29708
29708
|
);
|
|
@@ -30194,9 +30194,9 @@ function view3DXml(view) {
|
|
|
30194
30194
|
function legendXml(context, legend) {
|
|
30195
30195
|
if (!legend) return "";
|
|
30196
30196
|
const entries = legend.entries.map(
|
|
30197
|
-
(
|
|
30197
|
+
(entry4) => elementXml(
|
|
30198
30198
|
"legendEntry",
|
|
30199
|
-
valXml("idx",
|
|
30199
|
+
valXml("idx", entry4.index) + valXml("delete", entry4.deleted) + textBodyXml(context, entry4.txPr)
|
|
30200
30200
|
)
|
|
30201
30201
|
).join("");
|
|
30202
30202
|
return elementXml(
|
|
@@ -31181,12 +31181,12 @@ function chartSeriesEntries(space) {
|
|
|
31181
31181
|
(group3, groupIndex) => group3.series.map((series, position3) => ({ group: group3, groupIndex, series, position: position3 }))
|
|
31182
31182
|
);
|
|
31183
31183
|
}
|
|
31184
|
-
var chartSpaceSeries = (space) => chartSeriesEntries(space).map((
|
|
31184
|
+
var chartSpaceSeries = (space) => chartSeriesEntries(space).map((entry4) => entry4.series);
|
|
31185
31185
|
function chartSeriesEntryAt(space, index5) {
|
|
31186
31186
|
const entries = chartSeriesEntries(space);
|
|
31187
|
-
const
|
|
31188
|
-
if (!
|
|
31189
|
-
return
|
|
31187
|
+
const entry4 = typeof index5 === "number" && Number.isSafeInteger(index5) ? entries.find((_, position3) => position3 === index5) : void 0;
|
|
31188
|
+
if (!entry4) throw new RangeError(`No chart series at index ${String(index5)}`);
|
|
31189
|
+
return entry4;
|
|
31190
31190
|
}
|
|
31191
31191
|
function firstChartGroup(space) {
|
|
31192
31192
|
const group3 = space.plotArea.groups[0];
|
|
@@ -32150,7 +32150,7 @@ async function appendChartExWorkbookData(bytes, before, after) {
|
|
|
32150
32150
|
const defined = first(root, "definedNames", NS.x);
|
|
32151
32151
|
const names = defined ? children(defined, "definedName", NS.x) : [];
|
|
32152
32152
|
const resolve3 = (name3) => names.find(
|
|
32153
|
-
(
|
|
32153
|
+
(entry4) => entry4.getAttribute("name")?.toLowerCase() === name3.toLowerCase() && !entry4.hasAttribute("localSheetId")
|
|
32154
32154
|
)?.textContent ?? void 0;
|
|
32155
32155
|
await writeChartWorkbookUpdates(bytes, chartExSpaceWorkbookWrites(before, resolve3), {
|
|
32156
32156
|
atomic: true,
|
|
@@ -32268,8 +32268,8 @@ function summaryErrorBars(source3) {
|
|
|
32268
32268
|
return out;
|
|
32269
32269
|
}
|
|
32270
32270
|
function summaryAnalysis(series) {
|
|
32271
|
-
const trendlines = (series.trendlines ?? []).map(summaryTrendline).filter((
|
|
32272
|
-
const errorBars = (series.errorBars ?? []).map(summaryErrorBars).filter((
|
|
32271
|
+
const trendlines = (series.trendlines ?? []).map(summaryTrendline).filter((entry4) => entry4 !== void 0);
|
|
32272
|
+
const errorBars = (series.errorBars ?? []).map(summaryErrorBars).filter((entry4) => entry4 !== void 0);
|
|
32273
32273
|
return {
|
|
32274
32274
|
...trendlines.length ? { trendlines } : {},
|
|
32275
32275
|
...errorBars.length ? { errorBars } : {}
|
|
@@ -32398,7 +32398,7 @@ function extraGroups(chartSpace, firstType) {
|
|
|
32398
32398
|
const stockOverColumns = group3.kind === "stock" && firstType === "column";
|
|
32399
32399
|
if (group3.is3D || !(["bar", "line", "area"].includes(group3.kind) || stockOverColumns)) continue;
|
|
32400
32400
|
const type = group3.kind === "bar" ? "column" : group3.kind;
|
|
32401
|
-
const
|
|
32401
|
+
const entry4 = {
|
|
32402
32402
|
chartType: type,
|
|
32403
32403
|
series: group3.series.map((source3, index5) => ({
|
|
32404
32404
|
...chartSummarySeries(
|
|
@@ -32412,13 +32412,13 @@ function extraGroups(chartSpace, firstType) {
|
|
|
32412
32412
|
secondary: valueAxisId(chartSpace, group3.axisIds) !== primary
|
|
32413
32413
|
};
|
|
32414
32414
|
if (group3.grouping && GROUPINGS.has(group3.grouping))
|
|
32415
|
-
|
|
32416
|
-
if (type === "stock")
|
|
32415
|
+
entry4.grouping = group3.grouping;
|
|
32416
|
+
if (type === "stock") entry4.stock = stockStyle(group3);
|
|
32417
32417
|
if (type === "column") {
|
|
32418
|
-
if (group3.gapWidth !== void 0)
|
|
32419
|
-
if (group3.overlap !== void 0)
|
|
32418
|
+
if (group3.gapWidth !== void 0) entry4.barGapWidth = group3.gapWidth;
|
|
32419
|
+
if (group3.overlap !== void 0) entry4.barOverlap = group3.overlap;
|
|
32420
32420
|
}
|
|
32421
|
-
if (
|
|
32421
|
+
if (entry4.series.length) out.push(entry4);
|
|
32422
32422
|
}
|
|
32423
32423
|
return out;
|
|
32424
32424
|
}
|
|
@@ -32566,9 +32566,9 @@ var TEXT_PARTS = [
|
|
|
32566
32566
|
"legend",
|
|
32567
32567
|
"dataLabel"
|
|
32568
32568
|
];
|
|
32569
|
-
function inheritChartText(part,
|
|
32570
|
-
if (!root || !TEXT_PARTS.includes(part)) return
|
|
32571
|
-
const out = { ...
|
|
32569
|
+
function inheritChartText(part, entry4, builtIn, root) {
|
|
32570
|
+
if (!root || !TEXT_PARTS.includes(part)) return entry4;
|
|
32571
|
+
const out = { ...entry4 };
|
|
32572
32572
|
for (const key2 of TEXT_KEYS) {
|
|
32573
32573
|
delete out[key2];
|
|
32574
32574
|
const value3 = root[key2] ?? builtIn?.[key2];
|
|
@@ -32581,11 +32581,11 @@ function inheritChartText(part, entry3, builtIn, root) {
|
|
|
32581
32581
|
|
|
32582
32582
|
// chart/render/chart-appearance.ts
|
|
32583
32583
|
var chartPointsToPixels = (points3) => points3 * EMU_PER_POINT / EMU_PER_PIXEL;
|
|
32584
|
-
function typeface(
|
|
32585
|
-
const name3 =
|
|
32584
|
+
function typeface(entry4, theme3) {
|
|
32585
|
+
const name3 = entry4.typeface;
|
|
32586
32586
|
if (name3?.startsWith("+mj-")) return theme3.majorFont;
|
|
32587
32587
|
if (name3?.startsWith("+mn-")) return theme3.minorFont;
|
|
32588
|
-
return name3 ?? (
|
|
32588
|
+
return name3 ?? (entry4.fontRef?.index === "major" ? theme3.majorFont : entry4.fontRef?.index === "minor" ? theme3.minorFont : void 0);
|
|
32589
32589
|
}
|
|
32590
32590
|
function chartAppearance(chart, theme3) {
|
|
32591
32591
|
const defaults = builtInChartTextStyle(effectiveBuiltInChartStyle(chart.formatting));
|
|
@@ -32594,7 +32594,7 @@ function chartAppearance(chart, theme3) {
|
|
|
32594
32594
|
const base3 = chart.styleDefinition?.entries[part];
|
|
32595
32595
|
const direct = chart.formatting?.entries[part];
|
|
32596
32596
|
if (!defaults[part] && !base3 && !direct) continue;
|
|
32597
|
-
const
|
|
32597
|
+
const entry4 = {
|
|
32598
32598
|
...inheritChartText(
|
|
32599
32599
|
part,
|
|
32600
32600
|
{ ...defaults[part], ...base3, sourceXml: base3?.sourceXml ?? "" },
|
|
@@ -32604,8 +32604,8 @@ function chartAppearance(chart, theme3) {
|
|
|
32604
32604
|
...direct,
|
|
32605
32605
|
sourceXml: direct?.sourceXml ?? base3?.sourceXml ?? ""
|
|
32606
32606
|
};
|
|
32607
|
-
if (base3?.line || direct?.line)
|
|
32608
|
-
entries[part] =
|
|
32607
|
+
if (base3?.line || direct?.line) entry4.line = { ...base3?.line, ...direct?.line };
|
|
32608
|
+
entries[part] = entry4;
|
|
32609
32609
|
}
|
|
32610
32610
|
const scheme2 = chartColorScheme(theme3);
|
|
32611
32611
|
const resolve3 = (color4) => resolveDrawingColor(
|
|
@@ -32618,19 +32618,19 @@ function chartAppearance(chart, theme3) {
|
|
|
32618
32618
|
(color4) => drawingColorCss(resolve3(color4))
|
|
32619
32619
|
) ?? {};
|
|
32620
32620
|
for (const part of CHART_STYLE_PARTS) {
|
|
32621
|
-
const
|
|
32622
|
-
if (!
|
|
32623
|
-
const family = typeface(
|
|
32624
|
-
const shadow = resolveDrawingShadowXml(
|
|
32621
|
+
const entry4 = entries[part];
|
|
32622
|
+
if (!entry4) continue;
|
|
32623
|
+
const family = typeface(entry4, theme3);
|
|
32624
|
+
const shadow = resolveDrawingShadowXml(entry4.textEffectsXml, {
|
|
32625
32625
|
scheme: (name3) => scheme2[name3]
|
|
32626
32626
|
});
|
|
32627
32627
|
if (shadow) (out[part] ??= {}).textShadow = shadow;
|
|
32628
32628
|
if (family) (out[part] ??= {}).typeface = family;
|
|
32629
|
-
if (
|
|
32630
|
-
if (
|
|
32631
|
-
if (
|
|
32632
|
-
if (
|
|
32633
|
-
(out[part] ??= {}).gradient = resolveChartGradient(
|
|
32629
|
+
if (entry4.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry4.axisVisible;
|
|
32630
|
+
if (entry4.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry4.labelsVisible;
|
|
32631
|
+
if (entry4.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
|
|
32632
|
+
if (entry4.fill?.kind === "gradient") {
|
|
32633
|
+
(out[part] ??= {}).gradient = resolveChartGradient(entry4.fill, resolve3);
|
|
32634
32634
|
}
|
|
32635
32635
|
}
|
|
32636
32636
|
return out;
|
|
@@ -32649,8 +32649,8 @@ function chartRunStyle(run2) {
|
|
|
32649
32649
|
}
|
|
32650
32650
|
function chartTitleText(chart, theme3) {
|
|
32651
32651
|
const formatting = chart.formatting;
|
|
32652
|
-
const
|
|
32653
|
-
const body =
|
|
32652
|
+
const entry4 = formatting?.entries.title;
|
|
32653
|
+
const body = entry4?.textBody;
|
|
32654
32654
|
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
32655
32655
|
if (body.paragraphs.length === 1 && body.paragraphs[0].runs.length <= 1 && !body.text.includes("\n") && !body.paragraphs[0].lineSpacing && !body.paragraphs[0].spaceBefore && !body.paragraphs[0].spaceAfter)
|
|
32656
32656
|
return void 0;
|
|
@@ -32663,7 +32663,7 @@ function chartTitleText(chart, theme3) {
|
|
|
32663
32663
|
runs: paragraph2.runs.map((run2) => {
|
|
32664
32664
|
const direct = {
|
|
32665
32665
|
sourceXml: "",
|
|
32666
|
-
...
|
|
32666
|
+
...entry4.textBodyStyle,
|
|
32667
32667
|
...chartRunStyle(paragraph2.defaultProperties ?? {}),
|
|
32668
32668
|
...chartRunStyle(run2)
|
|
32669
32669
|
};
|
|
@@ -33239,14 +33239,14 @@ function strokeOf(line3, fallback, resolve3) {
|
|
|
33239
33239
|
}
|
|
33240
33240
|
function analysisView(source3, seriesColor, resolve3) {
|
|
33241
33241
|
const plain4 = seriesColor === "none" || seriesColor.startsWith("url(") ? TEXT_COLOR : seriesColor;
|
|
33242
|
-
const trendlines = (source3.trendlines ?? []).flatMap((
|
|
33243
|
-
const { name: _name, line: line3, ...fit3 } =
|
|
33242
|
+
const trendlines = (source3.trendlines ?? []).flatMap((entry4) => {
|
|
33243
|
+
const { name: _name, line: line3, ...fit3 } = entry4;
|
|
33244
33244
|
const fallback = { color: plain4, width: chartPointsToPixels(1.5), dash: "sysDot" };
|
|
33245
33245
|
const stroke = strokeOf(line3, fallback, resolve3);
|
|
33246
33246
|
return stroke ? [{ fit: fit3, stroke }] : [];
|
|
33247
33247
|
});
|
|
33248
|
-
const errorBars = (source3.errorBars ?? []).flatMap((
|
|
33249
|
-
const { direction: direction2, barType, noEndCap, line: line3, ...amount } =
|
|
33248
|
+
const errorBars = (source3.errorBars ?? []).flatMap((entry4) => {
|
|
33249
|
+
const { direction: direction2, barType, noEndCap, line: line3, ...amount } = entry4;
|
|
33250
33250
|
const stroke = strokeOf(line3, { color: TEXT_COLOR, width: chartPointsToPixels(0.75) }, resolve3);
|
|
33251
33251
|
return stroke ? [{ direction: direction2, barType, amount, endCap: noEndCap !== true, stroke }] : [];
|
|
33252
33252
|
});
|
|
@@ -34065,10 +34065,10 @@ function chartTargetDraftShapes(draft, target3) {
|
|
|
34065
34065
|
for (const group3 of draft.plotArea.groups)
|
|
34066
34066
|
if (group3.kind !== "surface") group3.dataLabels ??= { labels: [] };
|
|
34067
34067
|
} else {
|
|
34068
|
-
const
|
|
34069
|
-
if (
|
|
34068
|
+
const entry4 = chartSeriesEntryAt(draft, target3.seriesIndex);
|
|
34069
|
+
if (entry4.group.kind === "surface")
|
|
34070
34070
|
throw new RangeError("Surface charts have no data labels");
|
|
34071
|
-
|
|
34071
|
+
entry4.series.dataLabels ??= { labels: [] };
|
|
34072
34072
|
}
|
|
34073
34073
|
const labels = target3.seriesIndex === void 0 ? draft.plotArea.groups.flatMap((group3) => group3.dataLabels ? [group3.dataLabels] : []) : [chartSeriesEntryAt(draft, target3.seriesIndex).series.dataLabels].filter(
|
|
34074
34074
|
(item2) => item2 !== void 0
|
|
@@ -34473,10 +34473,10 @@ function holders(draft, target3, create4 = false) {
|
|
|
34473
34473
|
for (const group3 of draft.plotArea.groups)
|
|
34474
34474
|
if (group3.kind !== "surface") group3.dataLabels ??= { labels: [] };
|
|
34475
34475
|
} else {
|
|
34476
|
-
const
|
|
34477
|
-
if (
|
|
34476
|
+
const entry4 = chartSeriesEntryAt(draft, target3.seriesIndex);
|
|
34477
|
+
if (entry4.group.kind === "surface")
|
|
34478
34478
|
throw new RangeError("Surface charts have no data labels");
|
|
34479
|
-
|
|
34479
|
+
entry4.series.dataLabels ??= { labels: [] };
|
|
34480
34480
|
}
|
|
34481
34481
|
}
|
|
34482
34482
|
const labels = target3.seriesIndex === void 0 ? draft.plotArea.groups.flatMap((group3) => group3.dataLabels ? [group3.dataLabels] : []) : [chartSeriesEntryAt(draft, target3.seriesIndex).series.dataLabels].filter(
|
|
@@ -35766,8 +35766,8 @@ function chartSpaceDataSheet(space) {
|
|
|
35766
35766
|
const firstEntry = entries[0];
|
|
35767
35767
|
const first3 = firstEntry ? isXYChartKind(firstEntry.group.kind) ? firstEntry.series.xValues : firstEntry.series.categories : void 0;
|
|
35768
35768
|
const valuesOf = (index5) => {
|
|
35769
|
-
const
|
|
35770
|
-
const source3 = isXYChartKind(
|
|
35769
|
+
const entry4 = entries[index5];
|
|
35770
|
+
const source3 = isXYChartKind(entry4.group.kind) ? entry4.series.yValues : entry4.series.values;
|
|
35771
35771
|
return chartSourceValues(source3).map((value3) => typeof value3 === "number" ? value3 : null);
|
|
35772
35772
|
};
|
|
35773
35773
|
const longest = entries.reduce((max, _, index5) => Math.max(max, valuesOf(index5).length), 0);
|
|
@@ -35776,10 +35776,10 @@ function chartSpaceDataSheet(space) {
|
|
|
35776
35776
|
const categories = Array.from({ length: count3 }, (_, index5) => labels[index5] ?? "");
|
|
35777
35777
|
return {
|
|
35778
35778
|
categories,
|
|
35779
|
-
series: entries.map((
|
|
35779
|
+
series: entries.map((entry4, index5) => {
|
|
35780
35780
|
const values2 = valuesOf(index5);
|
|
35781
35781
|
return {
|
|
35782
|
-
name:
|
|
35782
|
+
name: entry4.series.tx?.text ?? entry4.series.tx?.value ?? String(chartSourceValues(entry4.series.tx?.reference)[0] ?? ""),
|
|
35783
35783
|
values: Array.from({ length: count3 }, (_, point3) => values2[point3] ?? null)
|
|
35784
35784
|
};
|
|
35785
35785
|
})
|
|
@@ -37083,11 +37083,11 @@ async function dropDrawingPart(zip, relId, partName, ownerPart = HOST_PART) {
|
|
|
37083
37083
|
const xml = await zip.file(relsPath)?.async("string");
|
|
37084
37084
|
if (xml) {
|
|
37085
37085
|
const document = parseXml(xml);
|
|
37086
|
-
const
|
|
37086
|
+
const entry4 = elements(document.documentElement).find(
|
|
37087
37087
|
(node4) => node4.namespaceURI === NS.rels && node4.getAttribute("Id") === relId && node4.getAttribute("Type") === DIAGRAM_RELATIONSHIP_TYPES.drawing
|
|
37088
37088
|
);
|
|
37089
|
-
if (
|
|
37090
|
-
document.documentElement.removeChild(
|
|
37089
|
+
if (entry4) {
|
|
37090
|
+
document.documentElement.removeChild(entry4);
|
|
37091
37091
|
zip.file(relsPath, buildXml(document));
|
|
37092
37092
|
}
|
|
37093
37093
|
}
|
|
@@ -37792,7 +37792,7 @@ function parseFormField(ffData) {
|
|
|
37792
37792
|
const result2 = parseInteger(getW(first2(typed, "result"), "val"));
|
|
37793
37793
|
const fallback = parseInteger(getW(first2(typed, "default"), "val"));
|
|
37794
37794
|
field2.dropDown = {
|
|
37795
|
-
entries: elementChildren(typed).filter((child11) => named2(child11, "listEntry")).map((
|
|
37795
|
+
entries: elementChildren(typed).filter((child11) => named2(child11, "listEntry")).map((entry4) => getW(entry4, "val") ?? ""),
|
|
37796
37796
|
...result2 !== void 0 && { result: result2 },
|
|
37797
37797
|
...fallback !== void 0 && { default: fallback }
|
|
37798
37798
|
};
|
|
@@ -37829,7 +37829,7 @@ function kindElement(doc, field2) {
|
|
|
37829
37829
|
const list3 = field2.dropDown ?? { entries: [] };
|
|
37830
37830
|
if (list3.result !== void 0) add5(valued(doc, "result", String(list3.result)));
|
|
37831
37831
|
if (list3.default !== void 0) add5(valued(doc, "default", String(list3.default)));
|
|
37832
|
-
for (const
|
|
37832
|
+
for (const entry4 of list3.entries) add5(valued(doc, "listEntry", entry4));
|
|
37833
37833
|
}
|
|
37834
37834
|
return element5;
|
|
37835
37835
|
}
|
|
@@ -39055,7 +39055,7 @@ function applyBlocks(doc, container, blocks, original, allocator, contentWidthTw
|
|
|
39055
39055
|
};
|
|
39056
39056
|
const boundWriteParagraph = (writeDoc, paragraph2, node4, base3) => writeParagraphImpl(writeDoc, paragraph2, node4, base3, allocator, spans3);
|
|
39057
39057
|
const flat = flatBlocks(container);
|
|
39058
|
-
const oldNodes = flat.map((
|
|
39058
|
+
const oldNodes = flat.map((entry4) => entry4.element);
|
|
39059
39059
|
const oldById = /* @__PURE__ */ new Map();
|
|
39060
39060
|
original.forEach((block, index5) => {
|
|
39061
39061
|
if (oldNodes[index5]) oldById.set(block.id, oldNodes[index5]);
|
|
@@ -39081,7 +39081,7 @@ function applyBlocks(doc, container, blocks, original, allocator, contentWidthTw
|
|
|
39081
39081
|
) : createTable(doc, block, allocator, contentWidthTwips, spans3)
|
|
39082
39082
|
);
|
|
39083
39083
|
}
|
|
39084
|
-
const nested = flat.some((
|
|
39084
|
+
const nested = flat.some((entry4) => entry4.sdt) || blocks.some((block) => block.contentControl);
|
|
39085
39085
|
if (nested && placeBlocksById(doc, container, flat, blocks, output2, anchor2)) return;
|
|
39086
39086
|
replaceSlots(doc, container, oldNodes, output2, anchor2);
|
|
39087
39087
|
}
|
|
@@ -39834,12 +39834,12 @@ function parseNum(element5) {
|
|
|
39834
39834
|
const levelOverrides = dictionary();
|
|
39835
39835
|
for (const override of children2(element5, "lvlOverride")) {
|
|
39836
39836
|
const level4 = integer3(getW(override, "ilvl"), 0);
|
|
39837
|
-
const
|
|
39837
|
+
const entry4 = {};
|
|
39838
39838
|
const startOverride = getW(first2(override, "startOverride"), "val");
|
|
39839
|
-
if (startOverride !== void 0)
|
|
39839
|
+
if (startOverride !== void 0) entry4.startOverride = clampStart(integer3(startOverride, 1));
|
|
39840
39840
|
const lvl = first2(override, "lvl");
|
|
39841
|
-
if (lvl)
|
|
39842
|
-
if (Object.keys(
|
|
39841
|
+
if (lvl) entry4.lvl = parseNumberingLevel(lvl);
|
|
39842
|
+
if (Object.keys(entry4).length) levelOverrides[level4] = entry4;
|
|
39843
39843
|
}
|
|
39844
39844
|
return {
|
|
39845
39845
|
id: id5,
|
|
@@ -44326,15 +44326,15 @@ function parseComments(commentsXml, extendedXml) {
|
|
|
44326
44326
|
});
|
|
44327
44327
|
if (extendedXml) {
|
|
44328
44328
|
const extended2 = parseXml2(extendedXml);
|
|
44329
|
-
for (const
|
|
44329
|
+
for (const entry4 of Array.from(
|
|
44330
44330
|
extended2.getElementsByTagNameNS(W15_NS2, "commentEx")
|
|
44331
44331
|
)) {
|
|
44332
|
-
const paraId =
|
|
44332
|
+
const paraId = entry4.getAttributeNS(W15_NS2, "paraId");
|
|
44333
44333
|
const comment = paraId && comments.find((c2) => c2.id === paraIdToCommentId.get(paraId));
|
|
44334
44334
|
if (!comment) continue;
|
|
44335
|
-
const done =
|
|
44335
|
+
const done = entry4.getAttributeNS(W15_NS2, "done");
|
|
44336
44336
|
comment.resolved = done === "1" || done === "true";
|
|
44337
|
-
const parentParaId =
|
|
44337
|
+
const parentParaId = entry4.getAttributeNS(W15_NS2, "paraIdParent");
|
|
44338
44338
|
const parentId = parentParaId && paraIdToCommentId.get(parentParaId);
|
|
44339
44339
|
if (parentId) comment.parentId = parentId;
|
|
44340
44340
|
}
|
|
@@ -44454,7 +44454,7 @@ async function readPlaceholderTexts(zip, relationships, model2) {
|
|
|
44454
44454
|
});
|
|
44455
44455
|
if (!named3.length) return;
|
|
44456
44456
|
const relationship2 = [...relationships.values()].find(
|
|
44457
|
-
(
|
|
44457
|
+
(entry4) => entry4.type === GLOSSARY_DOCUMENT && entry4.mode === "Internal"
|
|
44458
44458
|
);
|
|
44459
44459
|
const part = relationship2 && zip.file(resolveInternalTarget(relationship2.target));
|
|
44460
44460
|
if (!part) return;
|
|
@@ -45141,7 +45141,7 @@ function describeLegacy(site) {
|
|
|
45141
45141
|
...base3,
|
|
45142
45142
|
type: "dropdown",
|
|
45143
45143
|
value: index5 === void 0 ? "" : entries[index5],
|
|
45144
|
-
choices: entries.map((
|
|
45144
|
+
choices: entries.map((entry4) => ({ display: entry4, value: entry4 })),
|
|
45145
45145
|
...blocked()
|
|
45146
45146
|
};
|
|
45147
45147
|
}
|
|
@@ -47136,8 +47136,8 @@ function sortKeys(value3) {
|
|
|
47136
47136
|
if (value3 && typeof value3 === "object") {
|
|
47137
47137
|
const out = {};
|
|
47138
47138
|
for (const key2 of Object.keys(value3).sort()) {
|
|
47139
|
-
const
|
|
47140
|
-
if (
|
|
47139
|
+
const entry4 = value3[key2];
|
|
47140
|
+
if (entry4 !== void 0) out[key2] = sortKeys(entry4);
|
|
47141
47141
|
}
|
|
47142
47142
|
return out;
|
|
47143
47143
|
}
|
|
@@ -47179,7 +47179,7 @@ function styleCache(workbook) {
|
|
|
47179
47179
|
}
|
|
47180
47180
|
function compact(value3) {
|
|
47181
47181
|
const out = {};
|
|
47182
|
-
for (const [key2,
|
|
47182
|
+
for (const [key2, entry4] of Object.entries(value3)) if (entry4 !== void 0) out[key2] = entry4;
|
|
47183
47183
|
return out;
|
|
47184
47184
|
}
|
|
47185
47185
|
function patchStyle(base3, patch2) {
|
|
@@ -47383,10 +47383,10 @@ function hls240ToRgb({ h: h2, l, s }) {
|
|
|
47383
47383
|
var parseHex = parseArgbHex;
|
|
47384
47384
|
var toHexColor = rgbToUpperHex;
|
|
47385
47385
|
function applyTint(hex4, tint2) {
|
|
47386
|
-
const
|
|
47387
|
-
if (!tint2) return toHexColor(
|
|
47386
|
+
const rgb8 = parseHex(hex4) ?? [0, 0, 0];
|
|
47387
|
+
if (!tint2) return toHexColor(rgb8);
|
|
47388
47388
|
const t = Math.max(-1, Math.min(1, tint2));
|
|
47389
|
-
const hls = rgbToHls240(...
|
|
47389
|
+
const hls = rgbToHls240(...rgb8);
|
|
47390
47390
|
const l = t < 0 ? Math.trunc(hls.l * (1 + t)) : Math.round(hls.l * (1 - t) + HLSMAX * t);
|
|
47391
47391
|
return toHexColor(hls240ToRgb({ ...hls, l: Math.max(0, Math.min(HLSMAX, l)) }));
|
|
47392
47392
|
}
|
|
@@ -48910,7 +48910,7 @@ function countDerived(pivot) {
|
|
|
48910
48910
|
}
|
|
48911
48911
|
var pivotAxisFieldNames = (pivot) => [
|
|
48912
48912
|
...pivot.fields,
|
|
48913
|
-
...derivedDateFields(pivot).filter((
|
|
48913
|
+
...derivedDateFields(pivot).filter((entry4) => !pivot.fields.includes(entry4.name)).map((entry4) => entry4.name)
|
|
48914
48914
|
];
|
|
48915
48915
|
function resolveDateGroups(pivot) {
|
|
48916
48916
|
return (pivot.dateGroups ?? []).map((group3) => {
|
|
@@ -48921,11 +48921,11 @@ function resolveDateGroups(pivot) {
|
|
|
48921
48921
|
});
|
|
48922
48922
|
}
|
|
48923
48923
|
function derivedDateLabels(pivot, name3) {
|
|
48924
|
-
const
|
|
48925
|
-
if (!
|
|
48926
|
-
const [group3] = resolveDateGroups({ ...pivot, dateGroups: [
|
|
48924
|
+
const entry4 = derivedDateFields(pivot).find((candidate) => candidate.name === name3);
|
|
48925
|
+
if (!entry4) return void 0;
|
|
48926
|
+
const [group3] = resolveDateGroups({ ...pivot, dateGroups: [entry4.group] });
|
|
48927
48927
|
const range3 = { start: group3.start, end: group3.end };
|
|
48928
|
-
return dateUnitLabels(
|
|
48928
|
+
return dateUnitLabels(entry4.unit, range3, dateGroupDays(group3), pivot.date1904 ?? false, group3);
|
|
48929
48929
|
}
|
|
48930
48930
|
function validateDateGroups(pivot) {
|
|
48931
48931
|
const groups = pivot.dateGroups;
|
|
@@ -48961,19 +48961,19 @@ function expandDateGroups(pivot) {
|
|
|
48961
48961
|
const resolved = { ...pivot, dateGroups: groups };
|
|
48962
48962
|
const derived2 = derivedDateFields(resolved);
|
|
48963
48963
|
const date1904 = pivot.date1904 ?? false;
|
|
48964
|
-
const tables = derived2.map((
|
|
48965
|
-
const range3 = { start:
|
|
48966
|
-
const days = dateGroupDays(
|
|
48967
|
-
const labels = dateUnitLabels(
|
|
48964
|
+
const tables = derived2.map((entry4) => {
|
|
48965
|
+
const range3 = { start: entry4.group.start, end: entry4.group.end };
|
|
48966
|
+
const days = dateGroupDays(entry4.group);
|
|
48967
|
+
const labels = dateUnitLabels(entry4.unit, range3, days, date1904, entry4.group);
|
|
48968
48968
|
return {
|
|
48969
|
-
base: pivot.fields.indexOf(
|
|
48969
|
+
base: pivot.fields.indexOf(entry4.group.field),
|
|
48970
48970
|
labels,
|
|
48971
|
-
index: (serial) => dateUnitIndex(
|
|
48971
|
+
index: (serial) => dateUnitIndex(entry4.unit, range3, days, date1904, serial, labels.length)
|
|
48972
48972
|
};
|
|
48973
48973
|
});
|
|
48974
48974
|
return {
|
|
48975
48975
|
...resolved,
|
|
48976
|
-
fields: [...pivot.fields, ...derived2.map((
|
|
48976
|
+
fields: [...pivot.fields, ...derived2.map((entry4) => entry4.name)],
|
|
48977
48977
|
records: pivot.records.map((record3) => [
|
|
48978
48978
|
...record3,
|
|
48979
48979
|
...tables.map((table4) => {
|
|
@@ -49018,7 +49018,7 @@ function validateFieldGroups(pivot) {
|
|
|
49018
49018
|
if (!group3 || typeof group3 !== "object" || index5 < 0 || seen.has(group3.field) || ![group3.start, group3.end, group3.by].every(Number.isInteger) || group3.by < 1 || group3.start >= group3.end || groupBucketCount(group3) > MAX_BUCKETS)
|
|
49019
49019
|
throw new Error("Choose a valid number group.");
|
|
49020
49020
|
seen.add(group3.field);
|
|
49021
|
-
if (pivot.pageFilter?.field === group3.field || pivot.valueField === group3.field || (pivot.additionalValues ?? []).some((
|
|
49021
|
+
if (pivot.pageFilter?.field === group3.field || pivot.valueField === group3.field || (pivot.additionalValues ?? []).some((measure6) => measure6.field === group3.field) || (pivot.dateFields ?? []).includes(group3.field) || (pivot.itemFilters ?? []).some((filter2) => filter2.field === group3.field))
|
|
49022
49022
|
throw new Error("A grouped field cannot also be a filter, date field or value field.");
|
|
49023
49023
|
for (const record3 of pivot.records) {
|
|
49024
49024
|
const value3 = record3[index5];
|
|
@@ -49083,17 +49083,17 @@ var PIVOT_SUBTOTAL_ORDER = [
|
|
|
49083
49083
|
"varp"
|
|
49084
49084
|
];
|
|
49085
49085
|
function fieldSubtotalFunctions(pivot, field2) {
|
|
49086
|
-
const
|
|
49087
|
-
if (
|
|
49086
|
+
const entry4 = pivot.fieldSubtotals?.find((item2) => item2.field === field2);
|
|
49087
|
+
if (entry4) return PIVOT_SUBTOTAL_ORDER.filter((fn) => entry4.functions.includes(fn));
|
|
49088
49088
|
return field2 === pivot.rowField && pivot.subtotals === false ? [] : "auto";
|
|
49089
49089
|
}
|
|
49090
49090
|
function normalizedFieldSubtotals(entries) {
|
|
49091
|
-
return entries.map((
|
|
49092
|
-
if (!
|
|
49091
|
+
return entries.map((entry4) => {
|
|
49092
|
+
if (!entry4 || !Array.isArray(entry4.functions) || entry4.functions.some((fn) => !PIVOT_SUBTOTAL_ORDER.includes(fn)))
|
|
49093
49093
|
throw new Error("Choose valid field subtotals.");
|
|
49094
49094
|
return {
|
|
49095
|
-
field:
|
|
49096
|
-
functions: PIVOT_SUBTOTAL_ORDER.filter((fn) =>
|
|
49095
|
+
field: entry4.field,
|
|
49096
|
+
functions: PIVOT_SUBTOTAL_ORDER.filter((fn) => entry4.functions.includes(fn))
|
|
49097
49097
|
};
|
|
49098
49098
|
});
|
|
49099
49099
|
}
|
|
@@ -49102,31 +49102,31 @@ function validateFieldSubtotals(pivot, axisFields) {
|
|
|
49102
49102
|
if (entries === void 0) return;
|
|
49103
49103
|
if (!Array.isArray(entries)) throw new Error("Choose valid field subtotals.");
|
|
49104
49104
|
const seen = /* @__PURE__ */ new Set();
|
|
49105
|
-
for (const
|
|
49106
|
-
if (!
|
|
49105
|
+
for (const entry4 of entries) {
|
|
49106
|
+
if (!entry4 || typeof entry4 !== "object" || !axisFields.includes(entry4.field) || seen.has(entry4.field) || !Array.isArray(entry4.functions) || entry4.functions.some((fn) => !PIVOT_AGGREGATES.includes(fn)) || new Set(entry4.functions).size !== entry4.functions.length)
|
|
49107
49107
|
throw new Error("Choose valid field subtotals.");
|
|
49108
|
-
seen.add(
|
|
49108
|
+
seen.add(entry4.field);
|
|
49109
49109
|
}
|
|
49110
49110
|
}
|
|
49111
49111
|
|
|
49112
49112
|
// xlsx/pivot/item-filters.ts
|
|
49113
49113
|
function hiddenItemKeys(pivot, field2) {
|
|
49114
|
-
const filter2 = pivot.itemFilters?.find((
|
|
49114
|
+
const filter2 = pivot.itemFilters?.find((entry4) => entry4.field === field2);
|
|
49115
49115
|
return new Set((filter2?.hidden ?? []).map(pivotValueKey));
|
|
49116
49116
|
}
|
|
49117
49117
|
function filteredFields(pivot) {
|
|
49118
49118
|
return new Set(
|
|
49119
|
-
(pivot.itemFilters ?? []).filter((
|
|
49119
|
+
(pivot.itemFilters ?? []).filter((entry4) => entry4.hidden.length).map((entry4) => entry4.field)
|
|
49120
49120
|
);
|
|
49121
49121
|
}
|
|
49122
49122
|
function applyPivotItemFilters(pivot) {
|
|
49123
|
-
const active = (pivot.itemFilters ?? []).filter((
|
|
49123
|
+
const active = (pivot.itemFilters ?? []).filter((entry4) => entry4.hidden.length);
|
|
49124
49124
|
const range3 = pivot.dateFilter;
|
|
49125
49125
|
if (!active.length && !range3) return pivot;
|
|
49126
49126
|
const dateIndex = range3 ? pivot.fields.indexOf(range3.field) : -1;
|
|
49127
|
-
const tests = active.map((
|
|
49128
|
-
index: pivot.fields.indexOf(
|
|
49129
|
-
hidden: new Set(
|
|
49127
|
+
const tests = active.map((entry4) => ({
|
|
49128
|
+
index: pivot.fields.indexOf(entry4.field),
|
|
49129
|
+
hidden: new Set(entry4.hidden.map(pivotValueKey))
|
|
49130
49130
|
}));
|
|
49131
49131
|
return {
|
|
49132
49132
|
...pivot,
|
|
@@ -49186,11 +49186,11 @@ function pruneItemFilters(pivot) {
|
|
|
49186
49186
|
var keyOf = (field2, item2) => `${field2}\0${pivotValueKey(item2)}`;
|
|
49187
49187
|
function pivotItemLabeler(pivot) {
|
|
49188
49188
|
const blank = pivotCaptions(pivot).blank;
|
|
49189
|
-
const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((
|
|
49189
|
+
const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((entry4) => [keyOf(entry4.field, entry4.item), entry4.name])) : void 0;
|
|
49190
49190
|
return (field2, value3) => names?.get(keyOf(field2, value3)) ?? (value3 === null || value3 === "" ? blank : pivotItemLabel(value3));
|
|
49191
49191
|
}
|
|
49192
49192
|
var pivotItemName = (pivot, field2, item2) => pivot.itemNames?.find(
|
|
49193
|
-
(
|
|
49193
|
+
(entry4) => entry4.field === field2 && pivotValueKey(entry4.item) === pivotValueKey(item2)
|
|
49194
49194
|
)?.name;
|
|
49195
49195
|
|
|
49196
49196
|
// xlsx/pivot/page-filter.ts
|
|
@@ -49381,9 +49381,9 @@ function validatePivotFields(pivot) {
|
|
|
49381
49381
|
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== pivotCaptions(pivot).values)
|
|
49382
49382
|
throw new Error("This PivotTable uses unsupported Values header captions.");
|
|
49383
49383
|
if (!Array.isArray(extras) || extras.length > 15 || extras.some(
|
|
49384
|
-
(
|
|
49384
|
+
(measure6) => !measure6 || !pivot.fields.includes(measure6.field) || !PIVOT_AGGREGATES.includes(measure6.aggregate) || typeof measure6.caption !== "string" || !measure6.caption.trim() || measure6.caption.length > 255 || pivot.fields.some((field2) => field2.toLowerCase() === measure6.caption.toLowerCase())
|
|
49385
49385
|
) || new Set(
|
|
49386
|
-
[pivot.valueCaption, ...extras.map((
|
|
49386
|
+
[pivot.valueCaption, ...extras.map((measure6) => measure6.caption)].map(
|
|
49387
49387
|
(caption) => caption?.toLowerCase()
|
|
49388
49388
|
)
|
|
49389
49389
|
).size !== extras.length + 1)
|
|
@@ -49482,7 +49482,7 @@ function aggregateValues(records, field2, type) {
|
|
|
49482
49482
|
const sum3 = numbers3.reduce((total2, value3) => total2 + value3, 0);
|
|
49483
49483
|
return type === "average" ? sum3 / numbers3.length : sum3;
|
|
49484
49484
|
}
|
|
49485
|
-
var pivotMeasureNumber = (pivot, records,
|
|
49485
|
+
var pivotMeasureNumber = (pivot, records, measure6) => aggregateValues(records, pivot.fields.indexOf(measure6.field), measure6.aggregate);
|
|
49486
49486
|
|
|
49487
49487
|
// xlsx/pivot/columns.ts
|
|
49488
49488
|
var SEPARATOR = "";
|
|
@@ -49519,17 +49519,17 @@ function pivotColumnEntries(pivot) {
|
|
|
49519
49519
|
values: [...values2, child11[1].value],
|
|
49520
49520
|
keys: [...keys, child11[0]]
|
|
49521
49521
|
};
|
|
49522
|
-
const
|
|
49522
|
+
const entry4 = {
|
|
49523
49523
|
path: here.path,
|
|
49524
49524
|
key: columnKey(here.keys, here.keys.length),
|
|
49525
49525
|
values: here.values
|
|
49526
49526
|
};
|
|
49527
|
-
if (level4 === names.length - 1) entries.push({ kind: "leaf", ...
|
|
49527
|
+
if (level4 === names.length - 1) entries.push({ kind: "leaf", ...entry4 });
|
|
49528
49528
|
else {
|
|
49529
49529
|
visit3(child11[1], level4 + 1, here.path, here.values, here.keys);
|
|
49530
49530
|
const own3 = functions[level4];
|
|
49531
|
-
if (own3 === "auto") entries.push({ kind: "subtotal", ...
|
|
49532
|
-
else for (const fn of own3) entries.push({ kind: "subtotal", ...
|
|
49531
|
+
if (own3 === "auto") entries.push({ kind: "subtotal", ...entry4 });
|
|
49532
|
+
else for (const fn of own3) entries.push({ kind: "subtotal", ...entry4, fn });
|
|
49533
49533
|
}
|
|
49534
49534
|
}
|
|
49535
49535
|
};
|
|
@@ -49552,7 +49552,7 @@ function pivotColumnHeaders(pivot, columns2, rowLabels2, valuesOnRows = false) {
|
|
|
49552
49552
|
const levels = columns2.names.length;
|
|
49553
49553
|
if (!levels)
|
|
49554
49554
|
return [
|
|
49555
|
-
[...rowLabels2, ...valuesOnRows ? [null] : measures2.map((
|
|
49555
|
+
[...rowLabels2, ...valuesOnRows ? [null] : measures2.map((measure6) => measure6.caption)]
|
|
49556
49556
|
];
|
|
49557
49557
|
const compact3 = pivot.layout === "compact";
|
|
49558
49558
|
const labelColumns = rowLabels2.length;
|
|
@@ -49570,22 +49570,22 @@ function pivotColumnHeaders(pivot, columns2, rowLabels2, valuesOnRows = false) {
|
|
|
49570
49570
|
grid[rows - 1][i2] = text9;
|
|
49571
49571
|
});
|
|
49572
49572
|
let previous = [];
|
|
49573
|
-
columns2.entries.forEach((
|
|
49573
|
+
columns2.entries.forEach((entry4, j) => {
|
|
49574
49574
|
const at3 = labelColumns + j * count3;
|
|
49575
|
-
if (
|
|
49576
|
-
|
|
49577
|
-
const continued =
|
|
49578
|
-
if (!continued) grid[1 + level4][at3] = labelOf(columns2.names[level4],
|
|
49575
|
+
if (entry4.kind === "leaf") {
|
|
49576
|
+
entry4.path.forEach((_index, level4) => {
|
|
49577
|
+
const continued = entry4.path.slice(0, level4 + 1).every((p, i2) => p === previous[i2]);
|
|
49578
|
+
if (!continued) grid[1 + level4][at3] = labelOf(columns2.names[level4], entry4.values[level4]);
|
|
49579
49579
|
});
|
|
49580
|
-
previous =
|
|
49581
|
-
if (count3 > 1) measures2.forEach((
|
|
49580
|
+
previous = entry4.path;
|
|
49581
|
+
if (count3 > 1) measures2.forEach((measure6, m) => grid[rows - 1][at3 + m] = measure6.caption);
|
|
49582
49582
|
return;
|
|
49583
49583
|
}
|
|
49584
|
-
const row3 =
|
|
49585
|
-
const name3 =
|
|
49586
|
-
measures2.forEach((
|
|
49587
|
-
const custom2 =
|
|
49588
|
-
grid[row3][at3 + m] = custom2 ? count3 === 1 ? `${name3} ${custom2}` : `${name3} ${custom2} of ${
|
|
49584
|
+
const row3 = entry4.kind === "grand" ? 1 : entry4.path.length;
|
|
49585
|
+
const name3 = entry4.kind === "grand" ? "" : String(labelOf(columns2.names[entry4.path.length - 1], entry4.values.at(-1)));
|
|
49586
|
+
measures2.forEach((measure6, m) => {
|
|
49587
|
+
const custom2 = entry4.fn ? caps.functions[entry4.fn] : void 0;
|
|
49588
|
+
grid[row3][at3 + m] = custom2 ? count3 === 1 ? `${name3} ${custom2}` : `${name3} ${custom2} of ${measure6.field}` : count3 === 1 ? entry4.kind === "grand" ? caps.grandTotal : fillCaption(caps.subtotal, name3) : entry4.kind === "grand" ? fillCaption(caps.measureTotal, measure6.caption) : `${name3} ${measure6.caption}`;
|
|
49589
49589
|
});
|
|
49590
49590
|
});
|
|
49591
49591
|
return grid;
|
|
@@ -49598,19 +49598,19 @@ function sharedPrefix(path4, previous) {
|
|
|
49598
49598
|
function pivotColumnItemsXml(entries, measures2, remap) {
|
|
49599
49599
|
const out = [];
|
|
49600
49600
|
let previous = [];
|
|
49601
|
-
for (const
|
|
49601
|
+
for (const entry4 of entries)
|
|
49602
49602
|
for (let m = 0; m < measures2; m++) {
|
|
49603
|
-
if (
|
|
49603
|
+
if (entry4.kind === "grand") {
|
|
49604
49604
|
out.push(`<i${attrs3({ t: "grand", i: m || void 0 })}><x/></i>`);
|
|
49605
49605
|
previous = [];
|
|
49606
49606
|
continue;
|
|
49607
49607
|
}
|
|
49608
|
-
const group3 =
|
|
49609
|
-
const path4 =
|
|
49608
|
+
const group3 = entry4.path.map((index5, level4) => remap(level4, index5));
|
|
49609
|
+
const path4 = entry4.kind === "leaf" && measures2 > 1 ? [...group3, m] : group3;
|
|
49610
49610
|
const prefix3 = sharedPrefix(path4, previous);
|
|
49611
49611
|
const xs = path4.slice(prefix3).map((index5) => `<x${attrs3({ v: index5 || void 0 })}/>`);
|
|
49612
49612
|
out.push(
|
|
49613
|
-
`<i${attrs3({ t:
|
|
49613
|
+
`<i${attrs3({ t: entry4.kind === "subtotal" ? entry4.fn ? PIVOT_SUBTOTALS[entry4.fn].item : "default" : void 0, r: prefix3 || void 0, i: m || void 0 })}>${xs.join("")}</i>`
|
|
49614
49614
|
);
|
|
49615
49615
|
previous = path4;
|
|
49616
49616
|
}
|
|
@@ -49683,11 +49683,11 @@ function nestedPivotGrid(pivot) {
|
|
|
49683
49683
|
let rowCount = 0;
|
|
49684
49684
|
const width = dimensions3.width - labelColumns;
|
|
49685
49685
|
const blanks = () => Array(width).fill(null);
|
|
49686
|
-
const cells3 = (group3, rowFn,
|
|
49687
|
-
const records =
|
|
49688
|
-
const picked =
|
|
49689
|
-
if (rowFn &&
|
|
49690
|
-
const fn = rowFn ??
|
|
49686
|
+
const cells3 = (group3, rowFn, measure6) => columns2.entries.flatMap((entry4) => {
|
|
49687
|
+
const records = entry4.kind === "grand" ? group3.records : group3.columns.get(entry4.key) ?? [];
|
|
49688
|
+
const picked = measure6 === void 0 ? measures2 : [measures2[measure6]];
|
|
49689
|
+
if (rowFn && entry4.fn && rowFn !== entry4.fn) return picked.map(() => null);
|
|
49690
|
+
const fn = rowFn ?? entry4.fn;
|
|
49691
49691
|
return picked.map(
|
|
49692
49692
|
(one2) => fn ? aggregateValues(records, pivot.fields.indexOf(one2.field), fn) : pivotMeasureNumber(pivot, records, one2)
|
|
49693
49693
|
);
|
|
@@ -49707,17 +49707,17 @@ function nestedPivotGrid(pivot) {
|
|
|
49707
49707
|
throw new Error("The PivotTable result is too large.");
|
|
49708
49708
|
return;
|
|
49709
49709
|
}
|
|
49710
|
-
const [cells4, numbers3,
|
|
49710
|
+
const [cells4, numbers3, entry4] = build3();
|
|
49711
49711
|
values2.push([...cells4, ...numbers3]);
|
|
49712
|
-
rowEntries.push(
|
|
49712
|
+
rowEntries.push(entry4);
|
|
49713
49713
|
indents.push(compact3 ? indent : 0);
|
|
49714
49714
|
};
|
|
49715
|
-
const entryOf = (indices,
|
|
49715
|
+
const entryOf = (indices, measure6, type) => ({
|
|
49716
49716
|
indices,
|
|
49717
|
-
...
|
|
49717
|
+
...measure6 !== void 0 ? { measure: measure6 } : {},
|
|
49718
49718
|
...type ? { type } : {}
|
|
49719
49719
|
});
|
|
49720
|
-
const walk3 = (level4, group3,
|
|
49720
|
+
const walk3 = (level4, group3, measure6, path4) => {
|
|
49721
49721
|
const field2 = fieldOf(level4);
|
|
49722
49722
|
const last = level4 === levels - 1;
|
|
49723
49723
|
const repeated = Array.from(
|
|
@@ -49762,16 +49762,16 @@ function nestedPivotGrid(pivot) {
|
|
|
49762
49762
|
if (last)
|
|
49763
49763
|
return push3(level4, () => [
|
|
49764
49764
|
labelCells(path4, leafShown(here.firsts), level4, text9),
|
|
49765
|
-
cells3(child11, void 0,
|
|
49766
|
-
entryOf(here.indices,
|
|
49765
|
+
cells3(child11, void 0, measure6),
|
|
49766
|
+
entryOf(here.indices, measure6)
|
|
49767
49767
|
]);
|
|
49768
49768
|
if (!tabular)
|
|
49769
49769
|
push3(level4, () => [
|
|
49770
49770
|
labelCells(path4, repeated, level4, text9),
|
|
49771
|
-
showsValue ? cells3(child11, void 0,
|
|
49772
|
-
entryOf(here.indices,
|
|
49771
|
+
showsValue ? cells3(child11, void 0, measure6) : blanks(),
|
|
49772
|
+
entryOf(here.indices, measure6)
|
|
49773
49773
|
]);
|
|
49774
|
-
walk3(level4 + 1, child11,
|
|
49774
|
+
walk3(level4 + 1, child11, measure6, here);
|
|
49775
49775
|
if (field2 === depth - 1) return;
|
|
49776
49776
|
const caption = String(text9);
|
|
49777
49777
|
const subtotal = (title, fn, one2) => push3(level4, () => [
|
|
@@ -49781,21 +49781,21 @@ function nestedPivotGrid(pivot) {
|
|
|
49781
49781
|
]);
|
|
49782
49782
|
if (own3 === "auto") {
|
|
49783
49783
|
if (showsValue) return;
|
|
49784
|
-
if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0,
|
|
49784
|
+
if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0, measure6);
|
|
49785
49785
|
else measures2.forEach((one2, m) => subtotal(`${caption} ${one2.caption}`, void 0, m));
|
|
49786
49786
|
} else
|
|
49787
49787
|
for (const fn of own3)
|
|
49788
|
-
if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn,
|
|
49788
|
+
if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn, measure6);
|
|
49789
49789
|
else
|
|
49790
49790
|
measures2.forEach(
|
|
49791
49791
|
(one2, m) => subtotal(`${caption} ${caps.functions[fn]} of ${one2.field}`, fn, m)
|
|
49792
49792
|
);
|
|
49793
49793
|
});
|
|
49794
49794
|
};
|
|
49795
|
-
const grand = (text9,
|
|
49795
|
+
const grand = (text9, measure6) => push3(0, () => [
|
|
49796
49796
|
compact3 ? [text9] : [text9, ...Array(levels - 1).fill(null)],
|
|
49797
|
-
cells3(root, void 0,
|
|
49798
|
-
entryOf([0],
|
|
49797
|
+
cells3(root, void 0, measure6),
|
|
49798
|
+
entryOf([0], measure6, "grand")
|
|
49799
49799
|
]);
|
|
49800
49800
|
const build2 = () => {
|
|
49801
49801
|
walk3(0, root, void 0, { labels: [], indices: [], firsts: [] });
|
|
@@ -49975,15 +49975,15 @@ function readPivotCaptionAttributes(root) {
|
|
|
49975
49975
|
}
|
|
49976
49976
|
function aggregateCaptionsOf(pivot) {
|
|
49977
49977
|
const out = {};
|
|
49978
|
-
for (const
|
|
49978
|
+
for (const measure6 of [
|
|
49979
49979
|
{ field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
|
|
49980
49980
|
...pivot.additionalValues ?? []
|
|
49981
49981
|
]) {
|
|
49982
|
-
const at3 =
|
|
49983
|
-
if (at3 < 0 ||
|
|
49984
|
-
const template2 = `${
|
|
49985
|
-
if (template2 !== ENGLISH_PIVOT_CAPTIONS.aggregates[
|
|
49986
|
-
out[
|
|
49982
|
+
const at3 = measure6.caption.indexOf(measure6.field);
|
|
49983
|
+
if (at3 < 0 || measure6.caption === measure6.field) continue;
|
|
49984
|
+
const template2 = `${measure6.caption.slice(0, at3)}{0}${measure6.caption.slice(at3 + measure6.field.length)}`;
|
|
49985
|
+
if (template2 !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure6.aggregate])
|
|
49986
|
+
out[measure6.aggregate] = template2;
|
|
49987
49987
|
}
|
|
49988
49988
|
return Object.keys(out).length ? out : void 0;
|
|
49989
49989
|
}
|
|
@@ -50379,17 +50379,17 @@ function settleSlicers(workbook, warn) {
|
|
|
50379
50379
|
const book = workbook.slicers;
|
|
50380
50380
|
if (!book) return;
|
|
50381
50381
|
const pivotAt2 = (tabId, name3) => {
|
|
50382
|
-
const sheet2 = workbook.sheets.find((
|
|
50383
|
-
const pivot = sheet2?.pivotTables?.find((
|
|
50382
|
+
const sheet2 = workbook.sheets.find((entry4) => entry4.sheetId === tabId);
|
|
50383
|
+
const pivot = sheet2?.pivotTables?.find((entry4) => entry4.name === name3);
|
|
50384
50384
|
return sheet2 && pivot ? { sheet: sheet2, pivot } : void 0;
|
|
50385
50385
|
};
|
|
50386
50386
|
const good = (cache3) => {
|
|
50387
50387
|
if (cache3.source.kind === "table") {
|
|
50388
50388
|
const { tableId, column: column3 } = cache3.source;
|
|
50389
50389
|
for (const sheet2 of workbook.sheets) {
|
|
50390
|
-
const table4 = sheet2.tables.find((
|
|
50390
|
+
const table4 = sheet2.tables.find((entry4) => entry4.id === tableId);
|
|
50391
50391
|
if (table4)
|
|
50392
|
-
return table4.headerRow && !table4.filterNotModeled && table4.columns.some((
|
|
50392
|
+
return table4.headerRow && !table4.filterNotModeled && table4.columns.some((entry4) => entry4.sourceId === column3);
|
|
50393
50393
|
}
|
|
50394
50394
|
return false;
|
|
50395
50395
|
}
|
|
@@ -50490,7 +50490,7 @@ function pivotDateFieldsOf(workbook, sheet2, pivot) {
|
|
|
50490
50490
|
...pivot.moreColumnFields ?? [],
|
|
50491
50491
|
pivot.pageFilter?.field,
|
|
50492
50492
|
pivot.valueField,
|
|
50493
|
-
...(pivot.additionalValues ?? []).map((
|
|
50493
|
+
...(pivot.additionalValues ?? []).map((measure6) => measure6.field)
|
|
50494
50494
|
].filter((name3) => !!name3)
|
|
50495
50495
|
);
|
|
50496
50496
|
return pivotDateColumns(workbook, sheet2, pivot.source, pivot.fields, used);
|
|
@@ -50612,13 +50612,13 @@ function readDateGroups(fields, count3, names, dateFields, records, date1904) {
|
|
|
50612
50612
|
for (const [base3, list3] of members4) {
|
|
50613
50613
|
const field2 = names[base3] ?? "";
|
|
50614
50614
|
const parent = first(fields[base3], "fieldGroup", NS.x);
|
|
50615
|
-
const units3 = list3.map((
|
|
50615
|
+
const units3 = list3.map((entry4) => entry4.unit);
|
|
50616
50616
|
if (!dateFields.includes(field2) || Number(att(parent, "par")) !== list3.at(-1).index || units3.some(
|
|
50617
50617
|
(unit4, i2) => i2 > 0 && PIVOT_DATE_UNITS.indexOf(unit4) <= PIVOT_DATE_UNITS.indexOf(units3[i2 - 1])
|
|
50618
50618
|
))
|
|
50619
50619
|
throw unsupported3("group parent");
|
|
50620
50620
|
const ranges = list3.map(
|
|
50621
|
-
(
|
|
50621
|
+
(entry4) => first(first(entry4.node, "fieldGroup", NS.x), "rangePr", NS.x)
|
|
50622
50622
|
);
|
|
50623
50623
|
const sample = ranges[0];
|
|
50624
50624
|
const autoStart = att(sample, "autoStart") !== "0";
|
|
@@ -50646,15 +50646,15 @@ function readDateGroups(fields, count3, names, dateFields, records, date1904) {
|
|
|
50646
50646
|
if (!close(expected.start, start) || !close(expected.end, end))
|
|
50647
50647
|
throw unsupported3("stale range");
|
|
50648
50648
|
const localized = {};
|
|
50649
|
-
for (const
|
|
50650
|
-
const labels = englishDateUnitLabels(
|
|
50651
|
-
const node4 = first(first(
|
|
50649
|
+
for (const entry4 of list3) {
|
|
50650
|
+
const labels = englishDateUnitLabels(entry4.unit, expected, dateGroupDays(group3), date1904);
|
|
50651
|
+
const node4 = first(first(entry4.node, "fieldGroup", NS.x), "groupItems", NS.x);
|
|
50652
50652
|
const actual = children(node4, "s", NS.x).map((item2) => decodeEscapes(att(item2, "v") ?? ""));
|
|
50653
|
-
const name3 = decodeEscapes(att(
|
|
50653
|
+
const name3 = decodeEscapes(att(entry4.node, "name") ?? "");
|
|
50654
50654
|
if (!name3 || elements(node4).length !== actual.length || actual.length !== labels.length || actual.some((label2) => !label2) || new Set(actual).size !== actual.length)
|
|
50655
50655
|
throw unsupported3("group items");
|
|
50656
|
-
if (name3 !== dateGroupFieldName(
|
|
50657
|
-
localized[
|
|
50656
|
+
if (name3 !== dateGroupFieldName(entry4.unit, field2) || actual.some((l, i2) => l !== labels[i2]))
|
|
50657
|
+
localized[entry4.unit] = { name: name3, labels: actual };
|
|
50658
50658
|
}
|
|
50659
50659
|
groups.push(Object.keys(localized).length ? { ...group3, localized } : group3);
|
|
50660
50660
|
}
|
|
@@ -50731,9 +50731,9 @@ function readItemNames(tableFields2, names, shared) {
|
|
|
50731
50731
|
// xlsx/pivot/values-axis.ts
|
|
50732
50732
|
function remapPivotRowEntries(entries, axes) {
|
|
50733
50733
|
return entries.map(
|
|
50734
|
-
(
|
|
50735
|
-
...
|
|
50736
|
-
indices:
|
|
50734
|
+
(entry4) => entry4.type === "grand" ? entry4 : {
|
|
50735
|
+
...entry4,
|
|
50736
|
+
indices: entry4.indices.map((item2, axis) => {
|
|
50737
50737
|
if (axes[axis] === null) return item2;
|
|
50738
50738
|
const index5 = axes[axis]?.[item2];
|
|
50739
50739
|
if (index5 === void 0) throw new Error("Invalid report row axis item");
|
|
@@ -50759,9 +50759,9 @@ function pivotValueIndex(root, axis) {
|
|
|
50759
50759
|
}
|
|
50760
50760
|
function pivotValueAxisItems(measures2) {
|
|
50761
50761
|
const entries = [];
|
|
50762
|
-
for (let
|
|
50762
|
+
for (let measure6 = 0; measure6 < measures2; measure6++)
|
|
50763
50763
|
entries.push(
|
|
50764
|
-
`<i${attrs3({ i:
|
|
50764
|
+
`<i${attrs3({ i: measure6 || void 0 })}><x${attrs3({ v: measure6 || void 0 })}/></i>`
|
|
50765
50765
|
);
|
|
50766
50766
|
return `<colItems count="${entries.length}">${entries.join("")}</colItems>`;
|
|
50767
50767
|
}
|
|
@@ -50877,9 +50877,9 @@ function assertPageAxisItems(root, pivot, shared, cache3, recordRoot) {
|
|
|
50877
50877
|
throw new Error("Invalid page column items");
|
|
50878
50878
|
let previous = [];
|
|
50879
50879
|
colItems.forEach((item2, i2) => {
|
|
50880
|
-
const grand = i2 >= expected.length,
|
|
50880
|
+
const grand = i2 >= expected.length, measure6 = grand ? i2 - expected.length : i2 % measures2;
|
|
50881
50881
|
const xs = children(item2, "x", NS.x).map((x) => integer5(x.getAttribute("v"), 0)), prefix3 = integer5(item2.getAttribute("r"), 0);
|
|
50882
|
-
if (integer5(item2.getAttribute("i"), 0) !==
|
|
50882
|
+
if (integer5(item2.getAttribute("i"), 0) !== measure6 || !Number.isInteger(prefix3) || prefix3 < 0 || prefix3 > Math.max(0, previous.length - 1))
|
|
50883
50883
|
throw new Error("Invalid page column prefix");
|
|
50884
50884
|
if (grand) {
|
|
50885
50885
|
if (item2.getAttribute("t") !== "grand" || prefix3 !== 0 || xs.length !== 1 || xs[0] !== 0)
|
|
@@ -50921,12 +50921,12 @@ function readOne(workbook, source3, part) {
|
|
|
50921
50921
|
const cachePart = source3.targetOfType(part, RELATIONSHIP_TYPES.pivotCacheDefinition);
|
|
50922
50922
|
if (!cachePart) throw new Error("Missing pivot cache");
|
|
50923
50923
|
const bookPart = source3.workbookPart();
|
|
50924
|
-
const
|
|
50924
|
+
const entry4 = children(
|
|
50925
50925
|
first(parseXml(source3.text(bookPart)).documentElement, "pivotCaches", NS.x),
|
|
50926
50926
|
"pivotCache",
|
|
50927
50927
|
NS.x
|
|
50928
50928
|
).find((node4) => Number(att(node4, "cacheId")) === cacheId);
|
|
50929
|
-
const relationship2 =
|
|
50929
|
+
const relationship2 = entry4 && source3.rels(bookPart).get(relAttr(entry4, "id") ?? "");
|
|
50930
50930
|
if (!relationship2 || source3.target(bookPart, relationship2) !== cachePart)
|
|
50931
50931
|
throw new Error("Inconsistent pivot cache identity");
|
|
50932
50932
|
const cache3 = parseXml(source3.text(cachePart)).documentElement;
|
|
@@ -50981,7 +50981,7 @@ function readOne(workbook, source3, part) {
|
|
|
50981
50981
|
if (rowFields.length < 1 || dataFields.length < 1 || dataFields.length > 16 || !supportedPivotAxes(rowFields, colFields, dataFields.length, rowsAxis) || root.getAttribute("rowGrandTotals") === "0" || root.getAttribute("colGrandTotals") === "0")
|
|
50982
50982
|
throw new Error("Unsupported pivot layout");
|
|
50983
50983
|
const valueIndex = pivotValueIndex(root, rowsAxis ? rowFields : colFields);
|
|
50984
|
-
const
|
|
50984
|
+
const measure6 = dataFields[0];
|
|
50985
50985
|
const definition2 = elements(first(root, "extLst", NS.x) ?? parseXml("<root/>").documentElement).map(
|
|
50986
50986
|
(extension2) => first(
|
|
50987
50987
|
extension2,
|
|
@@ -51005,8 +51005,8 @@ function readOne(workbook, source3, part) {
|
|
|
51005
51005
|
throw new Error("Unsupported Values axis item");
|
|
51006
51006
|
}
|
|
51007
51007
|
}
|
|
51008
|
-
const aggregate3 = att(
|
|
51009
|
-
if (!PIVOT_AGGREGATES.includes(aggregate3) || att(
|
|
51008
|
+
const aggregate3 = att(measure6, "subtotal") ?? "sum";
|
|
51009
|
+
if (!PIVOT_AGGREGATES.includes(aggregate3) || att(measure6, "showDataAs") && att(measure6, "showDataAs") !== "normal")
|
|
51010
51010
|
throw new Error("Unsupported pivot aggregate");
|
|
51011
51011
|
const names = fields.map((field2) => decodeEscapes(att(field2, "name") ?? ""));
|
|
51012
51012
|
const axisNames = allFields.map((field2) => decodeEscapes(att(field2, "name") ?? ""));
|
|
@@ -51027,7 +51027,7 @@ function readOne(workbook, source3, part) {
|
|
|
51027
51027
|
const rowDefinitions = realRows.map((field2) => tableFields2[Number(att(field2, "x"))]);
|
|
51028
51028
|
const subtotalSettings = fieldSubtotalsOf(rowDefinitions, [row3, second, ...more]);
|
|
51029
51029
|
const subtotal = !subtotalSettings.some(
|
|
51030
|
-
(
|
|
51030
|
+
(entry5) => entry5.field === row3 && entry5.functions.length === 0
|
|
51031
51031
|
);
|
|
51032
51032
|
const repeat = realRows.map((field2) => {
|
|
51033
51033
|
const node4 = tableFields2[Number(att(field2, "x"))];
|
|
@@ -51041,7 +51041,7 @@ function readOne(workbook, source3, part) {
|
|
|
51041
51041
|
"fillDownLabels"
|
|
51042
51042
|
) === "1";
|
|
51043
51043
|
});
|
|
51044
|
-
if (repeat.some((
|
|
51044
|
+
if (repeat.some((entry5) => entry5 !== repeat[0])) throw new Error("Mixed field label repetition");
|
|
51045
51045
|
const columnDefs = dataFields.length > 1 && !rowsAxis ? colFields.slice(0, -1) : colFields;
|
|
51046
51046
|
const columnNames = columnDefs.map((field2) => axisNames[Number(att(field2, "x"))]);
|
|
51047
51047
|
const hasColumn = columnDefs.length > 0;
|
|
@@ -51050,7 +51050,7 @@ function readOne(workbook, source3, part) {
|
|
|
51050
51050
|
const columnDefinitions = columnDefs.map((field2) => tableFields2[Number(att(field2, "x"))]);
|
|
51051
51051
|
if (columnNames.some((name3) => !name3)) throw new Error("Invalid pivot column fields");
|
|
51052
51052
|
const columnSubtotals = fieldSubtotalsOf(columnDefinitions, columnNames);
|
|
51053
|
-
const data = names[Number(att(
|
|
51053
|
+
const data = names[Number(att(measure6, "fld"))];
|
|
51054
51054
|
const location = parseRange(att(first(root, "location", NS.x), "ref") ?? "");
|
|
51055
51055
|
if (!row3 || !data || !location || hasColumn && !col || realRows.length === 2 && !second)
|
|
51056
51056
|
throw new Error("Invalid pivot fields");
|
|
@@ -51092,7 +51092,7 @@ function readOne(workbook, source3, part) {
|
|
|
51092
51092
|
if (dateFields.some((field2) => onAxis.has(field2)))
|
|
51093
51093
|
throw new Error("Date fields used as rows, columns or values are preserved");
|
|
51094
51094
|
const fieldSubtotals = [
|
|
51095
|
-
...subtotalSettings.filter((
|
|
51095
|
+
...subtotalSettings.filter((entry5) => entry5.field !== row3 || entry5.functions.length),
|
|
51096
51096
|
...columnSubtotals
|
|
51097
51097
|
];
|
|
51098
51098
|
const pivot = {
|
|
@@ -51122,14 +51122,14 @@ function readOne(workbook, source3, part) {
|
|
|
51122
51122
|
},
|
|
51123
51123
|
valueField: data,
|
|
51124
51124
|
aggregate: aggregate3,
|
|
51125
|
-
valueCaption: decodeEscapes(att(
|
|
51125
|
+
valueCaption: decodeEscapes(att(measure6, "name") ?? data),
|
|
51126
51126
|
...dataFields.length > 1 ? {
|
|
51127
|
-
additionalValues: dataFields.slice(1).map((
|
|
51128
|
-
const field2 = names[Number(att(
|
|
51129
|
-
const aggregate4 = att(
|
|
51130
|
-
if (!field2 || !PIVOT_AGGREGATES.includes(aggregate4) || att(
|
|
51127
|
+
additionalValues: dataFields.slice(1).map((measure7) => {
|
|
51128
|
+
const field2 = names[Number(att(measure7, "fld"))];
|
|
51129
|
+
const aggregate4 = att(measure7, "subtotal") ?? "sum";
|
|
51130
|
+
if (!field2 || !PIVOT_AGGREGATES.includes(aggregate4) || att(measure7, "showDataAs") && att(measure7, "showDataAs") !== "normal")
|
|
51131
51131
|
throw new Error("Unsupported pivot measure");
|
|
51132
|
-
return { field: field2, aggregate: aggregate4, caption: decodeEscapes(att(
|
|
51132
|
+
return { field: field2, aggregate: aggregate4, caption: decodeEscapes(att(measure7, "name") ?? field2) };
|
|
51133
51133
|
})
|
|
51134
51134
|
} : {},
|
|
51135
51135
|
fields: names,
|
|
@@ -51454,9 +51454,9 @@ async function openPackage(input2, limits) {
|
|
|
51454
51454
|
async function readZipParts(input2, limits = {}) {
|
|
51455
51455
|
const zip = await openPackage(input2, resolveLoadLimits(limits));
|
|
51456
51456
|
const parts = /* @__PURE__ */ new Map();
|
|
51457
|
-
for (const
|
|
51458
|
-
if (
|
|
51459
|
-
parts.set(
|
|
51457
|
+
for (const entry4 of Object.values(zip.files)) {
|
|
51458
|
+
if (entry4.dir) continue;
|
|
51459
|
+
parts.set(entry4.name.replace(/^\//, ""), await entry4.async("uint8array"));
|
|
51460
51460
|
}
|
|
51461
51461
|
return parts;
|
|
51462
51462
|
}
|
|
@@ -51580,10 +51580,10 @@ function splitSheetData(xml) {
|
|
|
51580
51580
|
function parseColor(element5, palette) {
|
|
51581
51581
|
if (!element5) return void 0;
|
|
51582
51582
|
const color4 = {};
|
|
51583
|
-
const
|
|
51583
|
+
const rgb8 = att(element5, "rgb");
|
|
51584
51584
|
const theme3 = numAttr(element5, "theme");
|
|
51585
51585
|
const indexed = numAttr(element5, "indexed");
|
|
51586
|
-
if (
|
|
51586
|
+
if (rgb8 && /^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(rgb8)) color4.rgb = rgb8.toUpperCase();
|
|
51587
51587
|
else if (theme3 !== void 0) color4.theme = theme3;
|
|
51588
51588
|
else if (indexed !== void 0) {
|
|
51589
51589
|
const override = palette?.[indexed];
|
|
@@ -51871,15 +51871,15 @@ function parseStyles(xml, warnings) {
|
|
|
51871
51871
|
const xfId = numAttr(node4, "xfId") ?? 0;
|
|
51872
51872
|
const name3 = att(node4, "name") ?? `Style ${xfId}`;
|
|
51873
51873
|
const style4 = styleXfs[xfId] ?? fallback;
|
|
51874
|
-
const
|
|
51874
|
+
const entry4 = { name: name3, style: structuredClone(style4) };
|
|
51875
51875
|
const builtinId = numAttr(node4, "builtinId");
|
|
51876
|
-
if (builtinId !== void 0)
|
|
51876
|
+
if (builtinId !== void 0) entry4.builtinId = builtinId;
|
|
51877
51877
|
if (!namesByXf.has(xfId)) namesByXf.set(xfId, name3);
|
|
51878
|
-
namedStyles.push(
|
|
51878
|
+
namedStyles.push(entry4);
|
|
51879
51879
|
}
|
|
51880
|
-
const normalAt = namedStyles.findIndex((
|
|
51880
|
+
const normalAt = namedStyles.findIndex((entry4) => entry4.builtinId === 0);
|
|
51881
51881
|
if (normalAt > 0) namedStyles.unshift(...namedStyles.splice(normalAt, 1));
|
|
51882
|
-
if (!namedStyles.some((
|
|
51882
|
+
if (!namedStyles.some((entry4) => entry4.name === "Normal"))
|
|
51883
51883
|
namedStyles.unshift({ name: "Normal", style: styleXfs[0] ?? defaultCellStyle(), builtinId: 0 });
|
|
51884
51884
|
const styles = [];
|
|
51885
51885
|
const keys = /* @__PURE__ */ new Map();
|
|
@@ -52002,13 +52002,13 @@ function readDateGroup(node4) {
|
|
|
52002
52002
|
return item2;
|
|
52003
52003
|
}
|
|
52004
52004
|
function readFilterColumn(column3, dxfs) {
|
|
52005
|
-
const
|
|
52005
|
+
const entry4 = { offset: numAttr(column3, "colId") ?? 0 };
|
|
52006
52006
|
const filters = xFirst(column3, "filters");
|
|
52007
52007
|
if (filters) {
|
|
52008
|
-
|
|
52009
|
-
if (boolAttr(filters, "blank"))
|
|
52008
|
+
entry4.values = xChildren(filters, "filter").map((f6) => att(f6, "val") ?? "");
|
|
52009
|
+
if (boolAttr(filters, "blank")) entry4.blank = true;
|
|
52010
52010
|
const groups = xChildren(filters, "dateGroupItem").map(readDateGroup).filter((g2) => g2 !== void 0);
|
|
52011
|
-
if (groups.length)
|
|
52011
|
+
if (groups.length) entry4.dateGroups = groups;
|
|
52012
52012
|
}
|
|
52013
52013
|
const custom2 = xFirst(column3, "customFilters");
|
|
52014
52014
|
if (custom2) {
|
|
@@ -52019,12 +52019,12 @@ function readFilterColumn(column3, dxfs) {
|
|
|
52019
52019
|
value: att(c2, "val") ?? ""
|
|
52020
52020
|
};
|
|
52021
52021
|
});
|
|
52022
|
-
|
|
52022
|
+
entry4.custom = { ...boolAttr(custom2, "and") ? { and: true } : {}, conditions };
|
|
52023
52023
|
}
|
|
52024
52024
|
const top = xFirst(column3, "top10");
|
|
52025
52025
|
if (top) {
|
|
52026
52026
|
const filterValue = numAttr(top, "filterVal");
|
|
52027
|
-
|
|
52027
|
+
entry4.top10 = {
|
|
52028
52028
|
top: boolAttr(top, "top", true),
|
|
52029
52029
|
percent: boolAttr(top, "percent", false),
|
|
52030
52030
|
value: numAttr(top, "val") ?? 10,
|
|
@@ -52035,7 +52035,7 @@ function readFilterColumn(column3, dxfs) {
|
|
|
52035
52035
|
if (dynamic2) {
|
|
52036
52036
|
const value3 = numAttr(dynamic2, "val");
|
|
52037
52037
|
const maxValue = numAttr(dynamic2, "maxVal");
|
|
52038
|
-
|
|
52038
|
+
entry4.dynamic = {
|
|
52039
52039
|
type: att(dynamic2, "type") ?? "null",
|
|
52040
52040
|
...value3 !== void 0 ? { value: value3 } : {},
|
|
52041
52041
|
...maxValue !== void 0 ? { maxValue } : {}
|
|
@@ -52045,7 +52045,7 @@ function readFilterColumn(column3, dxfs) {
|
|
|
52045
52045
|
if (color4) {
|
|
52046
52046
|
const dxfId = numAttr(color4, "dxfId");
|
|
52047
52047
|
const style4 = dxfId === void 0 ? void 0 : dxfs?.[dxfId];
|
|
52048
|
-
|
|
52048
|
+
entry4.color = {
|
|
52049
52049
|
cellColor: boolAttr(color4, "cellColor", true),
|
|
52050
52050
|
...dxfId !== void 0 ? { dxfId } : {},
|
|
52051
52051
|
...style4 ? { style: structuredClone(style4) } : {}
|
|
@@ -52055,11 +52055,11 @@ function readFilterColumn(column3, dxfs) {
|
|
|
52055
52055
|
const iconSet = att(icon, "iconSet");
|
|
52056
52056
|
if (iconSet) {
|
|
52057
52057
|
const iconId = numAttr(icon, "iconId");
|
|
52058
|
-
|
|
52058
|
+
entry4.icon = { iconSet, ...iconId !== void 0 ? { iconId } : {} };
|
|
52059
52059
|
}
|
|
52060
|
-
if (boolAttr(column3, "hiddenButton"))
|
|
52061
|
-
|
|
52062
|
-
return
|
|
52060
|
+
if (boolAttr(column3, "hiddenButton")) entry4.hiddenButton = true;
|
|
52061
|
+
entry4.sourceXml = outerXml2(column3).replace(MAIN_NS_DECL, "");
|
|
52062
|
+
return entry4;
|
|
52063
52063
|
}
|
|
52064
52064
|
|
|
52065
52065
|
// xlsx/read/sort-state.ts
|
|
@@ -53889,23 +53889,23 @@ function readValue2(ctx, c2, cell2) {
|
|
|
53889
53889
|
const raw2 = v ? v.textContent ?? "" : void 0;
|
|
53890
53890
|
switch (type) {
|
|
53891
53891
|
case "s": {
|
|
53892
|
-
const
|
|
53893
|
-
if (!
|
|
53892
|
+
const entry4 = ctx.sharedStrings[Number(raw2)];
|
|
53893
|
+
if (!entry4) {
|
|
53894
53894
|
if (raw2 !== void 0) ctx.warn("A cell refers to a missing shared string.");
|
|
53895
53895
|
return;
|
|
53896
53896
|
}
|
|
53897
|
-
cell2.value =
|
|
53898
|
-
if (
|
|
53899
|
-
if (
|
|
53897
|
+
cell2.value = entry4.text;
|
|
53898
|
+
if (entry4.runs) cell2.richText = entry4.runs.map((run2) => ({ ...run2 }));
|
|
53899
|
+
if (entry4.phonetic) cell2.phonetic = structuredClone(entry4.phonetic);
|
|
53900
53900
|
return;
|
|
53901
53901
|
}
|
|
53902
53902
|
case "inlineStr": {
|
|
53903
53903
|
const is2 = xFirst(c2, "is");
|
|
53904
53904
|
if (!is2) return;
|
|
53905
|
-
const
|
|
53906
|
-
cell2.value =
|
|
53907
|
-
if (
|
|
53908
|
-
if (
|
|
53905
|
+
const entry4 = parseRichString(is2, ctx.palette);
|
|
53906
|
+
cell2.value = entry4.text;
|
|
53907
|
+
if (entry4.runs) cell2.richText = entry4.runs;
|
|
53908
|
+
if (entry4.phonetic) cell2.phonetic = entry4.phonetic;
|
|
53909
53909
|
return;
|
|
53910
53910
|
}
|
|
53911
53911
|
case "str":
|
|
@@ -54398,13 +54398,13 @@ async function loadXlsx(input2, options2 = {}) {
|
|
|
54398
54398
|
const warn = (message) => {
|
|
54399
54399
|
if (!warnings.includes(message)) warnings.push(message);
|
|
54400
54400
|
};
|
|
54401
|
-
const
|
|
54402
|
-
const stylesPart =
|
|
54401
|
+
const partOf2 = (type) => source3.targetOfType(workbookPart, type);
|
|
54402
|
+
const stylesPart = partOf2(RELATIONSHIP_TYPES.styles);
|
|
54403
54403
|
const styles = parseStyles(stylesPart ? source3.text(stylesPart) : void 0, warnings);
|
|
54404
|
-
const themePart2 =
|
|
54405
|
-
const stringsPart =
|
|
54406
|
-
const personsPart =
|
|
54407
|
-
const metadataPart =
|
|
54404
|
+
const themePart2 = partOf2(RELATIONSHIP_TYPES.theme);
|
|
54405
|
+
const stringsPart = partOf2(RELATIONSHIP_TYPES.sharedStrings);
|
|
54406
|
+
const personsPart = partOf2(RELATIONSHIP_TYPES.person);
|
|
54407
|
+
const metadataPart = partOf2(RELATIONSHIP_TYPES.sheetMetadata);
|
|
54408
54408
|
const ctx = {
|
|
54409
54409
|
source: source3,
|
|
54410
54410
|
sharedStrings: parseSharedStrings(
|
|
@@ -54422,24 +54422,24 @@ async function loadXlsx(input2, options2 = {}) {
|
|
|
54422
54422
|
maxXmlElements: limits.maxXmlElements
|
|
54423
54423
|
};
|
|
54424
54424
|
const rels = source3.rels(workbookPart);
|
|
54425
|
-
const sheets = book.sheets.map((
|
|
54426
|
-
const rel = rels.get(
|
|
54425
|
+
const sheets = book.sheets.map((entry4) => {
|
|
54426
|
+
const rel = rels.get(entry4.relId);
|
|
54427
54427
|
const target3 = rel ? source3.target(workbookPart, rel) : void 0;
|
|
54428
54428
|
let sheet2;
|
|
54429
54429
|
if (rel?.type === RELATIONSHIP_TYPES.worksheet && target3) {
|
|
54430
|
-
sheet2 = parseWorksheet(ctx, target3,
|
|
54430
|
+
sheet2 = parseWorksheet(ctx, target3, entry4.name, entry4.sheetId);
|
|
54431
54431
|
} else {
|
|
54432
|
-
sheet2 = createWorksheet(
|
|
54432
|
+
sheet2 = createWorksheet(entry4.name, entry4.sheetId);
|
|
54433
54433
|
if (target3) sheet2.partName = target3;
|
|
54434
54434
|
const kind = rel?.type.split("/").pop() ?? "sheet";
|
|
54435
|
-
warn(`Sheet "${
|
|
54435
|
+
warn(`Sheet "${entry4.name}" is a ${kind}; it is kept on save but cannot be shown or edited.`);
|
|
54436
54436
|
}
|
|
54437
|
-
sheet2.state =
|
|
54437
|
+
sheet2.state = entry4.state;
|
|
54438
54438
|
return sheet2;
|
|
54439
54439
|
});
|
|
54440
|
-
if (source3.has("xl/vbaProject.bin") ||
|
|
54440
|
+
if (source3.has("xl/vbaProject.bin") || partOf2(RELATIONSHIP_TYPES.vbaProject))
|
|
54441
54441
|
warn("The workbook contains VBA macros; they are kept on save but never run.");
|
|
54442
|
-
if (
|
|
54442
|
+
if (partOf2(RELATIONSHIP_TYPES.externalLink))
|
|
54443
54443
|
warn("External workbook links are kept but not updated.");
|
|
54444
54444
|
const signatures = detectDigitalSignatures([...parts.keys()]);
|
|
54445
54445
|
if (signatures.hasSignatures)
|
|
@@ -55069,8 +55069,8 @@ function writeChartColorStyle(writer, chartPart, chart) {
|
|
|
55069
55069
|
if (!palette) return;
|
|
55070
55070
|
const source3 = writer.source;
|
|
55071
55071
|
const existing = [...source3?.rels(chartPart).entries() ?? []];
|
|
55072
|
-
const
|
|
55073
|
-
const sourcePart =
|
|
55072
|
+
const entry4 = existing.find(([, rel]) => rel.type.endsWith("/chartColorStyle"));
|
|
55073
|
+
const sourcePart = entry4 && source3?.target(chartPart, entry4[1]);
|
|
55074
55074
|
const original = sourcePart && source3?.text(sourcePart);
|
|
55075
55075
|
if (original && chartColorStyleId(original) === palette.id) return;
|
|
55076
55076
|
const part = writer.uniqueName(
|
|
@@ -55085,7 +55085,7 @@ function writeChartColorStyle(writer, chartPart, chart) {
|
|
|
55085
55085
|
const rels = new RelationshipSet();
|
|
55086
55086
|
for (const [id5, rel] of existing) rels.keep(id5, rel);
|
|
55087
55087
|
const target3 = chartPart.split("/").slice(0, -1).join("/") === "xl/charts" ? part.slice("xl/charts/".length) : "/" + part;
|
|
55088
|
-
if (
|
|
55088
|
+
if (entry4) rels.keep(entry4[0], { ...entry4[1], target: target3 });
|
|
55089
55089
|
else rels.add(CHART_COLOR_STYLE_REL, target3);
|
|
55090
55090
|
writer.rels(chartPart, rels);
|
|
55091
55091
|
}
|
|
@@ -55222,7 +55222,7 @@ function style(chart) {
|
|
|
55222
55222
|
return id5 > 100 ? { c14Style: id5, style: id5 - 100 } : { style: id5 };
|
|
55223
55223
|
}
|
|
55224
55224
|
function chartSpaceFromObject(chart) {
|
|
55225
|
-
const series = chart.series.map((
|
|
55225
|
+
const series = chart.series.map((entry4, index5) => seriesModel(chart, entry4, index5));
|
|
55226
55226
|
const [group3, chartAxes] = plot(chart, series);
|
|
55227
55227
|
const space = {
|
|
55228
55228
|
roundedCorners: false,
|
|
@@ -55265,8 +55265,8 @@ function stable2(value3) {
|
|
|
55265
55265
|
if (value3 && typeof value3 === "object") {
|
|
55266
55266
|
const out = {};
|
|
55267
55267
|
for (const key2 of Object.keys(value3).sort()) {
|
|
55268
|
-
const
|
|
55269
|
-
if (
|
|
55268
|
+
const entry4 = value3[key2];
|
|
55269
|
+
if (entry4 !== void 0) out[key2] = stable2(entry4);
|
|
55270
55270
|
}
|
|
55271
55271
|
return out;
|
|
55272
55272
|
}
|
|
@@ -55388,9 +55388,9 @@ function writeEditedSmartArt(writer, object2, rels, relativeTarget5, context = {
|
|
|
55388
55388
|
if (dataRelsXml) {
|
|
55389
55389
|
const document = parseXml(dataRelsXml);
|
|
55390
55390
|
const drawingLinks = elements(document.documentElement).filter(
|
|
55391
|
-
(
|
|
55391
|
+
(entry4) => entry4.namespaceURI === NS.rels && entry4.getAttribute("Type") === DIAGRAM_RELATIONSHIP_TYPES.drawing
|
|
55392
55392
|
);
|
|
55393
|
-
for (const
|
|
55393
|
+
for (const entry4 of drawingLinks) document.documentElement.removeChild(entry4);
|
|
55394
55394
|
if (drawingLinks.length) writer.add(dataRelsPath, buildXml(document), CONTENT_TYPES2.rels);
|
|
55395
55395
|
}
|
|
55396
55396
|
writer.add(
|
|
@@ -55765,25 +55765,25 @@ var AreaIndex = class {
|
|
|
55765
55765
|
for (let col = start.col; col <= end.col; col++) push(cells3, cellKey(start.row, col), node4);
|
|
55766
55766
|
return;
|
|
55767
55767
|
}
|
|
55768
|
-
const
|
|
55768
|
+
const entry4 = { range: area2.range, node: node4 };
|
|
55769
55769
|
if (end.col - start.col + 1 > BUCKET_WIDTH) {
|
|
55770
55770
|
const list3 = this.wide.get(area2.sheet);
|
|
55771
|
-
if (list3) list3.push(
|
|
55772
|
-
else this.wide.set(area2.sheet, [
|
|
55771
|
+
if (list3) list3.push(entry4);
|
|
55772
|
+
else this.wide.set(area2.sheet, [entry4]);
|
|
55773
55773
|
return;
|
|
55774
55774
|
}
|
|
55775
55775
|
const first3 = start.row >> CHUNK_SHIFT;
|
|
55776
55776
|
const last = end.row >> CHUNK_SHIFT;
|
|
55777
55777
|
if (last - first3 + 1 > CHUNKS) {
|
|
55778
55778
|
const cols2 = inner(this.tall, area2.sheet);
|
|
55779
|
-
for (let c2 = start.col; c2 <= end.col; c2++) push(cols2, c2,
|
|
55779
|
+
for (let c2 = start.col; c2 <= end.col; c2++) push(cols2, c2, entry4);
|
|
55780
55780
|
return;
|
|
55781
55781
|
}
|
|
55782
55782
|
const cols = inner(this.chunked, area2.sheet);
|
|
55783
55783
|
for (let c2 = start.col; c2 <= end.col; c2++) {
|
|
55784
55784
|
let chunks = cols.get(c2);
|
|
55785
55785
|
if (!chunks) cols.set(c2, chunks = /* @__PURE__ */ new Map());
|
|
55786
|
-
for (let k = first3; k <= last; k++) push(chunks, k,
|
|
55786
|
+
for (let k = first3; k <= last; k++) push(chunks, k, entry4);
|
|
55787
55787
|
}
|
|
55788
55788
|
}
|
|
55789
55789
|
/** Items whose areas intersect `range` on `sheet` (each once). */
|
|
@@ -55796,7 +55796,7 @@ var AreaIndex = class {
|
|
|
55796
55796
|
const { start, end } = range3;
|
|
55797
55797
|
const check4 = (list3) => {
|
|
55798
55798
|
if (list3) {
|
|
55799
|
-
for (const
|
|
55799
|
+
for (const entry4 of list3) if (rangesIntersect(entry4.range, range3)) out.add(entry4.node);
|
|
55800
55800
|
}
|
|
55801
55801
|
};
|
|
55802
55802
|
const cells3 = this.cells.get(sheet2);
|
|
@@ -57117,8 +57117,8 @@ function unique(args, ctx) {
|
|
|
57117
57117
|
const counts = /* @__PURE__ */ new Map();
|
|
57118
57118
|
for (const row3 of m.data) {
|
|
57119
57119
|
const key2 = keyOf3(row3);
|
|
57120
|
-
const
|
|
57121
|
-
if (
|
|
57120
|
+
const entry4 = counts.get(key2);
|
|
57121
|
+
if (entry4) entry4.count++;
|
|
57122
57122
|
else counts.set(key2, { row: row3, count: 1 });
|
|
57123
57123
|
}
|
|
57124
57124
|
const rows = [...counts.values()].filter((e) => !once || e.count === 1).map((e) => e.row);
|
|
@@ -65619,10 +65619,10 @@ var GETPIVOTDATA = spec(
|
|
|
65619
65619
|
return fail(ERR.REF);
|
|
65620
65620
|
}
|
|
65621
65621
|
const wanted = str(args[0]).toLowerCase();
|
|
65622
|
-
const
|
|
65622
|
+
const measure6 = pivotMeasures(pivot).find(
|
|
65623
65623
|
(m) => m.caption.toLowerCase() === wanted || m.field.toLowerCase() === wanted
|
|
65624
65624
|
);
|
|
65625
|
-
if (!
|
|
65625
|
+
if (!measure6) fail(ERR.REF);
|
|
65626
65626
|
const axes = [...pivotRowFields(pivot), ...pivotColumnFields(pivot), pivot.pageFilter?.field];
|
|
65627
65627
|
let records = pivot.records;
|
|
65628
65628
|
for (let i2 = 2; i2 < args.length; i2 += 2) {
|
|
@@ -65635,7 +65635,7 @@ var GETPIVOTDATA = spec(
|
|
|
65635
65635
|
records = records.filter((record3) => same7(record3[index5] ?? null, item2));
|
|
65636
65636
|
}
|
|
65637
65637
|
if (records.length === 0) fail(ERR.REF);
|
|
65638
|
-
const value3 = pivotMeasureNumber(pivot, records,
|
|
65638
|
+
const value3 = pivotMeasureNumber(pivot, records, measure6);
|
|
65639
65639
|
return value3;
|
|
65640
65640
|
},
|
|
65641
65641
|
["any"]
|
|
@@ -68838,7 +68838,7 @@ function writeMetadataPart(writer, rels, bookPart, plan2, dynamicArraysUsed, sou
|
|
|
68838
68838
|
}
|
|
68839
68839
|
|
|
68840
68840
|
// xlsx/write/style-xml.ts
|
|
68841
|
-
var argb = (
|
|
68841
|
+
var argb = (rgb8) => (rgb8.length === 6 ? `FF${rgb8}` : rgb8).toUpperCase();
|
|
68842
68842
|
function colorXml(color4, name3 = "color") {
|
|
68843
68843
|
if (!color4) return "";
|
|
68844
68844
|
if (color4.rgb) return el5(name3, { rgb: argb(color4.rgb), tint: color4.tint });
|
|
@@ -69048,7 +69048,7 @@ var StyleWriter = class {
|
|
|
69048
69048
|
}
|
|
69049
69049
|
xml() {
|
|
69050
69050
|
const named3 = [...this.workbook.namedStyles];
|
|
69051
|
-
const normalAt = named3.findIndex((
|
|
69051
|
+
const normalAt = named3.findIndex((entry4) => entry4.name === "Normal" || entry4.builtinId === 0);
|
|
69052
69052
|
if (normalAt > 0) named3.unshift(...named3.splice(normalAt, 1));
|
|
69053
69053
|
if (normalAt < 0)
|
|
69054
69054
|
named3.unshift({
|
|
@@ -69057,17 +69057,17 @@ var StyleWriter = class {
|
|
|
69057
69057
|
builtinId: 0
|
|
69058
69058
|
});
|
|
69059
69059
|
const seen = /* @__PURE__ */ new Set();
|
|
69060
|
-
const unique4 = named3.filter((
|
|
69061
|
-
const xfIdOf = new Map(unique4.map((
|
|
69060
|
+
const unique4 = named3.filter((entry4) => !seen.has(entry4.name) && seen.add(entry4.name));
|
|
69061
|
+
const xfIdOf = new Map(unique4.map((entry4, index5) => [entry4.name, index5]));
|
|
69062
69062
|
const base3 = this.workbook.styles[0] ?? defaultCellStyle();
|
|
69063
69063
|
this.fonts.id(fontXml(base3.font));
|
|
69064
69064
|
this.borders.id(borderXml({}));
|
|
69065
|
-
const styleXfs = unique4.map((
|
|
69065
|
+
const styleXfs = unique4.map((entry4) => this.xf(entry4.style, void 0));
|
|
69066
69066
|
const cellXfs = (this.workbook.styles.length ? this.workbook.styles : [base3]).map(
|
|
69067
69067
|
(style4) => this.xf(style4, xfIdOf.get(style4.cellStyleName ?? "Normal") ?? 0)
|
|
69068
69068
|
);
|
|
69069
69069
|
const cellStyles = unique4.map(
|
|
69070
|
-
(
|
|
69070
|
+
(entry4, index5) => el5("cellStyle", { name: entry4.name, xfId: index5, builtinId: entry4.builtinId })
|
|
69071
69071
|
);
|
|
69072
69072
|
const custom2 = [...this.numFmts].filter(([code]) => builtinFormatIdOf(code) === void 0).sort((a2, b) => a2[1] - b[1]);
|
|
69073
69073
|
let out = `${XML_HEADER}<styleSheet xmlns="${NS.x}" xmlns:mc="${NS.mc}" mc:Ignorable="x14ac" xmlns:x14ac="${NS.x14ac}">`;
|
|
@@ -69717,7 +69717,7 @@ function workbookXml(workbook, sheets, activeTab, sourceXml, pivotCachesXml) {
|
|
|
69717
69717
|
"workbookSaltValue",
|
|
69718
69718
|
"workbookSpinCount"
|
|
69719
69719
|
];
|
|
69720
|
-
const modern = Object.entries(modernHashValues(workbook.workbookModernHash, "workbook")).filter((
|
|
69720
|
+
const modern = Object.entries(modernHashValues(workbook.workbookModernHash, "workbook")).filter((entry4) => entry4[1] !== void 0).map(([name3, value3]) => ` ${name3}="${escapeAttr3(value3)}"`).join("");
|
|
69721
69721
|
const password = workbook.workbookPasswordHash ? ` workbookPassword="${escapeAttr3(workbook.workbookPasswordHash)}"` : "";
|
|
69722
69722
|
out += `<workbookProtection${copyAttrs(kept.get("workbookProtection"), skip)}${modern}${password} lockStructure="1"/>`;
|
|
69723
69723
|
}
|
|
@@ -70478,9 +70478,9 @@ function groupData(workbook, sheet2, group3) {
|
|
|
70478
70478
|
function sparklineViewAt(workbook, sheetIndex2, row3, col) {
|
|
70479
70479
|
const sheet2 = workbook.sheets[sheetIndex2];
|
|
70480
70480
|
if (!sheet2) return void 0;
|
|
70481
|
-
const
|
|
70482
|
-
if (!
|
|
70483
|
-
const { group: group3, index: index5 } =
|
|
70481
|
+
const entry4 = hosts(sheet2).get(cellKey(row3, col));
|
|
70482
|
+
if (!entry4) return void 0;
|
|
70483
|
+
const { group: group3, index: index5 } = entry4;
|
|
70484
70484
|
const needsGroup = group3.minAxisType === "group" || group3.maxAxisType === "group";
|
|
70485
70485
|
const data = needsGroup ? groupData(workbook, sheet2, group3) : groupData(workbook, sheet2, { ...group3, sparklines: [group3.sparklines[index5]] });
|
|
70486
70486
|
const at3 = needsGroup ? index5 : 0;
|
|
@@ -71383,7 +71383,7 @@ function pivotCacheDefinitionXml(pivot, workbook, data, recordRel) {
|
|
|
71383
71383
|
if (pivot.dateFields?.includes(name3) && items.every((v) => typeof v === "number")) {
|
|
71384
71384
|
const serials = items;
|
|
71385
71385
|
const range3 = dateGroupRange({}, serials);
|
|
71386
|
-
const parent = derived2.filter((
|
|
71386
|
+
const parent = derived2.filter((entry4) => entry4.group.field === name3).at(-1);
|
|
71387
71387
|
const link = parent ? `<fieldGroup par="${parent.index}"/>` : "";
|
|
71388
71388
|
return `<cacheField${attrs3({ name: encodeEscapes(name3), numFmtId: 14 })}><sharedItems${attrs3({ containsSemiMixedTypes: false, containsNonDate: false, containsDate: true, containsString: false, minDate: iso(range3.start), maxDate: iso(range3.end), count: serials.length })}>${serials.map((serial) => `<d v="${iso(serial)}"/>`).join("")}</sharedItems>${link}</cacheField>`;
|
|
71389
71389
|
}
|
|
@@ -71394,22 +71394,22 @@ function pivotCacheDefinitionXml(pivot, workbook, data, recordRel) {
|
|
|
71394
71394
|
const text9 = items.some((item2) => item2 !== null && item2 !== "" && typeof item2 !== "number");
|
|
71395
71395
|
return `<cacheField${attrs3({ name: encodeEscapes(name3), numFmtId: 0 })}><sharedItems${attrs3({ count: items.length, containsString: !nums.length || text9, containsNumber: !!nums.length, containsInteger: nums.length > 0 && nums.every(Number.isInteger), containsBlank: types.has("blank"), containsMixedTypes: nums.length > 0 && text9, containsSemiMixedTypes: !nums.length || types.size > 1 })}>${items.map(valueXml).join("")}</sharedItems>${groupXml2(pivot, name3, index5)}</cacheField>`;
|
|
71396
71396
|
}).join("");
|
|
71397
|
-
const extra = derived2.map((
|
|
71397
|
+
const extra = derived2.map((entry4) => derivedFieldXml(pivot, entry4, workbook.date1904)).join("");
|
|
71398
71398
|
return `${XML_HEADER}<pivotCacheDefinition xmlns="${NS.x}" xmlns:r="${NS.r}" r:id="${recordRel}" createdVersion="6" refreshedVersion="6" minRefreshableVersion="3" recordCount="${pivot.records.length}"><cacheSource type="worksheet"><worksheetSource${attrs3({ ref: formatRange(source3.range), sheet: workbook.sheets[source3.sheet].name })}/></cacheSource><cacheFields count="${pivot.fields.length + derived2.length}">${fields}${extra}</cacheFields>${slicerExt(pivot)}</pivotCacheDefinition>`;
|
|
71399
71399
|
}
|
|
71400
71400
|
function derivedFields(pivot, date1904) {
|
|
71401
71401
|
const resolved = { ...pivot, dateGroups: resolveDateGroups({ ...pivot}) };
|
|
71402
|
-
return derivedDateFields(resolved).map((
|
|
71403
|
-
const chosen = pivot.dateGroups.find((group3) => group3.field ===
|
|
71404
|
-
return { ...
|
|
71402
|
+
return derivedDateFields(resolved).map((entry4) => {
|
|
71403
|
+
const chosen = pivot.dateGroups.find((group3) => group3.field === entry4.group.field);
|
|
71404
|
+
return { ...entry4, autoStart: chosen.start === void 0, autoEnd: chosen.end === void 0 };
|
|
71405
71405
|
});
|
|
71406
71406
|
}
|
|
71407
|
-
function derivedFieldXml(pivot,
|
|
71408
|
-
const range3 = { start:
|
|
71409
|
-
const days = dateGroupDays(
|
|
71410
|
-
const labels = dateUnitLabels(
|
|
71411
|
-
const base3 = pivot.fields.indexOf(
|
|
71412
|
-
return `<cacheField${attrs3({ name: encodeEscapes(
|
|
71407
|
+
function derivedFieldXml(pivot, entry4, date1904) {
|
|
71408
|
+
const range3 = { start: entry4.group.start, end: entry4.group.end };
|
|
71409
|
+
const days = dateGroupDays(entry4.group);
|
|
71410
|
+
const labels = dateUnitLabels(entry4.unit, range3, days, date1904, entry4.group);
|
|
71411
|
+
const base3 = pivot.fields.indexOf(entry4.group.field);
|
|
71412
|
+
return `<cacheField${attrs3({ name: encodeEscapes(entry4.name), numFmtId: 0, databaseField: false })}><fieldGroup base="${base3}"><rangePr${attrs3({ autoStart: entry4.autoStart ? void 0 : false, autoEnd: entry4.autoEnd ? void 0 : false, groupBy: entry4.unit, startDate: serialToIso(range3.start, date1904), endDate: serialToIso(range3.end, date1904), groupInterval: days > 1 ? days : void 0 })}/><groupItems count="${labels.length}">${labels.map((label2) => `<s v="${escapeAttr3(label2)}"/>`).join("")}</groupItems></fieldGroup></cacheField>`;
|
|
71413
71413
|
}
|
|
71414
71414
|
function groupXml2(pivot, name3, index5) {
|
|
71415
71415
|
const group3 = groupOf(pivot, name3);
|
|
@@ -71493,19 +71493,19 @@ function pivotTableXml(source3, cacheId, cache3) {
|
|
|
71493
71493
|
custom2.map((fn) => [PIVOT_SUBTOTALS[fn].attr, true])
|
|
71494
71494
|
);
|
|
71495
71495
|
const entries = automatic ? '<item t="default"/>' : custom2.map((fn) => `<item t="${PIVOT_SUBTOTALS[fn].item}"/>`).join("");
|
|
71496
|
-
return `<pivotField${attrs3({ axis: index5 === page ? "axisPage" : at3 >= 0 ? "axisRow" : colAt >= 0 ? "axisCol" : void 0, dataField: measures2.some((
|
|
71496
|
+
return `<pivotField${attrs3({ axis: index5 === page ? "axisPage" : at3 >= 0 ? "axisRow" : colAt >= 0 ? "axisCol" : void 0, dataField: measures2.some((measure6) => pivot.fields.indexOf(measure6.field) === index5) ? true : void 0, compact: compact3, outline: outline2, showAll: false, subtotalTop: at3 >= 0 ? top : void 0, numFmtId: isDate ? 14 : void 0, defaultSubtotal: automatic ? void 0 : false, ...flags })}>${items2 ? `<items count="${items2.length + (automatic ? 1 : custom2.length)}">${items2.map((item2) => `<item${hidden.has(pivotValueKey(item2)) ? ' h="1"' : ""}${named3(name3, item2)} x="${itemX(index5, item2)}"/>`).join("")}${entries}</items>` : ""}${repeated}</pivotField>`;
|
|
71497
71497
|
}).join("");
|
|
71498
71498
|
const items = (count3, indices) => Array.from({ length: count3 }, (_v, i2) => `<i><x v="${indices?.[i2] ?? i2}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
71499
71499
|
const header = grid.firstHeaderRow !== void 0 ? grid.firstHeaderRow - pageOffset : col >= 0 ? 1 : grid.firstDataRow - pageOffset - 1;
|
|
71500
71500
|
const rowIndices = [...rowIdx];
|
|
71501
71501
|
if (valuesAt >= 0) rowIndices.splice(valuesAt, 0, -2);
|
|
71502
71502
|
let previous = [];
|
|
71503
|
-
const rowItems = rowEntries?.map((
|
|
71503
|
+
const rowItems = rowEntries?.map((entry4) => {
|
|
71504
71504
|
let prefix3 = 0;
|
|
71505
|
-
const type =
|
|
71506
|
-
if (
|
|
71507
|
-
previous =
|
|
71508
|
-
return `<i${attrs3({ t: type, r: prefix3 || void 0, i:
|
|
71505
|
+
const type = entry4.type === void 0 || entry4.type === "default" || entry4.type === "grand" ? entry4.type : PIVOT_SUBTOTALS[entry4.type].item;
|
|
71506
|
+
if (entry4.type !== "grand") prefix3 = sharedPrefix(entry4.indices, previous);
|
|
71507
|
+
previous = entry4.type === "grand" ? [] : entry4.indices;
|
|
71508
|
+
return `<i${attrs3({ t: type, r: prefix3 || void 0, i: entry4.measure || void 0 })}>${entry4.indices.slice(prefix3).map((index5) => `<x${attrs3({ v: index5 || void 0 })}/>`).join("")}</i>`;
|
|
71509
71509
|
}).join("") ?? items(grid.rowItems.length, rowIndicesFull[0]);
|
|
71510
71510
|
let body = `<location${attrs3({ 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((index5) => `<field x="${index5}"/>`).join("")}</rowFields><rowItems count="${grid.rowEntries?.length ?? grid.rowItems.length + 1}">${rowItems}</rowItems>`;
|
|
71511
71511
|
if (col >= 0 && grid.columnEntries) {
|
|
@@ -71516,7 +71516,7 @@ function pivotTableXml(source3, cacheId, cache3) {
|
|
|
71516
71516
|
else body += '<colItems count="1"><i/></colItems>';
|
|
71517
71517
|
if (page >= 0)
|
|
71518
71518
|
body += `<pageFields count="1"><pageField${attrs3({ fld: page, hier: -1, item: pivot.pageFilter.item !== void 0 ? pageItems.findIndex((item2) => pivotValueKey(item2) === pivotValueKey(pivot.pageFilter.item)) : void 0 })}/></pageFields>`;
|
|
71519
|
-
body += `<dataFields count="${measures2.length}">${measures2.map((
|
|
71519
|
+
body += `<dataFields count="${measures2.length}">${measures2.map((measure6) => `<dataField${attrs3({ name: encodeEscapes(measure6.caption), fld: pivot.fields.indexOf(measure6.field), subtotal: measure6.aggregate, baseField: 0, baseItem: 0 })}/>`).join("")}</dataFields>`;
|
|
71520
71520
|
const doc = parseXml(
|
|
71521
71521
|
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>`
|
|
71522
71522
|
);
|
|
@@ -71634,7 +71634,7 @@ var PivotWritePlan = class {
|
|
|
71634
71634
|
if (rel.type !== RELATIONSHIP_TYPES.pivotTable) continue;
|
|
71635
71635
|
const part = source3.target(sheet2.partName, rel);
|
|
71636
71636
|
if (!part) continue;
|
|
71637
|
-
const pivot = sheet2.pivotTables?.find((
|
|
71637
|
+
const pivot = sheet2.pivotTables?.find((entry4) => entry4.partName === part);
|
|
71638
71638
|
if (pivot?.dirty || !pivot && sheet2.preserved.get("source:pivotTables")?.includes(part))
|
|
71639
71639
|
continue;
|
|
71640
71640
|
const xml = source3.text(part);
|
|
@@ -71709,10 +71709,10 @@ var PivotWritePlan = class {
|
|
|
71709
71709
|
|
|
71710
71710
|
// xlsx/filter-menu.ts
|
|
71711
71711
|
function colorFilterCriteria(color4, cellColor) {
|
|
71712
|
-
const
|
|
71712
|
+
const rgb8 = color4 && `FF${color4.replace("#", "").toUpperCase()}`;
|
|
71713
71713
|
const style4 = cellColor ? {
|
|
71714
|
-
fill:
|
|
71715
|
-
} :
|
|
71714
|
+
fill: rgb8 ? { type: "pattern", pattern: "solid", fgColor: { rgb: rgb8 } } : { type: "pattern", pattern: "none" }
|
|
71715
|
+
} : rgb8 ? { font: { color: { rgb: rgb8 } } } : {};
|
|
71716
71716
|
return { color: { cellColor, style: style4 } };
|
|
71717
71717
|
}
|
|
71718
71718
|
|
|
@@ -71912,12 +71912,12 @@ function dataBarAppearance(rule2, workbook) {
|
|
|
71912
71912
|
function dataBarGeometry(value3, low, high, options2) {
|
|
71913
71913
|
const lo = options2.autoMin ? Math.min(0, low) : low;
|
|
71914
71914
|
const hi = options2.autoMax ? Math.max(0, high) : high;
|
|
71915
|
-
const
|
|
71915
|
+
const clamp5 = (v) => Math.max(0, Math.min(1, v));
|
|
71916
71916
|
const minimum = options2.minLength;
|
|
71917
71917
|
const delta = options2.maxLength - minimum;
|
|
71918
|
-
const interpolate = (ratio, offset2 = minimum) =>
|
|
71918
|
+
const interpolate = (ratio, offset2 = minimum) => clamp5(offset2 + clamp5(ratio) * delta);
|
|
71919
71919
|
if (options2.axis === "none") {
|
|
71920
|
-
const ratio = hi > lo ?
|
|
71920
|
+
const ratio = hi > lo ? clamp5((value3 - lo) / (hi - lo)) : 0.5;
|
|
71921
71921
|
return {
|
|
71922
71922
|
start: 0,
|
|
71923
71923
|
fraction: interpolate(ratio),
|
|
@@ -72100,11 +72100,11 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
|
|
|
72100
72100
|
return { error: "#VALUE!" };
|
|
72101
72101
|
}
|
|
72102
72102
|
};
|
|
72103
|
-
const thresholdValue = (t,
|
|
72104
|
-
const s = stats(
|
|
72105
|
-
const anchor2 =
|
|
72103
|
+
const thresholdValue = (t, entry4) => {
|
|
72104
|
+
const s = stats(entry4.format);
|
|
72105
|
+
const anchor2 = entry4.format.ranges[0]?.start ?? { row: 0, col: 0 };
|
|
72106
72106
|
const n = () => {
|
|
72107
|
-
const raw2 = t.value === void 0 ? 0 : run2(t.value,
|
|
72107
|
+
const raw2 = t.value === void 0 ? 0 : run2(t.value, entry4.format, anchor2.row, anchor2.col);
|
|
72108
72108
|
return typeof raw2 === "number" ? raw2 : Number(raw2) || 0;
|
|
72109
72109
|
};
|
|
72110
72110
|
switch (t.type) {
|
|
@@ -72121,16 +72121,16 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
|
|
|
72121
72121
|
return percentile(s.sorted, n() / 100);
|
|
72122
72122
|
}
|
|
72123
72123
|
};
|
|
72124
|
-
const thresholds = (
|
|
72125
|
-
let cached7 = thresholdCache.get(
|
|
72124
|
+
const thresholds = (entry4, list3) => {
|
|
72125
|
+
let cached7 = thresholdCache.get(entry4);
|
|
72126
72126
|
if (!cached7) {
|
|
72127
|
-
cached7 = list3.map((t) => thresholdValue(t,
|
|
72128
|
-
thresholdCache.set(
|
|
72127
|
+
cached7 = list3.map((t) => thresholdValue(t, entry4));
|
|
72128
|
+
thresholdCache.set(entry4, cached7);
|
|
72129
72129
|
}
|
|
72130
72130
|
return cached7;
|
|
72131
72131
|
};
|
|
72132
|
-
const matches3 = (
|
|
72133
|
-
const { rule: rule2, format: format9 } =
|
|
72132
|
+
const matches3 = (entry4, value3, row3, col) => {
|
|
72133
|
+
const { rule: rule2, format: format9 } = entry4;
|
|
72134
72134
|
switch (rule2.type) {
|
|
72135
72135
|
case "cellIs": {
|
|
72136
72136
|
const a2 = rule2.formulas[0] !== void 0 ? run2(rule2.formulas[0], format9, row3, col) : null;
|
|
@@ -72187,13 +72187,13 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
|
|
|
72187
72187
|
return false;
|
|
72188
72188
|
}
|
|
72189
72189
|
};
|
|
72190
|
-
const apply3 = (
|
|
72191
|
-
const { rule: rule2 } =
|
|
72190
|
+
const apply3 = (entry4, value3, row3, col, result2) => {
|
|
72191
|
+
const { rule: rule2 } = entry4;
|
|
72192
72192
|
if (rule2.type === "colorScale") {
|
|
72193
72193
|
if (result2.colorScale || typeof value3 !== "number") return false;
|
|
72194
72194
|
const color4 = scaleColor(
|
|
72195
72195
|
value3,
|
|
72196
|
-
thresholds(
|
|
72196
|
+
thresholds(entry4, rule2.thresholds),
|
|
72197
72197
|
rule2.colors.map((c2) => resolveColor(c2, workbook.theme, "#FFFFFF") ?? "#FFFFFF")
|
|
72198
72198
|
);
|
|
72199
72199
|
if (!color4) return false;
|
|
@@ -72202,12 +72202,12 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
|
|
|
72202
72202
|
}
|
|
72203
72203
|
if (rule2.type === "dataBar") {
|
|
72204
72204
|
if (result2.dataBar || typeof value3 !== "number") return false;
|
|
72205
|
-
let appearance = barAppearances.get(
|
|
72205
|
+
let appearance = barAppearances.get(entry4);
|
|
72206
72206
|
if (!appearance) {
|
|
72207
72207
|
appearance = dataBarAppearance(rule2, workbook);
|
|
72208
|
-
barAppearances.set(
|
|
72208
|
+
barAppearances.set(entry4, appearance);
|
|
72209
72209
|
}
|
|
72210
|
-
const [lo = 0, hi = 0] = thresholds(
|
|
72210
|
+
const [lo = 0, hi = 0] = thresholds(entry4, [rule2.min, rule2.max]);
|
|
72211
72211
|
const geometry2 = dataBarGeometry(value3, lo, hi, appearance);
|
|
72212
72212
|
const rtl = appearance.direction === "context" ? Boolean(sheet2.view.rightToLeft) : appearance.direction === "rightToLeft";
|
|
72213
72213
|
result2.dataBar = {
|
|
@@ -72230,7 +72230,7 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
|
|
|
72230
72230
|
}
|
|
72231
72231
|
if (rule2.type === "iconSet") {
|
|
72232
72232
|
if (result2.icon || typeof value3 !== "number") return false;
|
|
72233
|
-
const index5 = iconIndex(value3, thresholds(
|
|
72233
|
+
const index5 = iconIndex(value3, thresholds(entry4, rule2.thresholds), rule2.thresholds);
|
|
72234
72234
|
result2.icon = {
|
|
72235
72235
|
set: rule2.iconSet,
|
|
72236
72236
|
index: rule2.reverse ? rule2.thresholds.length - 1 - index5 : index5
|
|
@@ -72238,7 +72238,7 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
|
|
|
72238
72238
|
if (rule2.showValue === false) result2.hideValue = true;
|
|
72239
72239
|
return true;
|
|
72240
72240
|
}
|
|
72241
|
-
if (!matches3(
|
|
72241
|
+
if (!matches3(entry4, value3, row3, col)) return false;
|
|
72242
72242
|
result2.style = mergeDxf(result2.style, rule2.style);
|
|
72243
72243
|
return true;
|
|
72244
72244
|
};
|
|
@@ -72247,12 +72247,12 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
|
|
|
72247
72247
|
const result2 = {};
|
|
72248
72248
|
let value3;
|
|
72249
72249
|
let any2 = false;
|
|
72250
|
-
for (const
|
|
72251
|
-
if (!
|
|
72250
|
+
for (const entry4 of entries) {
|
|
72251
|
+
if (!entry4.format.ranges.some((r) => rangeContains(r, { row: row3, col }))) continue;
|
|
72252
72252
|
value3 ??= getValue(sheet2, row3, col);
|
|
72253
|
-
if (!apply3(
|
|
72253
|
+
if (!apply3(entry4, value3, row3, col, result2)) continue;
|
|
72254
72254
|
any2 = true;
|
|
72255
|
-
if (
|
|
72255
|
+
if (entry4.rule.stopIfTrue && !GRAPHIC_RULES.has(entry4.rule.type)) break;
|
|
72256
72256
|
}
|
|
72257
72257
|
return any2 ? result2 : void 0;
|
|
72258
72258
|
}
|
|
@@ -72583,12 +72583,12 @@ function slicerTarget(workbook, cache3) {
|
|
|
72583
72583
|
const source3 = cache3.source;
|
|
72584
72584
|
for (const [sheetIndex2, sheet2] of workbook.sheets.entries()) {
|
|
72585
72585
|
if (source3.kind === "table") {
|
|
72586
|
-
const table4 = sheet2.tables.find((
|
|
72586
|
+
const table4 = sheet2.tables.find((entry4) => entry4.id === source3.tableId);
|
|
72587
72587
|
const offset2 = table4?.columns.findIndex((column3) => column3.sourceId === source3.column) ?? -1;
|
|
72588
72588
|
if (table4 && offset2 >= 0) return { kind: "table", sheet: sheet2, sheetIndex: sheetIndex2, table: table4, offset: offset2 };
|
|
72589
72589
|
} else {
|
|
72590
72590
|
const first3 = source3.pivots[0];
|
|
72591
|
-
const pivot = first3 && sheet2.sheetId === first3.tabId ? sheet2.pivotTables?.find((
|
|
72591
|
+
const pivot = first3 && sheet2.sheetId === first3.tabId ? sheet2.pivotTables?.find((entry4) => entry4.name === first3.name) : void 0;
|
|
72592
72592
|
if (pivot) return { kind: "pivot", sheet: sheet2, sheetIndex: sheetIndex2, pivot };
|
|
72593
72593
|
}
|
|
72594
72594
|
}
|
|
@@ -72609,7 +72609,7 @@ function timelineTarget(workbook, cache3) {
|
|
|
72609
72609
|
const first3 = cache3.pivots[0];
|
|
72610
72610
|
if (!first3) return void 0;
|
|
72611
72611
|
for (const [sheetIndex2, sheet2] of workbook.sheets.entries()) {
|
|
72612
|
-
const pivot = sheet2.sheetId === first3.tabId ? sheet2.pivotTables?.find((
|
|
72612
|
+
const pivot = sheet2.sheetId === first3.tabId ? sheet2.pivotTables?.find((entry4) => entry4.name === first3.name) : void 0;
|
|
72613
72613
|
if (pivot) return { sheet: sheet2, sheetIndex: sheetIndex2, pivot };
|
|
72614
72614
|
}
|
|
72615
72615
|
return void 0;
|
|
@@ -72879,7 +72879,7 @@ var SlicerWritePlan = class {
|
|
|
72879
72879
|
const modeled = /* @__PURE__ */ new Set();
|
|
72880
72880
|
const place4 = (kind, group3, xml, pattern, type) => {
|
|
72881
72881
|
if (!group3.length) return;
|
|
72882
|
-
const existing = group3.find((
|
|
72882
|
+
const existing = group3.find((entry4) => entry4.partName && !this.claimed.has(entry4.partName));
|
|
72883
72883
|
const part = existing?.partName ?? this.writer.uniqueName(pattern, /* @__PURE__ */ new Set([...this.reserved, ...this.claimed]));
|
|
72884
72884
|
this.claimed.add(part);
|
|
72885
72885
|
modeled.add(part);
|
|
@@ -72916,9 +72916,9 @@ var SlicerWritePlan = class {
|
|
|
72916
72916
|
for (const ext of elements(root)) {
|
|
72917
72917
|
const kind = uris.get(ext.getAttribute("uri") ?? "");
|
|
72918
72918
|
if (!kind) continue;
|
|
72919
|
-
for (const
|
|
72920
|
-
if (
|
|
72921
|
-
const id5 =
|
|
72919
|
+
for (const entry4 of ext.getElementsByTagName("*")) {
|
|
72920
|
+
if (entry4.localName !== FAMILIES[kind].sheetChild) continue;
|
|
72921
|
+
const id5 = entry4.getAttributeNS(NS.r, "id");
|
|
72922
72922
|
const rel = id5 ? rels.entries.get(id5) : void 0;
|
|
72923
72923
|
const target3 = rel && resolvePartPath(sheetPart, rel.target);
|
|
72924
72924
|
if (id5 && target3 && !modeled.has(target3) && !this.removed(target3)) kept[kind].push(id5);
|
|
@@ -73411,7 +73411,7 @@ function syncTableHeader(ctx, sheet2, row3, col, formulaCells) {
|
|
|
73411
73411
|
const text9 = displayText(ctx.workbook, getCell(sheet2, row3, col)).trim();
|
|
73412
73412
|
if (!text9 || column3.name === text9) return;
|
|
73413
73413
|
const oldName = column3.name;
|
|
73414
|
-
const others = table4.columns.filter((
|
|
73414
|
+
const others = table4.columns.filter((entry4) => entry4 !== column3).map((entry4) => entry4.name);
|
|
73415
73415
|
const newName = uniqueHeaders([...others, text9]).at(-1);
|
|
73416
73416
|
column3.name = newName;
|
|
73417
73417
|
if (newName !== text9) writeValue2(sheet2, row3, col, newName);
|
|
@@ -75130,10 +75130,10 @@ function parseCssColor(text9) {
|
|
|
75130
75130
|
return {
|
|
75131
75131
|
rgb: (hex4.length === 3 ? [...hex4].map((ch) => ch + ch).join("") : hex4).toUpperCase()
|
|
75132
75132
|
};
|
|
75133
|
-
const
|
|
75134
|
-
if (
|
|
75133
|
+
const rgb8 = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(value3);
|
|
75134
|
+
if (rgb8)
|
|
75135
75135
|
return {
|
|
75136
|
-
rgb:
|
|
75136
|
+
rgb: rgb8.slice(1, 4).map((n) => Math.min(255, Number(n)).toString(16).padStart(2, "0")).join("").toUpperCase()
|
|
75137
75137
|
};
|
|
75138
75138
|
const named3 = NAMED_COLORS2[value3];
|
|
75139
75139
|
return named3 ? { rgb: named3 } : void 0;
|
|
@@ -76018,25 +76018,25 @@ function estimateWidth(text9, style4) {
|
|
|
76018
76018
|
return longest * MDW * scale2 * (style4.font.bold ? 1.1 : 1);
|
|
76019
76019
|
}
|
|
76020
76020
|
var pixelsToWidth = (px2) => Math.round((px2 + 5) / MDW * 256) / 256;
|
|
76021
|
-
function fitColumnWidth(ctx, sheet2, col,
|
|
76021
|
+
function fitColumnWidth(ctx, sheet2, col, measure6) {
|
|
76022
76022
|
let widest = -1;
|
|
76023
76023
|
for (const [row3, cells3] of sheet2.rows) {
|
|
76024
76024
|
const cell2 = cells3.get(col);
|
|
76025
76025
|
if (!cell2 || sheet2.rowInfo.get(row3)?.hidden) continue;
|
|
76026
76026
|
const text9 = displayText(ctx.workbook, cell2);
|
|
76027
76027
|
if (!text9) continue;
|
|
76028
|
-
widest = Math.max(widest,
|
|
76028
|
+
widest = Math.max(widest, measure6(text9, styleAt(ctx.workbook, cell2.styleId)));
|
|
76029
76029
|
}
|
|
76030
76030
|
return widest < 0 ? void 0 : Math.min(MAX_WIDTH, pixelsToWidth(widest));
|
|
76031
76031
|
}
|
|
76032
|
-
function setColumnWidth(ctx, s, cols, width,
|
|
76032
|
+
function setColumnWidth(ctx, s, cols, width, measure6) {
|
|
76033
76033
|
const sheet2 = sheetAt(ctx.workbook, s);
|
|
76034
76034
|
if (!cols.length) return;
|
|
76035
76035
|
const widths = /* @__PURE__ */ new Map();
|
|
76036
76036
|
for (const col of cols)
|
|
76037
76037
|
widths.set(
|
|
76038
76038
|
col,
|
|
76039
|
-
width === "auto" ? fitColumnWidth(ctx, sheet2, col,
|
|
76039
|
+
width === "auto" ? fitColumnWidth(ctx, sheet2, col, measure6 ?? estimateWidth) : Math.max(0, Math.min(MAX_WIDTH, width))
|
|
76040
76040
|
);
|
|
76041
76041
|
ctx.run(
|
|
76042
76042
|
"Column width",
|
|
@@ -76284,9 +76284,9 @@ function setColumnCriteria(ctx, s, col, criteria) {
|
|
|
76284
76284
|
const old = filter2.columns?.find((fc) => fc.offset === offset2);
|
|
76285
76285
|
const columns2 = (filter2.columns ?? []).filter((fc) => fc.offset !== offset2);
|
|
76286
76286
|
if (criteria) {
|
|
76287
|
-
const
|
|
76288
|
-
if (old?.hiddenButton)
|
|
76289
|
-
columns2.push(
|
|
76287
|
+
const entry4 = { offset: offset2, ...structuredClone(criteria) };
|
|
76288
|
+
if (old?.hiddenButton) entry4.hiddenButton = true;
|
|
76289
|
+
columns2.push(entry4);
|
|
76290
76290
|
}
|
|
76291
76291
|
columns2.sort((a2, b) => a2.offset - b.offset);
|
|
76292
76292
|
const next = { ...filter2 };
|
|
@@ -76467,7 +76467,7 @@ function replaceAll(ctx, query, replacement) {
|
|
|
76467
76467
|
)
|
|
76468
76468
|
);
|
|
76469
76469
|
const uniqueScopes = scopes.filter(
|
|
76470
|
-
(scope, index5) => scope.kind !== "refs" || scopes.findIndex((
|
|
76470
|
+
(scope, index5) => scope.kind !== "refs" || scopes.findIndex((entry4) => entry4.kind === "refs") === index5
|
|
76471
76471
|
);
|
|
76472
76472
|
return ctx.run(
|
|
76473
76473
|
"Replace",
|
|
@@ -76510,10 +76510,10 @@ function captureRefs(workbook, withFormulas2 = true) {
|
|
|
76510
76510
|
(sheet2, s) => sheet2.rows.forEach(
|
|
76511
76511
|
(cells3, row3) => cells3.forEach((cell2, col) => {
|
|
76512
76512
|
if (cell2.formula === void 0 && !cell2.arrayRange) return;
|
|
76513
|
-
const
|
|
76514
|
-
if (cell2.formula !== void 0)
|
|
76515
|
-
if (cell2.arrayRange)
|
|
76516
|
-
formulas.push(
|
|
76513
|
+
const entry4 = { sheet: s, row: row3, col, cell: cell2 };
|
|
76514
|
+
if (cell2.formula !== void 0) entry4.formula = cell2.formula;
|
|
76515
|
+
if (cell2.arrayRange) entry4.arrayRange = structuredClone(cell2.arrayRange);
|
|
76516
|
+
formulas.push(entry4);
|
|
76517
76517
|
})
|
|
76518
76518
|
)
|
|
76519
76519
|
);
|
|
@@ -76533,13 +76533,13 @@ function restoreRefs(workbook, data) {
|
|
|
76533
76533
|
Object.assign(target3, copy9);
|
|
76534
76534
|
});
|
|
76535
76535
|
workbook.definedNames = structuredClone(data.definedNames);
|
|
76536
|
-
for (const
|
|
76537
|
-
const sheet2 = workbook.sheets[
|
|
76538
|
-
const cell2 = sheet2 && getCell(sheet2,
|
|
76536
|
+
for (const entry4 of data.formulas) {
|
|
76537
|
+
const sheet2 = workbook.sheets[entry4.sheet];
|
|
76538
|
+
const cell2 = sheet2 && getCell(sheet2, entry4.row, entry4.col);
|
|
76539
76539
|
if (!cell2) continue;
|
|
76540
|
-
if (
|
|
76541
|
-
else cell2.formula =
|
|
76542
|
-
if (
|
|
76540
|
+
if (entry4.formula === void 0) delete cell2.formula;
|
|
76541
|
+
else cell2.formula = entry4.formula;
|
|
76542
|
+
if (entry4.arrayRange) cell2.arrayRange = structuredClone(entry4.arrayRange);
|
|
76543
76543
|
else delete cell2.arrayRange;
|
|
76544
76544
|
}
|
|
76545
76545
|
}
|
|
@@ -76809,7 +76809,7 @@ function rowMajor(cells3) {
|
|
|
76809
76809
|
}
|
|
76810
76810
|
function touchedCells(step2) {
|
|
76811
76811
|
const out = [];
|
|
76812
|
-
const lists2 = step2.entries.flatMap((
|
|
76812
|
+
const lists2 = step2.entries.flatMap((entry4) => [entry4.before, entry4.after]).filter((snapshot2) => snapshot2.kind === "cells" && snapshot2.cells.length > 0);
|
|
76813
76813
|
const [first3, second, ...rest] = lists2;
|
|
76814
76814
|
if (first3 && !rest.length && (!second || second.sheet === first3.sheet)) {
|
|
76815
76815
|
const sheet2 = first3.sheet;
|
|
@@ -76833,8 +76833,8 @@ function touchedCells(step2) {
|
|
|
76833
76833
|
out.length = 0;
|
|
76834
76834
|
}
|
|
76835
76835
|
const seen = /* @__PURE__ */ new Map();
|
|
76836
|
-
for (const
|
|
76837
|
-
for (const snapshot2 of [
|
|
76836
|
+
for (const entry4 of step2.entries)
|
|
76837
|
+
for (const snapshot2 of [entry4.before, entry4.after]) {
|
|
76838
76838
|
if (snapshot2.kind !== "cells") continue;
|
|
76839
76839
|
let keys = seen.get(snapshot2.sheet);
|
|
76840
76840
|
if (!keys) seen.set(snapshot2.sheet, keys = /* @__PURE__ */ new Set());
|
|
@@ -76863,8 +76863,8 @@ var History = class {
|
|
|
76863
76863
|
const step2 = this.done.pop();
|
|
76864
76864
|
if (!step2) return void 0;
|
|
76865
76865
|
for (let i2 = step2.entries.length - 1; i2 >= 0; i2--) {
|
|
76866
|
-
const
|
|
76867
|
-
if (
|
|
76866
|
+
const entry4 = step2.entries[i2];
|
|
76867
|
+
if (entry4) restoreSnapshot(workbook, entry4.before);
|
|
76868
76868
|
}
|
|
76869
76869
|
this.undone.push(step2);
|
|
76870
76870
|
return step2;
|
|
@@ -76872,7 +76872,7 @@ var History = class {
|
|
|
76872
76872
|
redo(workbook) {
|
|
76873
76873
|
const step2 = this.undone.pop();
|
|
76874
76874
|
if (!step2) return void 0;
|
|
76875
|
-
for (const
|
|
76875
|
+
for (const entry4 of step2.entries) restoreSnapshot(workbook, entry4.after);
|
|
76876
76876
|
this.done.push(step2);
|
|
76877
76877
|
return step2;
|
|
76878
76878
|
}
|
|
@@ -76899,7 +76899,7 @@ function setCalcMode(ctx, mode) {
|
|
|
76899
76899
|
}
|
|
76900
76900
|
|
|
76901
76901
|
// xlsx/edit/session-calc.ts
|
|
76902
|
-
var isStructural = (step2) => step2.structural || step2.entries.some((
|
|
76902
|
+
var isStructural = (step2) => step2.structural || step2.entries.some((entry4) => entry4.before.kind !== "cells");
|
|
76903
76903
|
function hintFor(step2, mode) {
|
|
76904
76904
|
const hint = step2.calc;
|
|
76905
76905
|
if (!hint) return void 0;
|
|
@@ -77809,11 +77809,11 @@ function removeTimelines(workbook, doomed) {
|
|
|
77809
77809
|
workbook.slicers = book;
|
|
77810
77810
|
}
|
|
77811
77811
|
function timelineOnPivot(workbook, cacheName, tabId, name3) {
|
|
77812
|
-
const cache3 = workbook.slicers?.timelineCaches.find((
|
|
77812
|
+
const cache3 = workbook.slicers?.timelineCaches.find((entry4) => entry4.name === cacheName);
|
|
77813
77813
|
return !!cache3?.pivots.some((pivot) => pivot.tabId === tabId && pivot.name === name3);
|
|
77814
77814
|
}
|
|
77815
77815
|
function slicerOnPivot(workbook, cacheName, tabId, name3) {
|
|
77816
|
-
const cache3 = workbook.slicers?.caches.find((
|
|
77816
|
+
const cache3 = workbook.slicers?.caches.find((entry4) => entry4.name === cacheName);
|
|
77817
77817
|
return cache3?.source.kind === "pivot" && cache3.source.pivots.some((pivot) => pivot.tabId === tabId && pivot.name === name3);
|
|
77818
77818
|
}
|
|
77819
77819
|
function removeSlicers(workbook, doomed) {
|
|
@@ -77879,7 +77879,7 @@ function reconcileDateAxes(next, previous) {
|
|
|
77879
77879
|
else delete next.moreColumnFields;
|
|
77880
77880
|
if (next.fieldSubtotals) {
|
|
77881
77881
|
const kept = next.fieldSubtotals.filter(
|
|
77882
|
-
(
|
|
77882
|
+
(entry4) => rows.includes(entry4.field) || columns2.includes(entry4.field)
|
|
77883
77883
|
);
|
|
77884
77884
|
if (kept.length) next.fieldSubtotals = kept;
|
|
77885
77885
|
else delete next.fieldSubtotals;
|
|
@@ -77888,7 +77888,7 @@ function reconcileDateAxes(next, previous) {
|
|
|
77888
77888
|
|
|
77889
77889
|
// xlsx/edit/pivots.ts
|
|
77890
77890
|
function pivotAt(ctx, sheet2, name3) {
|
|
77891
|
-
const pivot = sheetAt(ctx.workbook, sheet2).pivotTables?.find((
|
|
77891
|
+
const pivot = sheetAt(ctx.workbook, sheet2).pivotTables?.find((entry4) => entry4.name === name3);
|
|
77892
77892
|
if (!pivot) throw new Error("The selected PivotTable is not available.");
|
|
77893
77893
|
return pivot;
|
|
77894
77894
|
}
|
|
@@ -77969,7 +77969,7 @@ function writePivot(ctx, s, pivot, old, label2, inside2) {
|
|
|
77969
77969
|
inside2?.();
|
|
77970
77970
|
const next = { ...pivot, location, dirty: true };
|
|
77971
77971
|
const list3 = sheet2.pivotTables ?? [];
|
|
77972
|
-
sheet2.pivotTables = old ? list3.map((
|
|
77972
|
+
sheet2.pivotTables = old ? list3.map((entry4) => entry4 === old ? next : entry4) : [...list3, next];
|
|
77973
77973
|
grid.values.forEach(
|
|
77974
77974
|
(line3, row3) => line3.forEach((value3, col) => {
|
|
77975
77975
|
const r = startRow(location, row3);
|
|
@@ -78100,7 +78100,7 @@ function refreshPivotTable(ctx, s, name3, patch2 = {}) {
|
|
|
78100
78100
|
if (next.dateFilter && !dates.includes(next.dateFilter.field)) delete next.dateFilter;
|
|
78101
78101
|
if (patch2.fieldSubtotals === void 0 && next.fieldSubtotals) {
|
|
78102
78102
|
const onAxes = [...pivotRowFields(next), ...pivotColumnFields(next)];
|
|
78103
|
-
const left2 = next.fieldSubtotals.filter((
|
|
78103
|
+
const left2 = next.fieldSubtotals.filter((entry4) => onAxes.includes(entry4.field));
|
|
78104
78104
|
if (left2.length) next.fieldSubtotals = left2;
|
|
78105
78105
|
else delete next.fieldSubtotals;
|
|
78106
78106
|
}
|
|
@@ -78138,7 +78138,7 @@ function deletePivotTable(ctx, s, name3) {
|
|
|
78138
78138
|
ctx.workbook,
|
|
78139
78139
|
(timeline) => timelineOnPivot(ctx.workbook, timeline.cache, sheet2.sheetId, pivot.name)
|
|
78140
78140
|
);
|
|
78141
|
-
sheet2.pivotTables = sheet2.pivotTables.filter((
|
|
78141
|
+
sheet2.pivotTables = sheet2.pivotTables.filter((entry4) => entry4 !== pivot);
|
|
78142
78142
|
forEachCellInRange(sheet2, pivot.location, (_cell, row3, col) => deleteCell(sheet2, row3, col));
|
|
78143
78143
|
},
|
|
78144
78144
|
{ sheet: s, ranges: [pivot.location] }
|
|
@@ -78148,7 +78148,7 @@ function deletePivotTable(ctx, s, name3) {
|
|
|
78148
78148
|
// xlsx/edit/timelines.ts
|
|
78149
78149
|
var TIMELINE_BOX = { w: 480, h: 130 };
|
|
78150
78150
|
function cacheOf(ctx, name3) {
|
|
78151
|
-
const cache3 = ctx.workbook.slicers?.timelineCaches.find((
|
|
78151
|
+
const cache3 = ctx.workbook.slicers?.timelineCaches.find((entry4) => entry4.name === name3);
|
|
78152
78152
|
if (!cache3) throw new Error("The timeline is not available.");
|
|
78153
78153
|
return cache3;
|
|
78154
78154
|
}
|
|
@@ -78173,13 +78173,13 @@ function setTimelineSelection(ctx, cacheName, selection) {
|
|
|
78173
78173
|
selection ? "Filter timeline" : "Clear timeline filter",
|
|
78174
78174
|
() => {
|
|
78175
78175
|
const book = cloneBook(ctx.workbook);
|
|
78176
|
-
const
|
|
78176
|
+
const entry4 = book.timelineCaches.find((item2) => item2.name === cacheName);
|
|
78177
78177
|
if (selection) {
|
|
78178
|
-
|
|
78179
|
-
|
|
78178
|
+
entry4.selection = { ...selection };
|
|
78179
|
+
entry4.filterType = "dateBetween";
|
|
78180
78180
|
} else {
|
|
78181
|
-
delete
|
|
78182
|
-
|
|
78181
|
+
delete entry4.selection;
|
|
78182
|
+
entry4.filterType = "unknown";
|
|
78183
78183
|
}
|
|
78184
78184
|
book.dirty = true;
|
|
78185
78185
|
ctx.workbook.slicers = book;
|
|
@@ -78187,7 +78187,7 @@ function setTimelineSelection(ctx, cacheName, selection) {
|
|
|
78187
78187
|
);
|
|
78188
78188
|
}
|
|
78189
78189
|
function updateTimeline(ctx, name3, patch2) {
|
|
78190
|
-
if (!ctx.workbook.slicers?.timelines.some((
|
|
78190
|
+
if (!ctx.workbook.slicers?.timelines.some((entry4) => entry4.name === name3))
|
|
78191
78191
|
throw new Error("The timeline is not available.");
|
|
78192
78192
|
if (patch2.level !== void 0 && ![0, 1, 2, 3].includes(patch2.level) || patch2.caption !== void 0 && patch2.caption.length > 255)
|
|
78193
78193
|
throw new Error("Choose a valid timeline setting.");
|
|
@@ -78197,7 +78197,7 @@ function updateTimeline(ctx, name3, patch2) {
|
|
|
78197
78197
|
[{ kind: "meta" }],
|
|
78198
78198
|
() => {
|
|
78199
78199
|
const book = cloneBook(ctx.workbook);
|
|
78200
|
-
const
|
|
78200
|
+
const entry4 = book.timelines.find((item2) => item2.name === name3);
|
|
78201
78201
|
for (const key2 of [
|
|
78202
78202
|
"caption",
|
|
78203
78203
|
"showHeader",
|
|
@@ -78207,11 +78207,11 @@ function updateTimeline(ctx, name3, patch2) {
|
|
|
78207
78207
|
"style"
|
|
78208
78208
|
])
|
|
78209
78209
|
if (patch2[key2] !== void 0)
|
|
78210
|
-
|
|
78210
|
+
entry4[key2] = patch2[key2];
|
|
78211
78211
|
if (patch2.level !== void 0) {
|
|
78212
|
-
|
|
78213
|
-
|
|
78214
|
-
delete
|
|
78212
|
+
entry4.level = patch2.level;
|
|
78213
|
+
entry4.selectionLevel = patch2.level;
|
|
78214
|
+
delete entry4.scrollPosition;
|
|
78215
78215
|
}
|
|
78216
78216
|
book.dirty = true;
|
|
78217
78217
|
ctx.workbook.slicers = book;
|
|
@@ -78222,7 +78222,7 @@ function updateTimeline(ctx, name3, patch2) {
|
|
|
78222
78222
|
function insertTimeline(ctx, s, ref) {
|
|
78223
78223
|
const { workbook } = ctx;
|
|
78224
78224
|
const sheet2 = sheetAt(workbook, s);
|
|
78225
|
-
const pivot = sheet2.pivotTables?.find((
|
|
78225
|
+
const pivot = sheet2.pivotTables?.find((entry4) => entry4.name === ref.pivot);
|
|
78226
78226
|
if (!pivot || !pivot.dateFields?.includes(ref.field))
|
|
78227
78227
|
throw new Error("Choose a PivotTable with a date field.");
|
|
78228
78228
|
const column3 = pivot.fields.indexOf(ref.field);
|
|
@@ -78236,11 +78236,11 @@ function insertTimeline(ctx, s, ref) {
|
|
|
78236
78236
|
}
|
|
78237
78237
|
if (earliest > latest) throw new Error("Choose a PivotTable with a date field.");
|
|
78238
78238
|
const taken = /* @__PURE__ */ new Set([
|
|
78239
|
-
...(workbook.slicers?.slicers ?? []).map((
|
|
78240
|
-
...(workbook.slicers?.timelines ?? []).map((
|
|
78241
|
-
...(workbook.slicers?.caches ?? []).map((
|
|
78242
|
-
...(workbook.slicers?.timelineCaches ?? []).map((
|
|
78243
|
-
...workbook.definedNames.map((
|
|
78239
|
+
...(workbook.slicers?.slicers ?? []).map((entry4) => entry4.name.toLowerCase()),
|
|
78240
|
+
...(workbook.slicers?.timelines ?? []).map((entry4) => entry4.name.toLowerCase()),
|
|
78241
|
+
...(workbook.slicers?.caches ?? []).map((entry4) => entry4.name.toLowerCase()),
|
|
78242
|
+
...(workbook.slicers?.timelineCaches ?? []).map((entry4) => entry4.name.toLowerCase()),
|
|
78243
|
+
...workbook.definedNames.map((entry4) => entry4.name.toLowerCase())
|
|
78244
78244
|
]);
|
|
78245
78245
|
const unique4 = (base3) => {
|
|
78246
78246
|
if (!taken.has(base3.toLowerCase())) return base3;
|
|
@@ -78331,9 +78331,9 @@ function insertTimeline(ctx, s, ref) {
|
|
|
78331
78331
|
return name3;
|
|
78332
78332
|
}
|
|
78333
78333
|
function deleteTimeline(ctx, name3) {
|
|
78334
|
-
const timeline = ctx.workbook.slicers?.timelines.find((
|
|
78334
|
+
const timeline = ctx.workbook.slicers?.timelines.find((entry4) => entry4.name === name3);
|
|
78335
78335
|
if (!timeline) throw new Error("The timeline is not available.");
|
|
78336
|
-
const cache3 = ctx.workbook.slicers?.timelineCaches.find((
|
|
78336
|
+
const cache3 = ctx.workbook.slicers?.timelineCaches.find((entry4) => entry4.name === timeline.cache);
|
|
78337
78337
|
const target3 = cache3 && timelineTarget(ctx.workbook, cache3);
|
|
78338
78338
|
if (cache3?.selection && target3) {
|
|
78339
78339
|
setTimelineSelection(ctx, cache3.name, null);
|
|
@@ -78342,7 +78342,7 @@ function deleteTimeline(ctx, name3) {
|
|
|
78342
78342
|
"Delete timeline",
|
|
78343
78343
|
"annotations",
|
|
78344
78344
|
[{ kind: "workbook" }],
|
|
78345
|
-
() => removeTimelines(ctx.workbook, (
|
|
78345
|
+
() => removeTimelines(ctx.workbook, (entry4) => entry4.name === name3),
|
|
78346
78346
|
{}
|
|
78347
78347
|
);
|
|
78348
78348
|
}
|
|
@@ -78593,7 +78593,7 @@ function deleteSparklines(ctx, s, ranges, wholeGroups = false) {
|
|
|
78593
78593
|
// xlsx/edit/slicers.ts
|
|
78594
78594
|
var SLICER_BOX = { w: 144, h: 188 };
|
|
78595
78595
|
function cacheOf2(workbook, name3) {
|
|
78596
|
-
const cache3 = workbook.slicers?.caches.find((
|
|
78596
|
+
const cache3 = workbook.slicers?.caches.find((entry4) => entry4.name === name3);
|
|
78597
78597
|
if (!cache3) throw new Error("The slicer is not available.");
|
|
78598
78598
|
return cache3;
|
|
78599
78599
|
}
|
|
@@ -78627,7 +78627,7 @@ function setSlicerSelection(ctx, cacheName, keys) {
|
|
|
78627
78627
|
return;
|
|
78628
78628
|
}
|
|
78629
78629
|
const { pivot } = target3;
|
|
78630
|
-
const filters = (pivot.itemFilters ?? []).filter((
|
|
78630
|
+
const filters = (pivot.itemFilters ?? []).filter((entry4) => entry4.field !== cache3.sourceName);
|
|
78631
78631
|
const hidden = hiddenFor(pivot, cache3.sourceName, keys);
|
|
78632
78632
|
if (hidden.length) filters.push({ field: cache3.sourceName, hidden });
|
|
78633
78633
|
const next = { ...pivot };
|
|
@@ -78643,7 +78643,7 @@ function setSlicerSelection(ctx, cacheName, keys) {
|
|
|
78643
78643
|
);
|
|
78644
78644
|
}
|
|
78645
78645
|
function updateSlicer(ctx, name3, patch2) {
|
|
78646
|
-
const slicer = ctx.workbook.slicers?.slicers.find((
|
|
78646
|
+
const slicer = ctx.workbook.slicers?.slicers.find((entry4) => entry4.name === name3);
|
|
78647
78647
|
if (!slicer) throw new Error("The slicer is not available.");
|
|
78648
78648
|
if (patch2.columnCount !== void 0 && (!Number.isInteger(patch2.columnCount) || patch2.columnCount < 1 || patch2.columnCount > 2e4) || patch2.rowHeight !== void 0 && !(patch2.rowHeight >= 38100 && patch2.rowHeight <= 9144e3) || patch2.caption !== void 0 && patch2.caption.length > 255)
|
|
78649
78649
|
throw new Error("Choose a valid slicer setting.");
|
|
@@ -78653,14 +78653,14 @@ function updateSlicer(ctx, name3, patch2) {
|
|
|
78653
78653
|
[{ kind: "meta" }],
|
|
78654
78654
|
() => {
|
|
78655
78655
|
const book = cloneBook(ctx.workbook);
|
|
78656
|
-
const
|
|
78657
|
-
const cache3 = book.caches.find((item2) => item2.name ===
|
|
78656
|
+
const entry4 = book.slicers.find((item2) => item2.name === name3);
|
|
78657
|
+
const cache3 = book.caches.find((item2) => item2.name === entry4.cache);
|
|
78658
78658
|
for (const key2 of ["caption", "style", "rowHeight", "showCaption"])
|
|
78659
78659
|
if (patch2[key2] !== void 0)
|
|
78660
|
-
|
|
78660
|
+
entry4[key2] = patch2[key2];
|
|
78661
78661
|
if (patch2.columnCount !== void 0) {
|
|
78662
|
-
if (patch2.columnCount === 1) delete
|
|
78663
|
-
else
|
|
78662
|
+
if (patch2.columnCount === 1) delete entry4.columnCount;
|
|
78663
|
+
else entry4.columnCount = patch2.columnCount;
|
|
78664
78664
|
}
|
|
78665
78665
|
if (patch2.sortOrder !== void 0) cache3.sortOrder = patch2.sortOrder;
|
|
78666
78666
|
if (patch2.hideNoData !== void 0) {
|
|
@@ -78696,7 +78696,7 @@ function insertSlicer(ctx, s, ref) {
|
|
|
78696
78696
|
let field2;
|
|
78697
78697
|
if (ref.kind === "table") {
|
|
78698
78698
|
table4 = sheet2.tables.find(
|
|
78699
|
-
(
|
|
78699
|
+
(entry4) => entry4.name === ref.table || entry4.displayName === ref.table
|
|
78700
78700
|
);
|
|
78701
78701
|
if (!table4?.headerRow || table4.filterNotModeled)
|
|
78702
78702
|
throw new Error("Choose a table with a header row and value filters.");
|
|
@@ -78704,16 +78704,16 @@ function insertSlicer(ctx, s, ref) {
|
|
|
78704
78704
|
if (!table4.columns.some((column3) => column3.name === field2))
|
|
78705
78705
|
throw new Error("Choose a column of the table.");
|
|
78706
78706
|
} else {
|
|
78707
|
-
pivot = sheet2.pivotTables?.find((
|
|
78707
|
+
pivot = sheet2.pivotTables?.find((entry4) => entry4.name === ref.pivot);
|
|
78708
78708
|
if (!pivot) throw new Error("Choose a PivotTable that can be refreshed.");
|
|
78709
78709
|
field2 = ref.field;
|
|
78710
78710
|
if (!pivot.fields.includes(field2) || pivot.pageFilter?.field === field2)
|
|
78711
78711
|
throw new Error("Choose a PivotTable field that is not the report filter.");
|
|
78712
78712
|
}
|
|
78713
78713
|
const names = /* @__PURE__ */ new Set([
|
|
78714
|
-
...(workbook.slicers?.slicers ?? []).map((
|
|
78715
|
-
...(workbook.slicers?.caches ?? []).map((
|
|
78716
|
-
...workbook.definedNames.map((
|
|
78714
|
+
...(workbook.slicers?.slicers ?? []).map((entry4) => entry4.name.toLowerCase()),
|
|
78715
|
+
...(workbook.slicers?.caches ?? []).map((entry4) => entry4.name.toLowerCase()),
|
|
78716
|
+
...workbook.definedNames.map((entry4) => entry4.name.toLowerCase())
|
|
78717
78717
|
]);
|
|
78718
78718
|
const slicerName = unique2(field2, (c2) => names.has(c2.toLowerCase()));
|
|
78719
78719
|
const cacheName = unique2(
|
|
@@ -79001,22 +79001,22 @@ var BUILTIN_CELL_STYLES = [
|
|
|
79001
79001
|
}
|
|
79002
79002
|
];
|
|
79003
79003
|
var builtinCellStyle = (name3) => BUILTIN_CELL_STYLES.find((s) => s.name.toLowerCase() === name3.toLowerCase());
|
|
79004
|
-
function applyBuiltinStyle(base3,
|
|
79005
|
-
if (
|
|
79004
|
+
function applyBuiltinStyle(base3, entry4, normal3) {
|
|
79005
|
+
if (entry4.builtinId === 0) {
|
|
79006
79006
|
const reset = structuredClone(normal3);
|
|
79007
79007
|
delete reset.cellStyleName;
|
|
79008
79008
|
return { ...reset, cellStyleName: "Normal" };
|
|
79009
79009
|
}
|
|
79010
|
-
const next = { ...structuredClone(base3), cellStyleName:
|
|
79011
|
-
if (
|
|
79012
|
-
const font = { ...structuredClone(normal3.font), ...structuredClone(
|
|
79010
|
+
const next = { ...structuredClone(base3), cellStyleName: entry4.name };
|
|
79011
|
+
if (entry4.font) {
|
|
79012
|
+
const font = { ...structuredClone(normal3.font), ...structuredClone(entry4.font) };
|
|
79013
79013
|
next.font = font;
|
|
79014
79014
|
}
|
|
79015
|
-
if (
|
|
79016
|
-
if (
|
|
79017
|
-
if (
|
|
79018
|
-
if (
|
|
79019
|
-
if (
|
|
79015
|
+
if (entry4.fill) next.fill = structuredClone(entry4.fill);
|
|
79016
|
+
if (entry4.border) next.border = structuredClone(entry4.border);
|
|
79017
|
+
if (entry4.numFmt !== void 0) next.numFmt = entry4.numFmt;
|
|
79018
|
+
if (entry4.alignment) next.alignment = structuredClone(entry4.alignment);
|
|
79019
|
+
if (entry4.protection) next.protection = structuredClone(entry4.protection);
|
|
79020
79020
|
return next;
|
|
79021
79021
|
}
|
|
79022
79022
|
|
|
@@ -79028,13 +79028,13 @@ function ensureNamedStyle(workbook, name3) {
|
|
|
79028
79028
|
const builtin = builtinCellStyle(name3);
|
|
79029
79029
|
if (!builtin) throw new Error(`Unknown cell style "${name3}".`);
|
|
79030
79030
|
const normal3 = styleAt(workbook, 0);
|
|
79031
|
-
const
|
|
79031
|
+
const entry4 = {
|
|
79032
79032
|
name: builtin.name,
|
|
79033
79033
|
style: applyBuiltinStyle(normal3, builtin, normal3),
|
|
79034
79034
|
builtinId: builtin.builtinId
|
|
79035
79035
|
};
|
|
79036
|
-
workbook.namedStyles.push(
|
|
79037
|
-
return
|
|
79036
|
+
workbook.namedStyles.push(entry4);
|
|
79037
|
+
return entry4;
|
|
79038
79038
|
}
|
|
79039
79039
|
function styled(base3, named3, builtin, normal3) {
|
|
79040
79040
|
if (!builtin) return { ...structuredClone(named3.style), cellStyleName: named3.name };
|
|
@@ -80079,9 +80079,9 @@ function resetPageBreaks(ctx, s) {
|
|
|
80079
80079
|
"view",
|
|
80080
80080
|
[{ kind: "parts", sheet: s, parts: ["preserved"] }],
|
|
80081
80081
|
() => {
|
|
80082
|
-
for (const
|
|
80083
|
-
if (
|
|
80084
|
-
else sheet2.preserved.delete(
|
|
80082
|
+
for (const entry4 of next) {
|
|
80083
|
+
if (entry4.xml.length) sheet2.preserved.set(entry4.key, entry4.xml);
|
|
80084
|
+
else sheet2.preserved.delete(entry4.key);
|
|
80085
80085
|
}
|
|
80086
80086
|
},
|
|
80087
80087
|
{ sheet: s }
|
|
@@ -80095,7 +80095,7 @@ function refs(ast) {
|
|
|
80095
80095
|
}
|
|
80096
80096
|
function printTitles(workbook, sheetIndex2) {
|
|
80097
80097
|
const name3 = workbook.definedNames.find(
|
|
80098
|
-
(
|
|
80098
|
+
(entry4) => entry4.name === PRINT_TITLES_NAME && entry4.localSheet === sheetIndex2
|
|
80099
80099
|
);
|
|
80100
80100
|
if (!name3) return {};
|
|
80101
80101
|
try {
|
|
@@ -80208,13 +80208,13 @@ function setDefinedName(ctx, name3) {
|
|
|
80208
80208
|
const problem2 = name3.name.startsWith("_xlnm.") ? void 0 : validateDefinedName(name3.name);
|
|
80209
80209
|
if (problem2) throw new Error(problem2);
|
|
80210
80210
|
if (name3.localSheet !== void 0) sheetAt(ctx.workbook, name3.localSheet);
|
|
80211
|
-
const
|
|
80212
|
-
|
|
80211
|
+
const entry4 = structuredClone(name3);
|
|
80212
|
+
entry4.formula = entry4.formula.replace(/^=/, "");
|
|
80213
80213
|
ctx.run("Define name", "names", [{ kind: "meta" }], () => {
|
|
80214
80214
|
const { definedNames } = ctx.workbook;
|
|
80215
80215
|
const index5 = definedNames.findIndex((n) => sameName(n, name3.name, name3.localSheet));
|
|
80216
|
-
if (index5 >= 0) definedNames[index5] =
|
|
80217
|
-
else definedNames.push(
|
|
80216
|
+
if (index5 >= 0) definedNames[index5] = entry4;
|
|
80217
|
+
else definedNames.push(entry4);
|
|
80218
80218
|
});
|
|
80219
80219
|
}
|
|
80220
80220
|
function deleteDefinedName(ctx, name3, localSheet) {
|
|
@@ -80601,7 +80601,7 @@ function lineHeightPoints(sizePt) {
|
|
|
80601
80601
|
}
|
|
80602
80602
|
return Math.max(0.75, Math.ceil(height / 0.75 - 1e-9) * 0.75);
|
|
80603
80603
|
}
|
|
80604
|
-
function wrappedLineCount2(text9, width,
|
|
80604
|
+
function wrappedLineCount2(text9, width, measure6) {
|
|
80605
80605
|
let lines3 = 0;
|
|
80606
80606
|
for (const paragraph2 of text9.split(/\r?\n/)) {
|
|
80607
80607
|
lines3++;
|
|
@@ -80610,14 +80610,14 @@ function wrappedLineCount2(text9, width, measure5) {
|
|
|
80610
80610
|
for (const word of paragraph2.split(/(\s+)/)) {
|
|
80611
80611
|
if (word === "") continue;
|
|
80612
80612
|
const next = current + word;
|
|
80613
|
-
if (current.trim() === "" ||
|
|
80613
|
+
if (current.trim() === "" || measure6(next) <= width) current = next;
|
|
80614
80614
|
else {
|
|
80615
80615
|
lines3++;
|
|
80616
80616
|
current = word.trimStart();
|
|
80617
80617
|
}
|
|
80618
|
-
while (current.length > 1 &&
|
|
80618
|
+
while (current.length > 1 && measure6(current) > width) {
|
|
80619
80619
|
let fit3 = 1;
|
|
80620
|
-
while (fit3 < current.length &&
|
|
80620
|
+
while (fit3 < current.length && measure6(current.slice(0, fit3 + 1)) <= width) fit3++;
|
|
80621
80621
|
current = current.slice(fit3);
|
|
80622
80622
|
lines3++;
|
|
80623
80623
|
}
|
|
@@ -80625,7 +80625,7 @@ function wrappedLineCount2(text9, width, measure5) {
|
|
|
80625
80625
|
}
|
|
80626
80626
|
return lines3;
|
|
80627
80627
|
}
|
|
80628
|
-
function fitRowHeights(workbook, sheetIndex2, rows,
|
|
80628
|
+
function fitRowHeights(workbook, sheetIndex2, rows, measure6) {
|
|
80629
80629
|
const heights = /* @__PURE__ */ new Map();
|
|
80630
80630
|
const sheet2 = workbook.sheets[sheetIndex2];
|
|
80631
80631
|
if (!sheet2) return heights;
|
|
@@ -80651,7 +80651,7 @@ function fitRowHeights(workbook, sheetIndex2, rows, measure5) {
|
|
|
80651
80651
|
if (view.wrap) {
|
|
80652
80652
|
colWidth ??= createColumnWidths(sheet2, { zoom: 100 });
|
|
80653
80653
|
const width = colWidth(col) - COLUMN_PADDING_PX - 1 - view.indentPx;
|
|
80654
|
-
lines3 = wrappedLineCount2(view.text, width, (text9) =>
|
|
80654
|
+
lines3 = wrappedLineCount2(view.text, width, (text9) => measure6(text9, view.font));
|
|
80655
80655
|
}
|
|
80656
80656
|
tallest = Math.max(tallest, lines3 * lineHeightPoints(sizePt));
|
|
80657
80657
|
}
|
|
@@ -80663,13 +80663,13 @@ var approximateMeasure = (text9, font) => text9.length * font.sizePx * (font.bol
|
|
|
80663
80663
|
|
|
80664
80664
|
// xlsx/edit/row-autofit.ts
|
|
80665
80665
|
var MAX_HEIGHT2 = 409;
|
|
80666
|
-
function autoGrowRows(ctx, s, rows,
|
|
80666
|
+
function autoGrowRows(ctx, s, rows, measure6 = approximateMeasure) {
|
|
80667
80667
|
const sheet2 = sheetAt(ctx.workbook, s);
|
|
80668
80668
|
const candidates = [...new Set(rows)].filter((row3) => {
|
|
80669
80669
|
const info = sheet2.rowInfo.get(row3);
|
|
80670
80670
|
return !info?.customHeight && !info?.hidden;
|
|
80671
80671
|
});
|
|
80672
|
-
const fits4 = fitRowHeights(ctx.workbook, s, candidates,
|
|
80672
|
+
const fits4 = fitRowHeights(ctx.workbook, s, candidates, measure6);
|
|
80673
80673
|
const updates = [];
|
|
80674
80674
|
for (const row3 of candidates) {
|
|
80675
80675
|
const fit3 = Math.min(MAX_HEIGHT2, fits4.get(row3) ?? sheet2.defaultRowHeight);
|
|
@@ -81228,8 +81228,8 @@ function createEditSession(workbook, options2 = {}) {
|
|
|
81228
81228
|
};
|
|
81229
81229
|
const rollback = (current, from) => {
|
|
81230
81230
|
for (let i2 = current.step.entries.length - 1; i2 >= from; i2--) {
|
|
81231
|
-
const
|
|
81232
|
-
if (
|
|
81231
|
+
const entry4 = current.step.entries[i2];
|
|
81232
|
+
if (entry4) restoreSnapshot(workbook, entry4.before);
|
|
81233
81233
|
}
|
|
81234
81234
|
current.step.entries.length = from;
|
|
81235
81235
|
};
|
|
@@ -81324,7 +81324,7 @@ function createEditSession(workbook, options2 = {}) {
|
|
|
81324
81324
|
deleteColumns: (s, at3, count3) => deleteColumns(ctx, s, at3, count3),
|
|
81325
81325
|
insertCellsShift: (s, range3, dir) => insertCellsShift(ctx, s, range3, dir),
|
|
81326
81326
|
deleteCellsShift: (s, range3, dir) => deleteCellsShift(ctx, s, range3, dir),
|
|
81327
|
-
setColumnWidth: (s, cols, width,
|
|
81327
|
+
setColumnWidth: (s, cols, width, measure6) => setColumnWidth(ctx, s, cols, width, measure6),
|
|
81328
81328
|
setRowHeight: (s, rows, height) => setRowHeight(ctx, s, rows, height),
|
|
81329
81329
|
setHidden: (s, axis, indices, hidden) => setHidden(ctx, s, axis, indices, hidden),
|
|
81330
81330
|
merge: (s, range3, mode) => merge(ctx, s, range3, mode),
|
|
@@ -81836,8 +81836,8 @@ function color2(value3) {
|
|
|
81836
81836
|
if (!value3) return void 0;
|
|
81837
81837
|
const out = {};
|
|
81838
81838
|
if (value3.rgb) {
|
|
81839
|
-
const
|
|
81840
|
-
out.rgb =
|
|
81839
|
+
const rgb8 = value3.rgb.toUpperCase();
|
|
81840
|
+
out.rgb = rgb8.length === 6 ? `FF${rgb8}` : rgb8;
|
|
81841
81841
|
}
|
|
81842
81842
|
if (value3.theme !== void 0) out.theme = value3.theme;
|
|
81843
81843
|
if (value3.indexed !== void 0) out.indexed = value3.indexed;
|
|
@@ -81923,11 +81923,11 @@ function formatAttributeKeys(style4) {
|
|
|
81923
81923
|
function withCanonicalColors(value3) {
|
|
81924
81924
|
if (Array.isArray(value3)) return value3.map(withCanonicalColors);
|
|
81925
81925
|
if (!value3 || typeof value3 !== "object") return value3;
|
|
81926
|
-
const entries = Object.entries(value3).map(([key2,
|
|
81926
|
+
const entries = Object.entries(value3).map(([key2, entry4]) => [key2, withCanonicalColors(entry4)]);
|
|
81927
81927
|
const out = Object.fromEntries(entries);
|
|
81928
81928
|
if (typeof out.rgb === "string") {
|
|
81929
|
-
const
|
|
81930
|
-
out.rgb =
|
|
81929
|
+
const rgb8 = out.rgb.toUpperCase();
|
|
81930
|
+
out.rgb = rgb8.length === 6 ? `FF${rgb8}` : rgb8;
|
|
81931
81931
|
}
|
|
81932
81932
|
if (out.tint === 0) delete out.tint;
|
|
81933
81933
|
return out;
|
|
@@ -82797,8 +82797,8 @@ function canonicalJson(value3) {
|
|
|
82797
82797
|
if (Array.isArray(value3))
|
|
82798
82798
|
return `[${value3.map((item2) => canonicalJson(item2 ?? null)).join(",")}]`;
|
|
82799
82799
|
if (value3 && typeof value3 === "object") {
|
|
82800
|
-
const entries = Object.entries(value3).filter(([,
|
|
82801
|
-
return `{${entries.map(([key2,
|
|
82800
|
+
const entries = Object.entries(value3).filter(([, entry4]) => entry4 !== void 0).sort(([a2], [b]) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
82801
|
+
return `{${entries.map(([key2, entry4]) => `${JSON.stringify(key2)}:${canonicalJson(entry4)}`).join(",")}}`;
|
|
82802
82802
|
}
|
|
82803
82803
|
return JSON.stringify(value3) ?? "null";
|
|
82804
82804
|
}
|
|
@@ -83193,8 +83193,8 @@ var VisioPackage = class _VisioPackage {
|
|
|
83193
83193
|
this.entries = entries;
|
|
83194
83194
|
this.limits = limits;
|
|
83195
83195
|
this.deadline = deadline;
|
|
83196
|
-
for (const
|
|
83197
|
-
if (!
|
|
83196
|
+
for (const entry4 of entries.values())
|
|
83197
|
+
if (!entry4.directory) this.decodedNames.set(decodePath(entry4.name), entry4.name);
|
|
83198
83198
|
}
|
|
83199
83199
|
zip;
|
|
83200
83200
|
entries;
|
|
@@ -83254,15 +83254,15 @@ var VisioPackage = class _VisioPackage {
|
|
|
83254
83254
|
}
|
|
83255
83255
|
/** The declared CRC-32 and size of a part, or an empty string when the package lacks it. */
|
|
83256
83256
|
printOf(path4) {
|
|
83257
|
-
const
|
|
83258
|
-
return
|
|
83257
|
+
const entry4 = this.entries.get(path4);
|
|
83258
|
+
return entry4 && !entry4.directory ? `${entry4.crc}:${entry4.size}` : "";
|
|
83259
83259
|
}
|
|
83260
83260
|
has(path4) {
|
|
83261
83261
|
this.noted?.add(path4);
|
|
83262
83262
|
return this.entries.get(path4)?.directory === false;
|
|
83263
83263
|
}
|
|
83264
83264
|
paths() {
|
|
83265
|
-
return [...this.entries.values()].filter((
|
|
83265
|
+
return [...this.entries.values()].filter((entry4) => !entry4.directory).map((entry4) => entry4.name);
|
|
83266
83266
|
}
|
|
83267
83267
|
async readXml(path4, expectedRoot) {
|
|
83268
83268
|
this.check();
|
|
@@ -83284,9 +83284,9 @@ var VisioPackage = class _VisioPackage {
|
|
|
83284
83284
|
this.check();
|
|
83285
83285
|
this.noted?.add(path4);
|
|
83286
83286
|
safePath(path4);
|
|
83287
|
-
const
|
|
83288
|
-
if (!
|
|
83289
|
-
return
|
|
83287
|
+
const entry4 = this.entries.get(path4);
|
|
83288
|
+
if (!entry4 || entry4.directory) fail3("MISSING_PART", `Missing package part: ${path4}`);
|
|
83289
|
+
return entry4.size;
|
|
83290
83290
|
}
|
|
83291
83291
|
/** Shared package-owned bytes. Treat the returned buffer as immutable. */
|
|
83292
83292
|
async readBytes(path4) {
|
|
@@ -83303,8 +83303,8 @@ var VisioPackage = class _VisioPackage {
|
|
|
83303
83303
|
return bytes;
|
|
83304
83304
|
}
|
|
83305
83305
|
async loadBytes(path4) {
|
|
83306
|
-
const
|
|
83307
|
-
if (!
|
|
83306
|
+
const entry4 = this.entries.get(path4), file2 = this.zip.file(path4);
|
|
83307
|
+
if (!entry4 || entry4.directory || !file2)
|
|
83308
83308
|
return fail3("MISSING_PART", `Missing package part: ${path4}`);
|
|
83309
83309
|
return new Promise((resolve3, reject2) => {
|
|
83310
83310
|
const stream = file2.internalStream("uint8array");
|
|
@@ -83335,9 +83335,9 @@ var VisioPackage = class _VisioPackage {
|
|
|
83335
83335
|
fail3("LIMIT_ENTRY", `Actual inflated entry exceeds limit: ${path4}`);
|
|
83336
83336
|
if (this.totalOutput > this.limits.maxTotalBytes)
|
|
83337
83337
|
fail3("LIMIT_TOTAL", "Actual inflated ZIP total exceeds limit");
|
|
83338
|
-
if (size3 > Math.max(1,
|
|
83338
|
+
if (size3 > Math.max(1, entry4.compressed) * this.limits.maxCompressionRatio)
|
|
83339
83339
|
fail3("LIMIT_RATIO", `Actual ZIP compression ratio exceeds limit: ${path4}`);
|
|
83340
|
-
if (size3 >
|
|
83340
|
+
if (size3 > entry4.size)
|
|
83341
83341
|
fail3("ZIP_MISMATCH", `Actual ZIP entry exceeds declared size: ${path4}`);
|
|
83342
83342
|
crc = crc32(chunk, crc);
|
|
83343
83343
|
chunks.push(chunk);
|
|
@@ -83346,7 +83346,7 @@ var VisioPackage = class _VisioPackage {
|
|
|
83346
83346
|
}
|
|
83347
83347
|
}).on("error", abort).on("end", () => {
|
|
83348
83348
|
if (settled) return;
|
|
83349
|
-
if (size3 !==
|
|
83349
|
+
if (size3 !== entry4.size || (crc ^ 4294967295) >>> 0 !== entry4.crc) {
|
|
83350
83350
|
abort(new VisioPackageError("ZIP_MISMATCH", `Inflated size or CRC mismatch: ${path4}`));
|
|
83351
83351
|
return;
|
|
83352
83352
|
}
|
|
@@ -87323,20 +87323,20 @@ function drawingPaint(node4, colors, placeholder3, depth = 0) {
|
|
|
87323
87323
|
(transform9) => !SUPPORTED_TRANSFORMS.has(transform9.name) || (integer7(transform9.value) ?? 100001) > 1e5
|
|
87324
87324
|
))
|
|
87325
87325
|
return void 0;
|
|
87326
|
-
let
|
|
87326
|
+
let rgb8;
|
|
87327
87327
|
let inherited;
|
|
87328
|
-
if (color4.kind === "srgb")
|
|
87329
|
-
else if (color4.kind === "system")
|
|
87328
|
+
if (color4.kind === "srgb") rgb8 = color4.value;
|
|
87329
|
+
else if (color4.kind === "system") rgb8 = color4.fallback;
|
|
87330
87330
|
else if (color4.kind === "scheme") {
|
|
87331
|
-
if (color4.value === "phClr")
|
|
87331
|
+
if (color4.value === "phClr") rgb8 = placeholder3;
|
|
87332
87332
|
else {
|
|
87333
87333
|
inherited = drawingPaint(colors.get(color4.value), colors, placeholder3, depth + 1);
|
|
87334
|
-
|
|
87334
|
+
rgb8 = inherited?.color;
|
|
87335
87335
|
}
|
|
87336
87336
|
}
|
|
87337
|
-
if (!
|
|
87337
|
+
if (!rgb8 || !/^#?[\da-f]{6}$/i.test(rgb8)) return void 0;
|
|
87338
87338
|
const resolved = resolveDrawingColor(
|
|
87339
|
-
{ kind: "srgb", value:
|
|
87339
|
+
{ kind: "srgb", value: rgb8.replace(/^#/, ""), transforms },
|
|
87340
87340
|
void 0,
|
|
87341
87341
|
{ transformOrder: "document" }
|
|
87342
87342
|
);
|
|
@@ -88327,7 +88327,7 @@ function shapeShadow(cells3, color4, report, themed) {
|
|
|
88327
88327
|
"approximate-shadow-offset",
|
|
88328
88328
|
"A shadow without a shape offset uses Visio's default 0.125 inch page offset."
|
|
88329
88329
|
);
|
|
88330
|
-
const
|
|
88330
|
+
const clamp5 = (value3, limit3) => Math.max(-limit3, Math.min(limit3, value3));
|
|
88331
88331
|
const transparency = number2(cells3, "ShdwForegndTrans", 0, report);
|
|
88332
88332
|
report(
|
|
88333
88333
|
"unverified-shadow",
|
|
@@ -88336,8 +88336,8 @@ function shapeShadow(cells3, color4, report, themed) {
|
|
|
88336
88336
|
return {
|
|
88337
88337
|
color: color4("ShdwForegnd", "#000000"),
|
|
88338
88338
|
opacity: Math.max(0, Math.min(1, 1 - transparency)),
|
|
88339
|
-
offsetX:
|
|
88340
|
-
offsetY:
|
|
88339
|
+
offsetX: clamp5(hasOffset ? number2(cells3, "ShapeShdwOffsetX", 0.125, report) : 0.125, 1e3),
|
|
88340
|
+
offsetY: clamp5(hasOffset ? number2(cells3, "ShapeShdwOffsetY", -0.125, report) : -0.125, 1e3),
|
|
88341
88341
|
blur: Math.max(0, Math.min(10, number2(cells3, "ShapeShdwBlur", 0, report)))
|
|
88342
88342
|
};
|
|
88343
88343
|
}
|
|
@@ -88345,30 +88345,30 @@ function shapeShadow(cells3, color4, report, themed) {
|
|
|
88345
88345
|
// visio/effects.ts
|
|
88346
88346
|
function shapeEffects(cells3, color4, report, themed) {
|
|
88347
88347
|
const explicit = (name3) => cells3.has(name3) && cells3.get(name3)?.value !== "Themed";
|
|
88348
|
-
const
|
|
88348
|
+
const clamp5 = (value3, maximum) => Math.max(0, Math.min(maximum, value3));
|
|
88349
88349
|
const result2 = {};
|
|
88350
|
-
const glow = explicit("GlowSize") ?
|
|
88350
|
+
const glow = explicit("GlowSize") ? clamp5(number2(cells3, "GlowSize", 0, report), 2.5) : 0;
|
|
88351
88351
|
if (glow > 0) {
|
|
88352
|
-
const opacity2 = 1 -
|
|
88352
|
+
const opacity2 = 1 - clamp5(number2(cells3, "GlowColorTrans", 0, report), 1);
|
|
88353
88353
|
if (opacity2 > 0) result2.glow = { color: color4("GlowColor", "#000000"), opacity: opacity2, size: glow };
|
|
88354
88354
|
}
|
|
88355
|
-
const soft = explicit("SoftEdgesSize") ?
|
|
88355
|
+
const soft = explicit("SoftEdgesSize") ? clamp5(number2(cells3, "SoftEdgesSize", 0, report), 2) : 0;
|
|
88356
88356
|
if (soft > 0) result2.softEdges = soft;
|
|
88357
|
-
const size3 = explicit("ReflectionSize") ?
|
|
88357
|
+
const size3 = explicit("ReflectionSize") ? clamp5(number2(cells3, "ReflectionSize", 0, report), 1) : 0;
|
|
88358
88358
|
if (size3 > 0) {
|
|
88359
|
-
const opacity2 = 1 -
|
|
88359
|
+
const opacity2 = 1 - clamp5(number2(cells3, "ReflectionTrans", 0, report), 1);
|
|
88360
88360
|
if (opacity2 > 0)
|
|
88361
88361
|
result2.reflection = {
|
|
88362
88362
|
opacity: opacity2,
|
|
88363
88363
|
size: size3,
|
|
88364
|
-
distance:
|
|
88365
|
-
blur:
|
|
88364
|
+
distance: clamp5(number2(cells3, "ReflectionDist", 0, report), 2),
|
|
88365
|
+
blur: clamp5(number2(cells3, "ReflectionBlur", 0, report), 2)
|
|
88366
88366
|
};
|
|
88367
88367
|
}
|
|
88368
|
-
const
|
|
88369
|
-
if (themed?.glow &&
|
|
88370
|
-
if (themed?.softEdges &&
|
|
88371
|
-
if (themed?.reflection &&
|
|
88368
|
+
const themedCell2 = (...names) => names.some((name3) => cells3.get(name3)?.value === "Themed");
|
|
88369
|
+
if (themed?.glow && themedCell2("GlowSize")) result2.glow = themed.glow;
|
|
88370
|
+
if (themed?.softEdges && themedCell2("SoftEdgesSize")) result2.softEdges = themed.softEdges;
|
|
88371
|
+
if (themed?.reflection && themedCell2("ReflectionSize", "ReflectionTrans"))
|
|
88372
88372
|
result2.reflection = themed.reflection;
|
|
88373
88373
|
if (result2.glow || result2.softEdges || result2.reflection)
|
|
88374
88374
|
report(
|
|
@@ -88404,7 +88404,11 @@ var VISIO_ROTATION_PRESETS = [
|
|
|
88404
88404
|
["off-axis-right", "Off Axis Right", 30, 20, 0, 0],
|
|
88405
88405
|
["perspective-left", "Perspective Left", -35, 0, 0, 60],
|
|
88406
88406
|
["perspective-right", "Perspective Right", 35, 0, 0, 60],
|
|
88407
|
-
["perspective-relaxed", "Perspective Relaxed", 20, 10, 0, 60]
|
|
88407
|
+
["perspective-relaxed", "Perspective Relaxed", 20, 10, 0, 60],
|
|
88408
|
+
["perspective-above", "Perspective Above", 0, -25, 0, 60],
|
|
88409
|
+
["perspective-below", "Perspective Below", 0, 25, 0, 60],
|
|
88410
|
+
["perspective-heroic-left", "Perspective Heroic Left", -45, -20, 0, 90],
|
|
88411
|
+
["perspective-heroic-right", "Perspective Heroic Right", 45, -20, 0, 90]
|
|
88408
88412
|
].map(([id5, label2, x, y, z2, perspective]) => ({
|
|
88409
88413
|
id: id5,
|
|
88410
88414
|
label: label2,
|
|
@@ -88429,6 +88433,39 @@ function rotationWrites(id5, add5) {
|
|
|
88429
88433
|
add5("RotationZAngle", radians(preset.z), "FillStyle", "DEG");
|
|
88430
88434
|
add5("Perspective", radians(preset.perspective), "FillStyle", "DEG");
|
|
88431
88435
|
}
|
|
88436
|
+
var rgb2 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
|
|
88437
|
+
function solidWrites(edit2, add5) {
|
|
88438
|
+
if (edit2.extrusionDepth !== void 0)
|
|
88439
|
+
add5("BevelDepthSize", edit2.extrusionDepth / 72, "FillStyle", "PT");
|
|
88440
|
+
if (edit2.extrusionColor !== void 0)
|
|
88441
|
+
add5("BevelDepthColor", edit2.extrusionColor, "FillStyle", void 0, rgb2(edit2.extrusionColor));
|
|
88442
|
+
if (edit2.contourSize !== void 0)
|
|
88443
|
+
add5("BevelContourSize", edit2.contourSize / 72, "FillStyle", "PT");
|
|
88444
|
+
if (edit2.contourColor !== void 0)
|
|
88445
|
+
add5("BevelContourColor", edit2.contourColor, "FillStyle", void 0, rgb2(edit2.contourColor));
|
|
88446
|
+
}
|
|
88447
|
+
function snapshotSolid(edit2) {
|
|
88448
|
+
const length = (value3, high, what) => {
|
|
88449
|
+
if (typeof value3 !== "number" || !Number.isFinite(value3) || value3 < 0 || value3 > high)
|
|
88450
|
+
fail3("INVALID_EDIT", `${what} must be 0 to ${high} points.`);
|
|
88451
|
+
return Math.round(value3 * 100) / 100;
|
|
88452
|
+
};
|
|
88453
|
+
const color4 = (value3, what) => {
|
|
88454
|
+
if (typeof value3 !== "string" || !/^#[0-9a-f]{6}$/i.test(value3))
|
|
88455
|
+
fail3("INVALID_EDIT", `${what} requires six hexadecimal digits.`);
|
|
88456
|
+
return value3.toLowerCase();
|
|
88457
|
+
};
|
|
88458
|
+
const result2 = {};
|
|
88459
|
+
if (edit2.extrusionDepth !== void 0)
|
|
88460
|
+
result2.extrusionDepth = length(edit2.extrusionDepth, 288, "Extrusion depth");
|
|
88461
|
+
if (edit2.extrusionColor !== void 0)
|
|
88462
|
+
result2.extrusionColor = color4(edit2.extrusionColor, "The extrusion colour");
|
|
88463
|
+
if (edit2.contourSize !== void 0)
|
|
88464
|
+
result2.contourSize = length(edit2.contourSize, 72, "Contour size");
|
|
88465
|
+
if (edit2.contourColor !== void 0)
|
|
88466
|
+
result2.contourColor = color4(edit2.contourColor, "The contour colour");
|
|
88467
|
+
return result2;
|
|
88468
|
+
}
|
|
88432
88469
|
function snapshotBevel(value3) {
|
|
88433
88470
|
if (!isVisioBevelPreset(value3)) fail3("INVALID_EDIT", "Unknown bevel preset.");
|
|
88434
88471
|
return value3;
|
|
@@ -88437,14 +88474,29 @@ function snapshotRotation(value3) {
|
|
|
88437
88474
|
if (!isVisioRotationPreset(value3)) fail3("INVALID_EDIT", "Unknown 3-D rotation preset.");
|
|
88438
88475
|
return value3;
|
|
88439
88476
|
}
|
|
88440
|
-
var
|
|
88441
|
-
|
|
88442
|
-
|
|
88443
|
-
|
|
88444
|
-
const
|
|
88445
|
-
|
|
88446
|
-
|
|
88447
|
-
|
|
88477
|
+
var themedCell = (cells3, name3) => cells3.get(name3)?.value === "Themed";
|
|
88478
|
+
var saved = (cells3, name3) => cells3.has(name3) && !themedCell(cells3, name3) ? number2(cells3, name3, 0) : 0;
|
|
88479
|
+
var clamp4 = (value3, high) => Math.max(0, Math.min(high, value3));
|
|
88480
|
+
function shapeBevel(cells3, themed) {
|
|
88481
|
+
const read = (name3, themeValue) => themedCell(cells3, name3) ? themeValue ?? 0 : saved(cells3, name3);
|
|
88482
|
+
const type = Math.trunc(read("BevelTopType", themed?.bevel?.type));
|
|
88483
|
+
const width = clamp4(read("BevelTopWidth", themed?.bevel?.width), 2);
|
|
88484
|
+
const height = clamp4(read("BevelTopHeight", themed?.bevel?.height), 2);
|
|
88485
|
+
return type >= 1 && type <= 12 ? { type, width, height } : void 0;
|
|
88486
|
+
}
|
|
88487
|
+
function shapeExtrusion(cells3, solid3, colorOf4) {
|
|
88488
|
+
const depth = clamp4(saved(cells3, "BevelDepthSize"), 4);
|
|
88489
|
+
return solid3 && depth > 0 ? { depth, color: colorOf4("BevelDepthColor", "#ffffff") } : void 0;
|
|
88490
|
+
}
|
|
88491
|
+
function shapeContour(cells3, solid3, themed, colorOf4) {
|
|
88492
|
+
const size3 = clamp4(
|
|
88493
|
+
themedCell(cells3, "BevelContourSize") ? themed?.contour?.size ?? 0 : saved(cells3, "BevelContourSize"),
|
|
88494
|
+
1
|
|
88495
|
+
);
|
|
88496
|
+
const color4 = themedCell(cells3, "BevelContourColor") ? themed?.contour?.color ?? colorOf4("BevelContourColor", "#000000") : colorOf4("BevelContourColor", "#000000");
|
|
88497
|
+
return solid3 && size3 > 0 ? { size: size3, color: color4 } : void 0;
|
|
88498
|
+
}
|
|
88499
|
+
var hasUndrawnBevel = (cells3) => saved(cells3, "BevelBottomType") > 0;
|
|
88448
88500
|
function shapeRotation3d(cells3) {
|
|
88449
88501
|
const angle = (name3) => Math.max(-Math.PI, Math.min(Math.PI, saved(cells3, name3)));
|
|
88450
88502
|
const x = angle("RotationXAngle"), y = angle("RotationYAngle"), z2 = angle("RotationZAngle");
|
|
@@ -88459,6 +88511,52 @@ function shapeRotation3d(cells3) {
|
|
|
88459
88511
|
};
|
|
88460
88512
|
}
|
|
88461
88513
|
|
|
88514
|
+
// visio/theme-solid.ts
|
|
88515
|
+
var PRESETS = [
|
|
88516
|
+
"circle",
|
|
88517
|
+
"relaxedInset",
|
|
88518
|
+
"cross",
|
|
88519
|
+
"coolSlant",
|
|
88520
|
+
"angle",
|
|
88521
|
+
"softRound",
|
|
88522
|
+
"convex",
|
|
88523
|
+
"slope",
|
|
88524
|
+
"divot",
|
|
88525
|
+
"riblet",
|
|
88526
|
+
"hardEdge",
|
|
88527
|
+
"artDeco"
|
|
88528
|
+
];
|
|
88529
|
+
var EMU2 = 914400;
|
|
88530
|
+
var measure4 = (node4, name3, fallback) => {
|
|
88531
|
+
const raw2 = node4.getAttribute(name3);
|
|
88532
|
+
return raw2 !== null && /^\d{1,10}$/.test(raw2) ? Number(raw2) / EMU2 : fallback;
|
|
88533
|
+
};
|
|
88534
|
+
function themeSolid(cells3, resources, placeholder3) {
|
|
88535
|
+
const solid3 = themeChild(themeFormat(cells3, "Effects", resources), "sp3d");
|
|
88536
|
+
if (!solid3) return void 0;
|
|
88537
|
+
const result2 = {};
|
|
88538
|
+
const top = themeChild(solid3, "bevelT");
|
|
88539
|
+
if (top) {
|
|
88540
|
+
const type = PRESETS.indexOf(top.getAttribute("prst") ?? "circle") + 1;
|
|
88541
|
+
if (type > 0)
|
|
88542
|
+
result2.bevel = {
|
|
88543
|
+
type,
|
|
88544
|
+
width: measure4(top, "w", 76200 / EMU2),
|
|
88545
|
+
height: measure4(top, "h", 76200 / EMU2)
|
|
88546
|
+
};
|
|
88547
|
+
}
|
|
88548
|
+
const size3 = measure4(solid3, "contourW", 0);
|
|
88549
|
+
if (size3 > 0) {
|
|
88550
|
+
const paint3 = drawingPaint(
|
|
88551
|
+
colorChoice(themeChild(solid3, "contourClr")),
|
|
88552
|
+
/* @__PURE__ */ new Map(),
|
|
88553
|
+
placeholder3
|
|
88554
|
+
);
|
|
88555
|
+
result2.contour = { size: size3, ...paint3 ? { color: paint3.color } : {} };
|
|
88556
|
+
}
|
|
88557
|
+
return result2;
|
|
88558
|
+
}
|
|
88559
|
+
|
|
88462
88560
|
// visio/text-background.ts
|
|
88463
88561
|
function textBackground(cells3, resources, report) {
|
|
88464
88562
|
const raw2 = cells3.get("TextBkgnd")?.value;
|
|
@@ -89737,9 +89835,9 @@ function roundedRectanglePath(points3, rounding, point3) {
|
|
|
89737
89835
|
const sweep = a2[0] * b[1] - a2[1] * b[0] > 0 ? 1 : 0;
|
|
89738
89836
|
const start = after[0], commands = [`M ${point3(start[0], start[1])}`];
|
|
89739
89837
|
for (let i2 = 1; i2 <= 4; i2++) {
|
|
89740
|
-
const
|
|
89838
|
+
const entry4 = before[i2 % 4], exit2 = after[i2 % 4];
|
|
89741
89839
|
commands.push(
|
|
89742
|
-
`L ${point3(
|
|
89840
|
+
`L ${point3(entry4[0], entry4[1])}`,
|
|
89743
89841
|
`A ${point3(radius, radius)} 0 0 ${sweep} ${point3(exit2[0], exit2[1])}`
|
|
89744
89842
|
);
|
|
89745
89843
|
}
|
|
@@ -89785,7 +89883,7 @@ function roundedOrthogonalPath(points3, radius, point3) {
|
|
|
89785
89883
|
const radius2 = radii[i2];
|
|
89786
89884
|
if (!Number.isFinite(radius2) || radius2 < 1e-9) return void 0;
|
|
89787
89885
|
const incoming = directions[i2 - 1], outgoing = directions[i2];
|
|
89788
|
-
const
|
|
89886
|
+
const entry4 = [
|
|
89789
89887
|
vertex[0] - incoming[0] * radius2,
|
|
89790
89888
|
vertex[1] - incoming[1] * radius2
|
|
89791
89889
|
];
|
|
@@ -89793,11 +89891,11 @@ function roundedOrthogonalPath(points3, radius, point3) {
|
|
|
89793
89891
|
vertex[0] + outgoing[0] * radius2,
|
|
89794
89892
|
vertex[1] + outgoing[1] * radius2
|
|
89795
89893
|
];
|
|
89796
|
-
if (!
|
|
89894
|
+
if (!entry4.every(Number.isFinite) || !exit2.every(Number.isFinite) || point3(...entry4) === point3(...vertex) || point3(...exit2) === point3(...vertex))
|
|
89797
89895
|
return void 0;
|
|
89798
89896
|
const sweep = incoming[0] * outgoing[1] - incoming[1] * outgoing[0] > 0 ? 1 : 0;
|
|
89799
89897
|
commands.push(
|
|
89800
|
-
`L ${point3(...
|
|
89898
|
+
`L ${point3(...entry4)}`,
|
|
89801
89899
|
`A ${point3(radius2, radius2)} 0 0 ${sweep} ${point3(...exit2)}`
|
|
89802
89900
|
);
|
|
89803
89901
|
extraCommands++;
|
|
@@ -90104,8 +90202,8 @@ function color3(cells3, name3, fallback, resources, report, themeCells = cells3,
|
|
|
90104
90202
|
if (value3 === void 0) return fallback;
|
|
90105
90203
|
if (/^#[0-9a-f]{6}$/i.test(value3)) return value3;
|
|
90106
90204
|
if (/^\d+$/.test(value3)) {
|
|
90107
|
-
const
|
|
90108
|
-
if (
|
|
90205
|
+
const entry4 = resources.colors.get(value3) ?? PALETTE[Number(value3)];
|
|
90206
|
+
if (entry4 && /^#[0-9a-f]{6}$/i.test(entry4)) return entry4;
|
|
90109
90207
|
}
|
|
90110
90208
|
if (value3 === "Themed") {
|
|
90111
90209
|
const resolved = themeColor2(themeCells, name3, resources, report, gradientRendered);
|
|
@@ -90173,15 +90271,27 @@ function shapeStyle2(sheet2, resources, report, width = number2(sheet2.cells, "W
|
|
|
90173
90271
|
report,
|
|
90174
90272
|
themedEffects
|
|
90175
90273
|
);
|
|
90176
|
-
const
|
|
90274
|
+
const themedSolid = themeSolid(
|
|
90275
|
+
cells3,
|
|
90276
|
+
resources,
|
|
90277
|
+
color3(cells3, "FillForegnd", "#ffffff", resources, () => {
|
|
90278
|
+
})
|
|
90279
|
+
);
|
|
90280
|
+
const bevel2 = shapeBevel(cells3, themedSolid);
|
|
90281
|
+
const solidColor2 = (name3, fallback) => color3(cells3, name3, fallback, resources, report);
|
|
90282
|
+
const extrusion = shapeExtrusion(cells3, !!bevel2, solidColor2);
|
|
90283
|
+
const contour = shapeContour(cells3, !!bevel2, themedSolid, solidColor2);
|
|
90177
90284
|
const rotation3d = shapeRotation3d(cells3);
|
|
90178
|
-
if (bevel2 || rotation3d)
|
|
90285
|
+
if (bevel2 && (bevel2.width > 0 || bevel2.height > 0) || rotation3d || extrusion || contour)
|
|
90179
90286
|
report(
|
|
90180
90287
|
"approximated-3d",
|
|
90181
|
-
"Bevel
|
|
90288
|
+
"Bevel, 3-D rotation, perspective, extrusion and contour are approximations: a lighting overlay, a projection and flat-shaded side faces, not Visio's renderer."
|
|
90182
90289
|
);
|
|
90183
90290
|
if (hasUndrawnBevel(cells3))
|
|
90184
|
-
report(
|
|
90291
|
+
report(
|
|
90292
|
+
"unsupported-bevel",
|
|
90293
|
+
"Bottom bevels are not drawn (Visio 16 shows no change on the front of a shape)."
|
|
90294
|
+
);
|
|
90185
90295
|
const themedBegin = themeArrow(cells3, resources, "Begin");
|
|
90186
90296
|
const themedEnd = themeArrow(cells3, resources, "End");
|
|
90187
90297
|
const cap = lineCap(cells3, resources, report);
|
|
@@ -90209,6 +90319,8 @@ function shapeStyle2(sheet2, resources, report, width = number2(sheet2.cells, "W
|
|
|
90209
90319
|
...shadow ? { shadow } : {},
|
|
90210
90320
|
...effects,
|
|
90211
90321
|
...bevel2 ? { bevel: bevel2 } : {},
|
|
90322
|
+
...extrusion ? { extrusion } : {},
|
|
90323
|
+
...contour ? { contour } : {},
|
|
90212
90324
|
...rotation3d ? { rotation3d } : {}
|
|
90213
90325
|
};
|
|
90214
90326
|
}
|
|
@@ -90522,7 +90634,7 @@ var VISIO_BUILT_IN_THEMES = [
|
|
|
90522
90634
|
)
|
|
90523
90635
|
];
|
|
90524
90636
|
function visioBuiltInTheme(id5) {
|
|
90525
|
-
return VISIO_BUILT_IN_THEMES.find((
|
|
90637
|
+
return VISIO_BUILT_IN_THEMES.find((entry4) => entry4.id === id5);
|
|
90526
90638
|
}
|
|
90527
90639
|
function visioThemeVariantColors(source3, variant) {
|
|
90528
90640
|
const accents = source3.colors.slice(4, 10);
|
|
@@ -90546,7 +90658,7 @@ function visioPageTheme(themes, pageCells) {
|
|
|
90546
90658
|
const light = drawingColor(theme3.colors.get("lt1"), theme3.colors);
|
|
90547
90659
|
const dark = drawingColor(theme3.colors.get("dk1"), theme3.colors);
|
|
90548
90660
|
const builtIn = VISIO_BUILT_IN_THEMES.find(
|
|
90549
|
-
(
|
|
90661
|
+
(entry4) => entry4.schemeId === id5 && entry4.name === theme3.name
|
|
90550
90662
|
);
|
|
90551
90663
|
return {
|
|
90552
90664
|
name: theme3.name ?? `Theme ${id5}`,
|
|
@@ -90575,7 +90687,7 @@ function visioPageThemeSchemes(themes, pageCells) {
|
|
|
90575
90687
|
if (!themes || id5 === void 0 || id5 === 0 || id5 >= 65534) continue;
|
|
90576
90688
|
const matches3 = themes.filter((theme3) => theme3[field2] === id5);
|
|
90577
90689
|
const builtIn = matches3.length === 1 ? VISIO_BUILT_IN_THEMES.find(
|
|
90578
|
-
(
|
|
90690
|
+
(entry4) => entry4.schemeId === id5 && entry4.name === matches3[0].name
|
|
90579
90691
|
) : void 0;
|
|
90580
90692
|
if (builtIn) result2[key2] = builtIn.id;
|
|
90581
90693
|
}
|
|
@@ -90986,7 +91098,7 @@ function optionsKey(options2) {
|
|
|
90986
91098
|
const { metafileConverter: _converter, pages: _pages, documentCache: _cache, ...rest } = options2;
|
|
90987
91099
|
return JSON.stringify(rest);
|
|
90988
91100
|
}
|
|
90989
|
-
var cacheMatches = (
|
|
91101
|
+
var cacheMatches = (entry4, pkg, options2) => entry4 !== void 0 && entry4.options === optionsKey(options2) && entry4.converter === options2.metafileConverter && entry4.reads.every(([path4, print]) => pkg.printOf(path4) === print);
|
|
90990
91102
|
async function readDocumentLevel(pkg, documentPart, options2, checkTime, forward) {
|
|
90991
91103
|
const reports = [];
|
|
90992
91104
|
const report = (...args) => {
|
|
@@ -91066,8 +91178,8 @@ var VISIO_COMMENT_LIMIT = 1e4;
|
|
|
91066
91178
|
var VISIO_COMMENT_TEXT_LIMIT = 16384;
|
|
91067
91179
|
var VISIO_COMMENT_AUTHOR_LIMIT = 256;
|
|
91068
91180
|
var unsigned = (value3) => value3 !== void 0 && /^(0|[1-9]\d{0,9})$/.test(value3) && Number(value3) <= 4294967295 ? value3 : void 0;
|
|
91069
|
-
function visioCommentId(
|
|
91070
|
-
return unsigned(attribute3(
|
|
91181
|
+
function visioCommentId(entry4, index5) {
|
|
91182
|
+
return unsigned(attribute3(entry4, "CommentID")) ?? `n${index5}`;
|
|
91071
91183
|
}
|
|
91072
91184
|
async function readVisioComments(pkg, documentPart, report) {
|
|
91073
91185
|
const path4 = await related(pkg, documentPart, "comments", false);
|
|
@@ -91092,10 +91204,10 @@ async function readVisioComments(pkg, documentPart, report) {
|
|
|
91092
91204
|
const comments = [];
|
|
91093
91205
|
const ids = /* @__PURE__ */ new Set();
|
|
91094
91206
|
let characters = 0;
|
|
91095
|
-
entries.slice(0, VISIO_COMMENT_LIMIT).forEach((
|
|
91096
|
-
const pageId2 = unsigned(attribute3(
|
|
91097
|
-
const id5 = visioCommentId(
|
|
91098
|
-
const text9 =
|
|
91207
|
+
entries.slice(0, VISIO_COMMENT_LIMIT).forEach((entry4, index5) => {
|
|
91208
|
+
const pageId2 = unsigned(attribute3(entry4, "PageID"));
|
|
91209
|
+
const id5 = visioCommentId(entry4, index5);
|
|
91210
|
+
const text9 = entry4.textContent ?? "";
|
|
91099
91211
|
characters += text9.length;
|
|
91100
91212
|
if (pageId2 === void 0 || ids.has(id5) || characters > 1e6) {
|
|
91101
91213
|
report(
|
|
@@ -91108,10 +91220,10 @@ async function readVisioComments(pkg, documentPart, report) {
|
|
|
91108
91220
|
return;
|
|
91109
91221
|
}
|
|
91110
91222
|
ids.add(id5);
|
|
91111
|
-
const shapeId2 = unsigned(attribute3(
|
|
91112
|
-
const author = authors.get(attribute3(
|
|
91113
|
-
const date6 = attribute3(
|
|
91114
|
-
const editDate = attribute3(
|
|
91223
|
+
const shapeId2 = unsigned(attribute3(entry4, "ShapeID"));
|
|
91224
|
+
const author = authors.get(attribute3(entry4, "AuthorID") ?? "");
|
|
91225
|
+
const date6 = attribute3(entry4, "Date");
|
|
91226
|
+
const editDate = attribute3(entry4, "EditDate");
|
|
91115
91227
|
comments.push({
|
|
91116
91228
|
id: id5,
|
|
91117
91229
|
pageId: pageId2,
|
|
@@ -91121,7 +91233,7 @@ async function readVisioComments(pkg, documentPart, report) {
|
|
|
91121
91233
|
...date6 ? { date: date6.slice(0, 64) } : {},
|
|
91122
91234
|
...editDate ? { editDate: editDate.slice(0, 64) } : {},
|
|
91123
91235
|
text: text9.slice(0, VISIO_COMMENT_TEXT_LIMIT),
|
|
91124
|
-
...yes(attribute3(
|
|
91236
|
+
...yes(attribute3(entry4, "Done")) ? { done: true } : {}
|
|
91125
91237
|
});
|
|
91126
91238
|
});
|
|
91127
91239
|
return comments;
|
|
@@ -94118,9 +94230,28 @@ function createLine(root, document, edit2) {
|
|
|
94118
94230
|
setCell(row3, "Y", 0);
|
|
94119
94231
|
section3.appendChild(row3);
|
|
94120
94232
|
}
|
|
94233
|
+
if (edit2.text !== void 0) appendLineTextCells(shape2, width);
|
|
94121
94234
|
shape2.appendChild(section3);
|
|
94235
|
+
if (edit2.text !== void 0) {
|
|
94236
|
+
const text9 = root.ownerDocument.createElementNS(root.namespaceURI, "Text");
|
|
94237
|
+
text9.appendChild(root.ownerDocument.createTextNode(encodeVisioPlainText(edit2.text)));
|
|
94238
|
+
shape2.appendChild(text9);
|
|
94239
|
+
}
|
|
94122
94240
|
return shape2;
|
|
94123
94241
|
}
|
|
94242
|
+
function appendLineTextCells(shape2, width) {
|
|
94243
|
+
const box6 = Math.max(0.5, Math.min(width, 1.2));
|
|
94244
|
+
const entries = [
|
|
94245
|
+
["TxtPinX", width / 2, "Width*0.5"],
|
|
94246
|
+
["TxtPinY", 0, "Height*0.5"],
|
|
94247
|
+
["TxtWidth", box6],
|
|
94248
|
+
["TxtHeight", 0.25],
|
|
94249
|
+
["TxtLocPinX", box6 / 2, "TxtWidth*0.5"],
|
|
94250
|
+
["TxtLocPinY", 0.125, "TxtHeight*0.5"],
|
|
94251
|
+
["TxtAngle", 0, "-Angle"]
|
|
94252
|
+
];
|
|
94253
|
+
for (const [name3, value3, formula2] of entries) setCell(shape2, name3, value3, formula2);
|
|
94254
|
+
}
|
|
94124
94255
|
|
|
94125
94256
|
// visio/path-fit.ts
|
|
94126
94257
|
var distance3 = (a2, b) => Math.hypot(b.x - a2.x, b.y - a2.y);
|
|
@@ -95891,13 +96022,17 @@ function effectiveNumber(cells3, name3, fallback) {
|
|
|
95891
96022
|
fail3("UNSUPPORTED_GEOMETRY_EDIT", `${name3} of the stencil shape is out of range.`);
|
|
95892
96023
|
return value3;
|
|
95893
96024
|
}
|
|
95894
|
-
var sectionRows2 = (shape2, name3) => children3(shape2, "Section").filter((section3) => attribute3(section3, "N") === name3 && !deleted(section3)).flatMap(
|
|
96025
|
+
var sectionRows2 = (shape2, name3) => children3(shape2, "Section").filter((section3) => attribute3(section3, "N") === name3 && !deleted(section3)).flatMap(
|
|
96026
|
+
(section3) => children3(section3, "Row").map((row3, position3) => ({
|
|
96027
|
+
row: row3,
|
|
96028
|
+
index: attribute3(row3, "IX") === void 0 ? position3 : Number(attribute3(row3, "IX"))
|
|
96029
|
+
}))
|
|
96030
|
+
);
|
|
95895
96031
|
function effectiveRows(shape2, section3) {
|
|
95896
96032
|
const rows = /* @__PURE__ */ new Map();
|
|
95897
96033
|
const gone = /* @__PURE__ */ new Set();
|
|
95898
96034
|
for (const source3 of [templates2.get(shape2), shape2])
|
|
95899
|
-
for (const row3 of sectionRows2(source3, section3)) {
|
|
95900
|
-
const index5 = Number(attribute3(row3, "IX") ?? "0");
|
|
96035
|
+
for (const { row: row3, index: index5 } of sectionRows2(source3, section3)) {
|
|
95901
96036
|
if (deleted(row3)) {
|
|
95902
96037
|
gone.add(index5);
|
|
95903
96038
|
continue;
|
|
@@ -96389,7 +96524,7 @@ var PASSIVE = /* @__PURE__ */ new Set([
|
|
|
96389
96524
|
"Reviewer",
|
|
96390
96525
|
"Annotation"
|
|
96391
96526
|
]);
|
|
96392
|
-
var LENGTHS2 = /^(width|height|pinx|piny|locpinx|locpiny|txtpinx|txtpiny|txtwidth|txtheight|txtlocpinx|txtlocpiny|beginx|beginy|endx|endy)$/;
|
|
96527
|
+
var LENGTHS2 = /^(width|height|pinx|piny|locpinx|locpiny|txtpinx|txtpiny|txtwidth|txtheight|txtlocpinx|txtlocpiny|beginx|beginy|endx|endy|lineweight|imgoffsetx|imgoffsety|imgwidth|imgheight)$/;
|
|
96393
96528
|
function expectedUnit(cell2) {
|
|
96394
96529
|
const unit4 = attribute3(cell2.local, "U") ?? attribute3(cell2.inherited, "U");
|
|
96395
96530
|
if (unit4 === void 0 && cell2.section && PASSIVE.has(cell2.section.name)) return void 0;
|
|
@@ -96407,7 +96542,12 @@ function expectedUnit(cell2) {
|
|
|
96407
96542
|
return "length";
|
|
96408
96543
|
return !cell2.relative && /^(geometry\d+|connections|controls)\.[xy]\d+$/.test(name3) ? "length" : "scalar";
|
|
96409
96544
|
}
|
|
96410
|
-
function
|
|
96545
|
+
function untaggedLength(cell2) {
|
|
96546
|
+
if (cell2.section?.name !== "User") return void 0;
|
|
96547
|
+
const formula2 = effectiveFormula(cell2);
|
|
96548
|
+
return formula2 && /^\s*[\d.]+\s*(?:MM|CM|IN|FT|M)/i.test(formula2) ? "length" : void 0;
|
|
96549
|
+
}
|
|
96550
|
+
function recalculateInstanceCaches(target3, changed, check4, pins = /* @__PURE__ */ new Map(), text9, keepTextSize = false) {
|
|
96411
96551
|
const scope = "sheets" in target3 ? target3 : singleScope(target3);
|
|
96412
96552
|
const overrides = new Map(changed);
|
|
96413
96553
|
const pinned = /* @__PURE__ */ new Map();
|
|
@@ -96429,11 +96569,11 @@ function recalculateInstanceCaches(target3, changed, check4, pins = /* @__PURE__
|
|
|
96429
96569
|
try {
|
|
96430
96570
|
const ast = parseVisioFormula(source3);
|
|
96431
96571
|
const analysis = analyzeVisioFormula(ast);
|
|
96432
|
-
const sized =
|
|
96572
|
+
const sized = analysis.dynamic && (text9 || keepTextSize) ? textSizeFormula(ast) : void 0;
|
|
96433
96573
|
result2 = sized ? {
|
|
96434
96574
|
ast,
|
|
96435
96575
|
local,
|
|
96436
|
-
text: true,
|
|
96576
|
+
...text9 ? { text: true } : { deferText: true },
|
|
96437
96577
|
references: sized.references.flatMap((ref) => found(ref.cell, ref.shapeId))
|
|
96438
96578
|
} : analysis.dynamic ? { local, references: mentioned() } : {
|
|
96439
96579
|
ast,
|
|
@@ -96479,22 +96619,42 @@ function recalculateInstanceCaches(target3, changed, check4, pins = /* @__PURE__
|
|
|
96479
96619
|
if (!node4 || node4.hasAttribute("E")) throw new Unevaluable();
|
|
96480
96620
|
try {
|
|
96481
96621
|
const value3 = visioFormulaCachedValue(attribute3(node4, "V") ?? "", attribute3(node4, "U"));
|
|
96482
|
-
const unit4 = expectedUnit(cell2);
|
|
96622
|
+
const unit4 = expectedUnit(cell2) ?? untaggedLength(cell2);
|
|
96483
96623
|
return value3.unit === "scalar" && unit4 && unit4 !== "scalar" ? { ...value3, unit: unit4 } : value3;
|
|
96484
96624
|
} catch {
|
|
96485
96625
|
throw new Unevaluable();
|
|
96486
96626
|
}
|
|
96487
96627
|
};
|
|
96628
|
+
const tainted = /* @__PURE__ */ new Set();
|
|
96629
|
+
let sawDeferred = false;
|
|
96488
96630
|
const evaluate = (cell2) => {
|
|
96631
|
+
const outer = sawDeferred;
|
|
96632
|
+
sawDeferred = false;
|
|
96633
|
+
try {
|
|
96634
|
+
const result2 = evaluateCell(cell2);
|
|
96635
|
+
if (sawDeferred) tainted.add(cell2);
|
|
96636
|
+
return result2;
|
|
96637
|
+
} finally {
|
|
96638
|
+
sawDeferred = sawDeferred || outer;
|
|
96639
|
+
}
|
|
96640
|
+
};
|
|
96641
|
+
const evaluateCell = (cell2) => {
|
|
96489
96642
|
check4();
|
|
96490
96643
|
if (--steps < 0)
|
|
96491
96644
|
fail3("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
96492
96645
|
const override = overrides.get(cell2);
|
|
96493
96646
|
if (override !== void 0) return { value: override, unit: expectedUnit(cell2) ?? "scalar" };
|
|
96494
96647
|
const known = values2.get(cell2);
|
|
96495
|
-
if (known)
|
|
96648
|
+
if (known) {
|
|
96649
|
+
if (tainted.has(cell2)) sawDeferred = true;
|
|
96650
|
+
return known;
|
|
96651
|
+
}
|
|
96496
96652
|
if (!isAffected(cell2, /* @__PURE__ */ new Set())) return cached7(cell2);
|
|
96497
96653
|
const own3 = dependenciesOf(cell2);
|
|
96654
|
+
if (own3?.deferText) {
|
|
96655
|
+
sawDeferred = true;
|
|
96656
|
+
return cached7(cell2);
|
|
96657
|
+
}
|
|
96498
96658
|
const ast = own3?.ast;
|
|
96499
96659
|
if (!ast || evaluating.has(cell2)) throw new Unevaluable();
|
|
96500
96660
|
evaluating.add(cell2);
|
|
@@ -96538,9 +96698,11 @@ function recalculateInstanceCaches(target3, changed, check4, pins = /* @__PURE__
|
|
|
96538
96698
|
let value3;
|
|
96539
96699
|
let length;
|
|
96540
96700
|
try {
|
|
96701
|
+
sawDeferred = false;
|
|
96541
96702
|
const result2 = evaluate(cell2);
|
|
96542
96703
|
value3 = result2.value;
|
|
96543
96704
|
length = result2.unit === "length";
|
|
96705
|
+
if (tainted.has(cell2) && cell2.section && PASSIVE.has(cell2.section.name)) continue;
|
|
96544
96706
|
} catch (error62) {
|
|
96545
96707
|
if (!(error62 instanceof Unevaluable)) throw error62;
|
|
96546
96708
|
if (cell2.section && PASSIVE.has(cell2.section.name)) continue;
|
|
@@ -97923,12 +98085,12 @@ function pathVertices(sheet2, width, height, writes) {
|
|
|
97923
98085
|
return refuse();
|
|
97924
98086
|
}
|
|
97925
98087
|
}
|
|
97926
|
-
const
|
|
97927
|
-
|
|
97928
|
-
rows.set(item2.row,
|
|
98088
|
+
const entry4 = rows.get(item2.row) ?? { relative: item2.relative };
|
|
98089
|
+
entry4[item2.name === "X" ? "x" : "y"] = number10;
|
|
98090
|
+
rows.set(item2.row, entry4);
|
|
97929
98091
|
}
|
|
97930
|
-
return [...rows.values()].filter((
|
|
97931
|
-
(
|
|
98092
|
+
return [...rows.values()].filter((entry4) => entry4.x !== void 0 && entry4.y !== void 0).map(
|
|
98093
|
+
(entry4) => entry4.relative ? { x: entry4.x * width, y: entry4.y * height } : { x: entry4.x, y: entry4.y }
|
|
97932
98094
|
);
|
|
97933
98095
|
}
|
|
97934
98096
|
function layoutStencilLine(root, pageId2, shape2, ends, check4) {
|
|
@@ -98685,7 +98847,7 @@ var designTextMeasurer = {
|
|
|
98685
98847
|
return em === void 0 ? void 0 : em * style4.fontSize + (style4.letterSpacing ?? 0) * text9.length;
|
|
98686
98848
|
}
|
|
98687
98849
|
};
|
|
98688
|
-
function
|
|
98850
|
+
function measure5(text9, style4) {
|
|
98689
98851
|
for (const measurer of [designTextMeasurer]) {
|
|
98690
98852
|
const width = measurer.width(text9, style4);
|
|
98691
98853
|
if (width !== void 0 && Number.isFinite(width) && width >= 0)
|
|
@@ -98729,7 +98891,7 @@ function layoutParagraph(pieces, fallback, paragraph2, available) {
|
|
|
98729
98891
|
for (const piece of pieces) {
|
|
98730
98892
|
for (const token2 of piece.text.match(/ +|[^ ]+/g) ?? []) {
|
|
98731
98893
|
if (UNSUPPORTED2.test(token2)) return void 0;
|
|
98732
|
-
const measured =
|
|
98894
|
+
const measured = measure5(token2, piece.run);
|
|
98733
98895
|
if (!measured) return void 0;
|
|
98734
98896
|
if (token2.startsWith(" ")) {
|
|
98735
98897
|
if (width > 0) pending3 += measured.width;
|
|
@@ -98745,7 +98907,7 @@ function layoutParagraph(pieces, fallback, paragraph2, available) {
|
|
|
98745
98907
|
pending3 = 0;
|
|
98746
98908
|
if (start === 0 && Number.isFinite(room()) && measured.width > room()) {
|
|
98747
98909
|
for (const character of token2) {
|
|
98748
|
-
const one2 =
|
|
98910
|
+
const one2 = measure5(character, piece.run);
|
|
98749
98911
|
if (!one2) return void 0;
|
|
98750
98912
|
const edge2 = room();
|
|
98751
98913
|
if (width > 0) {
|
|
@@ -98797,7 +98959,7 @@ function visioTextExtents(text9) {
|
|
|
98797
98959
|
width(maximum) {
|
|
98798
98960
|
const inner2 = maximum === void 0 ? Infinity : maximum - text9.margins.left - text9.margins.right;
|
|
98799
98961
|
const laid = layout3(inner2);
|
|
98800
|
-
const mark =
|
|
98962
|
+
const mark = measure5(" ", text9.runs.at(-1) ?? fallback);
|
|
98801
98963
|
if (!laid || !mark) return void 0;
|
|
98802
98964
|
let widest = 0;
|
|
98803
98965
|
laid.forEach((lines3, index5) => {
|
|
@@ -99555,7 +99717,9 @@ async function applyInstanceGeometryEdit(roots, edit2, template2, check4) {
|
|
|
99555
99717
|
scope,
|
|
99556
99718
|
overrides,
|
|
99557
99719
|
check4,
|
|
99558
|
-
new Map(pins.map((item2) => [item2, item2 === cell2("Width") ? width : height]))
|
|
99720
|
+
new Map(pins.map((item2) => [item2, item2 === cell2("Width") ? width : height])),
|
|
99721
|
+
void 0,
|
|
99722
|
+
true
|
|
99559
99723
|
);
|
|
99560
99724
|
for (const [item2, value3] of pinned) {
|
|
99561
99725
|
assertOverridable(item2, "The size");
|
|
@@ -103273,13 +103437,13 @@ function masterMediaParts(media, directory, taken, types, existing) {
|
|
|
103273
103437
|
node4.setAttribute("Target", `../media/${part.slice(folder.length)}`);
|
|
103274
103438
|
rels.appendChild(node4);
|
|
103275
103439
|
const known = Array.from(types.getElementsByTagNameNS(types.namespaceURI, "Default")).some(
|
|
103276
|
-
(
|
|
103440
|
+
(entry4) => entry4.getAttribute("Extension")?.toLowerCase() === extension2
|
|
103277
103441
|
);
|
|
103278
103442
|
if (!known) {
|
|
103279
|
-
const
|
|
103280
|
-
|
|
103281
|
-
|
|
103282
|
-
types.insertBefore(
|
|
103443
|
+
const entry4 = types.ownerDocument.createElementNS(types.namespaceURI, "Default");
|
|
103444
|
+
entry4.setAttribute("Extension", extension2);
|
|
103445
|
+
entry4.setAttribute("ContentType", MEDIA_TYPES[extension2] ?? "application/octet-stream");
|
|
103446
|
+
types.insertBefore(entry4, types.firstChild);
|
|
103283
103447
|
}
|
|
103284
103448
|
}
|
|
103285
103449
|
return { rels, parts };
|
|
@@ -103308,17 +103472,17 @@ async function addMasterToDrawing(source3, spec2, limits, maxOutput, deadline, c
|
|
|
103308
103472
|
if (entries.length >= MAX_MASTERS)
|
|
103309
103473
|
fail3("LIMIT_EDITS", "The drawing holds too many masters to add another.");
|
|
103310
103474
|
const same17 = (value3, other) => value3?.toLowerCase() === other.toLowerCase();
|
|
103311
|
-
const ours = spec2.uniqueId && entries.find((
|
|
103475
|
+
const ours = spec2.uniqueId && entries.find((entry4) => same17(attribute3(entry4, "UniqueID"), spec2.uniqueId));
|
|
103312
103476
|
if (ours) return { bytes: source3, masterId: attribute3(ours, "ID") ?? "", changedParts: [] };
|
|
103313
103477
|
const name3 = spec2.name;
|
|
103314
103478
|
const reused = await spec2.reuse?.({ pkg, existingPart, entries, check: check4 });
|
|
103315
103479
|
if (reused !== void 0) return { bytes: source3, masterId: reused, changedParts: [] };
|
|
103316
|
-
const ids = entries.map((
|
|
103480
|
+
const ids = entries.map((entry4) => Number(attribute3(entry4, "ID")));
|
|
103317
103481
|
if (ids.some((id6) => !Number.isSafeInteger(id6) || id6 < 0))
|
|
103318
103482
|
fail3("UNSUPPORTED_EDIT_PACKAGE", "The drawing has masters without canonical IDs.");
|
|
103319
103483
|
const id5 = String(Math.max(1, ...ids.map((value3) => value3 + 1)));
|
|
103320
103484
|
const names = new Set(
|
|
103321
|
-
entries.flatMap((
|
|
103485
|
+
entries.flatMap((entry4) => [attribute3(entry4, "NameU"), attribute3(entry4, "Name")])
|
|
103322
103486
|
);
|
|
103323
103487
|
const unique4 = names.has(name3) ? `${name3}.${id5}` : name3;
|
|
103324
103488
|
const relsPart = relationshipsPartFor(mastersPart);
|
|
@@ -103358,11 +103522,11 @@ async function addMasterToDrawing(source3, spec2, limits, maxOutput, deadline, c
|
|
|
103358
103522
|
spec2.entry(masters, id5, unique4, relId);
|
|
103359
103523
|
const documentCopy = copy2(document);
|
|
103360
103524
|
let documentTouched = false;
|
|
103361
|
-
const
|
|
103525
|
+
const contents2 = await spec2.contents(documentCopy, () => documentTouched = true);
|
|
103362
103526
|
const dirty = /* @__PURE__ */ new Map([
|
|
103363
103527
|
[mastersPart, masters],
|
|
103364
103528
|
[relsPart, rels],
|
|
103365
|
-
[masterPart,
|
|
103529
|
+
[masterPart, contents2],
|
|
103366
103530
|
["[Content_Types].xml", types]
|
|
103367
103531
|
]);
|
|
103368
103532
|
if (documentTouched) dirty.set(documentPart, documentCopy);
|
|
@@ -103670,18 +103834,18 @@ async function ensureStencilMaster(source3, master2, limits, maxOutput, deadline
|
|
|
103670
103834
|
uniqueId: builtIn.uniqueId,
|
|
103671
103835
|
name: name3,
|
|
103672
103836
|
async reuse({ pkg, existingPart, entries, check: tick }) {
|
|
103673
|
-
for (const
|
|
103837
|
+
for (const entry4 of entries) {
|
|
103674
103838
|
tick();
|
|
103675
|
-
if (!existingPart || !same17(attribute3(
|
|
103839
|
+
if (!existingPart || !same17(attribute3(entry4, "NameU") ?? attribute3(entry4, "Name"), name3))
|
|
103676
103840
|
continue;
|
|
103677
103841
|
try {
|
|
103678
|
-
const part = await indexedPart(pkg, existingPart,
|
|
103842
|
+
const part = await indexedPart(pkg, existingPart, entry4, "master");
|
|
103679
103843
|
const roots = shapesOf2(await visioXml(pkg, part, "MasterContents")).filter(
|
|
103680
103844
|
(shape2) => attribute3(shape2, "Del") !== "1"
|
|
103681
103845
|
);
|
|
103682
103846
|
const cells3 = new Set(children3(roots[0], "Cell").map((cell2) => attribute3(cell2, "N")));
|
|
103683
103847
|
if (roots.length === 1 && !cells3.has("BeginX") && !roots[0].hasAttribute("Master"))
|
|
103684
|
-
return attribute3(
|
|
103848
|
+
return attribute3(entry4, "ID") ?? "";
|
|
103685
103849
|
} catch {
|
|
103686
103850
|
}
|
|
103687
103851
|
}
|
|
@@ -103773,26 +103937,26 @@ async function importStencilMaster(source3, stencil, stencilMasterId, limits, ma
|
|
|
103773
103937
|
const stencilDocument = await visioXml(pkg, documentPart, "VisioDocument");
|
|
103774
103938
|
const mastersPart = await related(pkg, documentPart, "masters", false);
|
|
103775
103939
|
if (!mastersPart) fail3("EDIT_TARGET_NOT_FOUND", "The stencil has no masters.");
|
|
103776
|
-
const
|
|
103940
|
+
const entry4 = children3(await visioXml(pkg, mastersPart, "Masters"), "Master").find(
|
|
103777
103941
|
(node4) => attribute3(node4, "ID") === stencilMasterId
|
|
103778
103942
|
);
|
|
103779
|
-
if (!
|
|
103780
|
-
const part = await indexedPart(pkg, mastersPart,
|
|
103943
|
+
if (!entry4) fail3("EDIT_TARGET_NOT_FOUND", "The stencil has no such master.");
|
|
103944
|
+
const part = await indexedPart(pkg, mastersPart, entry4, "master");
|
|
103781
103945
|
const media = await masterPictures(pkg, part);
|
|
103782
|
-
const
|
|
103783
|
-
const name3 = attribute3(
|
|
103946
|
+
const contents2 = await visioXml(pkg, part, "MasterContents");
|
|
103947
|
+
const name3 = attribute3(entry4, "NameU") ?? attribute3(entry4, "Name") ?? `Master ${stencilMasterId}`;
|
|
103784
103948
|
return addMasterToDrawing(
|
|
103785
103949
|
source3,
|
|
103786
103950
|
{
|
|
103787
|
-
uniqueId: attribute3(
|
|
103951
|
+
uniqueId: attribute3(entry4, "UniqueID") ?? "",
|
|
103788
103952
|
name: name3,
|
|
103789
103953
|
entry(masters, id5, unique4, relationshipId) {
|
|
103790
|
-
const node4 = masters.ownerDocument.importNode(
|
|
103954
|
+
const node4 = masters.ownerDocument.importNode(entry4, true);
|
|
103791
103955
|
if (node4.namespaceURI !== masters.namespaceURI)
|
|
103792
103956
|
fail3("UNSUPPORTED_EDIT_PACKAGE", "The stencil uses another Visio namespace.");
|
|
103793
103957
|
node4.setAttribute("ID", id5);
|
|
103794
103958
|
node4.setAttribute("NameU", unique4);
|
|
103795
|
-
if (node4.hasAttribute("Name") && attribute3(
|
|
103959
|
+
if (node4.hasAttribute("Name") && attribute3(entry4, "Name") === name3)
|
|
103796
103960
|
node4.setAttribute("Name", unique4);
|
|
103797
103961
|
for (const sheet2 of children3(node4, "PageSheet"))
|
|
103798
103962
|
for (const style4 of STYLE_ATTRIBUTES)
|
|
@@ -103803,7 +103967,7 @@ async function importStencilMaster(source3, stencil, stencilMasterId, limits, ma
|
|
|
103803
103967
|
media,
|
|
103804
103968
|
contents(document, touch) {
|
|
103805
103969
|
const map2 = styleMapper(stencilDocument, document, touch);
|
|
103806
|
-
const root = copy2(
|
|
103970
|
+
const root = copy2(contents2);
|
|
103807
103971
|
if (root.namespaceURI !== document.namespaceURI)
|
|
103808
103972
|
fail3("UNSUPPORTED_EDIT_PACKAGE", "The stencil uses another Visio namespace.");
|
|
103809
103973
|
for (const shape2 of Array.from(root.getElementsByTagNameNS(root.namespaceURI, "Shape")))
|
|
@@ -105860,7 +106024,7 @@ function visioFallbackQuickStyle(style4) {
|
|
|
105860
106024
|
return { fill: mix2(base3, 0, 0.5), line: mix2(base3, 0, 0.5), font: light };
|
|
105861
106025
|
}
|
|
105862
106026
|
}
|
|
105863
|
-
var
|
|
106027
|
+
var rgb3 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
|
|
105864
106028
|
function shadowWrites(preset, add5) {
|
|
105865
106029
|
if (preset === "none") {
|
|
105866
106030
|
add5("ShdwPattern", 0, "FillStyle");
|
|
@@ -105868,7 +106032,7 @@ function shadowWrites(preset, add5) {
|
|
|
105868
106032
|
}
|
|
105869
106033
|
const { x, y, blur } = visioShadowPresetGeometry(preset);
|
|
105870
106034
|
add5("ShdwPattern", 1, "FillStyle");
|
|
105871
|
-
add5("ShdwForegnd", "#000000", "FillStyle", void 0,
|
|
106035
|
+
add5("ShdwForegnd", "#000000", "FillStyle", void 0, rgb3("#000000"));
|
|
105872
106036
|
add5("ShdwForegndTrans", 0.6, "FillStyle");
|
|
105873
106037
|
add5("ShapeShdwType", 1, "FillStyle");
|
|
105874
106038
|
add5("ShapeShdwOffsetX", x / 72, "FillStyle", "PT");
|
|
@@ -105897,7 +106061,7 @@ async function quickStyleWrites(pkg, document, shape2, pageId2, style4, add5, ch
|
|
|
105897
106061
|
);
|
|
105898
106062
|
for (const [name3, value3, category] of selectors2) add5(name3, value3, category);
|
|
105899
106063
|
const fallback = visioFallbackQuickStyle(style4);
|
|
105900
|
-
const paint3 = (name3, category, color4) => themed ? add5(name3, "Themed", category, void 0, "THEMEVAL()") : add5(name3, color4, category, void 0,
|
|
106064
|
+
const paint3 = (name3, category, color4) => themed ? add5(name3, "Themed", category, void 0, "THEMEVAL()") : add5(name3, color4, category, void 0, rgb3(color4));
|
|
105901
106065
|
add5("FillPattern", 1, "FillStyle");
|
|
105902
106066
|
add5("FillForegndTrans", 0, "FillStyle");
|
|
105903
106067
|
add5("LinePattern", 1, "LineStyle");
|
|
@@ -105962,12 +106126,12 @@ function snapshotReflection(value3) {
|
|
|
105962
106126
|
blur: bounded3(value3.blur, 100, "Reflection blur must be 0 to 100 points.")
|
|
105963
106127
|
};
|
|
105964
106128
|
}
|
|
105965
|
-
var
|
|
106129
|
+
var rgb4 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
|
|
105966
106130
|
function effectWrites(edit2, add5) {
|
|
105967
106131
|
if (edit2.glow) {
|
|
105968
106132
|
add5("GlowSize", edit2.glow.size / 72, "FillStyle", "PT");
|
|
105969
106133
|
if (edit2.glow.size > 0) {
|
|
105970
|
-
add5("GlowColor", edit2.glow.color, "FillStyle", void 0,
|
|
106134
|
+
add5("GlowColor", edit2.glow.color, "FillStyle", void 0, rgb4(edit2.glow.color));
|
|
105971
106135
|
add5("GlowColorTrans", edit2.glow.transparency / 100, "FillStyle");
|
|
105972
106136
|
}
|
|
105973
106137
|
}
|
|
@@ -106191,7 +106355,11 @@ function snapshotFormatting(edit2) {
|
|
|
106191
106355
|
"softEdges",
|
|
106192
106356
|
"reflection",
|
|
106193
106357
|
"bevel",
|
|
106194
|
-
"rotation3d"
|
|
106358
|
+
"rotation3d",
|
|
106359
|
+
"extrusionDepth",
|
|
106360
|
+
"extrusionColor",
|
|
106361
|
+
"contourSize",
|
|
106362
|
+
"contourColor"
|
|
106195
106363
|
].includes(key2) && edit2[key2] !== void 0
|
|
106196
106364
|
))
|
|
106197
106365
|
fail3("INVALID_EDIT", "A Quick Style replaces fill, line and font paint as a whole.");
|
|
@@ -106205,6 +106373,7 @@ function snapshotFormatting(edit2) {
|
|
|
106205
106373
|
if (edit2.reflection !== void 0) result2.reflection = snapshotReflection(edit2.reflection);
|
|
106206
106374
|
if (edit2.bevel !== void 0) result2.bevel = snapshotBevel(edit2.bevel);
|
|
106207
106375
|
if (edit2.rotation3d !== void 0) result2.rotation3d = snapshotRotation(edit2.rotation3d);
|
|
106376
|
+
Object.assign(result2, snapshotSolid(edit2));
|
|
106208
106377
|
if (result2.fillColor === "none" && result2.fillPattern !== void 0 && result2.fillPattern !== 0)
|
|
106209
106378
|
fail3("INVALID_EDIT", "No fill conflicts with a visible fill pattern.");
|
|
106210
106379
|
}
|
|
@@ -106377,7 +106546,8 @@ function snapshotVisioEdits(edits2, maxEdits, maxText) {
|
|
|
106377
106546
|
endX,
|
|
106378
106547
|
endY,
|
|
106379
106548
|
...connect ? { connect } : {},
|
|
106380
|
-
...route ? { route } : {}
|
|
106549
|
+
...route ? { route } : {},
|
|
106550
|
+
...edit2.text !== void 0 ? { text: text9(edit2.text) } : {}
|
|
106381
106551
|
};
|
|
106382
106552
|
}
|
|
106383
106553
|
case "create-rectangle":
|
|
@@ -106426,7 +106596,7 @@ function snapshotVisioEdits(edits2, maxEdits, maxText) {
|
|
|
106426
106596
|
};
|
|
106427
106597
|
}
|
|
106428
106598
|
case "delete-shape":
|
|
106429
|
-
return { ...target3, type: edit2.type };
|
|
106599
|
+
return { ...target3, type: edit2.type, ...edit2.deferred ? { deferred: true } : {} };
|
|
106430
106600
|
default:
|
|
106431
106601
|
return fail3("INVALID_EDIT", "Unsupported edit command.");
|
|
106432
106602
|
}
|
|
@@ -107670,13 +107840,13 @@ function createVisioPagePart(parts, pages, pageId2, check4) {
|
|
|
107670
107840
|
override.setAttribute("PartName", `/${path4}`);
|
|
107671
107841
|
override.setAttribute("ContentType", contentType);
|
|
107672
107842
|
parts.types.appendChild(override);
|
|
107673
|
-
const
|
|
107674
|
-
|
|
107675
|
-
parts.dirty.set(path4,
|
|
107843
|
+
const contents2 = parseXml(`<PageContents xmlns="${pages.namespaceURI}"/>`).documentElement;
|
|
107844
|
+
contents2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
107845
|
+
parts.dirty.set(path4, contents2);
|
|
107676
107846
|
parts.dirty.set(parts.pagesPart, pages);
|
|
107677
107847
|
parts.dirty.set(parts.relsPart, parts.rels);
|
|
107678
107848
|
parts.dirty.set("[Content_Types].xml", parts.types);
|
|
107679
|
-
return { page, contents };
|
|
107849
|
+
return { page, contents: contents2 };
|
|
107680
107850
|
}
|
|
107681
107851
|
|
|
107682
107852
|
// visio/edit-page-decoration.ts
|
|
@@ -108078,7 +108248,7 @@ function formattingFont(document, family) {
|
|
|
108078
108248
|
var hasCharacterExtras = (edit2) => textExtraCharacterKeys.some((key2) => edit2[key2] !== void 0);
|
|
108079
108249
|
var hasParagraphExtras = (edit2) => textExtraParagraphKeys.some((key2) => edit2[key2] !== void 0);
|
|
108080
108250
|
var quoted = (text9) => `"${text9.replaceAll('"', '""')}"`;
|
|
108081
|
-
var
|
|
108251
|
+
var rgb5 = (color4) => `RGB(${[1, 3, 5].map((i2) => parseInt(color4.slice(i2, i2 + 2), 16)).join(",")})`;
|
|
108082
108252
|
var inches = (value3) => Number(value3.toFixed(10));
|
|
108083
108253
|
function characterExtraWrites(edit2, name3, add5) {
|
|
108084
108254
|
if (edit2.fontTransparency !== void 0) add5(name3("ColorTrans"), edit2.fontTransparency / 100);
|
|
@@ -108131,7 +108301,7 @@ function textBlockWrites(shape2, edit2, add5) {
|
|
|
108131
108301
|
}
|
|
108132
108302
|
if (edit2.textBackground !== void 0) {
|
|
108133
108303
|
if (edit2.textBackground === "none") add5("TextBkgnd", 0);
|
|
108134
|
-
else add5("TextBkgnd", edit2.textBackground, void 0, `${
|
|
108304
|
+
else add5("TextBkgnd", edit2.textBackground, void 0, `${rgb5(edit2.textBackground)}+1`);
|
|
108135
108305
|
}
|
|
108136
108306
|
if (edit2.textBackgroundTransparency !== void 0)
|
|
108137
108307
|
add5("TextBkgndTrans", edit2.textBackgroundTransparency / 100);
|
|
@@ -108295,7 +108465,7 @@ function shapeFormattingWrites(edit2) {
|
|
|
108295
108465
|
edit2.fillColor,
|
|
108296
108466
|
"FillStyle",
|
|
108297
108467
|
void 0,
|
|
108298
|
-
edit2.fillColorTheme ? visioThemeColorFormula(edit2.fillColorTheme) :
|
|
108468
|
+
edit2.fillColorTheme ? visioThemeColorFormula(edit2.fillColorTheme) : rgb6(edit2.fillColor)
|
|
108299
108469
|
);
|
|
108300
108470
|
add5("FillForegndTrans", 0, "FillStyle");
|
|
108301
108471
|
}
|
|
@@ -108310,7 +108480,7 @@ function shapeFormattingWrites(edit2) {
|
|
|
108310
108480
|
edit2.fillBackgroundColor,
|
|
108311
108481
|
"FillStyle",
|
|
108312
108482
|
void 0,
|
|
108313
|
-
|
|
108483
|
+
rgb6(edit2.fillBackgroundColor)
|
|
108314
108484
|
);
|
|
108315
108485
|
}
|
|
108316
108486
|
if (edit2.fillTransparency !== void 0) {
|
|
@@ -108323,7 +108493,7 @@ function shapeFormattingWrites(edit2) {
|
|
|
108323
108493
|
edit2.lineColor,
|
|
108324
108494
|
"LineStyle",
|
|
108325
108495
|
void 0,
|
|
108326
|
-
edit2.lineColorTheme ? visioThemeColorFormula(edit2.lineColorTheme) :
|
|
108496
|
+
edit2.lineColorTheme ? visioThemeColorFormula(edit2.lineColorTheme) : rgb6(edit2.lineColor)
|
|
108327
108497
|
);
|
|
108328
108498
|
add5("LineColorTrans", 0, "LineStyle");
|
|
108329
108499
|
add5("LineGradientEnabled", 0, "LineStyle");
|
|
@@ -108362,6 +108532,7 @@ async function shapeFormattingPlan(pkg, document, shape2, edit2, check4) {
|
|
|
108362
108532
|
effectWrites(edit2, add5);
|
|
108363
108533
|
if (edit2.bevel !== void 0) bevelWrites(edit2.bevel, add5);
|
|
108364
108534
|
if (edit2.rotation3d !== void 0) rotationWrites(edit2.rotation3d, add5);
|
|
108535
|
+
solidWrites(edit2, add5);
|
|
108365
108536
|
return { writes: [...writes.values()], ...rows ? { rows } : {} };
|
|
108366
108537
|
}
|
|
108367
108538
|
async function assertShapeFormattingPaintScope(pkg, document, shape2, edit2, changed, check4) {
|
|
@@ -108371,7 +108542,7 @@ async function assertShapeFormattingPaintScope(pkg, document, shape2, edit2, cha
|
|
|
108371
108542
|
if (edit2.lineColor === void 0 && changed.has("LineColorTrans"))
|
|
108372
108543
|
await assertNonGradientPaint(pkg, document, shape2, edit2.pageId, "Line", check4);
|
|
108373
108544
|
}
|
|
108374
|
-
function
|
|
108545
|
+
function rgb6(color4) {
|
|
108375
108546
|
return `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
|
|
108376
108547
|
}
|
|
108377
108548
|
|
|
@@ -109056,11 +109227,11 @@ async function masterEntry(pkg, masterId) {
|
|
|
109056
109227
|
async function masterIdentities(pkg, masterIds) {
|
|
109057
109228
|
const result2 = [];
|
|
109058
109229
|
for (const id5 of masterIds) {
|
|
109059
|
-
const
|
|
109060
|
-
if (!
|
|
109230
|
+
const entry4 = await masterEntry(pkg, id5);
|
|
109231
|
+
if (!entry4) fail3("UNSUPPORTED_CLIPBOARD", "The master of a stencil shape cannot be resolved.");
|
|
109061
109232
|
result2.push({
|
|
109062
109233
|
id: id5,
|
|
109063
|
-
identity: ["UniqueID", "BaseID", "NameU"].map((name3) => attribute3(
|
|
109234
|
+
identity: ["UniqueID", "BaseID", "NameU"].map((name3) => attribute3(entry4.master, name3) ?? "").join("|")
|
|
109064
109235
|
});
|
|
109065
109236
|
}
|
|
109066
109237
|
return result2;
|
|
@@ -109068,11 +109239,11 @@ async function masterIdentities(pkg, masterIds) {
|
|
|
109068
109239
|
async function assertClipboardMasters(pkg, pagePath, source3, captured) {
|
|
109069
109240
|
for (const id5 of instanceMasterIds(source3)) {
|
|
109070
109241
|
const known = captured?.find((master2) => master2.id === id5);
|
|
109071
|
-
const
|
|
109072
|
-
if (!known || !
|
|
109242
|
+
const entry4 = await masterEntry(pkg, id5);
|
|
109243
|
+
if (!known || !entry4) fail3("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
|
|
109073
109244
|
const [actual] = await masterIdentities(pkg, [id5]);
|
|
109074
109245
|
if (actual.identity !== known.identity) fail3("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
|
|
109075
|
-
const masterPart = await indexedPart(pkg,
|
|
109246
|
+
const masterPart = await indexedPart(pkg, entry4.mastersPart, entry4.master, "master");
|
|
109076
109247
|
const linked = [...(await pkg.relationships(pagePath)).values()].some(
|
|
109077
109248
|
(rel) => rel.type === MASTER_RELATIONSHIP3 && rel.target === masterPart
|
|
109078
109249
|
);
|
|
@@ -109670,14 +109841,14 @@ async function editVsdxPicture(pkg, parts, pages, edit2, limits, maxOutput, dead
|
|
|
109670
109841
|
(node4) => node4.getAttribute("Extension")?.toLowerCase() === format9.extension
|
|
109671
109842
|
);
|
|
109672
109843
|
if (!declared || declared.getAttribute("ContentType") !== info.mimeType) {
|
|
109673
|
-
const
|
|
109844
|
+
const entry4 = types.ownerDocument.createElementNS(
|
|
109674
109845
|
types.namespaceURI,
|
|
109675
109846
|
declared ? "Override" : "Default"
|
|
109676
109847
|
);
|
|
109677
|
-
if (declared)
|
|
109678
|
-
else
|
|
109679
|
-
|
|
109680
|
-
types.insertBefore(
|
|
109848
|
+
if (declared) entry4.setAttribute("PartName", `/${media}`);
|
|
109849
|
+
else entry4.setAttribute("Extension", format9.extension);
|
|
109850
|
+
entry4.setAttribute("ContentType", info.mimeType);
|
|
109851
|
+
types.insertBefore(entry4, declared ? null : types.firstElementChild ?? null);
|
|
109681
109852
|
}
|
|
109682
109853
|
const dirty = /* @__PURE__ */ new Map([
|
|
109683
109854
|
[path4, root],
|
|
@@ -109736,14 +109907,14 @@ function declareType(types, extension2, contentType2, partName) {
|
|
|
109736
109907
|
(node4) => node4.getAttribute("Extension")?.toLowerCase() === extension2
|
|
109737
109908
|
);
|
|
109738
109909
|
if (declared?.getAttribute("ContentType") === contentType2) return;
|
|
109739
|
-
const
|
|
109910
|
+
const entry4 = types.ownerDocument.createElementNS(
|
|
109740
109911
|
types.namespaceURI,
|
|
109741
109912
|
declared ? "Override" : "Default"
|
|
109742
109913
|
);
|
|
109743
|
-
if (declared)
|
|
109744
|
-
else
|
|
109745
|
-
|
|
109746
|
-
types.insertBefore(
|
|
109914
|
+
if (declared) entry4.setAttribute("PartName", `/${partName}`);
|
|
109915
|
+
else entry4.setAttribute("Extension", extension2);
|
|
109916
|
+
entry4.setAttribute("ContentType", contentType2);
|
|
109917
|
+
types.insertBefore(entry4, declared ? null : types.firstElementChild ?? null);
|
|
109747
109918
|
}
|
|
109748
109919
|
async function stage(pkg, parts) {
|
|
109749
109920
|
const types = cloneRoot(await pkg.readXml("[Content_Types].xml", "Types"));
|
|
@@ -109930,7 +110101,7 @@ function refreshThemeColorCaches(root, colors, check4) {
|
|
|
109930
110101
|
}
|
|
109931
110102
|
|
|
109932
110103
|
// visio/edit-page-theme-recolor.ts
|
|
109933
|
-
var
|
|
110104
|
+
var rgb7 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
|
|
109934
110105
|
function formattingCell2(sheet2, name3) {
|
|
109935
110106
|
const matches3 = children3(sheet2, "Cell").filter((cell2) => attribute3(cell2, "N") === name3);
|
|
109936
110107
|
return matches3.length === 1 ? matches3[0] : void 0;
|
|
@@ -109954,14 +110125,14 @@ function style3(shape2, kind) {
|
|
|
109954
110125
|
function convert(cell2, fallback, mode) {
|
|
109955
110126
|
if (!cell2 || cell2.hasAttribute("E")) return false;
|
|
109956
110127
|
if (mode === "themed") {
|
|
109957
|
-
if (normal2(attribute3(cell2, "F")) !==
|
|
110128
|
+
if (normal2(attribute3(cell2, "F")) !== rgb7(fallback)) return false;
|
|
109958
110129
|
cell2.setAttribute("V", "Themed");
|
|
109959
110130
|
cell2.setAttribute("F", "THEMEVAL()");
|
|
109960
110131
|
} else {
|
|
109961
110132
|
if (normal2(attribute3(cell2, "F")) !== "THEMEVAL()" || attribute3(cell2, "V") !== "Themed")
|
|
109962
110133
|
return false;
|
|
109963
110134
|
cell2.setAttribute("V", fallback);
|
|
109964
|
-
cell2.setAttribute("F",
|
|
110135
|
+
cell2.setAttribute("F", rgb7(fallback));
|
|
109965
110136
|
}
|
|
109966
110137
|
cell2.removeAttribute("U");
|
|
109967
110138
|
return true;
|
|
@@ -110180,7 +110351,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
|
|
|
110180
110351
|
});
|
|
110181
110352
|
const dirty = /* @__PURE__ */ new Map([[pagesPath, pagesRoot]]);
|
|
110182
110353
|
const created = /* @__PURE__ */ new Map();
|
|
110183
|
-
const
|
|
110354
|
+
const contents2 = copy5(await visioXml(pkg, contentsPath, "PageContents"));
|
|
110184
110355
|
let recolored = false;
|
|
110185
110356
|
const part = PAGE_THEME_PARTS.find((name3) => edit2[name3] !== void 0);
|
|
110186
110357
|
if (edit2.embellishment !== void 0)
|
|
@@ -110193,8 +110364,8 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
|
|
|
110193
110364
|
(style4) => attribute3(style4, "ID") === "0"
|
|
110194
110365
|
);
|
|
110195
110366
|
if (attribute3(root, "NameU") !== "No Style")
|
|
110196
|
-
recolored = recolorQuickStyledShapes(
|
|
110197
|
-
recolored = refreshThemeColorCaches(
|
|
110367
|
+
recolored = recolorQuickStyledShapes(contents2, "fallback", check4);
|
|
110368
|
+
recolored = refreshThemeColorCaches(contents2, VISIO_UNTHEMED_COLORS, check4) || recolored;
|
|
110198
110369
|
} else if (edit2.theme || part) {
|
|
110199
110370
|
const source3 = visioBuiltInTheme(edit2.theme ?? edit2[part]);
|
|
110200
110371
|
await ensureBuiltInThemePart(pkg, parts, documentPath, themes, source3, dirty, created, check4);
|
|
@@ -110203,7 +110374,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
|
|
|
110203
110374
|
if (!part || part === "colors") {
|
|
110204
110375
|
for (const name3 of ["VariationColorIndex", "VariationStyleIndex"])
|
|
110205
110376
|
setCell(sheet2, name3, edit2.variant ?? 0);
|
|
110206
|
-
recolored = recolorQuickStyledShapes(
|
|
110377
|
+
recolored = recolorQuickStyledShapes(contents2, "themed", check4);
|
|
110207
110378
|
}
|
|
110208
110379
|
const hex4 = (index5) => `#${source3.colors[index5].toLowerCase()}`;
|
|
110209
110380
|
const variant = visioThemeVariantColors(source3, edit2.variant ?? 0);
|
|
@@ -110212,7 +110383,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
|
|
|
110212
110383
|
for (let index5 = 1; index5 <= 7; index5++)
|
|
110213
110384
|
colors[`variant${index5}`] = `#${variant[index5 - 1].toLowerCase()}`;
|
|
110214
110385
|
if (!part || part === "colors")
|
|
110215
|
-
recolored = refreshThemeColorCaches(
|
|
110386
|
+
recolored = refreshThemeColorCaches(contents2, colors, check4) || recolored;
|
|
110216
110387
|
} else if (edit2.variant !== void 0) {
|
|
110217
110388
|
const current = pageSelectedTheme(themes, sheet2);
|
|
110218
110389
|
if (!current || current.variants.length <= edit2.variant)
|
|
@@ -110232,9 +110403,9 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
|
|
|
110232
110403
|
const color4 = drawingColor(current.colors.get(key2), current.colors);
|
|
110233
110404
|
if (color4) colors[slot2] = color4;
|
|
110234
110405
|
}
|
|
110235
|
-
recolored = refreshThemeColorCaches(
|
|
110406
|
+
recolored = refreshThemeColorCaches(contents2, colors, check4);
|
|
110236
110407
|
}
|
|
110237
|
-
if (recolored) dirty.set(contentsPath,
|
|
110408
|
+
if (recolored) dirty.set(contentsPath, contents2);
|
|
110238
110409
|
if ((/* @__PURE__ */ new Set([...parts.keys(), ...dirty.keys(), ...created.keys()])).size > limits.maxEntries)
|
|
110239
110410
|
fail3("LIMIT_ENTRIES", "The theme exceeds the package entry limit.");
|
|
110240
110411
|
let total2 = [...parts.values()].reduce((sum3, bytes2) => sum3 + bytes2.length, 0);
|
|
@@ -110325,7 +110496,7 @@ async function editVsdxComments(pkg, parts, pages, edits2, limits, maxOutput, de
|
|
|
110325
110496
|
const authors = list2(root, "AuthorList");
|
|
110326
110497
|
const comments = list2(root, "CommentList");
|
|
110327
110498
|
const byId2 = new Map(
|
|
110328
|
-
children3(comments, "CommentEntry").map((
|
|
110499
|
+
children3(comments, "CommentEntry").map((entry4, index5) => [visioCommentId(entry4, index5), entry4])
|
|
110329
110500
|
);
|
|
110330
110501
|
const removed2 = /* @__PURE__ */ new Set();
|
|
110331
110502
|
for (const edit2 of edits2) {
|
|
@@ -110348,29 +110519,29 @@ async function editVsdxComments(pkg, parts, pages, edits2, limits, maxOutput, de
|
|
|
110348
110519
|
if (edit2.initials) author.setAttribute("Initials", edit2.initials);
|
|
110349
110520
|
authors.appendChild(author);
|
|
110350
110521
|
}
|
|
110351
|
-
const
|
|
110352
|
-
|
|
110353
|
-
|
|
110354
|
-
if (edit2.shapeId !== void 0)
|
|
110355
|
-
|
|
110356
|
-
|
|
110357
|
-
|
|
110358
|
-
comments.appendChild(
|
|
110522
|
+
const entry5 = root.ownerDocument.createElementNS(root.namespaceURI, "CommentEntry");
|
|
110523
|
+
entry5.setAttribute("AuthorID", attribute3(author, "ID"));
|
|
110524
|
+
entry5.setAttribute("PageID", edit2.pageId);
|
|
110525
|
+
if (edit2.shapeId !== void 0) entry5.setAttribute("ShapeID", edit2.shapeId);
|
|
110526
|
+
entry5.setAttribute("Date", edit2.date);
|
|
110527
|
+
entry5.setAttribute("CommentID", nextId(children3(comments, "CommentEntry"), "CommentID"));
|
|
110528
|
+
entry5.textContent = edit2.text;
|
|
110529
|
+
comments.appendChild(entry5);
|
|
110359
110530
|
continue;
|
|
110360
110531
|
}
|
|
110361
|
-
const
|
|
110362
|
-
if (!
|
|
110532
|
+
const entry4 = byId2.get(edit2.commentId);
|
|
110533
|
+
if (!entry4 || removed2.has(entry4) || attribute3(entry4, "PageID") !== edit2.pageId)
|
|
110363
110534
|
fail3("EDIT_TARGET_NOT_FOUND", "Comment does not exist on the page.");
|
|
110364
110535
|
if (edit2.type === "delete-comment") {
|
|
110365
|
-
|
|
110366
|
-
removed2.add(
|
|
110536
|
+
entry4.parentNode.removeChild(entry4);
|
|
110537
|
+
removed2.add(entry4);
|
|
110367
110538
|
continue;
|
|
110368
110539
|
}
|
|
110369
110540
|
if (edit2.text !== void 0) {
|
|
110370
|
-
|
|
110371
|
-
|
|
110541
|
+
entry4.textContent = edit2.text;
|
|
110542
|
+
entry4.setAttribute("EditDate", edit2.date);
|
|
110372
110543
|
}
|
|
110373
|
-
if (edit2.done !== void 0)
|
|
110544
|
+
if (edit2.done !== void 0) entry4.setAttribute("Done", edit2.done ? "1" : "0");
|
|
110374
110545
|
}
|
|
110375
110546
|
const dirty = /* @__PURE__ */ new Map([[path4, root]]);
|
|
110376
110547
|
if (created) {
|
|
@@ -110833,9 +111004,21 @@ var ROLES = {
|
|
|
110833
111004
|
"swimlane list": "swimlane-list",
|
|
110834
111005
|
"phase list": "phase-list"
|
|
110835
111006
|
};
|
|
111007
|
+
var CFF_AUTHORED_IDS = {
|
|
111008
|
+
frame: "{0F0C7A10-0001-0000-8E40-00608CF305B2}",
|
|
111009
|
+
"swimlane-list": "{0F0C7A10-0002-0000-8E40-00608CF305B2}",
|
|
111010
|
+
"phase-list": "{0F0C7A10-0003-0000-8E40-00608CF305B2}",
|
|
111011
|
+
lane: "{0F0C7A10-0004-0000-8E40-00608CF305B2}",
|
|
111012
|
+
separator: "{0F0C7A10-0005-0000-8E40-00608CF305B2}"
|
|
111013
|
+
};
|
|
111014
|
+
var AUTHORED_ROLES = new Map(
|
|
111015
|
+
Object.entries(CFF_AUTHORED_IDS).map(([role, id5]) => [id5, role])
|
|
111016
|
+
);
|
|
110836
111017
|
var noCffMasters = {
|
|
110837
111018
|
get: () => void 0,
|
|
110838
111019
|
roleOf: () => void 0,
|
|
111020
|
+
authoredId: () => void 0,
|
|
111021
|
+
authoredPart: () => void 0,
|
|
110839
111022
|
empty: true
|
|
110840
111023
|
};
|
|
110841
111024
|
async function loadCffMasters(pkg) {
|
|
@@ -110845,25 +111028,31 @@ async function loadCffMasters(pkg) {
|
|
|
110845
111028
|
const list3 = await visioXml(pkg, mastersPart, "Masters");
|
|
110846
111029
|
const shapes = /* @__PURE__ */ new Map();
|
|
110847
111030
|
const roles = /* @__PURE__ */ new Map();
|
|
111031
|
+
const authored = /* @__PURE__ */ new Map();
|
|
110848
111032
|
for (const master2 of children3(list3, "Master")) {
|
|
110849
111033
|
const id5 = attribute3(master2, "ID");
|
|
110850
111034
|
const role = ROLES[(attribute3(master2, "NameU") ?? attribute3(master2, "Name") ?? "").toLowerCase()];
|
|
110851
|
-
if (!id5
|
|
110852
|
-
const
|
|
110853
|
-
|
|
110854
|
-
|
|
110855
|
-
|
|
110856
|
-
|
|
111035
|
+
if (!id5) continue;
|
|
111036
|
+
const own3 = AUTHORED_ROLES.get((attribute3(master2, "UniqueID") ?? "").toUpperCase());
|
|
111037
|
+
if (!role && !own3) continue;
|
|
111038
|
+
const part = await indexedPart(pkg, mastersPart, master2, "master");
|
|
111039
|
+
if (own3) {
|
|
111040
|
+
authored.set(own3, { id: id5, part });
|
|
111041
|
+
continue;
|
|
111042
|
+
}
|
|
111043
|
+
const root = await visioXml(pkg, part, "MasterContents");
|
|
110857
111044
|
const top = children3(children3(root, "Shapes")[0], "Shape");
|
|
110858
111045
|
if (top.length !== 1) continue;
|
|
110859
111046
|
shapes.set(id5, top[0]);
|
|
110860
111047
|
roles.set(id5, role);
|
|
110861
111048
|
}
|
|
110862
|
-
if (!shapes.size) return noCffMasters;
|
|
111049
|
+
if (!shapes.size && !authored.size) return noCffMasters;
|
|
110863
111050
|
return {
|
|
110864
111051
|
get: (id5) => shapes.get(id5),
|
|
110865
111052
|
roleOf: (id5) => id5 ? roles.get(id5) : void 0,
|
|
110866
|
-
|
|
111053
|
+
authoredId: (role) => authored.get(role)?.id,
|
|
111054
|
+
authoredPart: (role) => authored.get(role)?.part,
|
|
111055
|
+
empty: !shapes.size
|
|
110867
111056
|
};
|
|
110868
111057
|
}
|
|
110869
111058
|
|
|
@@ -110886,10 +111075,10 @@ function turnSwimlanes(from, frame2, showTitle, lanes) {
|
|
|
110886
111075
|
box: horizontal2 ? { minX: 0, maxX: size3, minY: 0, maxY: cross } : { minX: 0, maxX: cross, minY: 0, maxY: size3 }
|
|
110887
111076
|
}))
|
|
110888
111077
|
);
|
|
110889
|
-
const turned = stacking.lanes.map((
|
|
110890
|
-
id:
|
|
111078
|
+
const turned = stacking.lanes.map((entry4, index5) => ({
|
|
111079
|
+
id: entry4.id,
|
|
110891
111080
|
from: lanes[index5].box,
|
|
110892
|
-
to:
|
|
111081
|
+
to: entry4.target
|
|
110893
111082
|
}));
|
|
110894
111083
|
return {
|
|
110895
111084
|
direction: direction2,
|
|
@@ -111633,13 +111822,13 @@ function relayout(scope, frame2, order) {
|
|
|
111633
111822
|
const titleSize = native && options2.title && Number.isFinite(laneTop) ? Math.max(0, frameBox.maxY - laneTop) : void 0;
|
|
111634
111823
|
const stacking = stackSwimlanes(options2.direction, frameBox, options2.title, boxes, titleSize);
|
|
111635
111824
|
const carried = new Map(
|
|
111636
|
-
stacking.lanes.map((
|
|
111825
|
+
stacking.lanes.map((entry4, index5) => [index5, [...containerClosure(scope.root, lanes[index5])]])
|
|
111637
111826
|
);
|
|
111638
111827
|
if (scope.contents === "move") for (const ids of carried.values()) assertMovable(scope.root, ids);
|
|
111639
|
-
stacking.lanes.forEach((
|
|
111828
|
+
stacking.lanes.forEach((entry4, index5) => {
|
|
111640
111829
|
scope.check();
|
|
111641
|
-
place3(scope, lanes[index5],
|
|
111642
|
-
if (scope.contents === "move") shift4(scope, carried.get(index5),
|
|
111830
|
+
place3(scope, lanes[index5], entry4.target);
|
|
111831
|
+
if (scope.contents === "move") shift4(scope, carried.get(index5), entry4.dx, entry4.dy);
|
|
111643
111832
|
});
|
|
111644
111833
|
const bars = separatorsOf(scope, frame2);
|
|
111645
111834
|
for (const shape2 of bars) {
|
|
@@ -111992,8 +112181,8 @@ function applySwimlaneEdit(roots, document, edit2, check4, instances = /* @__PUR
|
|
|
111992
112181
|
check4();
|
|
111993
112182
|
const root = roots.get(edit2.pageId);
|
|
111994
112183
|
if (!root) fail3("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
111995
|
-
const
|
|
111996
|
-
const scope = { roots, document, root, pageId: edit2.pageId, check: check4, contents, masters };
|
|
112184
|
+
const contents2 = "contents" in edit2 && edit2.contents === "leave" ? "leave" : "move";
|
|
112185
|
+
const scope = { roots, document, root, pageId: edit2.pageId, check: check4, contents: contents2, masters };
|
|
111997
112186
|
refuseBuiltByVisio(scope, edit2);
|
|
111998
112187
|
if (edit2.type === "create-swimlanes") createSwimlanes(scope, edit2);
|
|
111999
112188
|
else if (edit2.type === "insert-swimlane") insertSwimlane(scope, edit2);
|
|
@@ -112003,6 +112192,251 @@ function applySwimlaneEdit(roots, document, edit2, check4, instances = /* @__PUR
|
|
|
112003
112192
|
else setOptions(scope, edit2);
|
|
112004
112193
|
}
|
|
112005
112194
|
|
|
112195
|
+
// visio/edit-swimlane-stamp.ts
|
|
112196
|
+
var MASTER_RELATIONSHIP4 = "http://schemas.microsoft.com/visio/2010/relationships/master";
|
|
112197
|
+
var CFF_ROLES = Object.keys(CFF_AUTHORED_IDS);
|
|
112198
|
+
function partOf(shape2) {
|
|
112199
|
+
if (userValue(shape2, VISIO_SWIMLANE_FRAME_ROW) === "1") return "frame";
|
|
112200
|
+
if (userValue(shape2, VISIO_SWIMLANE_LANE_ROW) === "1") return "lane";
|
|
112201
|
+
if (userValue(shape2, VISIO_SEPARATOR_ROW) === "1") return "separator";
|
|
112202
|
+
if (userValue(shape2, "msvStructureType")?.toLowerCase() !== "list") return void 0;
|
|
112203
|
+
const kind = userValue(shape2, "msvSDListRequiredCategories");
|
|
112204
|
+
return kind === "Swimlane" ? "swimlane-list" : kind === "Phase" ? "phase-list" : void 0;
|
|
112205
|
+
}
|
|
112206
|
+
function unstampCffMasters(root, masters) {
|
|
112207
|
+
const ids = new Set(CFF_ROLES.map((role) => masters.authoredId(role)).filter(Boolean));
|
|
112208
|
+
if (!ids.size) return;
|
|
112209
|
+
for (const shape2 of topLevelShapes(root))
|
|
112210
|
+
if (ids.has(attribute3(shape2, "Master"))) shape2.removeAttribute("Master");
|
|
112211
|
+
}
|
|
112212
|
+
function stampCffMasters(root, masters) {
|
|
112213
|
+
const used = /* @__PURE__ */ new Set();
|
|
112214
|
+
for (const shape2 of topLevelShapes(root)) {
|
|
112215
|
+
const id5 = attribute3(shape2, "Master");
|
|
112216
|
+
const role = CFF_ROLES.find((item2) => masters.authoredId(item2) === id5);
|
|
112217
|
+
if (role && id5) used.add(role);
|
|
112218
|
+
}
|
|
112219
|
+
for (const shape2 of topLevelShapes(root)) {
|
|
112220
|
+
if (attribute3(shape2, "Master") || !shapeIdOf(shape2)) continue;
|
|
112221
|
+
const role = partOf(shape2);
|
|
112222
|
+
const id5 = role && masters.authoredId(role);
|
|
112223
|
+
if (!id5) continue;
|
|
112224
|
+
shape2.setAttribute("Master", id5);
|
|
112225
|
+
used.add(role);
|
|
112226
|
+
}
|
|
112227
|
+
return used;
|
|
112228
|
+
}
|
|
112229
|
+
async function relateCffMasters(pkg, parts, pagePath, roles, masters) {
|
|
112230
|
+
const part = relationshipsPartFor(pagePath);
|
|
112231
|
+
const rels = parts.has(part) ? copy2(await pkg.readXml(part, "Relationships")) : parseXml(`<Relationships xmlns="${NS.rels}"/>`).documentElement;
|
|
112232
|
+
const existing = () => Array.from(rels.getElementsByTagNameNS(rels.namespaceURI, "Relationship"));
|
|
112233
|
+
let changed = false;
|
|
112234
|
+
for (const role of roles) {
|
|
112235
|
+
const target3 = masters.authoredPart(role);
|
|
112236
|
+
if (!target3) continue;
|
|
112237
|
+
const linked = existing().some(
|
|
112238
|
+
(rel) => rel.getAttribute("Type") === MASTER_RELATIONSHIP4 && rel.getAttribute("TargetMode") !== "External" && resolvePartPath(pagePath, rel.getAttribute("Target") ?? "") === target3
|
|
112239
|
+
);
|
|
112240
|
+
if (linked) continue;
|
|
112241
|
+
const ids = new Set(existing().map((rel) => rel.getAttribute("Id") ?? ""));
|
|
112242
|
+
let index5 = 1;
|
|
112243
|
+
while (ids.has(`rId${index5}`)) index5++;
|
|
112244
|
+
const relationship2 = rels.ownerDocument.createElementNS(rels.namespaceURI, "Relationship");
|
|
112245
|
+
relationship2.setAttribute("Id", `rId${index5}`);
|
|
112246
|
+
relationship2.setAttribute("Type", MASTER_RELATIONSHIP4);
|
|
112247
|
+
const from = pagePath.split("/").slice(0, -1);
|
|
112248
|
+
const to = target3.split("/");
|
|
112249
|
+
let shared = 0;
|
|
112250
|
+
while (shared < from.length && shared < to.length - 1 && from[shared] === to[shared]) shared++;
|
|
112251
|
+
relationship2.setAttribute(
|
|
112252
|
+
"Target",
|
|
112253
|
+
[...from.slice(shared).map(() => ".."), ...to.slice(shared)].join("/")
|
|
112254
|
+
);
|
|
112255
|
+
rels.appendChild(relationship2);
|
|
112256
|
+
changed = true;
|
|
112257
|
+
}
|
|
112258
|
+
return changed ? { part, rels } : void 0;
|
|
112259
|
+
}
|
|
112260
|
+
|
|
112261
|
+
// visio/cff-author.ts
|
|
112262
|
+
var MM = 1 / 25.4;
|
|
112263
|
+
var STENCIL = ["visMasterStencil", "xfunc_m.vss"];
|
|
112264
|
+
var VERSION = ["visVersion", "15", ""];
|
|
112265
|
+
var HIDDEN_LAYER = ["msvSDMembersOnHiddenLayer", "1", "BOOL"];
|
|
112266
|
+
var QUIET = [
|
|
112267
|
+
["msvSDContainerNoHighlight", "1", "BOOL"],
|
|
112268
|
+
["msvSDContainerNoRibbon", "1", "BOOL"]
|
|
112269
|
+
];
|
|
112270
|
+
var ALL_PARTS2 = "CFF Container;CFF List;Swimlane;Phase;NonCFF";
|
|
112271
|
+
var DEFINITIONS = {
|
|
112272
|
+
frame: {
|
|
112273
|
+
name: "CFF Container",
|
|
112274
|
+
size: { width: 150 * MM, height: 100 * MM },
|
|
112275
|
+
rows: [
|
|
112276
|
+
["msvShapeCategories", "CFF Container;DoNotContain"],
|
|
112277
|
+
["msvStructureType", "Container"],
|
|
112278
|
+
...QUIET,
|
|
112279
|
+
["msvSDContainerRequiredCategories", "CFF List"],
|
|
112280
|
+
["msvSDContainerExcludedCategories", ""],
|
|
112281
|
+
STENCIL,
|
|
112282
|
+
VERSION
|
|
112283
|
+
]
|
|
112284
|
+
},
|
|
112285
|
+
"swimlane-list": {
|
|
112286
|
+
name: "Swimlane List",
|
|
112287
|
+
size: { width: 125 * MM, height: 100 * MM },
|
|
112288
|
+
rows: [
|
|
112289
|
+
["msvStructureType", "List"],
|
|
112290
|
+
["msvShapeCategories", "CFF List;DoNotContain"],
|
|
112291
|
+
["msvSDListRequiredCategories", "Swimlane"],
|
|
112292
|
+
["msvSDContainerExcludedCategories", "CFF Container;CFF List;Phase;NonCFF"],
|
|
112293
|
+
...QUIET,
|
|
112294
|
+
["msvSDListDirection", "2", ""],
|
|
112295
|
+
HIDDEN_LAYER,
|
|
112296
|
+
STENCIL,
|
|
112297
|
+
VERSION
|
|
112298
|
+
]
|
|
112299
|
+
},
|
|
112300
|
+
"phase-list": {
|
|
112301
|
+
name: "Phase List",
|
|
112302
|
+
size: { width: 100 * MM, height: 150 * MM },
|
|
112303
|
+
rows: [
|
|
112304
|
+
["msvStructureType", "List"],
|
|
112305
|
+
["msvShapeCategories", "CFF List;DoNotContain"],
|
|
112306
|
+
["msvSDContainerRequiredCategories", "Phase"],
|
|
112307
|
+
["msvSDListRequiredCategories", "Phase"],
|
|
112308
|
+
...QUIET,
|
|
112309
|
+
["msvSDListDirection", "0", ""],
|
|
112310
|
+
HIDDEN_LAYER,
|
|
112311
|
+
STENCIL,
|
|
112312
|
+
VERSION
|
|
112313
|
+
]
|
|
112314
|
+
},
|
|
112315
|
+
lane: {
|
|
112316
|
+
name: "Swimlane",
|
|
112317
|
+
size: { width: 125 * MM, height: 30 * MM },
|
|
112318
|
+
rows: [
|
|
112319
|
+
["msvShapeCategories", "Swimlane;DoNotContain"],
|
|
112320
|
+
["msvStructureType", "Container"],
|
|
112321
|
+
["msvSDContainerNoRibbon", "1", "BOOL"],
|
|
112322
|
+
["msvSDContainerExcludedCategories", ALL_PARTS2],
|
|
112323
|
+
HIDDEN_LAYER,
|
|
112324
|
+
STENCIL,
|
|
112325
|
+
VERSION
|
|
112326
|
+
]
|
|
112327
|
+
},
|
|
112328
|
+
separator: {
|
|
112329
|
+
name: "Separator",
|
|
112330
|
+
size: { width: 0.1, height: 100 * MM },
|
|
112331
|
+
rows: [
|
|
112332
|
+
["msvStructureType", "Container"],
|
|
112333
|
+
["msvShapeCategories", "Phase;DoNotContain"],
|
|
112334
|
+
["msvSDContainerExcludedCategories", ALL_PARTS2],
|
|
112335
|
+
...QUIET,
|
|
112336
|
+
HIDDEN_LAYER,
|
|
112337
|
+
STENCIL,
|
|
112338
|
+
VERSION
|
|
112339
|
+
]
|
|
112340
|
+
}
|
|
112341
|
+
};
|
|
112342
|
+
var CFF_ROLES2 = [
|
|
112343
|
+
"frame",
|
|
112344
|
+
"swimlane-list",
|
|
112345
|
+
"phase-list",
|
|
112346
|
+
"lane",
|
|
112347
|
+
"separator"
|
|
112348
|
+
];
|
|
112349
|
+
var baseId = (uniqueId) => uniqueId.replace(/^\{[0-9A-F]{8}/, "{4F0C7A10");
|
|
112350
|
+
function entry3(role) {
|
|
112351
|
+
return (masters, id5, name3, relationshipId) => {
|
|
112352
|
+
const doc = masters.ownerDocument;
|
|
112353
|
+
const node4 = (parent, tag) => parent.appendChild(doc.createElementNS(masters.namespaceURI, tag));
|
|
112354
|
+
const master2 = node4(masters, "Master");
|
|
112355
|
+
const { size: size3 } = DEFINITIONS[role];
|
|
112356
|
+
for (const [attribute4, value3] of [
|
|
112357
|
+
["ID", id5],
|
|
112358
|
+
["NameU", name3],
|
|
112359
|
+
["IsCustomNameU", "1"],
|
|
112360
|
+
["Name", name3],
|
|
112361
|
+
["IsCustomName", "1"],
|
|
112362
|
+
["Prompt", ""],
|
|
112363
|
+
["IconSize", "1"],
|
|
112364
|
+
["AlignName", "2"],
|
|
112365
|
+
["MatchByName", "0"],
|
|
112366
|
+
["IconUpdate", "1"],
|
|
112367
|
+
["UniqueID", CFF_AUTHORED_IDS[role]],
|
|
112368
|
+
["BaseID", baseId(CFF_AUTHORED_IDS[role])],
|
|
112369
|
+
["PatternFlags", "0"],
|
|
112370
|
+
["Hidden", "1"],
|
|
112371
|
+
["MasterType", "34"]
|
|
112372
|
+
])
|
|
112373
|
+
master2.setAttribute(attribute4, value3);
|
|
112374
|
+
const sheet2 = node4(master2, "PageSheet");
|
|
112375
|
+
for (const style4 of ["LineStyle", "FillStyle", "TextStyle"]) sheet2.setAttribute(style4, "0");
|
|
112376
|
+
for (const [cell2, value3] of [
|
|
112377
|
+
["PageWidth", size3.width],
|
|
112378
|
+
["PageHeight", size3.height],
|
|
112379
|
+
["PageScale", 1],
|
|
112380
|
+
["DrawingScale", 1],
|
|
112381
|
+
["DrawingSizeType", 4],
|
|
112382
|
+
["DrawingScaleType", 0]
|
|
112383
|
+
])
|
|
112384
|
+
setCell(sheet2, cell2, value3);
|
|
112385
|
+
node4(master2, "Rel").setAttributeNS(NS.r, "r:id", relationshipId);
|
|
112386
|
+
};
|
|
112387
|
+
}
|
|
112388
|
+
function contents(role) {
|
|
112389
|
+
return (document) => {
|
|
112390
|
+
const namespace = document.namespaceURI;
|
|
112391
|
+
const root = parseXml(`<MasterContents xmlns="${namespace}"/>`).documentElement;
|
|
112392
|
+
root.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
112393
|
+
const doc = root.ownerDocument;
|
|
112394
|
+
const shapes = root.appendChild(doc.createElementNS(namespace, "Shapes"));
|
|
112395
|
+
const shape2 = shapes.appendChild(doc.createElementNS(namespace, "Shape"));
|
|
112396
|
+
shape2.setAttribute("ID", "5");
|
|
112397
|
+
shape2.setAttribute("Type", "Shape");
|
|
112398
|
+
applyShapeCreationStyles(shape2, document);
|
|
112399
|
+
const { width, height } = DEFINITIONS[role].size;
|
|
112400
|
+
for (const [name3, value3, formula2] of [
|
|
112401
|
+
["PinX", width / 2],
|
|
112402
|
+
["PinY", height / 2],
|
|
112403
|
+
["Width", width],
|
|
112404
|
+
["Height", height],
|
|
112405
|
+
["LocPinX", width / 2, "Width*0.5"],
|
|
112406
|
+
["LocPinY", height / 2, "Height*0.5"],
|
|
112407
|
+
["Angle", 0],
|
|
112408
|
+
["FlipX", 0],
|
|
112409
|
+
["FlipY", 0],
|
|
112410
|
+
["ResizeMode", 0]
|
|
112411
|
+
])
|
|
112412
|
+
setCell(shape2, name3, value3, formula2);
|
|
112413
|
+
shape2.appendChild(userSection(shape2, DEFINITIONS[role].rows));
|
|
112414
|
+
return root;
|
|
112415
|
+
};
|
|
112416
|
+
}
|
|
112417
|
+
async function ensureCffMasters(source3, limits, maxOutput, deadline, check4) {
|
|
112418
|
+
let bytes = source3;
|
|
112419
|
+
const changedParts = /* @__PURE__ */ new Set();
|
|
112420
|
+
for (const role of CFF_ROLES2) {
|
|
112421
|
+
const added = await addMasterToDrawing(
|
|
112422
|
+
bytes,
|
|
112423
|
+
{
|
|
112424
|
+
uniqueId: CFF_AUTHORED_IDS[role],
|
|
112425
|
+
name: DEFINITIONS[role].name,
|
|
112426
|
+
entry: entry3(role),
|
|
112427
|
+
contents: contents(role)
|
|
112428
|
+
},
|
|
112429
|
+
limits,
|
|
112430
|
+
maxOutput,
|
|
112431
|
+
deadline,
|
|
112432
|
+
check4
|
|
112433
|
+
);
|
|
112434
|
+
bytes = added.bytes;
|
|
112435
|
+
for (const part of added.changedParts) changedParts.add(part);
|
|
112436
|
+
}
|
|
112437
|
+
return { bytes, changedParts: [...changedParts] };
|
|
112438
|
+
}
|
|
112439
|
+
|
|
112006
112440
|
// visio/edit-shape-data.ts
|
|
112007
112441
|
var UNITS = {
|
|
112008
112442
|
string: "STR",
|
|
@@ -113011,11 +113445,33 @@ async function editVsdx(input2, edits2, options2 = {}) {
|
|
|
113011
113445
|
] : [],
|
|
113012
113446
|
...prepared2.templateConverted ? [{ code: "TEMPLATE_SAVED_AS_DRAWING", message: "The template was saved as a drawing." }] : []
|
|
113013
113447
|
];
|
|
113014
|
-
const final = await
|
|
113448
|
+
const final = await editWithDeletionsLast(prepared2.bytes, snapshot2, options2, clock);
|
|
113015
113449
|
return notes.length ? { ...final, diagnostics: [...notes, ...final.diagnostics] } : final;
|
|
113016
113450
|
}
|
|
113451
|
+
async function editWithDeletionsLast(input2, edits2, options2, clock) {
|
|
113452
|
+
const deferred2 = edits2.filter((edit2) => edit2.type === "delete-shape" && edit2.deferred);
|
|
113453
|
+
if (!deferred2.length) return editVisioPrepared(input2, edits2, options2, clock);
|
|
113454
|
+
const rest = edits2.filter((edit2) => !deferred2.includes(edit2));
|
|
113455
|
+
const first3 = rest.length ? await editVsdx(input2, rest, options2) : { bytes: input2, changedParts: [], diagnostics: [] };
|
|
113456
|
+
const plain4 = deferred2.map((edit2) => ({ ...edit2, deferred: false }));
|
|
113457
|
+
const second = await editVsdx(first3.bytes, plain4, options2);
|
|
113458
|
+
return {
|
|
113459
|
+
bytes: second.bytes,
|
|
113460
|
+
changedParts: [.../* @__PURE__ */ new Set([...first3.changedParts, ...second.changedParts])],
|
|
113461
|
+
diagnostics: [...first3.diagnostics, ...second.diagnostics]
|
|
113462
|
+
};
|
|
113463
|
+
}
|
|
113017
113464
|
async function editVisioPrepared(input2, edits2, options2, clock) {
|
|
113018
|
-
const
|
|
113465
|
+
const limits = { ...DEFAULTS2, ...options2.limits };
|
|
113466
|
+
const cff = edits2.some((edit2) => edit2.type === "create-swimlanes") ? await ensureCffMasters(
|
|
113467
|
+
input2,
|
|
113468
|
+
limits,
|
|
113469
|
+
positive4(options2.maxOutputBytes ?? limits.maxInputBytes),
|
|
113470
|
+
Date.now() + limits.maxRuntimeMs,
|
|
113471
|
+
() => void 0
|
|
113472
|
+
) : void 0;
|
|
113473
|
+
const first3 = await editVsdxTransaction(cff?.bytes ?? input2, edits2, options2, clock);
|
|
113474
|
+
const edited = cff ? { ...first3, changedParts: [.../* @__PURE__ */ new Set([...cff.changedParts, ...first3.changedParts])] } : first3;
|
|
113019
113475
|
const resized = await refreshTextSizes(clock.textSizes, edited, options2, clock.deadline);
|
|
113020
113476
|
const result2 = await refreshLineJumpCaches(
|
|
113021
113477
|
clock.jumpPages,
|
|
@@ -113202,7 +113658,7 @@ async function editVsdxTransaction(input2, edits2, options2, clock = {
|
|
|
113202
113658
|
(command2) => command2.type !== "replace-plain-text" && command2.type !== "replace-text-ranges" && command2.type !== "insert-text-field" && command2.type !== "update-text-field" && command2.type !== "reorder-shape" && command2.type !== "duplicate-shapes" && command2.type !== "paste-shapes" && command2.type !== "change-shape" && command2.type !== "insert-picture" && !isVisioChartObjectEdit(command2) && command2.type !== "set-page-theme" && !isVisioMetadataEdit(command2) && command2.type !== "set-shape-data" && !isVisioControlEdit(command2) && !isVisioActionEdit(command2) && !isVisioGroupEdit(command2) && !isVisioDiagramPartEdit(command2) && !isVisioContainerEdit(command2) && !isVisioPictureEdit(command2) && !isVisioGuideEdit(command2) && !isVisioFormatEdit(command2)
|
|
113203
113659
|
);
|
|
113204
113660
|
let document;
|
|
113205
|
-
const cffMasters =
|
|
113661
|
+
const cffMasters = await loadCffMasters(pkg);
|
|
113206
113662
|
let masterMovePins = emptyMasterMoveProof();
|
|
113207
113663
|
const instanceCommands = /* @__PURE__ */ new Set();
|
|
113208
113664
|
let instanceDeletes = /* @__PURE__ */ new Set();
|
|
@@ -113212,7 +113668,9 @@ async function editVsdxTransaction(input2, edits2, options2, clock = {
|
|
|
113212
113668
|
)) {
|
|
113213
113669
|
for (const [pageId2, path5] of pages) {
|
|
113214
113670
|
const sourceRoot = await visioXml(pkg, path5, "PageContents");
|
|
113215
|
-
|
|
113671
|
+
const root = sourceRoot.ownerDocument.cloneNode(true).documentElement;
|
|
113672
|
+
unstampCffMasters(root, cffMasters);
|
|
113673
|
+
roots.set(pageId2, root);
|
|
113216
113674
|
}
|
|
113217
113675
|
for (const [pageId2, root] of roots) {
|
|
113218
113676
|
const ids = new Set(
|
|
@@ -113476,12 +113934,18 @@ async function editVsdxTransaction(input2, edits2, options2, clock = {
|
|
|
113476
113934
|
for (const shapeId2 of takeDeferredTextSizes(root)) clock.textSizes.push({ pageId: pageId2, shapeId: shapeId2 });
|
|
113477
113935
|
let totalBytes = [...parts.values()].reduce((sum3, bytes2) => sum3 + bytes2.length, 0);
|
|
113478
113936
|
let nodes = 0;
|
|
113937
|
+
for (const [path4, root] of [...dirty]) {
|
|
113938
|
+
if (![...pages.values()].includes(path4)) continue;
|
|
113939
|
+
const used = stampCffMasters(root, cffMasters);
|
|
113940
|
+
const related2 = used.size ? await relateCffMasters(pkg, parts, path4, used, cffMasters) : void 0;
|
|
113941
|
+
if (related2) dirty.set(related2.part, related2.rels);
|
|
113942
|
+
}
|
|
113479
113943
|
for (const [path4, root] of dirty) {
|
|
113480
113944
|
const serialized = serializeEditedXml(root, limits, check4);
|
|
113481
113945
|
nodes += serialized.nodes;
|
|
113482
113946
|
if (nodes > limits.maxTotalXmlNodes)
|
|
113483
113947
|
fail3("LIMIT_XML_TOTAL", "Edited XML node total exceeds limit.");
|
|
113484
|
-
totalBytes += serialized.bytes.length - parts.get(path4)
|
|
113948
|
+
totalBytes += serialized.bytes.length - (parts.get(path4)?.length ?? 0);
|
|
113485
113949
|
if (totalBytes > limits.maxTotalBytes)
|
|
113486
113950
|
fail3("LIMIT_TOTAL", "Edited package total exceeds limit.");
|
|
113487
113951
|
parts.set(path4, serialized.bytes);
|
|
@@ -113497,7 +113961,8 @@ async function editVsdxTransaction(input2, edits2, options2, clock = {
|
|
|
113497
113961
|
{ ...limits, maxInputBytes: maxOutput, maxRuntimeMs: Math.max(1, deadline - Date.now()) },
|
|
113498
113962
|
check4
|
|
113499
113963
|
);
|
|
113500
|
-
for (const path4 of dirty.keys())
|
|
113964
|
+
for (const path4 of dirty.keys())
|
|
113965
|
+
if (!path4.endsWith(".rels")) await visioXml(verified.pkg, path4, "PageContents");
|
|
113501
113966
|
check4();
|
|
113502
113967
|
}
|
|
113503
113968
|
return {
|
|
@@ -118964,9 +119429,9 @@ var memo = {
|
|
|
118964
119429
|
if (!bucket)
|
|
118965
119430
|
return empty;
|
|
118966
119431
|
handoff = void 0;
|
|
118967
|
-
const
|
|
118968
|
-
bucket.set(payload.value,
|
|
118969
|
-
open.push(
|
|
119432
|
+
const entry4 = { value: empty, issues: null };
|
|
119433
|
+
bucket.set(payload.value, entry4);
|
|
119434
|
+
open.push(entry4);
|
|
118970
119435
|
return empty;
|
|
118971
119436
|
},
|
|
118972
119437
|
guard(inst) {
|
|
@@ -119040,16 +119505,16 @@ var memo = {
|
|
|
119040
119505
|
const depth = open.length;
|
|
119041
119506
|
const result2 = base3(payload, ctx);
|
|
119042
119507
|
handoff = void 0;
|
|
119043
|
-
const
|
|
119508
|
+
const entry4 = open.length > depth ? open.pop() : void 0;
|
|
119044
119509
|
if (result2 instanceof Promise) {
|
|
119045
119510
|
return result2.then((r) => {
|
|
119046
|
-
if (
|
|
119047
|
-
|
|
119511
|
+
if (entry4)
|
|
119512
|
+
entry4.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
119048
119513
|
return r;
|
|
119049
119514
|
});
|
|
119050
119515
|
}
|
|
119051
|
-
if (
|
|
119052
|
-
|
|
119516
|
+
if (entry4)
|
|
119517
|
+
entry4.issues = result2.issues.length ? cloneIssues(result2.issues) : NO_ISSUES;
|
|
119053
119518
|
return result2;
|
|
119054
119519
|
};
|
|
119055
119520
|
inst._zod.parse = wrapped;
|
|
@@ -129458,42 +129923,42 @@ function extractDefs(ctx, schema) {
|
|
|
129458
129923
|
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external)
|
|
129459
129924
|
return;
|
|
129460
129925
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
129461
|
-
for (const
|
|
129462
|
-
const id5 = ctx.metadataRegistry.get(
|
|
129926
|
+
for (const entry4 of ctx.seen.entries()) {
|
|
129927
|
+
const id5 = ctx.metadataRegistry.get(entry4[0])?.id;
|
|
129463
129928
|
if (id5) {
|
|
129464
129929
|
const existing = idToSchema.get(id5);
|
|
129465
|
-
if (existing && existing !==
|
|
129930
|
+
if (existing && existing !== entry4[0]) {
|
|
129466
129931
|
throw new Error(`Duplicate schema id "${id5}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
129467
129932
|
}
|
|
129468
|
-
idToSchema.set(id5,
|
|
129933
|
+
idToSchema.set(id5, entry4[0]);
|
|
129469
129934
|
}
|
|
129470
129935
|
}
|
|
129471
|
-
const makeURI = (
|
|
129936
|
+
const makeURI = (entry4) => {
|
|
129472
129937
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
129473
129938
|
if (ctx.external) {
|
|
129474
|
-
const externalId = ctx.external.registry.get(
|
|
129939
|
+
const externalId = ctx.external.registry.get(entry4[0])?.id;
|
|
129475
129940
|
const uriGenerator = ctx.external.uri ?? ((id6) => id6);
|
|
129476
129941
|
if (externalId) {
|
|
129477
129942
|
return { ref: uriGenerator(externalId) };
|
|
129478
129943
|
}
|
|
129479
|
-
const id5 =
|
|
129480
|
-
|
|
129944
|
+
const id5 = entry4[1].defId ?? entry4[1].schema.id ?? `schema${ctx.counter++}`;
|
|
129945
|
+
entry4[1].defId = id5;
|
|
129481
129946
|
return { defId: id5, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id5)}` };
|
|
129482
129947
|
}
|
|
129483
129948
|
const uriPrefix = `#`;
|
|
129484
129949
|
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
129485
|
-
if (
|
|
129950
|
+
if (entry4[1] === root && !entry4[1].schema.id) {
|
|
129486
129951
|
return { ref: uriPrefix };
|
|
129487
129952
|
}
|
|
129488
|
-
const defId =
|
|
129953
|
+
const defId = entry4[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
129489
129954
|
return { defId, ref: defUriPrefix + encodeJSONPointerSegment(defId) };
|
|
129490
129955
|
};
|
|
129491
|
-
const extractToDef = (
|
|
129492
|
-
if (
|
|
129956
|
+
const extractToDef = (entry4) => {
|
|
129957
|
+
if (entry4[1].schema.$ref) {
|
|
129493
129958
|
return;
|
|
129494
129959
|
}
|
|
129495
|
-
const seen =
|
|
129496
|
-
const { ref, defId } = makeURI(
|
|
129960
|
+
const seen = entry4[1];
|
|
129961
|
+
const { ref, defId } = makeURI(entry4);
|
|
129497
129962
|
seen.def = { ...seen.schema };
|
|
129498
129963
|
if (defId)
|
|
129499
129964
|
seen.defId = defId;
|
|
@@ -129504,8 +129969,8 @@ function extractDefs(ctx, schema) {
|
|
|
129504
129969
|
schema2.$ref = ref;
|
|
129505
129970
|
};
|
|
129506
129971
|
if (ctx.cycles === "throw") {
|
|
129507
|
-
for (const
|
|
129508
|
-
const seen =
|
|
129972
|
+
for (const entry4 of ctx.seen.entries()) {
|
|
129973
|
+
const seen = entry4[1];
|
|
129509
129974
|
if (seen.cycle) {
|
|
129510
129975
|
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
129511
129976
|
|
|
@@ -129513,31 +129978,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
129513
129978
|
}
|
|
129514
129979
|
}
|
|
129515
129980
|
}
|
|
129516
|
-
for (const
|
|
129517
|
-
const seen =
|
|
129518
|
-
if (schema ===
|
|
129519
|
-
extractToDef(
|
|
129981
|
+
for (const entry4 of ctx.seen.entries()) {
|
|
129982
|
+
const seen = entry4[1];
|
|
129983
|
+
if (schema === entry4[0]) {
|
|
129984
|
+
extractToDef(entry4);
|
|
129520
129985
|
continue;
|
|
129521
129986
|
}
|
|
129522
129987
|
if (ctx.external) {
|
|
129523
|
-
const ext = ctx.external.registry.get(
|
|
129524
|
-
if (schema !==
|
|
129525
|
-
extractToDef(
|
|
129988
|
+
const ext = ctx.external.registry.get(entry4[0])?.id;
|
|
129989
|
+
if (schema !== entry4[0] && ext) {
|
|
129990
|
+
extractToDef(entry4);
|
|
129526
129991
|
continue;
|
|
129527
129992
|
}
|
|
129528
129993
|
}
|
|
129529
|
-
const id5 = ctx.metadataRegistry.get(
|
|
129994
|
+
const id5 = ctx.metadataRegistry.get(entry4[0])?.id;
|
|
129530
129995
|
if (id5) {
|
|
129531
|
-
extractToDef(
|
|
129996
|
+
extractToDef(entry4);
|
|
129532
129997
|
continue;
|
|
129533
129998
|
}
|
|
129534
129999
|
if (seen.cycle) {
|
|
129535
|
-
extractToDef(
|
|
130000
|
+
extractToDef(entry4);
|
|
129536
130001
|
continue;
|
|
129537
130002
|
}
|
|
129538
130003
|
if (seen.count > 1) {
|
|
129539
130004
|
if (ctx.reused === "ref") {
|
|
129540
|
-
extractToDef(
|
|
130005
|
+
extractToDef(entry4);
|
|
129541
130006
|
}
|
|
129542
130007
|
}
|
|
129543
130008
|
}
|
|
@@ -129719,12 +130184,12 @@ function finalize2(ctx, schema) {
|
|
|
129719
130184
|
});
|
|
129720
130185
|
};
|
|
129721
130186
|
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
129722
|
-
for (const
|
|
129723
|
-
flattenRef(
|
|
130187
|
+
for (const entry4 of [...ctx.seen.entries()].reverse()) {
|
|
130188
|
+
flattenRef(entry4[0]);
|
|
129724
130189
|
}
|
|
129725
130190
|
if (ctx.target !== "openapi-3.0") {
|
|
129726
|
-
for (const
|
|
129727
|
-
compactTypeUnion(
|
|
130191
|
+
for (const entry4 of ctx.seen.entries()) {
|
|
130192
|
+
compactTypeUnion(entry4[1].def ?? entry4[1].schema);
|
|
129728
130193
|
}
|
|
129729
130194
|
}
|
|
129730
130195
|
for (const rewrite2 of ctx.deferred)
|
|
@@ -129769,8 +130234,8 @@ function finalize2(ctx, schema) {
|
|
|
129769
130234
|
delete result2.id;
|
|
129770
130235
|
const defs = ctx.external?.defs ?? {};
|
|
129771
130236
|
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
129772
|
-
for (const
|
|
129773
|
-
const seen =
|
|
130237
|
+
for (const entry4 of ctx.seen.entries()) {
|
|
130238
|
+
const seen = entry4[1];
|
|
129774
130239
|
if (seen.def && seen.defId) {
|
|
129775
130240
|
if (seen.def.id === seen.defId)
|
|
129776
130241
|
delete seen.def.id;
|
|
@@ -130380,9 +130845,9 @@ function stringifyKeyNames(bySchema, json2, visited) {
|
|
|
130380
130845
|
var pendingRecords = /* @__PURE__ */ new WeakMap();
|
|
130381
130846
|
function rewriteKeyNames(ctx) {
|
|
130382
130847
|
const bySchema = /* @__PURE__ */ new Map();
|
|
130383
|
-
for (const
|
|
130384
|
-
if (
|
|
130385
|
-
bySchema.set(
|
|
130848
|
+
for (const entry4 of ctx.seen.values()) {
|
|
130849
|
+
if (entry4.def && !bySchema.has(entry4.schema))
|
|
130850
|
+
bySchema.set(entry4.schema, entry4);
|
|
130386
130851
|
}
|
|
130387
130852
|
const rewrites = /* @__PURE__ */ new Map();
|
|
130388
130853
|
for (const record3 of pendingRecords.get(ctx) ?? []) {
|
|
@@ -130396,8 +130861,8 @@ function rewriteKeyNames(ctx) {
|
|
|
130396
130861
|
}
|
|
130397
130862
|
if (!rewrites.size)
|
|
130398
130863
|
return;
|
|
130399
|
-
for (const
|
|
130400
|
-
for (const carrier of [
|
|
130864
|
+
for (const entry4 of ctx.seen.values()) {
|
|
130865
|
+
for (const carrier of [entry4.schema, entry4.def]) {
|
|
130401
130866
|
const rewritten = carrier && rewrites.get(carrier.propertyNames);
|
|
130402
130867
|
if (rewritten)
|
|
130403
130868
|
carrier.propertyNames = rewritten;
|
|
@@ -130591,8 +131056,8 @@ function toJSONSchema(input2, params) {
|
|
|
130591
131056
|
const registry2 = input2;
|
|
130592
131057
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
130593
131058
|
const defs = {};
|
|
130594
|
-
for (const
|
|
130595
|
-
const [_, schema] =
|
|
131059
|
+
for (const entry4 of registry2._idmap.entries()) {
|
|
131060
|
+
const [_, schema] = entry4;
|
|
130596
131061
|
processSchema(schema, ctx2);
|
|
130597
131062
|
}
|
|
130598
131063
|
const schemas = {};
|
|
@@ -130602,8 +131067,8 @@ function toJSONSchema(input2, params) {
|
|
|
130602
131067
|
defs
|
|
130603
131068
|
};
|
|
130604
131069
|
ctx2.external = external;
|
|
130605
|
-
for (const
|
|
130606
|
-
const [key2, schema] =
|
|
131070
|
+
for (const entry4 of registry2._idmap.entries()) {
|
|
131071
|
+
const [key2, schema] = entry4;
|
|
130607
131072
|
extractDefs(ctx2, schema);
|
|
130608
131073
|
assignProp(schemas, key2, finalize2(ctx2, schema));
|
|
130609
131074
|
}
|