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
package/dist/visio/index.cjs
CHANGED
|
@@ -754,8 +754,8 @@ var VisioPackage = class _VisioPackage {
|
|
|
754
754
|
this.entries = entries;
|
|
755
755
|
this.limits = limits;
|
|
756
756
|
this.deadline = deadline;
|
|
757
|
-
for (const
|
|
758
|
-
if (!
|
|
757
|
+
for (const entry4 of entries.values())
|
|
758
|
+
if (!entry4.directory) this.decodedNames.set(decodePath(entry4.name), entry4.name);
|
|
759
759
|
}
|
|
760
760
|
zip;
|
|
761
761
|
entries;
|
|
@@ -815,15 +815,15 @@ var VisioPackage = class _VisioPackage {
|
|
|
815
815
|
}
|
|
816
816
|
/** The declared CRC-32 and size of a part, or an empty string when the package lacks it. */
|
|
817
817
|
printOf(path3) {
|
|
818
|
-
const
|
|
819
|
-
return
|
|
818
|
+
const entry4 = this.entries.get(path3);
|
|
819
|
+
return entry4 && !entry4.directory ? `${entry4.crc}:${entry4.size}` : "";
|
|
820
820
|
}
|
|
821
821
|
has(path3) {
|
|
822
822
|
this.noted?.add(path3);
|
|
823
823
|
return this.entries.get(path3)?.directory === false;
|
|
824
824
|
}
|
|
825
825
|
paths() {
|
|
826
|
-
return [...this.entries.values()].filter((
|
|
826
|
+
return [...this.entries.values()].filter((entry4) => !entry4.directory).map((entry4) => entry4.name);
|
|
827
827
|
}
|
|
828
828
|
async readXml(path3, expectedRoot) {
|
|
829
829
|
this.check();
|
|
@@ -845,9 +845,9 @@ var VisioPackage = class _VisioPackage {
|
|
|
845
845
|
this.check();
|
|
846
846
|
this.noted?.add(path3);
|
|
847
847
|
safePath(path3);
|
|
848
|
-
const
|
|
849
|
-
if (!
|
|
850
|
-
return
|
|
848
|
+
const entry4 = this.entries.get(path3);
|
|
849
|
+
if (!entry4 || entry4.directory) fail("MISSING_PART", `Missing package part: ${path3}`);
|
|
850
|
+
return entry4.size;
|
|
851
851
|
}
|
|
852
852
|
/** Shared package-owned bytes. Treat the returned buffer as immutable. */
|
|
853
853
|
async readBytes(path3) {
|
|
@@ -864,8 +864,8 @@ var VisioPackage = class _VisioPackage {
|
|
|
864
864
|
return bytes;
|
|
865
865
|
}
|
|
866
866
|
async loadBytes(path3) {
|
|
867
|
-
const
|
|
868
|
-
if (!
|
|
867
|
+
const entry4 = this.entries.get(path3), file = this.zip.file(path3);
|
|
868
|
+
if (!entry4 || entry4.directory || !file)
|
|
869
869
|
return fail("MISSING_PART", `Missing package part: ${path3}`);
|
|
870
870
|
return new Promise((resolve, reject2) => {
|
|
871
871
|
const stream = file.internalStream("uint8array");
|
|
@@ -896,9 +896,9 @@ var VisioPackage = class _VisioPackage {
|
|
|
896
896
|
fail("LIMIT_ENTRY", `Actual inflated entry exceeds limit: ${path3}`);
|
|
897
897
|
if (this.totalOutput > this.limits.maxTotalBytes)
|
|
898
898
|
fail("LIMIT_TOTAL", "Actual inflated ZIP total exceeds limit");
|
|
899
|
-
if (size3 > Math.max(1,
|
|
899
|
+
if (size3 > Math.max(1, entry4.compressed) * this.limits.maxCompressionRatio)
|
|
900
900
|
fail("LIMIT_RATIO", `Actual ZIP compression ratio exceeds limit: ${path3}`);
|
|
901
|
-
if (size3 >
|
|
901
|
+
if (size3 > entry4.size)
|
|
902
902
|
fail("ZIP_MISMATCH", `Actual ZIP entry exceeds declared size: ${path3}`);
|
|
903
903
|
crc = crc32(chunk, crc);
|
|
904
904
|
chunks.push(chunk);
|
|
@@ -907,7 +907,7 @@ var VisioPackage = class _VisioPackage {
|
|
|
907
907
|
}
|
|
908
908
|
}).on("error", abort).on("end", () => {
|
|
909
909
|
if (settled) return;
|
|
910
|
-
if (size3 !==
|
|
910
|
+
if (size3 !== entry4.size || (crc ^ 4294967295) >>> 0 !== entry4.crc) {
|
|
911
911
|
abort(new VisioPackageError("ZIP_MISMATCH", `Inflated size or CRC mismatch: ${path3}`));
|
|
912
912
|
return;
|
|
913
913
|
}
|
|
@@ -4211,9 +4211,28 @@ function createLine(root2, document, edit) {
|
|
|
4211
4211
|
setCell(row2, "Y", 0);
|
|
4212
4212
|
section3.appendChild(row2);
|
|
4213
4213
|
}
|
|
4214
|
+
if (edit.text !== void 0) appendLineTextCells(shape, width);
|
|
4214
4215
|
shape.appendChild(section3);
|
|
4216
|
+
if (edit.text !== void 0) {
|
|
4217
|
+
const text7 = root2.ownerDocument.createElementNS(root2.namespaceURI, "Text");
|
|
4218
|
+
text7.appendChild(root2.ownerDocument.createTextNode(encodeVisioPlainText(edit.text)));
|
|
4219
|
+
shape.appendChild(text7);
|
|
4220
|
+
}
|
|
4215
4221
|
return shape;
|
|
4216
4222
|
}
|
|
4223
|
+
function appendLineTextCells(shape, width) {
|
|
4224
|
+
const box5 = Math.max(0.5, Math.min(width, 1.2));
|
|
4225
|
+
const entries = [
|
|
4226
|
+
["TxtPinX", width / 2, "Width*0.5"],
|
|
4227
|
+
["TxtPinY", 0, "Height*0.5"],
|
|
4228
|
+
["TxtWidth", box5],
|
|
4229
|
+
["TxtHeight", 0.25],
|
|
4230
|
+
["TxtLocPinX", box5 / 2, "TxtWidth*0.5"],
|
|
4231
|
+
["TxtLocPinY", 0.125, "TxtHeight*0.5"],
|
|
4232
|
+
["TxtAngle", 0, "-Angle"]
|
|
4233
|
+
];
|
|
4234
|
+
for (const [name3, value3, formula2] of entries) setCell(shape, name3, value3, formula2);
|
|
4235
|
+
}
|
|
4217
4236
|
|
|
4218
4237
|
// visio/path-fit.ts
|
|
4219
4238
|
var finite = (point2) => Number.isFinite(point2.x) && Number.isFinite(point2.y);
|
|
@@ -8567,12 +8586,12 @@ function linearToSrgb255(linear) {
|
|
|
8567
8586
|
// color/hex-rgb.ts
|
|
8568
8587
|
function parseArgbHex(hex) {
|
|
8569
8588
|
const clean5 = hex.replace(/^#/, "");
|
|
8570
|
-
const
|
|
8571
|
-
if (!/^[0-9a-fA-F]{6}$/.test(
|
|
8572
|
-
return [0, 2, 4].map((i) => parseInt(
|
|
8589
|
+
const rgb7 = clean5.length === 8 ? clean5.slice(2) : clean5;
|
|
8590
|
+
if (!/^[0-9a-fA-F]{6}$/.test(rgb7)) return void 0;
|
|
8591
|
+
return [0, 2, 4].map((i) => parseInt(rgb7.slice(i, i + 2), 16));
|
|
8573
8592
|
}
|
|
8574
8593
|
var clamp255 = (v) => Math.max(0, Math.min(255, v));
|
|
8575
|
-
var rgbToUpperHex = (
|
|
8594
|
+
var rgbToUpperHex = (rgb7) => `#${rgb7.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
|
|
8576
8595
|
|
|
8577
8596
|
// color/theme-palette.ts
|
|
8578
8597
|
function themePaletteVariantLuminance(variant) {
|
|
@@ -8581,9 +8600,9 @@ function themePaletteVariantLuminance(variant) {
|
|
|
8581
8600
|
return variant.kind === "lighter" ? { lumMod, lumOff: fraction } : { lumMod };
|
|
8582
8601
|
}
|
|
8583
8602
|
function applyThemePaletteVariant(hex, variant) {
|
|
8584
|
-
const
|
|
8585
|
-
if (!
|
|
8586
|
-
const { h, s, l } = rgbToHsl(
|
|
8603
|
+
const rgb7 = hexToRgbChannels(hex);
|
|
8604
|
+
if (!rgb7) return hex;
|
|
8605
|
+
const { h, s, l } = rgbToHsl(rgb7.r, rgb7.g, rgb7.b);
|
|
8587
8606
|
const { lumMod, lumOff } = themePaletteVariantLuminance(variant);
|
|
8588
8607
|
const next = hslToRgb(h, s, l * lumMod + (lumOff ?? 0), (value3) => Math.floor(value3 + 1e-6));
|
|
8589
8608
|
return `#${toHex(next.r)}${toHex(next.g)}${toHex(next.b)}`.toLowerCase();
|
|
@@ -8781,10 +8800,10 @@ var APPLIED = /* @__PURE__ */ new Set([
|
|
|
8781
8800
|
]);
|
|
8782
8801
|
function resolveDrawingColor(color2, theme2, options2) {
|
|
8783
8802
|
const base2 = baseHex(color2, theme2);
|
|
8784
|
-
const
|
|
8785
|
-
if (!
|
|
8803
|
+
const rgb7 = base2 ? hexToRgbChannels(base2) : null;
|
|
8804
|
+
if (!rgb7) return void 0;
|
|
8786
8805
|
if (options2?.transformOrder === "document") {
|
|
8787
|
-
const value3 = orderedColorTransforms(
|
|
8806
|
+
const value3 = orderedColorTransforms(rgb7, color2.transforms);
|
|
8788
8807
|
const round3 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
|
|
8789
8808
|
return {
|
|
8790
8809
|
hex: `#${toHex(round3(value3.r))}${toHex(round3(value3.g))}${toHex(round3(value3.b))}`,
|
|
@@ -8794,9 +8813,9 @@ function resolveDrawingColor(color2, theme2, options2) {
|
|
|
8794
8813
|
)
|
|
8795
8814
|
};
|
|
8796
8815
|
}
|
|
8797
|
-
let { r, g, b } =
|
|
8798
|
-
const find = (name3) => color2.transforms.find((
|
|
8799
|
-
const has = (name3) => color2.transforms.some((
|
|
8816
|
+
let { r, g, b } = rgb7;
|
|
8817
|
+
const find = (name3) => color2.transforms.find((entry4) => entry4.name === name3)?.value;
|
|
8818
|
+
const has = (name3) => color2.transforms.some((entry4) => entry4.name === name3);
|
|
8800
8819
|
if (has("comp")) {
|
|
8801
8820
|
const hsl = rgbToHsl(r, g, b);
|
|
8802
8821
|
({ r, g, b } = hslToRgb((hsl.h + 180) % 360, hsl.s, hsl.l));
|
|
@@ -8847,7 +8866,7 @@ function resolveDrawingColor(color2, theme2, options2) {
|
|
|
8847
8866
|
return {
|
|
8848
8867
|
hex: `#${toHex(r)}${toHex(g)}${toHex(b)}`,
|
|
8849
8868
|
alpha,
|
|
8850
|
-
unapplied: [...new Set(color2.transforms.map((
|
|
8869
|
+
unapplied: [...new Set(color2.transforms.map((entry4) => entry4.name))].filter(
|
|
8851
8870
|
(name3) => !APPLIED.has(name3)
|
|
8852
8871
|
)
|
|
8853
8872
|
};
|
|
@@ -10336,8 +10355,8 @@ function sortKeys(value3) {
|
|
|
10336
10355
|
if (value3 && typeof value3 === "object") {
|
|
10337
10356
|
const out = {};
|
|
10338
10357
|
for (const key3 of Object.keys(value3).sort()) {
|
|
10339
|
-
const
|
|
10340
|
-
if (
|
|
10358
|
+
const entry4 = value3[key3];
|
|
10359
|
+
if (entry4 !== void 0) out[key3] = sortKeys(entry4);
|
|
10341
10360
|
}
|
|
10342
10361
|
return out;
|
|
10343
10362
|
}
|
|
@@ -10614,7 +10633,7 @@ function compileFraction(tokens3, slash) {
|
|
|
10614
10633
|
let denEnd = slash + 1;
|
|
10615
10634
|
while (isDigit(tokens3[denEnd]) || tokens3[denEnd]?.t === "num") denEnd++;
|
|
10616
10635
|
const denTokens = tokens3.slice(slash + 1, denEnd);
|
|
10617
|
-
const
|
|
10636
|
+
const fixed2 = denTokens.some((t) => t.t === "num") && denTokens.every((t) => t.t === "num" || isDigit(t) && t.c === "0");
|
|
10618
10637
|
const plan = {
|
|
10619
10638
|
tokens: [],
|
|
10620
10639
|
intDigits: [],
|
|
@@ -10622,13 +10641,13 @@ function compileFraction(tokens3, slash) {
|
|
|
10622
10641
|
denDigits: [],
|
|
10623
10642
|
denWidth: denTokens.length
|
|
10624
10643
|
};
|
|
10625
|
-
if (
|
|
10644
|
+
if (fixed2) {
|
|
10626
10645
|
plan.fixedDenominator = Number(denTokens.map((t) => t.t === "num" ? t.v : "0").join(""));
|
|
10627
10646
|
}
|
|
10628
10647
|
tokens3.forEach((tok, i) => {
|
|
10629
10648
|
if (i === slash) plan.tokens.push({ r: "slash" });
|
|
10630
10649
|
else if (i > slash && i < denEnd) {
|
|
10631
|
-
if (
|
|
10650
|
+
if (fixed2) {
|
|
10632
10651
|
if (i === slash + 1) plan.tokens.push({ r: "den", index: 0 });
|
|
10633
10652
|
} else if (isDigit(tok)) {
|
|
10634
10653
|
plan.tokens.push({ r: "den", index: plan.denDigits.length });
|
|
@@ -11311,9 +11330,9 @@ function generalDigits(v, width) {
|
|
|
11311
11330
|
if (r.point > width) return scientific2(v, width).text;
|
|
11312
11331
|
return plain2(r);
|
|
11313
11332
|
}
|
|
11314
|
-
const
|
|
11333
|
+
const fixed2 = roundDecimals(v, Math.max(0, width - 2));
|
|
11315
11334
|
const sci = scientific2(v, width);
|
|
11316
|
-
if (
|
|
11335
|
+
if (fixed2.d && fixed2.d.length >= sci.sig) return plain2(fixed2);
|
|
11317
11336
|
return sci.text;
|
|
11318
11337
|
}
|
|
11319
11338
|
function formatGeneral(value3, width = GENERAL_WIDTH) {
|
|
@@ -11546,10 +11565,10 @@ function hls240ToRgb({ h, l, s }) {
|
|
|
11546
11565
|
var parseHex = parseArgbHex;
|
|
11547
11566
|
var toHexColor = rgbToUpperHex;
|
|
11548
11567
|
function applyTint(hex, tint) {
|
|
11549
|
-
const
|
|
11550
|
-
if (!tint) return toHexColor(
|
|
11568
|
+
const rgb7 = parseHex(hex) ?? [0, 0, 0];
|
|
11569
|
+
if (!tint) return toHexColor(rgb7);
|
|
11551
11570
|
const t = Math.max(-1, Math.min(1, tint));
|
|
11552
|
-
const hls = rgbToHls240(...
|
|
11571
|
+
const hls = rgbToHls240(...rgb7);
|
|
11553
11572
|
const l = t < 0 ? Math.trunc(hls.l * (1 + t)) : Math.round(hls.l * (1 - t) + HLSMAX * t);
|
|
11554
11573
|
return toHexColor(hls240ToRgb({ ...hls, l: Math.max(0, Math.min(HLSMAX, l)) }));
|
|
11555
11574
|
}
|
|
@@ -12465,7 +12484,7 @@ function countDerived(pivot) {
|
|
|
12465
12484
|
}
|
|
12466
12485
|
var pivotAxisFieldNames = (pivot) => [
|
|
12467
12486
|
...pivot.fields,
|
|
12468
|
-
...derivedDateFields(pivot).filter((
|
|
12487
|
+
...derivedDateFields(pivot).filter((entry4) => !pivot.fields.includes(entry4.name)).map((entry4) => entry4.name)
|
|
12469
12488
|
];
|
|
12470
12489
|
function resolveDateGroups(pivot) {
|
|
12471
12490
|
return (pivot.dateGroups ?? []).map((group2) => {
|
|
@@ -12476,11 +12495,11 @@ function resolveDateGroups(pivot) {
|
|
|
12476
12495
|
});
|
|
12477
12496
|
}
|
|
12478
12497
|
function derivedDateLabels(pivot, name3) {
|
|
12479
|
-
const
|
|
12480
|
-
if (!
|
|
12481
|
-
const [group2] = resolveDateGroups({ ...pivot, dateGroups: [
|
|
12498
|
+
const entry4 = derivedDateFields(pivot).find((candidate) => candidate.name === name3);
|
|
12499
|
+
if (!entry4) return void 0;
|
|
12500
|
+
const [group2] = resolveDateGroups({ ...pivot, dateGroups: [entry4.group] });
|
|
12482
12501
|
const range2 = { start: group2.start, end: group2.end };
|
|
12483
|
-
return dateUnitLabels(
|
|
12502
|
+
return dateUnitLabels(entry4.unit, range2, dateGroupDays(group2), pivot.date1904 ?? false, group2);
|
|
12484
12503
|
}
|
|
12485
12504
|
function validateDateGroups(pivot) {
|
|
12486
12505
|
const groups = pivot.dateGroups;
|
|
@@ -12516,19 +12535,19 @@ function expandDateGroups(pivot) {
|
|
|
12516
12535
|
const resolved = { ...pivot, dateGroups: groups };
|
|
12517
12536
|
const derived = derivedDateFields(resolved);
|
|
12518
12537
|
const date1904 = pivot.date1904 ?? false;
|
|
12519
|
-
const tables = derived.map((
|
|
12520
|
-
const range2 = { start:
|
|
12521
|
-
const days = dateGroupDays(
|
|
12522
|
-
const labels = dateUnitLabels(
|
|
12538
|
+
const tables = derived.map((entry4) => {
|
|
12539
|
+
const range2 = { start: entry4.group.start, end: entry4.group.end };
|
|
12540
|
+
const days = dateGroupDays(entry4.group);
|
|
12541
|
+
const labels = dateUnitLabels(entry4.unit, range2, days, date1904, entry4.group);
|
|
12523
12542
|
return {
|
|
12524
|
-
base: pivot.fields.indexOf(
|
|
12543
|
+
base: pivot.fields.indexOf(entry4.group.field),
|
|
12525
12544
|
labels,
|
|
12526
|
-
index: (serial) => dateUnitIndex(
|
|
12545
|
+
index: (serial) => dateUnitIndex(entry4.unit, range2, days, date1904, serial, labels.length)
|
|
12527
12546
|
};
|
|
12528
12547
|
});
|
|
12529
12548
|
return {
|
|
12530
12549
|
...resolved,
|
|
12531
|
-
fields: [...pivot.fields, ...derived.map((
|
|
12550
|
+
fields: [...pivot.fields, ...derived.map((entry4) => entry4.name)],
|
|
12532
12551
|
records: pivot.records.map((record5) => [
|
|
12533
12552
|
...record5,
|
|
12534
12553
|
...tables.map((table2) => {
|
|
@@ -12573,7 +12592,7 @@ function validateFieldGroups(pivot) {
|
|
|
12573
12592
|
if (!group2 || typeof group2 !== "object" || index3 < 0 || seen.has(group2.field) || ![group2.start, group2.end, group2.by].every(Number.isInteger) || group2.by < 1 || group2.start >= group2.end || groupBucketCount(group2) > MAX_BUCKETS)
|
|
12574
12593
|
throw new Error("Choose a valid number group.");
|
|
12575
12594
|
seen.add(group2.field);
|
|
12576
|
-
if (pivot.pageFilter?.field === group2.field || pivot.valueField === group2.field || (pivot.additionalValues ?? []).some((
|
|
12595
|
+
if (pivot.pageFilter?.field === group2.field || pivot.valueField === group2.field || (pivot.additionalValues ?? []).some((measure4) => measure4.field === group2.field) || (pivot.dateFields ?? []).includes(group2.field) || (pivot.itemFilters ?? []).some((filter) => filter.field === group2.field))
|
|
12577
12596
|
throw new Error("A grouped field cannot also be a filter, date field or value field.");
|
|
12578
12597
|
for (const record5 of pivot.records) {
|
|
12579
12598
|
const value3 = record5[index3];
|
|
@@ -12638,8 +12657,8 @@ var PIVOT_SUBTOTAL_ORDER = [
|
|
|
12638
12657
|
"varp"
|
|
12639
12658
|
];
|
|
12640
12659
|
function fieldSubtotalFunctions(pivot, field2) {
|
|
12641
|
-
const
|
|
12642
|
-
if (
|
|
12660
|
+
const entry4 = pivot.fieldSubtotals?.find((item2) => item2.field === field2);
|
|
12661
|
+
if (entry4) return PIVOT_SUBTOTAL_ORDER.filter((fn) => entry4.functions.includes(fn));
|
|
12643
12662
|
return field2 === pivot.rowField && pivot.subtotals === false ? [] : "auto";
|
|
12644
12663
|
}
|
|
12645
12664
|
function validateFieldSubtotals(pivot, axisFields) {
|
|
@@ -12647,22 +12666,22 @@ function validateFieldSubtotals(pivot, axisFields) {
|
|
|
12647
12666
|
if (entries === void 0) return;
|
|
12648
12667
|
if (!Array.isArray(entries)) throw new Error("Choose valid field subtotals.");
|
|
12649
12668
|
const seen = /* @__PURE__ */ new Set();
|
|
12650
|
-
for (const
|
|
12651
|
-
if (!
|
|
12669
|
+
for (const entry4 of entries) {
|
|
12670
|
+
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)
|
|
12652
12671
|
throw new Error("Choose valid field subtotals.");
|
|
12653
|
-
seen.add(
|
|
12672
|
+
seen.add(entry4.field);
|
|
12654
12673
|
}
|
|
12655
12674
|
}
|
|
12656
12675
|
|
|
12657
12676
|
// xlsx/pivot/item-filters.ts
|
|
12658
12677
|
function applyPivotItemFilters(pivot) {
|
|
12659
|
-
const active = (pivot.itemFilters ?? []).filter((
|
|
12678
|
+
const active = (pivot.itemFilters ?? []).filter((entry4) => entry4.hidden.length);
|
|
12660
12679
|
const range2 = pivot.dateFilter;
|
|
12661
12680
|
if (!active.length && !range2) return pivot;
|
|
12662
12681
|
const dateIndex = range2 ? pivot.fields.indexOf(range2.field) : -1;
|
|
12663
|
-
const tests = active.map((
|
|
12664
|
-
index: pivot.fields.indexOf(
|
|
12665
|
-
hidden: new Set(
|
|
12682
|
+
const tests = active.map((entry4) => ({
|
|
12683
|
+
index: pivot.fields.indexOf(entry4.field),
|
|
12684
|
+
hidden: new Set(entry4.hidden.map(pivotValueKey))
|
|
12666
12685
|
}));
|
|
12667
12686
|
return {
|
|
12668
12687
|
...pivot,
|
|
@@ -12705,7 +12724,7 @@ function validatePivotItemFilters(pivot) {
|
|
|
12705
12724
|
var keyOf = (field2, item2) => `${field2}\0${pivotValueKey(item2)}`;
|
|
12706
12725
|
function pivotItemLabeler(pivot) {
|
|
12707
12726
|
const blank = pivotCaptions(pivot).blank;
|
|
12708
|
-
const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((
|
|
12727
|
+
const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((entry4) => [keyOf(entry4.field, entry4.item), entry4.name])) : void 0;
|
|
12709
12728
|
return (field2, value3) => names?.get(keyOf(field2, value3)) ?? (value3 === null || value3 === "" ? blank : pivotItemLabel(value3));
|
|
12710
12729
|
}
|
|
12711
12730
|
|
|
@@ -12873,9 +12892,9 @@ function validatePivotFields(pivot) {
|
|
|
12873
12892
|
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== pivotCaptions(pivot).values)
|
|
12874
12893
|
throw new Error("This PivotTable uses unsupported Values header captions.");
|
|
12875
12894
|
if (!Array.isArray(extras) || extras.length > 15 || extras.some(
|
|
12876
|
-
(
|
|
12895
|
+
(measure4) => !measure4 || !pivot.fields.includes(measure4.field) || !PIVOT_AGGREGATES.includes(measure4.aggregate) || typeof measure4.caption !== "string" || !measure4.caption.trim() || measure4.caption.length > 255 || pivot.fields.some((field2) => field2.toLowerCase() === measure4.caption.toLowerCase())
|
|
12877
12896
|
) || new Set(
|
|
12878
|
-
[pivot.valueCaption, ...extras.map((
|
|
12897
|
+
[pivot.valueCaption, ...extras.map((measure4) => measure4.caption)].map(
|
|
12879
12898
|
(caption) => caption?.toLowerCase()
|
|
12880
12899
|
)
|
|
12881
12900
|
).size !== extras.length + 1)
|
|
@@ -12916,7 +12935,7 @@ function aggregateValues(records, field2, type) {
|
|
|
12916
12935
|
const sum = numbers.reduce((total, value3) => total + value3, 0);
|
|
12917
12936
|
return type === "average" ? sum / numbers.length : sum;
|
|
12918
12937
|
}
|
|
12919
|
-
var pivotMeasureNumber = (pivot, records,
|
|
12938
|
+
var pivotMeasureNumber = (pivot, records, measure4) => aggregateValues(records, pivot.fields.indexOf(measure4.field), measure4.aggregate);
|
|
12920
12939
|
|
|
12921
12940
|
// xlsx/pivot/columns.ts
|
|
12922
12941
|
var SEPARATOR = "";
|
|
@@ -12953,17 +12972,17 @@ function pivotColumnEntries(pivot) {
|
|
|
12953
12972
|
values: [...values, child4[1].value],
|
|
12954
12973
|
keys: [...keys, child4[0]]
|
|
12955
12974
|
};
|
|
12956
|
-
const
|
|
12975
|
+
const entry4 = {
|
|
12957
12976
|
path: here.path,
|
|
12958
12977
|
key: columnKey(here.keys, here.keys.length),
|
|
12959
12978
|
values: here.values
|
|
12960
12979
|
};
|
|
12961
|
-
if (level3 === names.length - 1) entries.push({ kind: "leaf", ...
|
|
12980
|
+
if (level3 === names.length - 1) entries.push({ kind: "leaf", ...entry4 });
|
|
12962
12981
|
else {
|
|
12963
12982
|
visit(child4[1], level3 + 1, here.path, here.values, here.keys);
|
|
12964
12983
|
const own = functions[level3];
|
|
12965
|
-
if (own === "auto") entries.push({ kind: "subtotal", ...
|
|
12966
|
-
else for (const fn of own) entries.push({ kind: "subtotal", ...
|
|
12984
|
+
if (own === "auto") entries.push({ kind: "subtotal", ...entry4 });
|
|
12985
|
+
else for (const fn of own) entries.push({ kind: "subtotal", ...entry4, fn });
|
|
12967
12986
|
}
|
|
12968
12987
|
}
|
|
12969
12988
|
};
|
|
@@ -12986,7 +13005,7 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
|
|
|
12986
13005
|
const levels = columns.names.length;
|
|
12987
13006
|
if (!levels)
|
|
12988
13007
|
return [
|
|
12989
|
-
[...rowLabels, ...valuesOnRows ? [null] : measures2.map((
|
|
13008
|
+
[...rowLabels, ...valuesOnRows ? [null] : measures2.map((measure4) => measure4.caption)]
|
|
12990
13009
|
];
|
|
12991
13010
|
const compact = pivot.layout === "compact";
|
|
12992
13011
|
const labelColumns = rowLabels.length;
|
|
@@ -13004,22 +13023,22 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
|
|
|
13004
13023
|
grid[rows - 1][i] = text7;
|
|
13005
13024
|
});
|
|
13006
13025
|
let previous = [];
|
|
13007
|
-
columns.entries.forEach((
|
|
13026
|
+
columns.entries.forEach((entry4, j) => {
|
|
13008
13027
|
const at3 = labelColumns + j * count;
|
|
13009
|
-
if (
|
|
13010
|
-
|
|
13011
|
-
const continued =
|
|
13012
|
-
if (!continued) grid[1 + level3][at3] = labelOf(columns.names[level3],
|
|
13028
|
+
if (entry4.kind === "leaf") {
|
|
13029
|
+
entry4.path.forEach((_index, level3) => {
|
|
13030
|
+
const continued = entry4.path.slice(0, level3 + 1).every((p, i) => p === previous[i]);
|
|
13031
|
+
if (!continued) grid[1 + level3][at3] = labelOf(columns.names[level3], entry4.values[level3]);
|
|
13013
13032
|
});
|
|
13014
|
-
previous =
|
|
13015
|
-
if (count > 1) measures2.forEach((
|
|
13033
|
+
previous = entry4.path;
|
|
13034
|
+
if (count > 1) measures2.forEach((measure4, m) => grid[rows - 1][at3 + m] = measure4.caption);
|
|
13016
13035
|
return;
|
|
13017
13036
|
}
|
|
13018
|
-
const row2 =
|
|
13019
|
-
const name3 =
|
|
13020
|
-
measures2.forEach((
|
|
13021
|
-
const custom =
|
|
13022
|
-
grid[row2][at3 + m] = custom ? count === 1 ? `${name3} ${custom}` : `${name3} ${custom} of ${
|
|
13037
|
+
const row2 = entry4.kind === "grand" ? 1 : entry4.path.length;
|
|
13038
|
+
const name3 = entry4.kind === "grand" ? "" : String(labelOf(columns.names[entry4.path.length - 1], entry4.values.at(-1)));
|
|
13039
|
+
measures2.forEach((measure4, m) => {
|
|
13040
|
+
const custom = entry4.fn ? caps.functions[entry4.fn] : void 0;
|
|
13041
|
+
grid[row2][at3 + m] = custom ? count === 1 ? `${name3} ${custom}` : `${name3} ${custom} of ${measure4.field}` : count === 1 ? entry4.kind === "grand" ? caps.grandTotal : fillCaption(caps.subtotal, name3) : entry4.kind === "grand" ? fillCaption(caps.measureTotal, measure4.caption) : `${name3} ${measure4.caption}`;
|
|
13023
13042
|
});
|
|
13024
13043
|
});
|
|
13025
13044
|
return grid;
|
|
@@ -13091,11 +13110,11 @@ function nestedPivotGrid(pivot) {
|
|
|
13091
13110
|
let rowCount = 0;
|
|
13092
13111
|
const width = dimensions3.width - labelColumns;
|
|
13093
13112
|
const blanks = () => Array(width).fill(null);
|
|
13094
|
-
const cells4 = (group2, rowFn,
|
|
13095
|
-
const records =
|
|
13096
|
-
const picked =
|
|
13097
|
-
if (rowFn &&
|
|
13098
|
-
const fn = rowFn ??
|
|
13113
|
+
const cells4 = (group2, rowFn, measure4) => columns.entries.flatMap((entry4) => {
|
|
13114
|
+
const records = entry4.kind === "grand" ? group2.records : group2.columns.get(entry4.key) ?? [];
|
|
13115
|
+
const picked = measure4 === void 0 ? measures2 : [measures2[measure4]];
|
|
13116
|
+
if (rowFn && entry4.fn && rowFn !== entry4.fn) return picked.map(() => null);
|
|
13117
|
+
const fn = rowFn ?? entry4.fn;
|
|
13099
13118
|
return picked.map(
|
|
13100
13119
|
(one) => fn ? aggregateValues(records, pivot.fields.indexOf(one.field), fn) : pivotMeasureNumber(pivot, records, one)
|
|
13101
13120
|
);
|
|
@@ -13115,17 +13134,17 @@ function nestedPivotGrid(pivot) {
|
|
|
13115
13134
|
throw new Error("The PivotTable result is too large.");
|
|
13116
13135
|
return;
|
|
13117
13136
|
}
|
|
13118
|
-
const [cells5, numbers,
|
|
13137
|
+
const [cells5, numbers, entry4] = build2();
|
|
13119
13138
|
values.push([...cells5, ...numbers]);
|
|
13120
|
-
rowEntries.push(
|
|
13139
|
+
rowEntries.push(entry4);
|
|
13121
13140
|
indents.push(compact ? indent : 0);
|
|
13122
13141
|
};
|
|
13123
|
-
const entryOf = (indices,
|
|
13142
|
+
const entryOf = (indices, measure4, type) => ({
|
|
13124
13143
|
indices,
|
|
13125
|
-
...
|
|
13144
|
+
...measure4 !== void 0 ? { measure: measure4 } : {},
|
|
13126
13145
|
...type ? { type } : {}
|
|
13127
13146
|
});
|
|
13128
|
-
const walk = (level3, group2,
|
|
13147
|
+
const walk = (level3, group2, measure4, path3) => {
|
|
13129
13148
|
const field2 = fieldOf(level3);
|
|
13130
13149
|
const last = level3 === levels - 1;
|
|
13131
13150
|
const repeated = Array.from(
|
|
@@ -13170,16 +13189,16 @@ function nestedPivotGrid(pivot) {
|
|
|
13170
13189
|
if (last)
|
|
13171
13190
|
return push(level3, () => [
|
|
13172
13191
|
labelCells(path3, leafShown(here.firsts), level3, text7),
|
|
13173
|
-
cells4(child4, void 0,
|
|
13174
|
-
entryOf(here.indices,
|
|
13192
|
+
cells4(child4, void 0, measure4),
|
|
13193
|
+
entryOf(here.indices, measure4)
|
|
13175
13194
|
]);
|
|
13176
13195
|
if (!tabular)
|
|
13177
13196
|
push(level3, () => [
|
|
13178
13197
|
labelCells(path3, repeated, level3, text7),
|
|
13179
|
-
showsValue ? cells4(child4, void 0,
|
|
13180
|
-
entryOf(here.indices,
|
|
13198
|
+
showsValue ? cells4(child4, void 0, measure4) : blanks(),
|
|
13199
|
+
entryOf(here.indices, measure4)
|
|
13181
13200
|
]);
|
|
13182
|
-
walk(level3 + 1, child4,
|
|
13201
|
+
walk(level3 + 1, child4, measure4, here);
|
|
13183
13202
|
if (field2 === depth - 1) return;
|
|
13184
13203
|
const caption = String(text7);
|
|
13185
13204
|
const subtotal = (title, fn, one) => push(level3, () => [
|
|
@@ -13189,21 +13208,21 @@ function nestedPivotGrid(pivot) {
|
|
|
13189
13208
|
]);
|
|
13190
13209
|
if (own === "auto") {
|
|
13191
13210
|
if (showsValue) return;
|
|
13192
|
-
if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0,
|
|
13211
|
+
if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0, measure4);
|
|
13193
13212
|
else measures2.forEach((one, m) => subtotal(`${caption} ${one.caption}`, void 0, m));
|
|
13194
13213
|
} else
|
|
13195
13214
|
for (const fn of own)
|
|
13196
|
-
if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn,
|
|
13215
|
+
if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn, measure4);
|
|
13197
13216
|
else
|
|
13198
13217
|
measures2.forEach(
|
|
13199
13218
|
(one, m) => subtotal(`${caption} ${caps.functions[fn]} of ${one.field}`, fn, m)
|
|
13200
13219
|
);
|
|
13201
13220
|
});
|
|
13202
13221
|
};
|
|
13203
|
-
const grand = (text7,
|
|
13222
|
+
const grand = (text7, measure4) => push(0, () => [
|
|
13204
13223
|
compact ? [text7] : [text7, ...Array(levels - 1).fill(null)],
|
|
13205
|
-
cells4(root2, void 0,
|
|
13206
|
-
entryOf([0],
|
|
13224
|
+
cells4(root2, void 0, measure4),
|
|
13225
|
+
entryOf([0], measure4, "grand")
|
|
13207
13226
|
]);
|
|
13208
13227
|
const build = () => {
|
|
13209
13228
|
walk(0, root2, void 0, { labels: [], indices: [], firsts: [] });
|
|
@@ -13410,8 +13429,8 @@ function isSafePartName(name3) {
|
|
|
13410
13429
|
if (body.startsWith("/")) return false;
|
|
13411
13430
|
return !body.split("/").some((segment) => segment === "..");
|
|
13412
13431
|
}
|
|
13413
|
-
function declaredEntrySize(
|
|
13414
|
-
const data =
|
|
13432
|
+
function declaredEntrySize(entry4) {
|
|
13433
|
+
const data = entry4._data;
|
|
13415
13434
|
const size3 = Number(data?.uncompressedSize ?? 0);
|
|
13416
13435
|
return Number.isFinite(size3) && size3 > 0 ? size3 : 0;
|
|
13417
13436
|
}
|
|
@@ -13425,10 +13444,10 @@ function resolveLimits(limits) {
|
|
|
13425
13444
|
fail: (message, limit3, kind, actual) => create3 ? create3(message, { limit: limit3, kind, actual }) : new ZipLimitError(message, { limit: limit3, kind, actual })
|
|
13426
13445
|
};
|
|
13427
13446
|
}
|
|
13428
|
-
async function inflateEntryGuarded(
|
|
13447
|
+
async function inflateEntryGuarded(entry4, alreadyRead, limits) {
|
|
13429
13448
|
const chunks = [];
|
|
13430
13449
|
let size3 = 0;
|
|
13431
|
-
for await (const chunk of streamEntryGuarded(
|
|
13450
|
+
for await (const chunk of streamEntryGuarded(entry4, alreadyRead, limits)) {
|
|
13432
13451
|
chunks.push(chunk);
|
|
13433
13452
|
size3 += chunk.byteLength;
|
|
13434
13453
|
}
|
|
@@ -13442,10 +13461,10 @@ async function inflateEntryGuarded(entry3, alreadyRead, limits) {
|
|
|
13442
13461
|
return out;
|
|
13443
13462
|
}
|
|
13444
13463
|
var AHEAD = 8;
|
|
13445
|
-
async function* streamEntryGuarded(
|
|
13464
|
+
async function* streamEntryGuarded(entry4, alreadyRead, limits) {
|
|
13446
13465
|
const r = resolveLimits(limits);
|
|
13447
|
-
const declared = declaredEntrySize(
|
|
13448
|
-
const stream =
|
|
13466
|
+
const declared = declaredEntrySize(entry4);
|
|
13467
|
+
const stream = entry4.internalStream("uint8array");
|
|
13449
13468
|
const queue = [];
|
|
13450
13469
|
let size3 = 0;
|
|
13451
13470
|
let ended = false;
|
|
@@ -13475,7 +13494,7 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
|
|
|
13475
13494
|
if (size3 > declared || size3 > r.maxEntryBytes)
|
|
13476
13495
|
return fail4(
|
|
13477
13496
|
r.fail(
|
|
13478
|
-
`${r.label} part ${
|
|
13497
|
+
`${r.label} part ${entry4.name} inflates past its declared size`,
|
|
13479
13498
|
r.maxEntryBytes,
|
|
13480
13499
|
size3 > declared ? "declaredSize" : "maxEntryBytes",
|
|
13481
13500
|
size3
|
|
@@ -13538,15 +13557,15 @@ function guardZip(zip, limits = {}) {
|
|
|
13538
13557
|
entries.length
|
|
13539
13558
|
);
|
|
13540
13559
|
let declared = 0;
|
|
13541
|
-
for (const
|
|
13542
|
-
const original =
|
|
13543
|
-
if (!isSafePartName(
|
|
13560
|
+
for (const entry4 of entries) {
|
|
13561
|
+
const original = entry4.unsafeOriginalName;
|
|
13562
|
+
if (!isSafePartName(entry4.name) || original !== void 0 && !isSafePartName(original))
|
|
13544
13563
|
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
|
|
13545
|
-
if (
|
|
13546
|
-
const size3 = declaredEntrySize(
|
|
13564
|
+
if (entry4.dir) continue;
|
|
13565
|
+
const size3 = declaredEntrySize(entry4);
|
|
13547
13566
|
if (size3 > r.maxEntryBytes)
|
|
13548
13567
|
throw r.fail(
|
|
13549
|
-
`${r.label} part ${
|
|
13568
|
+
`${r.label} part ${entry4.name} exceeds the uncompressed part size limit`,
|
|
13550
13569
|
r.maxEntryBytes,
|
|
13551
13570
|
"maxEntryBytes",
|
|
13552
13571
|
size3
|
|
@@ -13562,15 +13581,15 @@ function guardZip(zip, limits = {}) {
|
|
|
13562
13581
|
);
|
|
13563
13582
|
const produced = /* @__PURE__ */ new Map();
|
|
13564
13583
|
let total = 0;
|
|
13565
|
-
for (const
|
|
13566
|
-
if (
|
|
13567
|
-
const inflateOriginal =
|
|
13568
|
-
|
|
13569
|
-
const previous = produced.get(
|
|
13570
|
-
const bytes = await inflateEntryGuarded(
|
|
13584
|
+
for (const entry4 of entries) {
|
|
13585
|
+
if (entry4.dir) continue;
|
|
13586
|
+
const inflateOriginal = entry4.async.bind(entry4);
|
|
13587
|
+
entry4.async = async (type, onUpdate) => {
|
|
13588
|
+
const previous = produced.get(entry4.name) ?? 0;
|
|
13589
|
+
const bytes = await inflateEntryGuarded(entry4, total - previous, limits);
|
|
13571
13590
|
if (bytes.byteLength > previous) {
|
|
13572
13591
|
total += bytes.byteLength - previous;
|
|
13573
|
-
produced.set(
|
|
13592
|
+
produced.set(entry4.name, bytes.byteLength);
|
|
13574
13593
|
}
|
|
13575
13594
|
switch (type) {
|
|
13576
13595
|
case "uint8array":
|
|
@@ -14148,15 +14167,15 @@ function readPivotCaptionAttributes(root2) {
|
|
|
14148
14167
|
}
|
|
14149
14168
|
function aggregateCaptionsOf(pivot) {
|
|
14150
14169
|
const out = {};
|
|
14151
|
-
for (const
|
|
14170
|
+
for (const measure4 of [
|
|
14152
14171
|
{ field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
|
|
14153
14172
|
...pivot.additionalValues ?? []
|
|
14154
14173
|
]) {
|
|
14155
|
-
const at3 =
|
|
14156
|
-
if (at3 < 0 ||
|
|
14157
|
-
const template = `${
|
|
14158
|
-
if (template !== ENGLISH_PIVOT_CAPTIONS.aggregates[
|
|
14159
|
-
out[
|
|
14174
|
+
const at3 = measure4.caption.indexOf(measure4.field);
|
|
14175
|
+
if (at3 < 0 || measure4.caption === measure4.field) continue;
|
|
14176
|
+
const template = `${measure4.caption.slice(0, at3)}{0}${measure4.caption.slice(at3 + measure4.field.length)}`;
|
|
14177
|
+
if (template !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure4.aggregate])
|
|
14178
|
+
out[measure4.aggregate] = template;
|
|
14160
14179
|
}
|
|
14161
14180
|
return Object.keys(out).length ? out : void 0;
|
|
14162
14181
|
}
|
|
@@ -14539,17 +14558,17 @@ function settleSlicers(workbook, warn) {
|
|
|
14539
14558
|
const book = workbook.slicers;
|
|
14540
14559
|
if (!book) return;
|
|
14541
14560
|
const pivotAt = (tabId, name3) => {
|
|
14542
|
-
const sheet = workbook.sheets.find((
|
|
14543
|
-
const pivot = sheet?.pivotTables?.find((
|
|
14561
|
+
const sheet = workbook.sheets.find((entry4) => entry4.sheetId === tabId);
|
|
14562
|
+
const pivot = sheet?.pivotTables?.find((entry4) => entry4.name === name3);
|
|
14544
14563
|
return sheet && pivot ? { sheet, pivot } : void 0;
|
|
14545
14564
|
};
|
|
14546
14565
|
const good = (cache2) => {
|
|
14547
14566
|
if (cache2.source.kind === "table") {
|
|
14548
14567
|
const { tableId, column } = cache2.source;
|
|
14549
14568
|
for (const sheet of workbook.sheets) {
|
|
14550
|
-
const table2 = sheet.tables.find((
|
|
14569
|
+
const table2 = sheet.tables.find((entry4) => entry4.id === tableId);
|
|
14551
14570
|
if (table2)
|
|
14552
|
-
return table2.headerRow && !table2.filterNotModeled && table2.columns.some((
|
|
14571
|
+
return table2.headerRow && !table2.filterNotModeled && table2.columns.some((entry4) => entry4.sourceId === column);
|
|
14553
14572
|
}
|
|
14554
14573
|
return false;
|
|
14555
14574
|
}
|
|
@@ -14718,13 +14737,13 @@ function readDateGroups(fields, count, names, dateFields, records, date1904) {
|
|
|
14718
14737
|
for (const [base2, list2] of members3) {
|
|
14719
14738
|
const field2 = names[base2] ?? "";
|
|
14720
14739
|
const parent = first(fields[base2], "fieldGroup", NS.x);
|
|
14721
|
-
const units3 = list2.map((
|
|
14740
|
+
const units3 = list2.map((entry4) => entry4.unit);
|
|
14722
14741
|
if (!dateFields.includes(field2) || Number(att(parent, "par")) !== list2.at(-1).index || units3.some(
|
|
14723
14742
|
(unit4, i) => i > 0 && PIVOT_DATE_UNITS.indexOf(unit4) <= PIVOT_DATE_UNITS.indexOf(units3[i - 1])
|
|
14724
14743
|
))
|
|
14725
14744
|
throw unsupported3("group parent");
|
|
14726
14745
|
const ranges = list2.map(
|
|
14727
|
-
(
|
|
14746
|
+
(entry4) => first(first(entry4.node, "fieldGroup", NS.x), "rangePr", NS.x)
|
|
14728
14747
|
);
|
|
14729
14748
|
const sample = ranges[0];
|
|
14730
14749
|
const autoStart = att(sample, "autoStart") !== "0";
|
|
@@ -14752,15 +14771,15 @@ function readDateGroups(fields, count, names, dateFields, records, date1904) {
|
|
|
14752
14771
|
if (!close(expected.start, start) || !close(expected.end, end))
|
|
14753
14772
|
throw unsupported3("stale range");
|
|
14754
14773
|
const localized = {};
|
|
14755
|
-
for (const
|
|
14756
|
-
const labels = englishDateUnitLabels(
|
|
14757
|
-
const node3 = first(first(
|
|
14774
|
+
for (const entry4 of list2) {
|
|
14775
|
+
const labels = englishDateUnitLabels(entry4.unit, expected, dateGroupDays(group2), date1904);
|
|
14776
|
+
const node3 = first(first(entry4.node, "fieldGroup", NS.x), "groupItems", NS.x);
|
|
14758
14777
|
const actual = children(node3, "s", NS.x).map((item2) => decodeEscapes(att(item2, "v") ?? ""));
|
|
14759
|
-
const name3 = decodeEscapes(att(
|
|
14778
|
+
const name3 = decodeEscapes(att(entry4.node, "name") ?? "");
|
|
14760
14779
|
if (!name3 || elements(node3).length !== actual.length || actual.length !== labels.length || actual.some((label) => !label) || new Set(actual).size !== actual.length)
|
|
14761
14780
|
throw unsupported3("group items");
|
|
14762
|
-
if (name3 !== dateGroupFieldName(
|
|
14763
|
-
localized[
|
|
14781
|
+
if (name3 !== dateGroupFieldName(entry4.unit, field2) || actual.some((l, i) => l !== labels[i]))
|
|
14782
|
+
localized[entry4.unit] = { name: name3, labels: actual };
|
|
14764
14783
|
}
|
|
14765
14784
|
groups.push(Object.keys(localized).length ? { ...group2, localized } : group2);
|
|
14766
14785
|
}
|
|
@@ -14837,9 +14856,9 @@ function readItemNames(tableFields, names, shared) {
|
|
|
14837
14856
|
// xlsx/pivot/values-axis.ts
|
|
14838
14857
|
function remapPivotRowEntries(entries, axes) {
|
|
14839
14858
|
return entries.map(
|
|
14840
|
-
(
|
|
14841
|
-
...
|
|
14842
|
-
indices:
|
|
14859
|
+
(entry4) => entry4.type === "grand" ? entry4 : {
|
|
14860
|
+
...entry4,
|
|
14861
|
+
indices: entry4.indices.map((item2, axis) => {
|
|
14843
14862
|
if (axes[axis] === null) return item2;
|
|
14844
14863
|
const index3 = axes[axis]?.[item2];
|
|
14845
14864
|
if (index3 === void 0) throw new Error("Invalid report row axis item");
|
|
@@ -14975,9 +14994,9 @@ function assertPageAxisItems(root2, pivot, shared, cache2, recordRoot) {
|
|
|
14975
14994
|
throw new Error("Invalid page column items");
|
|
14976
14995
|
let previous = [];
|
|
14977
14996
|
colItems.forEach((item2, i) => {
|
|
14978
|
-
const grand = i >= expected.length,
|
|
14997
|
+
const grand = i >= expected.length, measure4 = grand ? i - expected.length : i % measures2;
|
|
14979
14998
|
const xs = children(item2, "x", NS.x).map((x) => integer2(x.getAttribute("v"), 0)), prefix2 = integer2(item2.getAttribute("r"), 0);
|
|
14980
|
-
if (integer2(item2.getAttribute("i"), 0) !==
|
|
14999
|
+
if (integer2(item2.getAttribute("i"), 0) !== measure4 || !Number.isInteger(prefix2) || prefix2 < 0 || prefix2 > Math.max(0, previous.length - 1))
|
|
14981
15000
|
throw new Error("Invalid page column prefix");
|
|
14982
15001
|
if (grand) {
|
|
14983
15002
|
if (item2.getAttribute("t") !== "grand" || prefix2 !== 0 || xs.length !== 1 || xs[0] !== 0)
|
|
@@ -15019,12 +15038,12 @@ function readOne(workbook, source, part) {
|
|
|
15019
15038
|
const cachePart = source.targetOfType(part, RELATIONSHIP_TYPES.pivotCacheDefinition);
|
|
15020
15039
|
if (!cachePart) throw new Error("Missing pivot cache");
|
|
15021
15040
|
const bookPart = source.workbookPart();
|
|
15022
|
-
const
|
|
15041
|
+
const entry4 = children(
|
|
15023
15042
|
first(parseXml(source.text(bookPart)).documentElement, "pivotCaches", NS.x),
|
|
15024
15043
|
"pivotCache",
|
|
15025
15044
|
NS.x
|
|
15026
15045
|
).find((node3) => Number(att(node3, "cacheId")) === cacheId);
|
|
15027
|
-
const relationship2 =
|
|
15046
|
+
const relationship2 = entry4 && source.rels(bookPart).get(relAttr(entry4, "id") ?? "");
|
|
15028
15047
|
if (!relationship2 || source.target(bookPart, relationship2) !== cachePart)
|
|
15029
15048
|
throw new Error("Inconsistent pivot cache identity");
|
|
15030
15049
|
const cache2 = parseXml(source.text(cachePart)).documentElement;
|
|
@@ -15079,7 +15098,7 @@ function readOne(workbook, source, part) {
|
|
|
15079
15098
|
if (rowFields.length < 1 || dataFields.length < 1 || dataFields.length > 16 || !supportedPivotAxes(rowFields, colFields, dataFields.length, rowsAxis) || root2.getAttribute("rowGrandTotals") === "0" || root2.getAttribute("colGrandTotals") === "0")
|
|
15080
15099
|
throw new Error("Unsupported pivot layout");
|
|
15081
15100
|
const valueIndex = pivotValueIndex(root2, rowsAxis ? rowFields : colFields);
|
|
15082
|
-
const
|
|
15101
|
+
const measure4 = dataFields[0];
|
|
15083
15102
|
const definition = elements(first(root2, "extLst", NS.x) ?? parseXml("<root/>").documentElement).map(
|
|
15084
15103
|
(extension2) => first(
|
|
15085
15104
|
extension2,
|
|
@@ -15103,8 +15122,8 @@ function readOne(workbook, source, part) {
|
|
|
15103
15122
|
throw new Error("Unsupported Values axis item");
|
|
15104
15123
|
}
|
|
15105
15124
|
}
|
|
15106
|
-
const aggregate = att(
|
|
15107
|
-
if (!PIVOT_AGGREGATES.includes(aggregate) || att(
|
|
15125
|
+
const aggregate = att(measure4, "subtotal") ?? "sum";
|
|
15126
|
+
if (!PIVOT_AGGREGATES.includes(aggregate) || att(measure4, "showDataAs") && att(measure4, "showDataAs") !== "normal")
|
|
15108
15127
|
throw new Error("Unsupported pivot aggregate");
|
|
15109
15128
|
const names = fields.map((field2) => decodeEscapes(att(field2, "name") ?? ""));
|
|
15110
15129
|
const axisNames = allFields.map((field2) => decodeEscapes(att(field2, "name") ?? ""));
|
|
@@ -15125,7 +15144,7 @@ function readOne(workbook, source, part) {
|
|
|
15125
15144
|
const rowDefinitions = realRows.map((field2) => tableFields[Number(att(field2, "x"))]);
|
|
15126
15145
|
const subtotalSettings = fieldSubtotalsOf(rowDefinitions, [row2, second, ...more]);
|
|
15127
15146
|
const subtotal = !subtotalSettings.some(
|
|
15128
|
-
(
|
|
15147
|
+
(entry5) => entry5.field === row2 && entry5.functions.length === 0
|
|
15129
15148
|
);
|
|
15130
15149
|
const repeat = realRows.map((field2) => {
|
|
15131
15150
|
const node3 = tableFields[Number(att(field2, "x"))];
|
|
@@ -15139,7 +15158,7 @@ function readOne(workbook, source, part) {
|
|
|
15139
15158
|
"fillDownLabels"
|
|
15140
15159
|
) === "1";
|
|
15141
15160
|
});
|
|
15142
|
-
if (repeat.some((
|
|
15161
|
+
if (repeat.some((entry5) => entry5 !== repeat[0])) throw new Error("Mixed field label repetition");
|
|
15143
15162
|
const columnDefs = dataFields.length > 1 && !rowsAxis ? colFields.slice(0, -1) : colFields;
|
|
15144
15163
|
const columnNames = columnDefs.map((field2) => axisNames[Number(att(field2, "x"))]);
|
|
15145
15164
|
const hasColumn = columnDefs.length > 0;
|
|
@@ -15148,7 +15167,7 @@ function readOne(workbook, source, part) {
|
|
|
15148
15167
|
const columnDefinitions = columnDefs.map((field2) => tableFields[Number(att(field2, "x"))]);
|
|
15149
15168
|
if (columnNames.some((name3) => !name3)) throw new Error("Invalid pivot column fields");
|
|
15150
15169
|
const columnSubtotals = fieldSubtotalsOf(columnDefinitions, columnNames);
|
|
15151
|
-
const data = names[Number(att(
|
|
15170
|
+
const data = names[Number(att(measure4, "fld"))];
|
|
15152
15171
|
const location = parseRange(att(first(root2, "location", NS.x), "ref") ?? "");
|
|
15153
15172
|
if (!row2 || !data || !location || hasColumn && !col || realRows.length === 2 && !second)
|
|
15154
15173
|
throw new Error("Invalid pivot fields");
|
|
@@ -15190,7 +15209,7 @@ function readOne(workbook, source, part) {
|
|
|
15190
15209
|
if (dateFields.some((field2) => onAxis.has(field2)))
|
|
15191
15210
|
throw new Error("Date fields used as rows, columns or values are preserved");
|
|
15192
15211
|
const fieldSubtotals = [
|
|
15193
|
-
...subtotalSettings.filter((
|
|
15212
|
+
...subtotalSettings.filter((entry5) => entry5.field !== row2 || entry5.functions.length),
|
|
15194
15213
|
...columnSubtotals
|
|
15195
15214
|
];
|
|
15196
15215
|
const pivot = {
|
|
@@ -15220,14 +15239,14 @@ function readOne(workbook, source, part) {
|
|
|
15220
15239
|
},
|
|
15221
15240
|
valueField: data,
|
|
15222
15241
|
aggregate,
|
|
15223
|
-
valueCaption: decodeEscapes(att(
|
|
15242
|
+
valueCaption: decodeEscapes(att(measure4, "name") ?? data),
|
|
15224
15243
|
...dataFields.length > 1 ? {
|
|
15225
|
-
additionalValues: dataFields.slice(1).map((
|
|
15226
|
-
const field2 = names[Number(att(
|
|
15227
|
-
const aggregate2 = att(
|
|
15228
|
-
if (!field2 || !PIVOT_AGGREGATES.includes(aggregate2) || att(
|
|
15244
|
+
additionalValues: dataFields.slice(1).map((measure5) => {
|
|
15245
|
+
const field2 = names[Number(att(measure5, "fld"))];
|
|
15246
|
+
const aggregate2 = att(measure5, "subtotal") ?? "sum";
|
|
15247
|
+
if (!field2 || !PIVOT_AGGREGATES.includes(aggregate2) || att(measure5, "showDataAs") && att(measure5, "showDataAs") !== "normal")
|
|
15229
15248
|
throw new Error("Unsupported pivot measure");
|
|
15230
|
-
return { field: field2, aggregate: aggregate2, caption: decodeEscapes(att(
|
|
15249
|
+
return { field: field2, aggregate: aggregate2, caption: decodeEscapes(att(measure5, "name") ?? field2) };
|
|
15231
15250
|
})
|
|
15232
15251
|
} : {},
|
|
15233
15252
|
fields: names,
|
|
@@ -15533,9 +15552,9 @@ async function openPackage(input, limits) {
|
|
|
15533
15552
|
async function readZipParts(input, limits = {}) {
|
|
15534
15553
|
const zip = await openPackage(input, resolveLoadLimits(limits));
|
|
15535
15554
|
const parts = /* @__PURE__ */ new Map();
|
|
15536
|
-
for (const
|
|
15537
|
-
if (
|
|
15538
|
-
parts.set(
|
|
15555
|
+
for (const entry4 of Object.values(zip.files)) {
|
|
15556
|
+
if (entry4.dir) continue;
|
|
15557
|
+
parts.set(entry4.name.replace(/^\//, ""), await entry4.async("uint8array"));
|
|
15539
15558
|
}
|
|
15540
15559
|
return parts;
|
|
15541
15560
|
}
|
|
@@ -15659,10 +15678,10 @@ function splitSheetData(xml) {
|
|
|
15659
15678
|
function parseColor(element2, palette) {
|
|
15660
15679
|
if (!element2) return void 0;
|
|
15661
15680
|
const color2 = {};
|
|
15662
|
-
const
|
|
15681
|
+
const rgb7 = att(element2, "rgb");
|
|
15663
15682
|
const theme2 = numAttr(element2, "theme");
|
|
15664
15683
|
const indexed = numAttr(element2, "indexed");
|
|
15665
|
-
if (
|
|
15684
|
+
if (rgb7 && /^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(rgb7)) color2.rgb = rgb7.toUpperCase();
|
|
15666
15685
|
else if (theme2 !== void 0) color2.theme = theme2;
|
|
15667
15686
|
else if (indexed !== void 0) {
|
|
15668
15687
|
const override = palette?.[indexed];
|
|
@@ -15946,15 +15965,15 @@ function parseStyles(xml, warnings) {
|
|
|
15946
15965
|
const xfId = numAttr(node3, "xfId") ?? 0;
|
|
15947
15966
|
const name3 = att(node3, "name") ?? `Style ${xfId}`;
|
|
15948
15967
|
const style3 = styleXfs[xfId] ?? fallback;
|
|
15949
|
-
const
|
|
15968
|
+
const entry4 = { name: name3, style: structuredClone(style3) };
|
|
15950
15969
|
const builtinId = numAttr(node3, "builtinId");
|
|
15951
|
-
if (builtinId !== void 0)
|
|
15970
|
+
if (builtinId !== void 0) entry4.builtinId = builtinId;
|
|
15952
15971
|
if (!namesByXf.has(xfId)) namesByXf.set(xfId, name3);
|
|
15953
|
-
namedStyles.push(
|
|
15972
|
+
namedStyles.push(entry4);
|
|
15954
15973
|
}
|
|
15955
|
-
const normalAt = namedStyles.findIndex((
|
|
15974
|
+
const normalAt = namedStyles.findIndex((entry4) => entry4.builtinId === 0);
|
|
15956
15975
|
if (normalAt > 0) namedStyles.unshift(...namedStyles.splice(normalAt, 1));
|
|
15957
|
-
if (!namedStyles.some((
|
|
15976
|
+
if (!namedStyles.some((entry4) => entry4.name === "Normal"))
|
|
15958
15977
|
namedStyles.unshift({ name: "Normal", style: styleXfs[0] ?? defaultCellStyle(), builtinId: 0 });
|
|
15959
15978
|
const styles = [];
|
|
15960
15979
|
const keys = /* @__PURE__ */ new Map();
|
|
@@ -16040,13 +16059,13 @@ function readDateGroup(node3) {
|
|
|
16040
16059
|
return item2;
|
|
16041
16060
|
}
|
|
16042
16061
|
function readFilterColumn(column, dxfs) {
|
|
16043
|
-
const
|
|
16062
|
+
const entry4 = { offset: numAttr(column, "colId") ?? 0 };
|
|
16044
16063
|
const filters = xFirst(column, "filters");
|
|
16045
16064
|
if (filters) {
|
|
16046
|
-
|
|
16047
|
-
if (boolAttr(filters, "blank"))
|
|
16065
|
+
entry4.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
|
|
16066
|
+
if (boolAttr(filters, "blank")) entry4.blank = true;
|
|
16048
16067
|
const groups = xChildren(filters, "dateGroupItem").map(readDateGroup).filter((g) => g !== void 0);
|
|
16049
|
-
if (groups.length)
|
|
16068
|
+
if (groups.length) entry4.dateGroups = groups;
|
|
16050
16069
|
}
|
|
16051
16070
|
const custom = xFirst(column, "customFilters");
|
|
16052
16071
|
if (custom) {
|
|
@@ -16057,12 +16076,12 @@ function readFilterColumn(column, dxfs) {
|
|
|
16057
16076
|
value: att(c2, "val") ?? ""
|
|
16058
16077
|
};
|
|
16059
16078
|
});
|
|
16060
|
-
|
|
16079
|
+
entry4.custom = { ...boolAttr(custom, "and") ? { and: true } : {}, conditions };
|
|
16061
16080
|
}
|
|
16062
16081
|
const top = xFirst(column, "top10");
|
|
16063
16082
|
if (top) {
|
|
16064
16083
|
const filterValue = numAttr(top, "filterVal");
|
|
16065
|
-
|
|
16084
|
+
entry4.top10 = {
|
|
16066
16085
|
top: boolAttr(top, "top", true),
|
|
16067
16086
|
percent: boolAttr(top, "percent", false),
|
|
16068
16087
|
value: numAttr(top, "val") ?? 10,
|
|
@@ -16073,7 +16092,7 @@ function readFilterColumn(column, dxfs) {
|
|
|
16073
16092
|
if (dynamic2) {
|
|
16074
16093
|
const value3 = numAttr(dynamic2, "val");
|
|
16075
16094
|
const maxValue = numAttr(dynamic2, "maxVal");
|
|
16076
|
-
|
|
16095
|
+
entry4.dynamic = {
|
|
16077
16096
|
type: att(dynamic2, "type") ?? "null",
|
|
16078
16097
|
...value3 !== void 0 ? { value: value3 } : {},
|
|
16079
16098
|
...maxValue !== void 0 ? { maxValue } : {}
|
|
@@ -16083,7 +16102,7 @@ function readFilterColumn(column, dxfs) {
|
|
|
16083
16102
|
if (color2) {
|
|
16084
16103
|
const dxfId = numAttr(color2, "dxfId");
|
|
16085
16104
|
const style3 = dxfId === void 0 ? void 0 : dxfs?.[dxfId];
|
|
16086
|
-
|
|
16105
|
+
entry4.color = {
|
|
16087
16106
|
cellColor: boolAttr(color2, "cellColor", true),
|
|
16088
16107
|
...dxfId !== void 0 ? { dxfId } : {},
|
|
16089
16108
|
...style3 ? { style: structuredClone(style3) } : {}
|
|
@@ -16093,11 +16112,11 @@ function readFilterColumn(column, dxfs) {
|
|
|
16093
16112
|
const iconSet = att(icon, "iconSet");
|
|
16094
16113
|
if (iconSet) {
|
|
16095
16114
|
const iconId = numAttr(icon, "iconId");
|
|
16096
|
-
|
|
16115
|
+
entry4.icon = { iconSet, ...iconId !== void 0 ? { iconId } : {} };
|
|
16097
16116
|
}
|
|
16098
|
-
if (boolAttr(column, "hiddenButton"))
|
|
16099
|
-
|
|
16100
|
-
return
|
|
16117
|
+
if (boolAttr(column, "hiddenButton")) entry4.hiddenButton = true;
|
|
16118
|
+
entry4.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
|
|
16119
|
+
return entry4;
|
|
16101
16120
|
}
|
|
16102
16121
|
|
|
16103
16122
|
// xlsx/read/sort-state.ts
|
|
@@ -17486,7 +17505,7 @@ function diagramNodesInTreeOrder(data) {
|
|
|
17486
17505
|
nodes.sort(
|
|
17487
17506
|
(a2, b) => (order.get(a2.node.id) ?? Number.MAX_SAFE_INTEGER) - (order.get(b.node.id) ?? Number.MAX_SAFE_INTEGER) || a2.index - b.index
|
|
17488
17507
|
);
|
|
17489
|
-
return treeOrderDiagramNodes(nodes.map((
|
|
17508
|
+
return treeOrderDiagramNodes(nodes.map((entry4) => entry4.node));
|
|
17490
17509
|
}
|
|
17491
17510
|
|
|
17492
17511
|
// units/constants.ts
|
|
@@ -17496,7 +17515,7 @@ var EMU_PER_POINT = 12700;
|
|
|
17496
17515
|
// drawingml/drawing-shadow.ts
|
|
17497
17516
|
function resolveDrawingShadow(effects, theme2) {
|
|
17498
17517
|
const effect = parseDrawingEffects(effects)?.effects.find(
|
|
17499
|
-
(
|
|
17518
|
+
(entry4) => entry4.kind === "outerShadow"
|
|
17500
17519
|
);
|
|
17501
17520
|
return effect?.kind === "outerShadow" ? resolveDrawingOuterShadow(effect, theme2) : void 0;
|
|
17502
17521
|
}
|
|
@@ -18047,12 +18066,12 @@ function captureDiagramPictures(model2, dataXml, dataParts, drawing) {
|
|
|
18047
18066
|
id4 = `ooxmlDiagramPicture${index3}`;
|
|
18048
18067
|
parts[id4] = part;
|
|
18049
18068
|
}
|
|
18050
|
-
const
|
|
18069
|
+
const entry4 = { ...source, fill: remapFill(source.fill, id4) };
|
|
18051
18070
|
const existing = pictures.findIndex(
|
|
18052
|
-
(item2) => item2.nodeId ===
|
|
18071
|
+
(item2) => item2.nodeId === entry4.nodeId && (item2.role === entry4.role && item2.styleLabel === entry4.styleLabel || !item2.role && !item2.styleLabel && item2.fill.relId === entry4.fill.relId)
|
|
18053
18072
|
);
|
|
18054
|
-
if (existing < 0) pictures.push(
|
|
18055
|
-
else pictures[existing] =
|
|
18073
|
+
if (existing < 0) pictures.push(entry4);
|
|
18074
|
+
else pictures[existing] = entry4;
|
|
18056
18075
|
};
|
|
18057
18076
|
const root2 = parseXml(dataXml).documentElement;
|
|
18058
18077
|
const saved2 = root2.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "picture");
|
|
@@ -18128,7 +18147,7 @@ async function resolveDiagramDrawingPart(hostPart, dataRelId, drawingExtensionRe
|
|
|
18128
18147
|
const entries = await host.readRelationshipEntries(diagramRelationshipsPart(dataPath));
|
|
18129
18148
|
if (!entries) return void 0;
|
|
18130
18149
|
const drawing = entries.find(
|
|
18131
|
-
(
|
|
18150
|
+
(entry4) => (!drawingExtensionRelId || entry4.id.trim() === drawingExtensionRelId) && entry4.type.endsWith("/diagramDrawing")
|
|
18132
18151
|
);
|
|
18133
18152
|
const id4 = drawing?.id.trim() ?? "";
|
|
18134
18153
|
const target2 = drawing?.target.trim() ?? "";
|
|
@@ -18567,13 +18586,13 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
18567
18586
|
diagramRelationshipsPart(drawingResolution.path)
|
|
18568
18587
|
);
|
|
18569
18588
|
const pictures = (entries ?? []).filter(
|
|
18570
|
-
(
|
|
18589
|
+
(entry4) => entry4.type.endsWith("/image") && entry4.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry4.target)
|
|
18571
18590
|
);
|
|
18572
18591
|
if (pictures.length)
|
|
18573
18592
|
drawing.pictureParts = Object.fromEntries(
|
|
18574
|
-
pictures.map((
|
|
18575
|
-
|
|
18576
|
-
host.resolvePath(drawingResolution.path,
|
|
18593
|
+
pictures.map((entry4) => [
|
|
18594
|
+
entry4.id,
|
|
18595
|
+
host.resolvePath(drawingResolution.path, entry4.target)
|
|
18577
18596
|
])
|
|
18578
18597
|
);
|
|
18579
18598
|
} catch {
|
|
@@ -18597,8 +18616,8 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
18597
18616
|
const entries = await host.readRelationshipEntries(diagramRelationshipsPart(owner));
|
|
18598
18617
|
pictureParts = Object.fromEntries(
|
|
18599
18618
|
(entries ?? []).filter(
|
|
18600
|
-
(
|
|
18601
|
-
).map((
|
|
18619
|
+
(entry4) => entry4.type.endsWith("/image") && entry4.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry4.target)
|
|
18620
|
+
).map((entry4) => [entry4.id, host.resolvePath(owner, entry4.target)])
|
|
18602
18621
|
);
|
|
18603
18622
|
} catch {
|
|
18604
18623
|
issues.push({
|
|
@@ -20065,12 +20084,12 @@ var LEGEND = /* @__PURE__ */ new Set(["legendPos", "legendEntry", "layout", "ove
|
|
|
20065
20084
|
function parseLegend(context, element2) {
|
|
20066
20085
|
reportUnmodelled(context, element2, LEGEND);
|
|
20067
20086
|
const entries = children(element2, "legendEntry", NS.c).map(
|
|
20068
|
-
(
|
|
20087
|
+
(entry4) => assignDefined(
|
|
20069
20088
|
{},
|
|
20070
20089
|
{
|
|
20071
|
-
index: cNumber(context,
|
|
20072
|
-
deleted: cBool(context,
|
|
20073
|
-
txPr: textProperties(
|
|
20090
|
+
index: cNumber(context, entry4, "idx"),
|
|
20091
|
+
deleted: cBool(context, entry4, "delete"),
|
|
20092
|
+
txPr: textProperties(entry4)
|
|
20074
20093
|
}
|
|
20075
20094
|
)
|
|
20076
20095
|
);
|
|
@@ -20554,9 +20573,9 @@ function view3DXml(view2) {
|
|
|
20554
20573
|
function legendXml(context, legend) {
|
|
20555
20574
|
if (!legend) return "";
|
|
20556
20575
|
const entries = legend.entries.map(
|
|
20557
|
-
(
|
|
20576
|
+
(entry4) => elementXml(
|
|
20558
20577
|
"legendEntry",
|
|
20559
|
-
valXml("idx",
|
|
20578
|
+
valXml("idx", entry4.index) + valXml("delete", entry4.deleted) + textBodyXml(context, entry4.txPr)
|
|
20560
20579
|
)
|
|
20561
20580
|
).join("");
|
|
20562
20581
|
return elementXml(
|
|
@@ -20707,8 +20726,8 @@ function summaryErrorBars(source) {
|
|
|
20707
20726
|
return out;
|
|
20708
20727
|
}
|
|
20709
20728
|
function summaryAnalysis(series) {
|
|
20710
|
-
const trendlines = (series.trendlines ?? []).map(summaryTrendline).filter((
|
|
20711
|
-
const errorBars = (series.errorBars ?? []).map(summaryErrorBars).filter((
|
|
20729
|
+
const trendlines = (series.trendlines ?? []).map(summaryTrendline).filter((entry4) => entry4 !== void 0);
|
|
20730
|
+
const errorBars = (series.errorBars ?? []).map(summaryErrorBars).filter((entry4) => entry4 !== void 0);
|
|
20712
20731
|
return {
|
|
20713
20732
|
...trendlines.length ? { trendlines } : {},
|
|
20714
20733
|
...errorBars.length ? { errorBars } : {}
|
|
@@ -21118,7 +21137,7 @@ function extraGroups(chartSpace, firstType) {
|
|
|
21118
21137
|
const stockOverColumns = group2.kind === "stock" && firstType === "column";
|
|
21119
21138
|
if (group2.is3D || !(["bar", "line", "area"].includes(group2.kind) || stockOverColumns)) continue;
|
|
21120
21139
|
const type = group2.kind === "bar" ? "column" : group2.kind;
|
|
21121
|
-
const
|
|
21140
|
+
const entry4 = {
|
|
21122
21141
|
chartType: type,
|
|
21123
21142
|
series: group2.series.map((source, index3) => ({
|
|
21124
21143
|
...chartSummarySeries(
|
|
@@ -21132,13 +21151,13 @@ function extraGroups(chartSpace, firstType) {
|
|
|
21132
21151
|
secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
|
|
21133
21152
|
};
|
|
21134
21153
|
if (group2.grouping && GROUPINGS.has(group2.grouping))
|
|
21135
|
-
|
|
21136
|
-
if (type === "stock")
|
|
21154
|
+
entry4.grouping = group2.grouping;
|
|
21155
|
+
if (type === "stock") entry4.stock = stockStyle(group2);
|
|
21137
21156
|
if (type === "column") {
|
|
21138
|
-
if (group2.gapWidth !== void 0)
|
|
21139
|
-
if (group2.overlap !== void 0)
|
|
21157
|
+
if (group2.gapWidth !== void 0) entry4.barGapWidth = group2.gapWidth;
|
|
21158
|
+
if (group2.overlap !== void 0) entry4.barOverlap = group2.overlap;
|
|
21140
21159
|
}
|
|
21141
|
-
if (
|
|
21160
|
+
if (entry4.series.length) out.push(entry4);
|
|
21142
21161
|
}
|
|
21143
21162
|
return out;
|
|
21144
21163
|
}
|
|
@@ -21842,20 +21861,20 @@ function resolveChartStyleDefinition(style3, resolve) {
|
|
|
21842
21861
|
for (const name3 of CHART_STYLE_PARTS) {
|
|
21843
21862
|
const source = style3.entries[name3];
|
|
21844
21863
|
if (!source) continue;
|
|
21845
|
-
const
|
|
21864
|
+
const entry4 = {};
|
|
21846
21865
|
for (const key3 of ["fontSize", "bold", "italic", "underline"]) {
|
|
21847
21866
|
const value3 = source[key3];
|
|
21848
|
-
if (value3 !== void 0) Object.assign(
|
|
21867
|
+
if (value3 !== void 0) Object.assign(entry4, { [key3]: value3 });
|
|
21849
21868
|
}
|
|
21850
21869
|
const line = fillColor(source.line?.fill) ?? (source.lineRef?.color && resolve(source.lineRef.color));
|
|
21851
21870
|
const fill = fillColor(source.fill) ?? (source.fillRef?.color && resolve(source.fillRef.color));
|
|
21852
21871
|
const color2 = (source.textColor && resolve(source.textColor)) ?? (source.fontRef?.color && resolve(source.fontRef.color));
|
|
21853
|
-
if (color2 !== void 0)
|
|
21854
|
-
if (line !== void 0)
|
|
21855
|
-
if (fill !== void 0)
|
|
21872
|
+
if (color2 !== void 0) entry4.color = color2;
|
|
21873
|
+
if (line !== void 0) entry4.lineColor = line;
|
|
21874
|
+
if (fill !== void 0) entry4.fillColor = fill;
|
|
21856
21875
|
if (source.line?.widthEmu !== void 0 && source.line.widthEmu > 0)
|
|
21857
|
-
|
|
21858
|
-
if (Object.keys(
|
|
21876
|
+
entry4.lineWidth = source.line.widthEmu / 12700;
|
|
21877
|
+
if (Object.keys(entry4).length) out[name3] = entry4;
|
|
21859
21878
|
}
|
|
21860
21879
|
return Object.keys(out).length ? out : void 0;
|
|
21861
21880
|
}
|
|
@@ -22002,9 +22021,9 @@ var TEXT_PARTS = [
|
|
|
22002
22021
|
"legend",
|
|
22003
22022
|
"dataLabel"
|
|
22004
22023
|
];
|
|
22005
|
-
function inheritChartText(part,
|
|
22006
|
-
if (!root2 || !TEXT_PARTS.includes(part)) return
|
|
22007
|
-
const out = { ...
|
|
22024
|
+
function inheritChartText(part, entry4, builtIn, root2) {
|
|
22025
|
+
if (!root2 || !TEXT_PARTS.includes(part)) return entry4;
|
|
22026
|
+
const out = { ...entry4 };
|
|
22008
22027
|
for (const key3 of TEXT_KEYS) {
|
|
22009
22028
|
delete out[key3];
|
|
22010
22029
|
const value3 = root2[key3] ?? builtIn?.[key3];
|
|
@@ -22017,11 +22036,11 @@ function inheritChartText(part, entry3, builtIn, root2) {
|
|
|
22017
22036
|
|
|
22018
22037
|
// chart/render/chart-appearance.ts
|
|
22019
22038
|
var chartPointsToPixels = (points) => points * EMU_PER_POINT / EMU_PER_PIXEL;
|
|
22020
|
-
function typeface(
|
|
22021
|
-
const name3 =
|
|
22039
|
+
function typeface(entry4, theme2) {
|
|
22040
|
+
const name3 = entry4.typeface;
|
|
22022
22041
|
if (name3?.startsWith("+mj-")) return theme2.majorFont;
|
|
22023
22042
|
if (name3?.startsWith("+mn-")) return theme2.minorFont;
|
|
22024
|
-
return name3 ?? (
|
|
22043
|
+
return name3 ?? (entry4.fontRef?.index === "major" ? theme2.majorFont : entry4.fontRef?.index === "minor" ? theme2.minorFont : void 0);
|
|
22025
22044
|
}
|
|
22026
22045
|
function chartAppearance(chart, theme2) {
|
|
22027
22046
|
const defaults = builtInChartTextStyle(effectiveBuiltInChartStyle(chart.formatting));
|
|
@@ -22030,7 +22049,7 @@ function chartAppearance(chart, theme2) {
|
|
|
22030
22049
|
const base2 = chart.styleDefinition?.entries[part];
|
|
22031
22050
|
const direct = chart.formatting?.entries[part];
|
|
22032
22051
|
if (!defaults[part] && !base2 && !direct) continue;
|
|
22033
|
-
const
|
|
22052
|
+
const entry4 = {
|
|
22034
22053
|
...inheritChartText(
|
|
22035
22054
|
part,
|
|
22036
22055
|
{ ...defaults[part], ...base2, sourceXml: base2?.sourceXml ?? "" },
|
|
@@ -22040,8 +22059,8 @@ function chartAppearance(chart, theme2) {
|
|
|
22040
22059
|
...direct,
|
|
22041
22060
|
sourceXml: direct?.sourceXml ?? base2?.sourceXml ?? ""
|
|
22042
22061
|
};
|
|
22043
|
-
if (base2?.line || direct?.line)
|
|
22044
|
-
entries[part] =
|
|
22062
|
+
if (base2?.line || direct?.line) entry4.line = { ...base2?.line, ...direct?.line };
|
|
22063
|
+
entries[part] = entry4;
|
|
22045
22064
|
}
|
|
22046
22065
|
const scheme = chartColorScheme(theme2);
|
|
22047
22066
|
const resolve = (color2) => resolveDrawingColor(
|
|
@@ -22054,19 +22073,19 @@ function chartAppearance(chart, theme2) {
|
|
|
22054
22073
|
(color2) => drawingColorCss(resolve(color2))
|
|
22055
22074
|
) ?? {};
|
|
22056
22075
|
for (const part of CHART_STYLE_PARTS) {
|
|
22057
|
-
const
|
|
22058
|
-
if (!
|
|
22059
|
-
const family = typeface(
|
|
22060
|
-
const shadow = resolveDrawingShadowXml(
|
|
22076
|
+
const entry4 = entries[part];
|
|
22077
|
+
if (!entry4) continue;
|
|
22078
|
+
const family = typeface(entry4, theme2);
|
|
22079
|
+
const shadow = resolveDrawingShadowXml(entry4.textEffectsXml, {
|
|
22061
22080
|
scheme: (name3) => scheme[name3]
|
|
22062
22081
|
});
|
|
22063
22082
|
if (shadow) (out[part] ??= {}).textShadow = shadow;
|
|
22064
22083
|
if (family) (out[part] ??= {}).typeface = family;
|
|
22065
|
-
if (
|
|
22066
|
-
if (
|
|
22067
|
-
if (
|
|
22068
|
-
if (
|
|
22069
|
-
(out[part] ??= {}).gradient = resolveChartGradient(
|
|
22084
|
+
if (entry4.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry4.axisVisible;
|
|
22085
|
+
if (entry4.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry4.labelsVisible;
|
|
22086
|
+
if (entry4.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
|
|
22087
|
+
if (entry4.fill?.kind === "gradient") {
|
|
22088
|
+
(out[part] ??= {}).gradient = resolveChartGradient(entry4.fill, resolve);
|
|
22070
22089
|
}
|
|
22071
22090
|
}
|
|
22072
22091
|
return out;
|
|
@@ -22085,8 +22104,8 @@ function chartRunStyle(run2) {
|
|
|
22085
22104
|
}
|
|
22086
22105
|
function chartTitleText(chart, theme2) {
|
|
22087
22106
|
const formatting = chart.formatting;
|
|
22088
|
-
const
|
|
22089
|
-
const body =
|
|
22107
|
+
const entry4 = formatting?.entries.title;
|
|
22108
|
+
const body = entry4?.textBody;
|
|
22090
22109
|
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
22091
22110
|
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)
|
|
22092
22111
|
return void 0;
|
|
@@ -22099,7 +22118,7 @@ function chartTitleText(chart, theme2) {
|
|
|
22099
22118
|
runs: paragraph2.runs.map((run2) => {
|
|
22100
22119
|
const direct = {
|
|
22101
22120
|
sourceXml: "",
|
|
22102
|
-
...
|
|
22121
|
+
...entry4.textBodyStyle,
|
|
22103
22122
|
...chartRunStyle(paragraph2.defaultProperties ?? {}),
|
|
22104
22123
|
...chartRunStyle(run2)
|
|
22105
22124
|
};
|
|
@@ -22925,23 +22944,23 @@ function readValue2(ctx, c2, cell) {
|
|
|
22925
22944
|
const raw2 = v ? v.textContent ?? "" : void 0;
|
|
22926
22945
|
switch (type) {
|
|
22927
22946
|
case "s": {
|
|
22928
|
-
const
|
|
22929
|
-
if (!
|
|
22947
|
+
const entry4 = ctx.sharedStrings[Number(raw2)];
|
|
22948
|
+
if (!entry4) {
|
|
22930
22949
|
if (raw2 !== void 0) ctx.warn("A cell refers to a missing shared string.");
|
|
22931
22950
|
return;
|
|
22932
22951
|
}
|
|
22933
|
-
cell.value =
|
|
22934
|
-
if (
|
|
22935
|
-
if (
|
|
22952
|
+
cell.value = entry4.text;
|
|
22953
|
+
if (entry4.runs) cell.richText = entry4.runs.map((run2) => ({ ...run2 }));
|
|
22954
|
+
if (entry4.phonetic) cell.phonetic = structuredClone(entry4.phonetic);
|
|
22936
22955
|
return;
|
|
22937
22956
|
}
|
|
22938
22957
|
case "inlineStr": {
|
|
22939
22958
|
const is = xFirst(c2, "is");
|
|
22940
22959
|
if (!is) return;
|
|
22941
|
-
const
|
|
22942
|
-
cell.value =
|
|
22943
|
-
if (
|
|
22944
|
-
if (
|
|
22960
|
+
const entry4 = parseRichString(is, ctx.palette);
|
|
22961
|
+
cell.value = entry4.text;
|
|
22962
|
+
if (entry4.runs) cell.richText = entry4.runs;
|
|
22963
|
+
if (entry4.phonetic) cell.phonetic = entry4.phonetic;
|
|
22945
22964
|
return;
|
|
22946
22965
|
}
|
|
22947
22966
|
case "str":
|
|
@@ -23434,13 +23453,13 @@ async function loadXlsx(input, options2 = {}) {
|
|
|
23434
23453
|
const warn = (message) => {
|
|
23435
23454
|
if (!warnings.includes(message)) warnings.push(message);
|
|
23436
23455
|
};
|
|
23437
|
-
const
|
|
23438
|
-
const stylesPart =
|
|
23456
|
+
const partOf2 = (type) => source.targetOfType(workbookPart, type);
|
|
23457
|
+
const stylesPart = partOf2(RELATIONSHIP_TYPES.styles);
|
|
23439
23458
|
const styles = parseStyles(stylesPart ? source.text(stylesPart) : void 0, warnings);
|
|
23440
|
-
const themePart =
|
|
23441
|
-
const stringsPart =
|
|
23442
|
-
const personsPart =
|
|
23443
|
-
const metadataPart =
|
|
23459
|
+
const themePart = partOf2(RELATIONSHIP_TYPES.theme);
|
|
23460
|
+
const stringsPart = partOf2(RELATIONSHIP_TYPES.sharedStrings);
|
|
23461
|
+
const personsPart = partOf2(RELATIONSHIP_TYPES.person);
|
|
23462
|
+
const metadataPart = partOf2(RELATIONSHIP_TYPES.sheetMetadata);
|
|
23444
23463
|
const ctx = {
|
|
23445
23464
|
source,
|
|
23446
23465
|
sharedStrings: parseSharedStrings(
|
|
@@ -23458,24 +23477,24 @@ async function loadXlsx(input, options2 = {}) {
|
|
|
23458
23477
|
maxXmlElements: limits.maxXmlElements
|
|
23459
23478
|
};
|
|
23460
23479
|
const rels = source.rels(workbookPart);
|
|
23461
|
-
const sheets = book.sheets.map((
|
|
23462
|
-
const rel = rels.get(
|
|
23480
|
+
const sheets = book.sheets.map((entry4) => {
|
|
23481
|
+
const rel = rels.get(entry4.relId);
|
|
23463
23482
|
const target2 = rel ? source.target(workbookPart, rel) : void 0;
|
|
23464
23483
|
let sheet;
|
|
23465
23484
|
if (rel?.type === RELATIONSHIP_TYPES.worksheet && target2) {
|
|
23466
|
-
sheet = parseWorksheet(ctx, target2,
|
|
23485
|
+
sheet = parseWorksheet(ctx, target2, entry4.name, entry4.sheetId);
|
|
23467
23486
|
} else {
|
|
23468
|
-
sheet = createWorksheet(
|
|
23487
|
+
sheet = createWorksheet(entry4.name, entry4.sheetId);
|
|
23469
23488
|
if (target2) sheet.partName = target2;
|
|
23470
23489
|
const kind = rel?.type.split("/").pop() ?? "sheet";
|
|
23471
|
-
warn(`Sheet "${
|
|
23490
|
+
warn(`Sheet "${entry4.name}" is a ${kind}; it is kept on save but cannot be shown or edited.`);
|
|
23472
23491
|
}
|
|
23473
|
-
sheet.state =
|
|
23492
|
+
sheet.state = entry4.state;
|
|
23474
23493
|
return sheet;
|
|
23475
23494
|
});
|
|
23476
|
-
if (source.has("xl/vbaProject.bin") ||
|
|
23495
|
+
if (source.has("xl/vbaProject.bin") || partOf2(RELATIONSHIP_TYPES.vbaProject))
|
|
23477
23496
|
warn("The workbook contains VBA macros; they are kept on save but never run.");
|
|
23478
|
-
if (
|
|
23497
|
+
if (partOf2(RELATIONSHIP_TYPES.externalLink))
|
|
23479
23498
|
warn("External workbook links are kept but not updated.");
|
|
23480
23499
|
const signatures = detectDigitalSignatures([...parts.keys()]);
|
|
23481
23500
|
if (signatures.hasSignatures)
|
|
@@ -24199,14 +24218,14 @@ function strokeOf(line, fallback, resolve) {
|
|
|
24199
24218
|
}
|
|
24200
24219
|
function analysisView(source, seriesColor, resolve) {
|
|
24201
24220
|
const plain3 = seriesColor === "none" || seriesColor.startsWith("url(") ? TEXT_COLOR : seriesColor;
|
|
24202
|
-
const trendlines = (source.trendlines ?? []).flatMap((
|
|
24203
|
-
const { name: _name, line, ...fit3 } =
|
|
24221
|
+
const trendlines = (source.trendlines ?? []).flatMap((entry4) => {
|
|
24222
|
+
const { name: _name, line, ...fit3 } = entry4;
|
|
24204
24223
|
const fallback = { color: plain3, width: chartPointsToPixels(1.5), dash: "sysDot" };
|
|
24205
24224
|
const stroke = strokeOf(line, fallback, resolve);
|
|
24206
24225
|
return stroke ? [{ fit: fit3, stroke }] : [];
|
|
24207
24226
|
});
|
|
24208
|
-
const errorBars = (source.errorBars ?? []).flatMap((
|
|
24209
|
-
const { direction: direction2, barType, noEndCap, line, ...amount } =
|
|
24227
|
+
const errorBars = (source.errorBars ?? []).flatMap((entry4) => {
|
|
24228
|
+
const { direction: direction2, barType, noEndCap, line, ...amount } = entry4;
|
|
24210
24229
|
const stroke = strokeOf(line, { color: TEXT_COLOR, width: chartPointsToPixels(0.75) }, resolve);
|
|
24211
24230
|
return stroke ? [{ direction: direction2, barType, amount, endCap: noEndCap !== true, stroke }] : [];
|
|
24212
24231
|
});
|
|
@@ -25282,13 +25301,13 @@ function cross2(o, a2, b) {
|
|
|
25282
25301
|
return (a2.x - o.x) * (b.y - o.y) - (a2.y - o.y) * (b.x - o.x);
|
|
25283
25302
|
}
|
|
25284
25303
|
function signedArea(poly) {
|
|
25285
|
-
let
|
|
25304
|
+
let area3 = 0;
|
|
25286
25305
|
for (let i = 0, n = poly.length; i < n; i++) {
|
|
25287
25306
|
const j = (i + 1) % n;
|
|
25288
|
-
|
|
25289
|
-
|
|
25307
|
+
area3 += at(poly, i).x * at(poly, j).y;
|
|
25308
|
+
area3 -= at(poly, j).x * at(poly, i).y;
|
|
25290
25309
|
}
|
|
25291
|
-
return
|
|
25310
|
+
return area3 / 2;
|
|
25292
25311
|
}
|
|
25293
25312
|
function ensureCCW(poly) {
|
|
25294
25313
|
return signedArea(poly) < 0 ? [...poly].reverse() : poly;
|
|
@@ -25478,20 +25497,20 @@ function drawingPaint(node3, colors, placeholder3, depth = 0) {
|
|
|
25478
25497
|
(transform2) => !SUPPORTED_TRANSFORMS.has(transform2.name) || (integer4(transform2.value) ?? 100001) > 1e5
|
|
25479
25498
|
))
|
|
25480
25499
|
return void 0;
|
|
25481
|
-
let
|
|
25500
|
+
let rgb7;
|
|
25482
25501
|
let inherited;
|
|
25483
|
-
if (color2.kind === "srgb")
|
|
25484
|
-
else if (color2.kind === "system")
|
|
25502
|
+
if (color2.kind === "srgb") rgb7 = color2.value;
|
|
25503
|
+
else if (color2.kind === "system") rgb7 = color2.fallback;
|
|
25485
25504
|
else if (color2.kind === "scheme") {
|
|
25486
|
-
if (color2.value === "phClr")
|
|
25505
|
+
if (color2.value === "phClr") rgb7 = placeholder3;
|
|
25487
25506
|
else {
|
|
25488
25507
|
inherited = drawingPaint(colors.get(color2.value), colors, placeholder3, depth + 1);
|
|
25489
|
-
|
|
25508
|
+
rgb7 = inherited?.color;
|
|
25490
25509
|
}
|
|
25491
25510
|
}
|
|
25492
|
-
if (!
|
|
25511
|
+
if (!rgb7 || !/^#?[\da-f]{6}$/i.test(rgb7)) return void 0;
|
|
25493
25512
|
const resolved = resolveDrawingColor(
|
|
25494
|
-
{ kind: "srgb", value:
|
|
25513
|
+
{ kind: "srgb", value: rgb7.replace(/^#/, ""), transforms },
|
|
25495
25514
|
void 0,
|
|
25496
25515
|
{ transformOrder: "document" }
|
|
25497
25516
|
);
|
|
@@ -26482,7 +26501,7 @@ function shapeShadow(cells4, color2, report, themed) {
|
|
|
26482
26501
|
"approximate-shadow-offset",
|
|
26483
26502
|
"A shadow without a shape offset uses Visio's default 0.125 inch page offset."
|
|
26484
26503
|
);
|
|
26485
|
-
const
|
|
26504
|
+
const clamp3 = (value3, limit3) => Math.max(-limit3, Math.min(limit3, value3));
|
|
26486
26505
|
const transparency = number(cells4, "ShdwForegndTrans", 0, report);
|
|
26487
26506
|
report(
|
|
26488
26507
|
"unverified-shadow",
|
|
@@ -26491,8 +26510,8 @@ function shapeShadow(cells4, color2, report, themed) {
|
|
|
26491
26510
|
return {
|
|
26492
26511
|
color: color2("ShdwForegnd", "#000000"),
|
|
26493
26512
|
opacity: Math.max(0, Math.min(1, 1 - transparency)),
|
|
26494
|
-
offsetX:
|
|
26495
|
-
offsetY:
|
|
26513
|
+
offsetX: clamp3(hasOffset ? number(cells4, "ShapeShdwOffsetX", 0.125, report) : 0.125, 1e3),
|
|
26514
|
+
offsetY: clamp3(hasOffset ? number(cells4, "ShapeShdwOffsetY", -0.125, report) : -0.125, 1e3),
|
|
26496
26515
|
blur: Math.max(0, Math.min(10, number(cells4, "ShapeShdwBlur", 0, report)))
|
|
26497
26516
|
};
|
|
26498
26517
|
}
|
|
@@ -26500,30 +26519,30 @@ function shapeShadow(cells4, color2, report, themed) {
|
|
|
26500
26519
|
// visio/effects.ts
|
|
26501
26520
|
function shapeEffects(cells4, color2, report, themed) {
|
|
26502
26521
|
const explicit = (name3) => cells4.has(name3) && cells4.get(name3)?.value !== "Themed";
|
|
26503
|
-
const
|
|
26522
|
+
const clamp3 = (value3, maximum) => Math.max(0, Math.min(maximum, value3));
|
|
26504
26523
|
const result2 = {};
|
|
26505
|
-
const glow = explicit("GlowSize") ?
|
|
26524
|
+
const glow = explicit("GlowSize") ? clamp3(number(cells4, "GlowSize", 0, report), 2.5) : 0;
|
|
26506
26525
|
if (glow > 0) {
|
|
26507
|
-
const opacity2 = 1 -
|
|
26526
|
+
const opacity2 = 1 - clamp3(number(cells4, "GlowColorTrans", 0, report), 1);
|
|
26508
26527
|
if (opacity2 > 0) result2.glow = { color: color2("GlowColor", "#000000"), opacity: opacity2, size: glow };
|
|
26509
26528
|
}
|
|
26510
|
-
const soft = explicit("SoftEdgesSize") ?
|
|
26529
|
+
const soft = explicit("SoftEdgesSize") ? clamp3(number(cells4, "SoftEdgesSize", 0, report), 2) : 0;
|
|
26511
26530
|
if (soft > 0) result2.softEdges = soft;
|
|
26512
|
-
const size3 = explicit("ReflectionSize") ?
|
|
26531
|
+
const size3 = explicit("ReflectionSize") ? clamp3(number(cells4, "ReflectionSize", 0, report), 1) : 0;
|
|
26513
26532
|
if (size3 > 0) {
|
|
26514
|
-
const opacity2 = 1 -
|
|
26533
|
+
const opacity2 = 1 - clamp3(number(cells4, "ReflectionTrans", 0, report), 1);
|
|
26515
26534
|
if (opacity2 > 0)
|
|
26516
26535
|
result2.reflection = {
|
|
26517
26536
|
opacity: opacity2,
|
|
26518
26537
|
size: size3,
|
|
26519
|
-
distance:
|
|
26520
|
-
blur:
|
|
26538
|
+
distance: clamp3(number(cells4, "ReflectionDist", 0, report), 2),
|
|
26539
|
+
blur: clamp3(number(cells4, "ReflectionBlur", 0, report), 2)
|
|
26521
26540
|
};
|
|
26522
26541
|
}
|
|
26523
|
-
const
|
|
26524
|
-
if (themed?.glow &&
|
|
26525
|
-
if (themed?.softEdges &&
|
|
26526
|
-
if (themed?.reflection &&
|
|
26542
|
+
const themedCell2 = (...names) => names.some((name3) => cells4.get(name3)?.value === "Themed");
|
|
26543
|
+
if (themed?.glow && themedCell2("GlowSize")) result2.glow = themed.glow;
|
|
26544
|
+
if (themed?.softEdges && themedCell2("SoftEdgesSize")) result2.softEdges = themed.softEdges;
|
|
26545
|
+
if (themed?.reflection && themedCell2("ReflectionSize", "ReflectionTrans"))
|
|
26527
26546
|
result2.reflection = themed.reflection;
|
|
26528
26547
|
if (result2.glow || result2.softEdges || result2.reflection)
|
|
26529
26548
|
report(
|
|
@@ -26561,7 +26580,11 @@ var VISIO_ROTATION_PRESETS = [
|
|
|
26561
26580
|
["off-axis-right", "Off Axis Right", 30, 20, 0, 0],
|
|
26562
26581
|
["perspective-left", "Perspective Left", -35, 0, 0, 60],
|
|
26563
26582
|
["perspective-right", "Perspective Right", 35, 0, 0, 60],
|
|
26564
|
-
["perspective-relaxed", "Perspective Relaxed", 20, 10, 0, 60]
|
|
26583
|
+
["perspective-relaxed", "Perspective Relaxed", 20, 10, 0, 60],
|
|
26584
|
+
["perspective-above", "Perspective Above", 0, -25, 0, 60],
|
|
26585
|
+
["perspective-below", "Perspective Below", 0, 25, 0, 60],
|
|
26586
|
+
["perspective-heroic-left", "Perspective Heroic Left", -45, -20, 0, 90],
|
|
26587
|
+
["perspective-heroic-right", "Perspective Heroic Right", 45, -20, 0, 90]
|
|
26565
26588
|
].map(([id4, label, x, y, z, perspective]) => ({
|
|
26566
26589
|
id: id4,
|
|
26567
26590
|
label,
|
|
@@ -26586,6 +26609,39 @@ function rotationWrites(id4, add) {
|
|
|
26586
26609
|
add("RotationZAngle", radians(preset.z), "FillStyle", "DEG");
|
|
26587
26610
|
add("Perspective", radians(preset.perspective), "FillStyle", "DEG");
|
|
26588
26611
|
}
|
|
26612
|
+
var rgb = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
|
|
26613
|
+
function solidWrites(edit, add) {
|
|
26614
|
+
if (edit.extrusionDepth !== void 0)
|
|
26615
|
+
add("BevelDepthSize", edit.extrusionDepth / 72, "FillStyle", "PT");
|
|
26616
|
+
if (edit.extrusionColor !== void 0)
|
|
26617
|
+
add("BevelDepthColor", edit.extrusionColor, "FillStyle", void 0, rgb(edit.extrusionColor));
|
|
26618
|
+
if (edit.contourSize !== void 0)
|
|
26619
|
+
add("BevelContourSize", edit.contourSize / 72, "FillStyle", "PT");
|
|
26620
|
+
if (edit.contourColor !== void 0)
|
|
26621
|
+
add("BevelContourColor", edit.contourColor, "FillStyle", void 0, rgb(edit.contourColor));
|
|
26622
|
+
}
|
|
26623
|
+
function snapshotSolid(edit) {
|
|
26624
|
+
const length = (value3, high, what) => {
|
|
26625
|
+
if (typeof value3 !== "number" || !Number.isFinite(value3) || value3 < 0 || value3 > high)
|
|
26626
|
+
fail("INVALID_EDIT", `${what} must be 0 to ${high} points.`);
|
|
26627
|
+
return Math.round(value3 * 100) / 100;
|
|
26628
|
+
};
|
|
26629
|
+
const color2 = (value3, what) => {
|
|
26630
|
+
if (typeof value3 !== "string" || !/^#[0-9a-f]{6}$/i.test(value3))
|
|
26631
|
+
fail("INVALID_EDIT", `${what} requires six hexadecimal digits.`);
|
|
26632
|
+
return value3.toLowerCase();
|
|
26633
|
+
};
|
|
26634
|
+
const result2 = {};
|
|
26635
|
+
if (edit.extrusionDepth !== void 0)
|
|
26636
|
+
result2.extrusionDepth = length(edit.extrusionDepth, 288, "Extrusion depth");
|
|
26637
|
+
if (edit.extrusionColor !== void 0)
|
|
26638
|
+
result2.extrusionColor = color2(edit.extrusionColor, "The extrusion colour");
|
|
26639
|
+
if (edit.contourSize !== void 0)
|
|
26640
|
+
result2.contourSize = length(edit.contourSize, 72, "Contour size");
|
|
26641
|
+
if (edit.contourColor !== void 0)
|
|
26642
|
+
result2.contourColor = color2(edit.contourColor, "The contour colour");
|
|
26643
|
+
return result2;
|
|
26644
|
+
}
|
|
26589
26645
|
function snapshotBevel(value3) {
|
|
26590
26646
|
if (!isVisioBevelPreset(value3)) fail("INVALID_EDIT", "Unknown bevel preset.");
|
|
26591
26647
|
return value3;
|
|
@@ -26594,14 +26650,29 @@ function snapshotRotation(value3) {
|
|
|
26594
26650
|
if (!isVisioRotationPreset(value3)) fail("INVALID_EDIT", "Unknown 3-D rotation preset.");
|
|
26595
26651
|
return value3;
|
|
26596
26652
|
}
|
|
26597
|
-
var
|
|
26598
|
-
|
|
26599
|
-
|
|
26600
|
-
|
|
26601
|
-
const
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26653
|
+
var themedCell = (cells4, name3) => cells4.get(name3)?.value === "Themed";
|
|
26654
|
+
var saved = (cells4, name3) => cells4.has(name3) && !themedCell(cells4, name3) ? number(cells4, name3, 0) : 0;
|
|
26655
|
+
var clamp2 = (value3, high) => Math.max(0, Math.min(high, value3));
|
|
26656
|
+
function shapeBevel(cells4, themed) {
|
|
26657
|
+
const read = (name3, themeValue) => themedCell(cells4, name3) ? themeValue ?? 0 : saved(cells4, name3);
|
|
26658
|
+
const type = Math.trunc(read("BevelTopType", themed?.bevel?.type));
|
|
26659
|
+
const width = clamp2(read("BevelTopWidth", themed?.bevel?.width), 2);
|
|
26660
|
+
const height = clamp2(read("BevelTopHeight", themed?.bevel?.height), 2);
|
|
26661
|
+
return type >= 1 && type <= 12 ? { type, width, height } : void 0;
|
|
26662
|
+
}
|
|
26663
|
+
function shapeExtrusion(cells4, solid2, colorOf) {
|
|
26664
|
+
const depth = clamp2(saved(cells4, "BevelDepthSize"), 4);
|
|
26665
|
+
return solid2 && depth > 0 ? { depth, color: colorOf("BevelDepthColor", "#ffffff") } : void 0;
|
|
26666
|
+
}
|
|
26667
|
+
function shapeContour(cells4, solid2, themed, colorOf) {
|
|
26668
|
+
const size3 = clamp2(
|
|
26669
|
+
themedCell(cells4, "BevelContourSize") ? themed?.contour?.size ?? 0 : saved(cells4, "BevelContourSize"),
|
|
26670
|
+
1
|
|
26671
|
+
);
|
|
26672
|
+
const color2 = themedCell(cells4, "BevelContourColor") ? themed?.contour?.color ?? colorOf("BevelContourColor", "#000000") : colorOf("BevelContourColor", "#000000");
|
|
26673
|
+
return solid2 && size3 > 0 ? { size: size3, color: color2 } : void 0;
|
|
26674
|
+
}
|
|
26675
|
+
var hasUndrawnBevel = (cells4) => saved(cells4, "BevelBottomType") > 0;
|
|
26605
26676
|
function shapeRotation3d(cells4) {
|
|
26606
26677
|
const angle = (name3) => Math.max(-Math.PI, Math.min(Math.PI, saved(cells4, name3)));
|
|
26607
26678
|
const x = angle("RotationXAngle"), y = angle("RotationYAngle"), z = angle("RotationZAngle");
|
|
@@ -26622,6 +26693,52 @@ function visioRotation3dMatrix(rotation) {
|
|
|
26622
26693
|
return [cc * ca + sc * sa * sb, sc * ca - cc * sa * sb, -sc * cb, cc * cb];
|
|
26623
26694
|
}
|
|
26624
26695
|
|
|
26696
|
+
// visio/theme-solid.ts
|
|
26697
|
+
var PRESETS = [
|
|
26698
|
+
"circle",
|
|
26699
|
+
"relaxedInset",
|
|
26700
|
+
"cross",
|
|
26701
|
+
"coolSlant",
|
|
26702
|
+
"angle",
|
|
26703
|
+
"softRound",
|
|
26704
|
+
"convex",
|
|
26705
|
+
"slope",
|
|
26706
|
+
"divot",
|
|
26707
|
+
"riblet",
|
|
26708
|
+
"hardEdge",
|
|
26709
|
+
"artDeco"
|
|
26710
|
+
];
|
|
26711
|
+
var EMU2 = 914400;
|
|
26712
|
+
var measure2 = (node3, name3, fallback) => {
|
|
26713
|
+
const raw2 = node3.getAttribute(name3);
|
|
26714
|
+
return raw2 !== null && /^\d{1,10}$/.test(raw2) ? Number(raw2) / EMU2 : fallback;
|
|
26715
|
+
};
|
|
26716
|
+
function themeSolid(cells4, resources, placeholder3) {
|
|
26717
|
+
const solid2 = themeChild(themeFormat(cells4, "Effects", resources), "sp3d");
|
|
26718
|
+
if (!solid2) return void 0;
|
|
26719
|
+
const result2 = {};
|
|
26720
|
+
const top = themeChild(solid2, "bevelT");
|
|
26721
|
+
if (top) {
|
|
26722
|
+
const type = PRESETS.indexOf(top.getAttribute("prst") ?? "circle") + 1;
|
|
26723
|
+
if (type > 0)
|
|
26724
|
+
result2.bevel = {
|
|
26725
|
+
type,
|
|
26726
|
+
width: measure2(top, "w", 76200 / EMU2),
|
|
26727
|
+
height: measure2(top, "h", 76200 / EMU2)
|
|
26728
|
+
};
|
|
26729
|
+
}
|
|
26730
|
+
const size3 = measure2(solid2, "contourW", 0);
|
|
26731
|
+
if (size3 > 0) {
|
|
26732
|
+
const paint3 = drawingPaint(
|
|
26733
|
+
colorChoice(themeChild(solid2, "contourClr")),
|
|
26734
|
+
/* @__PURE__ */ new Map(),
|
|
26735
|
+
placeholder3
|
|
26736
|
+
);
|
|
26737
|
+
result2.contour = { size: size3, ...paint3 ? { color: paint3.color } : {} };
|
|
26738
|
+
}
|
|
26739
|
+
return result2;
|
|
26740
|
+
}
|
|
26741
|
+
|
|
26625
26742
|
// visio/text-background.ts
|
|
26626
26743
|
function textBackground(cells4, resources, report) {
|
|
26627
26744
|
const raw2 = cells4.get("TextBkgnd")?.value;
|
|
@@ -27648,9 +27765,9 @@ function roundedRectanglePath(points, rounding, point2) {
|
|
|
27648
27765
|
const sweep = a2[0] * b[1] - a2[1] * b[0] > 0 ? 1 : 0;
|
|
27649
27766
|
const start = after[0], commands = [`M ${point2(start[0], start[1])}`];
|
|
27650
27767
|
for (let i = 1; i <= 4; i++) {
|
|
27651
|
-
const
|
|
27768
|
+
const entry4 = before[i % 4], exit2 = after[i % 4];
|
|
27652
27769
|
commands.push(
|
|
27653
|
-
`L ${point2(
|
|
27770
|
+
`L ${point2(entry4[0], entry4[1])}`,
|
|
27654
27771
|
`A ${point2(radius, radius)} 0 0 ${sweep} ${point2(exit2[0], exit2[1])}`
|
|
27655
27772
|
);
|
|
27656
27773
|
}
|
|
@@ -27696,7 +27813,7 @@ function roundedOrthogonalPath(points, radius, point2) {
|
|
|
27696
27813
|
const radius2 = radii[i];
|
|
27697
27814
|
if (!Number.isFinite(radius2) || radius2 < 1e-9) return void 0;
|
|
27698
27815
|
const incoming = directions[i - 1], outgoing = directions[i];
|
|
27699
|
-
const
|
|
27816
|
+
const entry4 = [
|
|
27700
27817
|
vertex[0] - incoming[0] * radius2,
|
|
27701
27818
|
vertex[1] - incoming[1] * radius2
|
|
27702
27819
|
];
|
|
@@ -27704,11 +27821,11 @@ function roundedOrthogonalPath(points, radius, point2) {
|
|
|
27704
27821
|
vertex[0] + outgoing[0] * radius2,
|
|
27705
27822
|
vertex[1] + outgoing[1] * radius2
|
|
27706
27823
|
];
|
|
27707
|
-
if (!
|
|
27824
|
+
if (!entry4.every(Number.isFinite) || !exit2.every(Number.isFinite) || point2(...entry4) === point2(...vertex) || point2(...exit2) === point2(...vertex))
|
|
27708
27825
|
return void 0;
|
|
27709
27826
|
const sweep = incoming[0] * outgoing[1] - incoming[1] * outgoing[0] > 0 ? 1 : 0;
|
|
27710
27827
|
commands.push(
|
|
27711
|
-
`L ${point2(...
|
|
27828
|
+
`L ${point2(...entry4)}`,
|
|
27712
27829
|
`A ${point2(radius2, radius2)} 0 0 ${sweep} ${point2(...exit2)}`
|
|
27713
27830
|
);
|
|
27714
27831
|
extraCommands++;
|
|
@@ -28015,8 +28132,8 @@ function color(cells4, name3, fallback, resources, report, themeCells = cells4,
|
|
|
28015
28132
|
if (value3 === void 0) return fallback;
|
|
28016
28133
|
if (/^#[0-9a-f]{6}$/i.test(value3)) return value3;
|
|
28017
28134
|
if (/^\d+$/.test(value3)) {
|
|
28018
|
-
const
|
|
28019
|
-
if (
|
|
28135
|
+
const entry4 = resources.colors.get(value3) ?? PALETTE[Number(value3)];
|
|
28136
|
+
if (entry4 && /^#[0-9a-f]{6}$/i.test(entry4)) return entry4;
|
|
28020
28137
|
}
|
|
28021
28138
|
if (value3 === "Themed") {
|
|
28022
28139
|
const resolved = themeColor2(themeCells, name3, resources, report, gradientRendered);
|
|
@@ -28084,15 +28201,27 @@ function shapeStyle(sheet, resources, report, width = number(sheet.cells, "Width
|
|
|
28084
28201
|
report,
|
|
28085
28202
|
themedEffects
|
|
28086
28203
|
);
|
|
28087
|
-
const
|
|
28204
|
+
const themedSolid = themeSolid(
|
|
28205
|
+
cells4,
|
|
28206
|
+
resources,
|
|
28207
|
+
color(cells4, "FillForegnd", "#ffffff", resources, () => {
|
|
28208
|
+
})
|
|
28209
|
+
);
|
|
28210
|
+
const bevel = shapeBevel(cells4, themedSolid);
|
|
28211
|
+
const solidColor2 = (name3, fallback) => color(cells4, name3, fallback, resources, report);
|
|
28212
|
+
const extrusion = shapeExtrusion(cells4, !!bevel, solidColor2);
|
|
28213
|
+
const contour = shapeContour(cells4, !!bevel, themedSolid, solidColor2);
|
|
28088
28214
|
const rotation3d = shapeRotation3d(cells4);
|
|
28089
|
-
if (bevel || rotation3d)
|
|
28215
|
+
if (bevel && (bevel.width > 0 || bevel.height > 0) || rotation3d || extrusion || contour)
|
|
28090
28216
|
report(
|
|
28091
28217
|
"approximated-3d",
|
|
28092
|
-
"Bevel
|
|
28218
|
+
"Bevel, 3-D rotation, perspective, extrusion and contour are approximations: a lighting overlay, a projection and flat-shaded side faces, not Visio's renderer."
|
|
28093
28219
|
);
|
|
28094
28220
|
if (hasUndrawnBevel(cells4))
|
|
28095
|
-
report(
|
|
28221
|
+
report(
|
|
28222
|
+
"unsupported-bevel",
|
|
28223
|
+
"Bottom bevels are not drawn (Visio 16 shows no change on the front of a shape)."
|
|
28224
|
+
);
|
|
28096
28225
|
const themedBegin = themeArrow(cells4, resources, "Begin");
|
|
28097
28226
|
const themedEnd = themeArrow(cells4, resources, "End");
|
|
28098
28227
|
const cap = lineCap(cells4, resources, report);
|
|
@@ -28120,6 +28249,8 @@ function shapeStyle(sheet, resources, report, width = number(sheet.cells, "Width
|
|
|
28120
28249
|
...shadow ? { shadow } : {},
|
|
28121
28250
|
...effects,
|
|
28122
28251
|
...bevel ? { bevel } : {},
|
|
28252
|
+
...extrusion ? { extrusion } : {},
|
|
28253
|
+
...contour ? { contour } : {},
|
|
28123
28254
|
...rotation3d ? { rotation3d } : {}
|
|
28124
28255
|
};
|
|
28125
28256
|
}
|
|
@@ -28433,7 +28564,7 @@ var VISIO_BUILT_IN_THEMES = [
|
|
|
28433
28564
|
)
|
|
28434
28565
|
];
|
|
28435
28566
|
function visioBuiltInTheme(id4) {
|
|
28436
|
-
return VISIO_BUILT_IN_THEMES.find((
|
|
28567
|
+
return VISIO_BUILT_IN_THEMES.find((entry4) => entry4.id === id4);
|
|
28437
28568
|
}
|
|
28438
28569
|
function visioThemeVariantColors(source, variant) {
|
|
28439
28570
|
const accents = source.colors.slice(4, 10);
|
|
@@ -28457,7 +28588,7 @@ function visioPageTheme(themes, pageCells) {
|
|
|
28457
28588
|
const light = drawingColor(theme2.colors.get("lt1"), theme2.colors);
|
|
28458
28589
|
const dark = drawingColor(theme2.colors.get("dk1"), theme2.colors);
|
|
28459
28590
|
const builtIn = VISIO_BUILT_IN_THEMES.find(
|
|
28460
|
-
(
|
|
28591
|
+
(entry4) => entry4.schemeId === id4 && entry4.name === theme2.name
|
|
28461
28592
|
);
|
|
28462
28593
|
return {
|
|
28463
28594
|
name: theme2.name ?? `Theme ${id4}`,
|
|
@@ -28486,7 +28617,7 @@ function visioPageThemeSchemes(themes, pageCells) {
|
|
|
28486
28617
|
if (!themes || id4 === void 0 || id4 === 0 || id4 >= 65534) continue;
|
|
28487
28618
|
const matches2 = themes.filter((theme2) => theme2[field2] === id4);
|
|
28488
28619
|
const builtIn = matches2.length === 1 ? VISIO_BUILT_IN_THEMES.find(
|
|
28489
|
-
(
|
|
28620
|
+
(entry4) => entry4.schemeId === id4 && entry4.name === matches2[0].name
|
|
28490
28621
|
) : void 0;
|
|
28491
28622
|
if (builtIn) result2[key3] = builtIn.id;
|
|
28492
28623
|
}
|
|
@@ -28822,7 +28953,7 @@ function optionsKey(options2) {
|
|
|
28822
28953
|
const { metafileConverter: _converter, pages: _pages, documentCache: _cache, ...rest } = options2;
|
|
28823
28954
|
return JSON.stringify(rest);
|
|
28824
28955
|
}
|
|
28825
|
-
var cacheMatches = (
|
|
28956
|
+
var cacheMatches = (entry4, pkg, options2) => entry4 !== void 0 && entry4.options === optionsKey(options2) && entry4.converter === options2.metafileConverter && entry4.reads.every(([path3, print]) => pkg.printOf(path3) === print);
|
|
28826
28957
|
async function readDocumentLevel(pkg, documentPart2, options2, checkTime, forward) {
|
|
28827
28958
|
const reports = [];
|
|
28828
28959
|
const report = (...args) => {
|
|
@@ -28902,8 +29033,8 @@ var VISIO_COMMENT_LIMIT = 1e4;
|
|
|
28902
29033
|
var VISIO_COMMENT_TEXT_LIMIT = 16384;
|
|
28903
29034
|
var VISIO_COMMENT_AUTHOR_LIMIT = 256;
|
|
28904
29035
|
var unsigned = (value3) => value3 !== void 0 && /^(0|[1-9]\d{0,9})$/.test(value3) && Number(value3) <= 4294967295 ? value3 : void 0;
|
|
28905
|
-
function visioCommentId(
|
|
28906
|
-
return unsigned(attribute2(
|
|
29036
|
+
function visioCommentId(entry4, index3) {
|
|
29037
|
+
return unsigned(attribute2(entry4, "CommentID")) ?? `n${index3}`;
|
|
28907
29038
|
}
|
|
28908
29039
|
async function readVisioComments(pkg, documentPart2, report) {
|
|
28909
29040
|
const path3 = await related(pkg, documentPart2, "comments", false);
|
|
@@ -28928,10 +29059,10 @@ async function readVisioComments(pkg, documentPart2, report) {
|
|
|
28928
29059
|
const comments = [];
|
|
28929
29060
|
const ids = /* @__PURE__ */ new Set();
|
|
28930
29061
|
let characters = 0;
|
|
28931
|
-
entries.slice(0, VISIO_COMMENT_LIMIT).forEach((
|
|
28932
|
-
const pageId2 = unsigned(attribute2(
|
|
28933
|
-
const id4 = visioCommentId(
|
|
28934
|
-
const text7 =
|
|
29062
|
+
entries.slice(0, VISIO_COMMENT_LIMIT).forEach((entry4, index3) => {
|
|
29063
|
+
const pageId2 = unsigned(attribute2(entry4, "PageID"));
|
|
29064
|
+
const id4 = visioCommentId(entry4, index3);
|
|
29065
|
+
const text7 = entry4.textContent ?? "";
|
|
28935
29066
|
characters += text7.length;
|
|
28936
29067
|
if (pageId2 === void 0 || ids.has(id4) || characters > 1e6) {
|
|
28937
29068
|
report(
|
|
@@ -28944,10 +29075,10 @@ async function readVisioComments(pkg, documentPart2, report) {
|
|
|
28944
29075
|
return;
|
|
28945
29076
|
}
|
|
28946
29077
|
ids.add(id4);
|
|
28947
|
-
const shapeId2 = unsigned(attribute2(
|
|
28948
|
-
const author = authors.get(attribute2(
|
|
28949
|
-
const date2 = attribute2(
|
|
28950
|
-
const editDate = attribute2(
|
|
29078
|
+
const shapeId2 = unsigned(attribute2(entry4, "ShapeID"));
|
|
29079
|
+
const author = authors.get(attribute2(entry4, "AuthorID") ?? "");
|
|
29080
|
+
const date2 = attribute2(entry4, "Date");
|
|
29081
|
+
const editDate = attribute2(entry4, "EditDate");
|
|
28951
29082
|
comments.push({
|
|
28952
29083
|
id: id4,
|
|
28953
29084
|
pageId: pageId2,
|
|
@@ -28957,7 +29088,7 @@ async function readVisioComments(pkg, documentPart2, report) {
|
|
|
28957
29088
|
...date2 ? { date: date2.slice(0, 64) } : {},
|
|
28958
29089
|
...editDate ? { editDate: editDate.slice(0, 64) } : {},
|
|
28959
29090
|
text: text7.slice(0, VISIO_COMMENT_TEXT_LIMIT),
|
|
28960
|
-
...yes(attribute2(
|
|
29091
|
+
...yes(attribute2(entry4, "Done")) ? { done: true } : {}
|
|
28961
29092
|
});
|
|
28962
29093
|
});
|
|
28963
29094
|
return comments;
|
|
@@ -31152,18 +31283,18 @@ function normalizePath(path3, rootName) {
|
|
|
31152
31283
|
return parts;
|
|
31153
31284
|
}
|
|
31154
31285
|
function child3(entries, parentId, name3) {
|
|
31155
|
-
const children5 = entries.filter((
|
|
31286
|
+
const children5 = entries.filter((entry4) => entry4.parentId === parentId && entry4.path !== void 0);
|
|
31156
31287
|
const pick = (matches2) => matches2.length === 1 ? matches2[0] : void 0;
|
|
31157
|
-
const exact = children5.filter((
|
|
31288
|
+
const exact = children5.filter((entry4) => entry4.name === name3);
|
|
31158
31289
|
if (exact.length)
|
|
31159
31290
|
return pick(exact);
|
|
31160
|
-
const folded = children5.filter((
|
|
31291
|
+
const folded = children5.filter((entry4) => sameName(entry4.name, name3));
|
|
31161
31292
|
if (folded.length)
|
|
31162
31293
|
return pick(folded);
|
|
31163
|
-
return pick(children5.filter((
|
|
31294
|
+
return pick(children5.filter((entry4) => sameName(bareName(entry4.name), bareName(name3))));
|
|
31164
31295
|
}
|
|
31165
31296
|
function findDirectoryEntry(entries, path3) {
|
|
31166
|
-
const root2 = entries.find((
|
|
31297
|
+
const root2 = entries.find((entry4) => entry4.type === ENTRY_TYPE_ROOT);
|
|
31167
31298
|
if (!root2)
|
|
31168
31299
|
return void 0;
|
|
31169
31300
|
let current = root2;
|
|
@@ -31177,11 +31308,11 @@ function findDirectoryEntry(entries, path3) {
|
|
|
31177
31308
|
return current;
|
|
31178
31309
|
}
|
|
31179
31310
|
function findStreamByName(entries, name3, isReadable) {
|
|
31180
|
-
const root2 = entries.find((
|
|
31311
|
+
const root2 = entries.find((entry4) => entry4.type === ENTRY_TYPE_ROOT);
|
|
31181
31312
|
if (root2 && root2.name === name3)
|
|
31182
31313
|
return root2;
|
|
31183
|
-
const top = entries.filter((
|
|
31184
|
-
return top.find((
|
|
31314
|
+
const top = entries.filter((entry4) => entry4.parentId === root2?.id && isReadable(entry4));
|
|
31315
|
+
return top.find((entry4) => entry4.name === name3) ?? top.find((entry4) => sameName(entry4.name, name3)) ?? entries.find((entry4) => entry4.name === name3 && isReadable(entry4));
|
|
31185
31316
|
}
|
|
31186
31317
|
|
|
31187
31318
|
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
|
|
@@ -31336,8 +31467,8 @@ function parseOle2(buffer, options2 = {}) {
|
|
|
31336
31467
|
throw new Ole2ParseError("Unexpected directory sector count");
|
|
31337
31468
|
}
|
|
31338
31469
|
const entries = readDirectory(directoryBytes, majorVersion, strict, warnings);
|
|
31339
|
-
for (const
|
|
31340
|
-
if (majorVersion === 4 && (!Number.isSafeInteger(
|
|
31470
|
+
for (const entry4 of entries) {
|
|
31471
|
+
if (majorVersion === 4 && (!Number.isSafeInteger(entry4.size) || entry4.size > sectorCount * sectorSize)) {
|
|
31341
31472
|
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
31342
31473
|
}
|
|
31343
31474
|
}
|
|
@@ -31398,27 +31529,27 @@ function parseOle2(buffer, options2 = {}) {
|
|
|
31398
31529
|
throw new Ole2ParseError("Truncated mini stream sector chain");
|
|
31399
31530
|
return result2;
|
|
31400
31531
|
}
|
|
31401
|
-
function readEntry(
|
|
31402
|
-
if (
|
|
31403
|
-
return readMiniStream(
|
|
31532
|
+
function readEntry(entry4) {
|
|
31533
|
+
if (entry4.size < miniStreamCutoff && entry4.type !== ENTRY_TYPE_ROOT) {
|
|
31534
|
+
return readMiniStream(entry4.startSector, entry4.size);
|
|
31404
31535
|
}
|
|
31405
|
-
return readStream(
|
|
31536
|
+
return readStream(entry4.startSector, entry4.size);
|
|
31406
31537
|
}
|
|
31407
|
-
const readable = (
|
|
31538
|
+
const readable = (entry4) => entry4.type === ENTRY_TYPE_STREAM || entry4.type === ENTRY_TYPE_ROOT;
|
|
31408
31539
|
return {
|
|
31409
31540
|
entries,
|
|
31410
31541
|
warnings,
|
|
31411
31542
|
getStream(name3) {
|
|
31412
|
-
const
|
|
31413
|
-
return
|
|
31543
|
+
const entry4 = findStreamByName(entries, name3, readable);
|
|
31544
|
+
return entry4 ? readEntry(entry4) : void 0;
|
|
31414
31545
|
},
|
|
31415
31546
|
getStreamByPath(path3) {
|
|
31416
|
-
const
|
|
31417
|
-
return
|
|
31547
|
+
const entry4 = findDirectoryEntry(entries, path3);
|
|
31548
|
+
return entry4 && entry4.type === ENTRY_TYPE_STREAM ? readEntry(entry4) : void 0;
|
|
31418
31549
|
},
|
|
31419
31550
|
getStreamById(id4) {
|
|
31420
|
-
const
|
|
31421
|
-
return
|
|
31551
|
+
const entry4 = entries.find((candidate) => candidate.id === id4);
|
|
31552
|
+
return entry4 && readable(entry4) ? readEntry(entry4) : void 0;
|
|
31422
31553
|
},
|
|
31423
31554
|
findEntry(path3) {
|
|
31424
31555
|
return findDirectoryEntry(entries, path3);
|
|
@@ -31428,12 +31559,12 @@ function parseOle2(buffer, options2 = {}) {
|
|
|
31428
31559
|
|
|
31429
31560
|
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-document-base.js
|
|
31430
31561
|
var copyOf = (bytes) => bytes === void 0 ? void 0 : new Uint8Array(bytes);
|
|
31431
|
-
var detachEntry = (
|
|
31432
|
-
...
|
|
31433
|
-
clsid: new Uint8Array(
|
|
31434
|
-
path:
|
|
31435
|
-
created:
|
|
31436
|
-
modified:
|
|
31562
|
+
var detachEntry = (entry4) => ({
|
|
31563
|
+
...entry4,
|
|
31564
|
+
clsid: new Uint8Array(entry4.clsid),
|
|
31565
|
+
path: entry4.path && [...entry4.path],
|
|
31566
|
+
created: entry4.created && new Date(entry4.created),
|
|
31567
|
+
modified: entry4.modified && new Date(entry4.modified)
|
|
31437
31568
|
});
|
|
31438
31569
|
var Ole2DocumentError = class extends Error {
|
|
31439
31570
|
code;
|
|
@@ -31476,8 +31607,8 @@ var Ole2DocumentBase = class {
|
|
|
31476
31607
|
#getStreamByPath = (path3) => copyOf(this.#container.getStreamByPath(path3));
|
|
31477
31608
|
#getStreamById = (id4) => copyOf(this.#container.getStreamById(id4));
|
|
31478
31609
|
#findEntry = (path3) => {
|
|
31479
|
-
const
|
|
31480
|
-
return
|
|
31610
|
+
const entry4 = this.#container.findEntry(path3);
|
|
31611
|
+
return entry4 && detachEntry(entry4);
|
|
31481
31612
|
};
|
|
31482
31613
|
/** Retain the original detachable callback API while observing current state. */
|
|
31483
31614
|
get getStream() {
|
|
@@ -31758,12 +31889,12 @@ function processCompoundFileStream(input, path3, replacement) {
|
|
|
31758
31889
|
const reserved = /* @__PURE__ */ new Set([...fatIds, ...difatIds, ...dirSectors, ...miniFatSectors]);
|
|
31759
31890
|
const regularUsed = new Set(reserved);
|
|
31760
31891
|
const rootMini = entries.find((e) => e.type === 5);
|
|
31761
|
-
for (const
|
|
31762
|
-
if (
|
|
31892
|
+
for (const entry4 of entries) {
|
|
31893
|
+
if (entry4.type !== 2 && entry4.type !== 5 || entry4.size === 0)
|
|
31763
31894
|
continue;
|
|
31764
|
-
if (
|
|
31895
|
+
if (entry4.type === 2 && entry4.size < miniCutoff)
|
|
31765
31896
|
continue;
|
|
31766
|
-
for (const id4 of exactChain(fat,
|
|
31897
|
+
for (const id4 of exactChain(fat, entry4.start, entry4.size, sectorSize)) {
|
|
31767
31898
|
sector(id4);
|
|
31768
31899
|
if (regularUsed.has(id4))
|
|
31769
31900
|
return reject2();
|
|
@@ -31771,10 +31902,10 @@ function processCompoundFileStream(input, path3, replacement) {
|
|
|
31771
31902
|
}
|
|
31772
31903
|
}
|
|
31773
31904
|
const miniUsed = /* @__PURE__ */ new Set();
|
|
31774
|
-
for (const
|
|
31775
|
-
if (
|
|
31905
|
+
for (const entry4 of entries) {
|
|
31906
|
+
if (entry4.type !== 2 || entry4.size === 0 || entry4.size >= miniCutoff)
|
|
31776
31907
|
continue;
|
|
31777
|
-
const ids = exactChain(miniFat,
|
|
31908
|
+
const ids = exactChain(miniFat, entry4.start, entry4.size, miniSize);
|
|
31778
31909
|
for (const id4 of ids) {
|
|
31779
31910
|
if ((id4 + 1) * miniSize > rootMini.size || miniUsed.has(id4))
|
|
31780
31911
|
return reject2();
|
|
@@ -31970,8 +32101,8 @@ function resizeCompoundFileStreamV4(input, path3, replacement) {
|
|
|
31970
32101
|
if (read(40) !== directoryChain.length)
|
|
31971
32102
|
return fail4("unsafe-edit");
|
|
31972
32103
|
for (const [block, sector] of directoryChain.entries()) {
|
|
31973
|
-
for (let
|
|
31974
|
-
const offset = (sector + 1) * SECTOR3 +
|
|
32104
|
+
for (let entry4 = 0; entry4 < DIRECTORY_ENTRIES; entry4++) {
|
|
32105
|
+
const offset = (sector + 1) * SECTOR3 + entry4 * 128, type = view2.getUint8(offset + 66);
|
|
31975
32106
|
if (!type)
|
|
31976
32107
|
continue;
|
|
31977
32108
|
const nameLength = view2.getUint16(offset + 64, true);
|
|
@@ -31982,7 +32113,7 @@ function resizeCompoundFileStreamV4(input, path3, replacement) {
|
|
|
31982
32113
|
name4 += String.fromCharCode(view2.getUint16(offset + i, true));
|
|
31983
32114
|
if (read(offset + 124) !== 0)
|
|
31984
32115
|
return fail4("unsafe-edit");
|
|
31985
|
-
const id4 = block * DIRECTORY_ENTRIES +
|
|
32116
|
+
const id4 = block * DIRECTORY_ENTRIES + entry4;
|
|
31986
32117
|
slots.set(id4, { id: id4, name: name4, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
|
|
31987
32118
|
}
|
|
31988
32119
|
}
|
|
@@ -32272,8 +32403,8 @@ function resizeCompoundFileStream(input, path3, replacement) {
|
|
|
32272
32403
|
return fail4("unsafe-edit");
|
|
32273
32404
|
const slots = /* @__PURE__ */ new Map();
|
|
32274
32405
|
for (const [block, sector] of follow2(fat, read(48)).entries()) {
|
|
32275
|
-
for (let
|
|
32276
|
-
const offset = (sector + 1) * SECTOR2 +
|
|
32406
|
+
for (let entry4 = 0; entry4 < 4; entry4++) {
|
|
32407
|
+
const offset = (sector + 1) * SECTOR2 + entry4 * 128, type = view2.getUint8(offset + 66);
|
|
32277
32408
|
if (!type)
|
|
32278
32409
|
continue;
|
|
32279
32410
|
const nameLength = view2.getUint16(offset + 64, true);
|
|
@@ -32282,7 +32413,7 @@ function resizeCompoundFileStream(input, path3, replacement) {
|
|
|
32282
32413
|
let name4 = "";
|
|
32283
32414
|
for (let i = 0; i < nameLength - 2; i += 2)
|
|
32284
32415
|
name4 += String.fromCharCode(view2.getUint16(offset + i, true));
|
|
32285
|
-
const id4 = block * 4 +
|
|
32416
|
+
const id4 = block * 4 + entry4;
|
|
32286
32417
|
slots.set(id4, { id: id4, name: name4, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
|
|
32287
32418
|
}
|
|
32288
32419
|
}
|
|
@@ -32441,15 +32572,15 @@ function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
|
|
|
32441
32572
|
const dirView = new DataView(dirData.buffer);
|
|
32442
32573
|
const tree = buildDirectoryTree(dirEntries.length);
|
|
32443
32574
|
for (let i = 0; i < dirEntries.length; i++) {
|
|
32444
|
-
const
|
|
32575
|
+
const entry4 = dirEntries[i];
|
|
32445
32576
|
const entryOffset = i * DIR_ENTRY_SIZE;
|
|
32446
|
-
const nameBytes = encodeName(
|
|
32577
|
+
const nameBytes = encodeName(entry4.name);
|
|
32447
32578
|
dirData.set(nameBytes.subarray(0, Math.min(nameBytes.length, 64)), entryOffset);
|
|
32448
|
-
dirView.setUint16(entryOffset + 64, Math.min((
|
|
32449
|
-
dirData[entryOffset + 66] =
|
|
32579
|
+
dirView.setUint16(entryOffset + 64, Math.min((entry4.name.length + 1) * 2, 64), true);
|
|
32580
|
+
dirData[entryOffset + 66] = entry4.type;
|
|
32450
32581
|
dirData[entryOffset + 67] = i === 0 ? 1 : tree.links.get(i).color;
|
|
32451
|
-
if (
|
|
32452
|
-
dirData.set(
|
|
32582
|
+
if (entry4.clsid) {
|
|
32583
|
+
dirData.set(entry4.clsid.subarray(0, 16), entryOffset + 80);
|
|
32453
32584
|
}
|
|
32454
32585
|
if (i === 0) {
|
|
32455
32586
|
dirView.setUint32(entryOffset + 68, 4294967295, true);
|
|
@@ -32460,8 +32591,8 @@ function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
|
|
|
32460
32591
|
dirView.setUint32(entryOffset + 72, tree.links.get(i).right, true);
|
|
32461
32592
|
dirView.setUint32(entryOffset + 76, 4294967295, true);
|
|
32462
32593
|
}
|
|
32463
|
-
dirView.setUint32(entryOffset + 116,
|
|
32464
|
-
dirView.setUint32(entryOffset + 120,
|
|
32594
|
+
dirView.setUint32(entryOffset + 116, entry4.startSector, true);
|
|
32595
|
+
dirView.setUint32(entryOffset + 120, entry4.size, true);
|
|
32465
32596
|
}
|
|
32466
32597
|
return dirData;
|
|
32467
32598
|
}
|
|
@@ -32698,29 +32829,29 @@ function buildCompoundFile(nodes, options2 = {}) {
|
|
|
32698
32829
|
return out;
|
|
32699
32830
|
}
|
|
32700
32831
|
function collect(file, dropUnreadable) {
|
|
32701
|
-
const root2 = file.entries.find((
|
|
32832
|
+
const root2 = file.entries.find((entry4) => entry4.type === ENTRY_TYPE_ROOT);
|
|
32702
32833
|
const nodes = [];
|
|
32703
32834
|
const dropped = [];
|
|
32704
|
-
for (const
|
|
32705
|
-
if (!
|
|
32835
|
+
for (const entry4 of file.entries) {
|
|
32836
|
+
if (!entry4.path?.length || entry4.type !== ENTRY_TYPE_STORAGE && entry4.type !== ENTRY_TYPE_STREAM)
|
|
32706
32837
|
continue;
|
|
32707
32838
|
let data;
|
|
32708
|
-
if (
|
|
32839
|
+
if (entry4.type === ENTRY_TYPE_STREAM) {
|
|
32709
32840
|
try {
|
|
32710
|
-
data = file.getStreamById(
|
|
32841
|
+
data = file.getStreamById(entry4.id);
|
|
32711
32842
|
} catch (error) {
|
|
32712
32843
|
throw error;
|
|
32713
32844
|
}
|
|
32714
32845
|
}
|
|
32715
32846
|
nodes.push({
|
|
32716
|
-
path: [...
|
|
32847
|
+
path: [...entry4.path],
|
|
32717
32848
|
data,
|
|
32718
|
-
stateBits:
|
|
32719
|
-
created:
|
|
32720
|
-
modified:
|
|
32721
|
-
createdFileTime:
|
|
32722
|
-
modifiedFileTime:
|
|
32723
|
-
clsid:
|
|
32849
|
+
stateBits: entry4.stateBits,
|
|
32850
|
+
created: entry4.created,
|
|
32851
|
+
modified: entry4.modified,
|
|
32852
|
+
createdFileTime: entry4.createdFileTime,
|
|
32853
|
+
modifiedFileTime: entry4.modifiedFileTime,
|
|
32854
|
+
clsid: entry4.clsid.some((byte) => byte !== 0) ? entry4.clsid : void 0
|
|
32724
32855
|
});
|
|
32725
32856
|
}
|
|
32726
32857
|
const options2 = { rootClsid: root2.clsid, rootStateBits: root2.stateBits, rootModified: root2.modified, rootModifiedFileTime: root2.modifiedFileTime };
|
|
@@ -32874,7 +33005,7 @@ var CfbDocument = class extends Ole2DocumentBase {
|
|
|
32874
33005
|
...access,
|
|
32875
33006
|
children: () => {
|
|
32876
33007
|
const parent = this.#entry(reference2);
|
|
32877
|
-
return Object.freeze(this.entries.filter((
|
|
33008
|
+
return Object.freeze(this.entries.filter((entry4) => entry4.parentId === parent.id).map((entry4) => this.#handle(entry4.path)));
|
|
32878
33009
|
},
|
|
32879
33010
|
storage: (name3) => this.storage(childPath(name3)),
|
|
32880
33011
|
stream: (name3) => this.stream(childPath(name3)),
|
|
@@ -32981,21 +33112,21 @@ var CfbDocument = class extends Ole2DocumentBase {
|
|
|
32981
33112
|
return this.findEntry(path3) ?? fail2("entry-not-found");
|
|
32982
33113
|
}
|
|
32983
33114
|
#requireStorage(path3) {
|
|
32984
|
-
const
|
|
32985
|
-
if (
|
|
33115
|
+
const entry4 = this.#requireEntry(path3);
|
|
33116
|
+
if (entry4.type !== 1 && entry4.type !== 5)
|
|
32986
33117
|
fail2("not-a-storage");
|
|
32987
|
-
return
|
|
33118
|
+
return entry4;
|
|
32988
33119
|
}
|
|
32989
33120
|
#reference(path3, kind) {
|
|
32990
33121
|
if (!Array.isArray(path3) || path3.some((name3) => typeof name3 !== "string"))
|
|
32991
33122
|
fail2("invalid-entry-path");
|
|
32992
|
-
const
|
|
32993
|
-
if (kind === "stream" ?
|
|
33123
|
+
const entry4 = this.findEntry(path3) ?? fail2(`${kind}-not-found`);
|
|
33124
|
+
if (kind === "stream" ? entry4.type !== 2 : entry4.type !== 1 && entry4.type !== 5)
|
|
32994
33125
|
fail2(`not-a-${kind}`);
|
|
32995
|
-
const id4 = key2(
|
|
33126
|
+
const id4 = key2(entry4.path);
|
|
32996
33127
|
let reference2 = this.#references.get(id4);
|
|
32997
33128
|
if (!reference2) {
|
|
32998
|
-
reference2 = { path: Object.freeze([...
|
|
33129
|
+
reference2 = { path: Object.freeze([...entry4.path]), live: true };
|
|
32999
33130
|
this.#references.set(id4, reference2);
|
|
33000
33131
|
}
|
|
33001
33132
|
return reference2;
|
|
@@ -34859,7 +34990,7 @@ function unwrapXlsBytes(bytes) {
|
|
|
34859
34990
|
if (rootWorkbooks.length !== 1)
|
|
34860
34991
|
return { workbookBytes: bytes };
|
|
34861
34992
|
const rootWorkbook = rootWorkbooks[0];
|
|
34862
|
-
const streamEntry = rootWorkbook ? workbookEntries.find((
|
|
34993
|
+
const streamEntry = rootWorkbook ? workbookEntries.find((entry4) => entry4.name.toLowerCase() === rootWorkbook.name) : void 0;
|
|
34863
34994
|
const workbookBytes = rootWorkbook?.data;
|
|
34864
34995
|
if (!rootWorkbook || !streamEntry || !workbookBytes) {
|
|
34865
34996
|
return { workbookBytes: bytes };
|
|
@@ -34878,13 +35009,13 @@ function unwrapXlsBytes(bytes) {
|
|
|
34878
35009
|
if (!canRebuild)
|
|
34879
35010
|
return originalBytes;
|
|
34880
35011
|
const streams = /* @__PURE__ */ new Map();
|
|
34881
|
-
for (const
|
|
34882
|
-
if (
|
|
35012
|
+
for (const entry4 of ole.entries) {
|
|
35013
|
+
if (entry4.type !== ENTRY_TYPE_STREAM) {
|
|
34883
35014
|
continue;
|
|
34884
35015
|
}
|
|
34885
|
-
const data =
|
|
35016
|
+
const data = entry4.name.toLowerCase() === streamEntry.name.toLowerCase() ? editedWorkbookBytes : ole.getStream(entry4.name);
|
|
34886
35017
|
if (data) {
|
|
34887
|
-
streams.set(
|
|
35018
|
+
streams.set(entry4.name, data);
|
|
34888
35019
|
}
|
|
34889
35020
|
}
|
|
34890
35021
|
return new Uint8Array(buildOle2(streams, rootClsid));
|
|
@@ -34895,11 +35026,11 @@ function unwrapXlsBytes(bytes) {
|
|
|
34895
35026
|
}
|
|
34896
35027
|
}
|
|
34897
35028
|
function hasFlatUniqueStreamLayout(entries, workbookCount) {
|
|
34898
|
-
const rootEntries = entries.filter((
|
|
34899
|
-
const streamEntries = entries.filter((
|
|
35029
|
+
const rootEntries = entries.filter((entry4) => entry4.type === ENTRY_TYPE_ROOT);
|
|
35030
|
+
const streamEntries = entries.filter((entry4) => entry4.type === ENTRY_TYPE_STREAM);
|
|
34900
35031
|
if (rootEntries.length !== 1 || workbookCount !== 1 || entries.length !== rootEntries.length + streamEntries.length)
|
|
34901
35032
|
return false;
|
|
34902
|
-
const names = streamEntries.map((
|
|
35033
|
+
const names = streamEntries.map((entry4) => entry4.name.toLowerCase());
|
|
34903
35034
|
return new Set(names).size === names.length;
|
|
34904
35035
|
}
|
|
34905
35036
|
function equalBytes(left, right2) {
|
|
@@ -34911,8 +35042,8 @@ function isCfb(bytes) {
|
|
|
34911
35042
|
|
|
34912
35043
|
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-functions.js
|
|
34913
35044
|
var TABLE2 = `0 COUNT -1|1 IF -1|2 ISNA 1|3 ISERROR 1|4 SUM -1|5 AVERAGE -1|6 MIN -1|7 MAX -1|8 ROW -1|9 COLUMN -1|10 NA 0|11 NPV -1|12 STDEV -1|13 DOLLAR -1|14 FIXED -1|15 SIN 1|16 COS 1|17 TAN 1|18 ATAN 1|19 PI 0|20 SQRT 1|21 EXP 1|22 LN 1|23 LOG10 1|24 ABS 1|25 INT 1|26 SIGN 1|27 ROUND 2|28 LOOKUP -1|29 INDEX -1|30 REPT 2|31 MID 3|32 LEN 1|33 VALUE 1|34 TRUE 0|35 FALSE 0|36 AND -1|37 OR -1|38 NOT 1|39 MOD 2|40 DCOUNT 3|41 DSUM 3|42 DAVERAGE 3|43 DMIN 3|44 DMAX 3|45 DSTDEV 3|46 VAR -1|47 DVAR 3|48 TEXT 2|49 LINEST -1|50 TREND -1|51 LOGEST -1|52 GROWTH -1|56 PV -1|57 FV -1|58 NPER -1|59 PMT -1|60 RATE -1|61 MIRR 3|62 IRR -1|63 RAND 0|64 MATCH -1|65 DATE 3|66 TIME 3|67 DAY 1|68 MONTH 1|69 YEAR 1|70 WEEKDAY -1|71 HOUR 1|72 MINUTE 1|73 SECOND 1|74 NOW 0|75 AREAS 1|76 ROWS 1|77 COLUMNS 1|78 OFFSET -1|82 SEARCH -1|83 TRANSPOSE 1|86 TYPE 1|97 ATAN2 2|98 ASIN 1|99 ACOS 1|100 CHOOSE -1|101 HLOOKUP -1|102 VLOOKUP -1|105 ISREF 1|109 LOG -1|111 CHAR 1|112 LOWER 1|113 UPPER 1|114 PROPER 1|115 LEFT -1|116 RIGHT -1|117 EXACT 2|118 TRIM 1|119 REPLACE 4|120 SUBSTITUTE -1|121 CODE 1|124 FIND -1|125 CELL -1|126 ISERR 1|127 ISTEXT 1|128 ISNUMBER 1|129 ISBLANK 1|130 T 1|131 N 1|140 DATEVALUE 1|141 TIMEVALUE 1|142 SLN 3|143 SYD 4|144 DDB -1|148 INDIRECT -1|150 CALL -1|162 CLEAN 1|163 MDETERM 1|164 MINVERSE 1|165 MMULT 2|167 IPMT -1|168 PPMT -1|169 COUNTA -1|183 PRODUCT -1|184 FACT 1|189 DPRODUCT 3|190 ISNONTEXT 1|193 STDEVP -1|194 VARP -1|195 DSTDEVP 3|196 DVARP 3|197 TRUNC -1|198 ISLOGICAL 1|199 DCOUNTA 3|204 USDOLLAR -1|205 FINDB -1|206 SEARCHB -1|207 REPLACEB 4|208 LEFTB -1|209 RIGHTB -1|210 MIDB 3|211 LENB 1|212 ROUNDUP 2|213 ROUNDDOWN 2|214 ASC 1|215 DBCS 1|216 RANK -1|219 ADDRESS -1|220 DAYS360 -1|221 TODAY 0|222 VDB -1|227 MEDIAN -1|228 SUMPRODUCT -1|229 SINH 1|230 COSH 1|231 TANH 1|232 ASINH 1|233 ACOSH 1|234 ATANH 1|235 DGET 3|244 INFO 1|247 DB -1|252 FREQUENCY 2|261 ERROR.TYPE 1|269 AVEDEV -1|270 BETADIST -1|271 GAMMALN 1|272 BETAINV -1|273 BINOMDIST 4|274 CHIDIST 2|275 CHIINV 2|276 COMBIN 2|277 CONFIDENCE 3|278 CRITBINOM 3|279 EVEN 1|280 EXPONDIST 3|281 FDIST 3|282 FINV 3|283 FISHER 1|284 FISHERINV 1|285 FLOOR 2|286 GAMMADIST 4|287 GAMMAINV 3|288 CEILING 2|289 HYPGEOMDIST 4|290 LOGNORMDIST 3|291 LOGINV 3|292 NEGBINOMDIST 3|293 NORMDIST 4|294 NORMSDIST 1|295 NORMINV 3|296 NORMSINV 1|297 STANDARDIZE 3|298 ODD 1|299 PERMUT 2|300 POISSON 3|301 TDIST 3|302 WEIBULL 4|303 SUMXMY2 2|304 SUMX2MY2 2|305 SUMX2PY2 2|306 CHITEST 2|307 CORREL 2|308 COVAR 2|309 FORECAST 3|310 FTEST 2|311 INTERCEPT 2|312 PEARSON 2|313 RSQ 2|314 STEYX 2|315 SLOPE 2|316 TTEST 4|317 PROB -1|318 DEVSQ -1|319 GEOMEAN -1|320 HARMEAN -1|321 SUMSQ -1|322 KURT -1|323 SKEW -1|324 ZTEST -1|325 LARGE 2|326 SMALL 2|327 QUARTILE 2|328 PERCENTILE 2|329 PERCENTRANK -1|330 MODE -1|331 TRIMMEAN 2|332 TINV 2|336 CONCATENATE -1|337 POWER 2|342 RADIANS 1|343 DEGREES 1|344 SUBTOTAL -1|345 SUMIF -1|346 COUNTIF 2|347 COUNTBLANK 1|350 ISPMT 4|351 DATEDIF 3|352 DATESTRING 1|353 NUMBERSTRING 2|354 ROMAN -1|358 GETPIVOTDATA -1|359 HYPERLINK -1|360 PHONETIC 1|361 AVERAGEA -1|362 MAXA -1|363 MINA -1|364 STDEVPA -1|365 VARPA -1|366 STDEVA -1|367 VARA -1|368 BAHTTEXT 1`;
|
|
34914
|
-
var XLS_FUNCTIONS = new Map(TABLE2.split("|").map((
|
|
34915
|
-
const [id4, name3, argc] =
|
|
35045
|
+
var XLS_FUNCTIONS = new Map(TABLE2.split("|").map((entry4) => {
|
|
35046
|
+
const [id4, name3, argc] = entry4.split(" ");
|
|
34916
35047
|
return [Number(id4), { name: name3 ?? "", argc: Number(argc) }];
|
|
34917
35048
|
}));
|
|
34918
35049
|
var XLS_USER_FUNCTION_ID = 255;
|
|
@@ -35467,8 +35598,8 @@ var XLS_BUILTIN_FORMATS = {
|
|
|
35467
35598
|
49: "@"
|
|
35468
35599
|
};
|
|
35469
35600
|
function paletteColor(index3, palette) {
|
|
35470
|
-
const
|
|
35471
|
-
return
|
|
35601
|
+
const rgb7 = index3 < 64 ? palette[index3] : void 0;
|
|
35602
|
+
return rgb7 ? { index: index3, rgb: rgb7 } : { index: index3, auto: true };
|
|
35472
35603
|
}
|
|
35473
35604
|
var UNDERLINE = {
|
|
35474
35605
|
1: "single",
|
|
@@ -35513,9 +35644,9 @@ function parsePalette(data) {
|
|
|
35513
35644
|
const count = r.u16();
|
|
35514
35645
|
const palette = [...DEFAULT_XLS_PALETTE];
|
|
35515
35646
|
for (let i = 0; i < count && i + 8 < 64; i++) {
|
|
35516
|
-
const
|
|
35647
|
+
const rgb7 = [r.u8(), r.u8(), r.u8()];
|
|
35517
35648
|
r.skip(1);
|
|
35518
|
-
palette[i + 8] =
|
|
35649
|
+
palette[i + 8] = rgb7.map((c2) => c2.toString(16).padStart(2, "0").toUpperCase()).join("");
|
|
35519
35650
|
}
|
|
35520
35651
|
return palette;
|
|
35521
35652
|
}
|
|
@@ -35632,9 +35763,9 @@ function fullColor(r, palette) {
|
|
|
35632
35763
|
if (type === 1)
|
|
35633
35764
|
return withTint(paletteColor(value3, palette));
|
|
35634
35765
|
if (type === 2) {
|
|
35635
|
-
const
|
|
35766
|
+
const rgb7 = [value3 & 255, value3 >>> 8 & 255, value3 >>> 16 & 255];
|
|
35636
35767
|
return withTint({
|
|
35637
|
-
rgb:
|
|
35768
|
+
rgb: rgb7.map((c2) => c2.toString(16).padStart(2, "0").toUpperCase()).join("")
|
|
35638
35769
|
});
|
|
35639
35770
|
}
|
|
35640
35771
|
if (type === 3)
|
|
@@ -37348,7 +37479,7 @@ function compoundStreamNames(bytes) {
|
|
|
37348
37479
|
return [];
|
|
37349
37480
|
try {
|
|
37350
37481
|
const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
37351
|
-
return parseOle2(buffer).entries.map((
|
|
37482
|
+
return parseOle2(buffer).entries.map((entry4) => entry4.name);
|
|
37352
37483
|
} catch {
|
|
37353
37484
|
throw new XlsReadError("corrupt", "The file is not a readable OLE2 compound file.");
|
|
37354
37485
|
}
|
|
@@ -37544,8 +37675,8 @@ function extSst(entries, map) {
|
|
|
37544
37675
|
view2.setUint16(2, out.length - 4, true);
|
|
37545
37676
|
view2.setUint16(4, interval, true);
|
|
37546
37677
|
for (let i = 0; i < count; i++) {
|
|
37547
|
-
const
|
|
37548
|
-
const offset = map(
|
|
37678
|
+
const entry4 = entries[i * interval];
|
|
37679
|
+
const offset = map(entry4.offset), base2 = map(entry4.recordOffset);
|
|
37549
37680
|
if (offset < base2 || offset - base2 > 65535)
|
|
37550
37681
|
reject("malformed-records");
|
|
37551
37682
|
view2.setUint32(6 + i * 8, offset, true);
|
|
@@ -37589,8 +37720,8 @@ function editXlsStringWorkbookStream(input, edit) {
|
|
|
37589
37720
|
if (interval !== Math.max(Math.floor(sst.entries.length / 128) + 1, 8) || ext.length !== 2 + Math.ceil(sst.entries.length / interval) * 8)
|
|
37590
37721
|
reject("malformed-records");
|
|
37591
37722
|
for (let i = 0; i < (ext.length - 2) / 8; i++) {
|
|
37592
|
-
const
|
|
37593
|
-
if (sourceView.getUint32(ext.dataOffset + 2 + i * 8, true) !==
|
|
37723
|
+
const entry4 = sst.entries[i * interval];
|
|
37724
|
+
if (sourceView.getUint32(ext.dataOffset + 2 + i * 8, true) !== entry4.offset || sourceView.getUint16(ext.dataOffset + 6 + i * 8, true) !== entry4.offset - entry4.recordOffset)
|
|
37594
37725
|
reject("malformed-records");
|
|
37595
37726
|
}
|
|
37596
37727
|
if (ext.headerOffset >= m.globalsEnd || ext.depth !== 1 || ext.length < 2 || (ext.length - 2) % 8 !== 0 || m.records[m.records.indexOf(ext) + 1]?.opcode === 60)
|
|
@@ -38133,11 +38264,11 @@ function snapshot(value3) {
|
|
|
38133
38264
|
if (!item2 || typeof item2 !== "object")
|
|
38134
38265
|
return;
|
|
38135
38266
|
if (item2 instanceof Map)
|
|
38136
|
-
for (const
|
|
38137
|
-
freeze(
|
|
38267
|
+
for (const entry4 of item2.values())
|
|
38268
|
+
freeze(entry4);
|
|
38138
38269
|
else
|
|
38139
|
-
for (const
|
|
38140
|
-
freeze(
|
|
38270
|
+
for (const entry4 of Object.values(item2))
|
|
38271
|
+
freeze(entry4);
|
|
38141
38272
|
Object.freeze(item2);
|
|
38142
38273
|
};
|
|
38143
38274
|
freeze(copy9);
|
|
@@ -41871,13 +42002,17 @@ function effectiveNumber(cells4, name3, fallback) {
|
|
|
41871
42002
|
fail("UNSUPPORTED_GEOMETRY_EDIT", `${name3} of the stencil shape is out of range.`);
|
|
41872
42003
|
return value3;
|
|
41873
42004
|
}
|
|
41874
|
-
var sectionRows2 = (shape, name3) => children2(shape, "Section").filter((section3) => attribute2(section3, "N") === name3 && !deleted(section3)).flatMap(
|
|
42005
|
+
var sectionRows2 = (shape, name3) => children2(shape, "Section").filter((section3) => attribute2(section3, "N") === name3 && !deleted(section3)).flatMap(
|
|
42006
|
+
(section3) => children2(section3, "Row").map((row2, position) => ({
|
|
42007
|
+
row: row2,
|
|
42008
|
+
index: attribute2(row2, "IX") === void 0 ? position : Number(attribute2(row2, "IX"))
|
|
42009
|
+
}))
|
|
42010
|
+
);
|
|
41875
42011
|
function effectiveRows(shape, section3) {
|
|
41876
42012
|
const rows = /* @__PURE__ */ new Map();
|
|
41877
42013
|
const gone = /* @__PURE__ */ new Set();
|
|
41878
42014
|
for (const source of [templates.get(shape), shape])
|
|
41879
|
-
for (const row2 of sectionRows2(source, section3)) {
|
|
41880
|
-
const index3 = Number(attribute2(row2, "IX") ?? "0");
|
|
42015
|
+
for (const { row: row2, index: index3 } of sectionRows2(source, section3)) {
|
|
41881
42016
|
if (deleted(row2)) {
|
|
41882
42017
|
gone.add(index3);
|
|
41883
42018
|
continue;
|
|
@@ -42369,7 +42504,7 @@ var PASSIVE = /* @__PURE__ */ new Set([
|
|
|
42369
42504
|
"Reviewer",
|
|
42370
42505
|
"Annotation"
|
|
42371
42506
|
]);
|
|
42372
|
-
var LENGTHS = /^(width|height|pinx|piny|locpinx|locpiny|txtpinx|txtpiny|txtwidth|txtheight|txtlocpinx|txtlocpiny|beginx|beginy|endx|endy)$/;
|
|
42507
|
+
var LENGTHS = /^(width|height|pinx|piny|locpinx|locpiny|txtpinx|txtpiny|txtwidth|txtheight|txtlocpinx|txtlocpiny|beginx|beginy|endx|endy|lineweight|imgoffsetx|imgoffsety|imgwidth|imgheight)$/;
|
|
42373
42508
|
function expectedUnit(cell) {
|
|
42374
42509
|
const unit4 = attribute2(cell.local, "U") ?? attribute2(cell.inherited, "U");
|
|
42375
42510
|
if (unit4 === void 0 && cell.section && PASSIVE.has(cell.section.name)) return void 0;
|
|
@@ -42387,7 +42522,12 @@ function expectedUnit(cell) {
|
|
|
42387
42522
|
return "length";
|
|
42388
42523
|
return !cell.relative && /^(geometry\d+|connections|controls)\.[xy]\d+$/.test(name3) ? "length" : "scalar";
|
|
42389
42524
|
}
|
|
42390
|
-
function
|
|
42525
|
+
function untaggedLength(cell) {
|
|
42526
|
+
if (cell.section?.name !== "User") return void 0;
|
|
42527
|
+
const formula2 = effectiveFormula(cell);
|
|
42528
|
+
return formula2 && /^\s*[\d.]+\s*(?:MM|CM|IN|FT|M)/i.test(formula2) ? "length" : void 0;
|
|
42529
|
+
}
|
|
42530
|
+
function recalculateInstanceCaches(target2, changed, check, pins = /* @__PURE__ */ new Map(), text7, keepTextSize = false) {
|
|
42391
42531
|
const scope = "sheets" in target2 ? target2 : singleScope(target2);
|
|
42392
42532
|
const overrides = new Map(changed);
|
|
42393
42533
|
const pinned = /* @__PURE__ */ new Map();
|
|
@@ -42409,11 +42549,11 @@ function recalculateInstanceCaches(target2, changed, check, pins = /* @__PURE__
|
|
|
42409
42549
|
try {
|
|
42410
42550
|
const ast = parseVisioFormula(source);
|
|
42411
42551
|
const analysis = analyzeVisioFormula(ast);
|
|
42412
|
-
const sized =
|
|
42552
|
+
const sized = analysis.dynamic && (text7 || keepTextSize) ? textSizeFormula(ast) : void 0;
|
|
42413
42553
|
result2 = sized ? {
|
|
42414
42554
|
ast,
|
|
42415
42555
|
local,
|
|
42416
|
-
text: true,
|
|
42556
|
+
...text7 ? { text: true } : { deferText: true },
|
|
42417
42557
|
references: sized.references.flatMap((ref) => found(ref.cell, ref.shapeId))
|
|
42418
42558
|
} : analysis.dynamic ? { local, references: mentioned() } : {
|
|
42419
42559
|
ast,
|
|
@@ -42459,22 +42599,42 @@ function recalculateInstanceCaches(target2, changed, check, pins = /* @__PURE__
|
|
|
42459
42599
|
if (!node3 || node3.hasAttribute("E")) throw new Unevaluable();
|
|
42460
42600
|
try {
|
|
42461
42601
|
const value3 = visioFormulaCachedValue(attribute2(node3, "V") ?? "", attribute2(node3, "U"));
|
|
42462
|
-
const unit4 = expectedUnit(cell);
|
|
42602
|
+
const unit4 = expectedUnit(cell) ?? untaggedLength(cell);
|
|
42463
42603
|
return value3.unit === "scalar" && unit4 && unit4 !== "scalar" ? { ...value3, unit: unit4 } : value3;
|
|
42464
42604
|
} catch {
|
|
42465
42605
|
throw new Unevaluable();
|
|
42466
42606
|
}
|
|
42467
42607
|
};
|
|
42608
|
+
const tainted = /* @__PURE__ */ new Set();
|
|
42609
|
+
let sawDeferred = false;
|
|
42468
42610
|
const evaluate = (cell) => {
|
|
42611
|
+
const outer = sawDeferred;
|
|
42612
|
+
sawDeferred = false;
|
|
42613
|
+
try {
|
|
42614
|
+
const result2 = evaluateCell(cell);
|
|
42615
|
+
if (sawDeferred) tainted.add(cell);
|
|
42616
|
+
return result2;
|
|
42617
|
+
} finally {
|
|
42618
|
+
sawDeferred = sawDeferred || outer;
|
|
42619
|
+
}
|
|
42620
|
+
};
|
|
42621
|
+
const evaluateCell = (cell) => {
|
|
42469
42622
|
check();
|
|
42470
42623
|
if (--steps < 0)
|
|
42471
42624
|
fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
42472
42625
|
const override = overrides.get(cell);
|
|
42473
42626
|
if (override !== void 0) return { value: override, unit: expectedUnit(cell) ?? "scalar" };
|
|
42474
42627
|
const known = values.get(cell);
|
|
42475
|
-
if (known)
|
|
42628
|
+
if (known) {
|
|
42629
|
+
if (tainted.has(cell)) sawDeferred = true;
|
|
42630
|
+
return known;
|
|
42631
|
+
}
|
|
42476
42632
|
if (!isAffected(cell, /* @__PURE__ */ new Set())) return cached5(cell);
|
|
42477
42633
|
const own = dependenciesOf(cell);
|
|
42634
|
+
if (own?.deferText) {
|
|
42635
|
+
sawDeferred = true;
|
|
42636
|
+
return cached5(cell);
|
|
42637
|
+
}
|
|
42478
42638
|
const ast = own?.ast;
|
|
42479
42639
|
if (!ast || evaluating.has(cell)) throw new Unevaluable();
|
|
42480
42640
|
evaluating.add(cell);
|
|
@@ -42518,9 +42678,11 @@ function recalculateInstanceCaches(target2, changed, check, pins = /* @__PURE__
|
|
|
42518
42678
|
let value3;
|
|
42519
42679
|
let length;
|
|
42520
42680
|
try {
|
|
42681
|
+
sawDeferred = false;
|
|
42521
42682
|
const result2 = evaluate(cell);
|
|
42522
42683
|
value3 = result2.value;
|
|
42523
42684
|
length = result2.unit === "length";
|
|
42685
|
+
if (tainted.has(cell) && cell.section && PASSIVE.has(cell.section.name)) continue;
|
|
42524
42686
|
} catch (error) {
|
|
42525
42687
|
if (!(error instanceof Unevaluable)) throw error;
|
|
42526
42688
|
if (cell.section && PASSIVE.has(cell.section.name)) continue;
|
|
@@ -43306,7 +43468,7 @@ function proveLocalLine(shape) {
|
|
|
43306
43468
|
);
|
|
43307
43469
|
}
|
|
43308
43470
|
function moveLocalLine(shape, pageId2, shapeId2, x, y) {
|
|
43309
|
-
const
|
|
43471
|
+
const fixed2 = proveLocalLine(shape);
|
|
43310
43472
|
const local = cells(shape);
|
|
43311
43473
|
const value3 = (name3) => numeric(local.get(name3));
|
|
43312
43474
|
const changed = [];
|
|
@@ -43331,11 +43493,11 @@ function moveLocalLine(shape, pageId2, shapeId2, x, y) {
|
|
|
43331
43493
|
changed.push({ pageId: pageId2, shapeId: shapeId2, cell: name3 });
|
|
43332
43494
|
}
|
|
43333
43495
|
}
|
|
43334
|
-
return { changed, fixed };
|
|
43496
|
+
return { changed, fixed: fixed2 };
|
|
43335
43497
|
}
|
|
43336
|
-
function assertLineTranslation(shape,
|
|
43498
|
+
function assertLineTranslation(shape, fixed2) {
|
|
43337
43499
|
const local = cells(shape);
|
|
43338
|
-
for (const [name3, expected] of
|
|
43500
|
+
for (const [name3, expected] of fixed2)
|
|
43339
43501
|
if (!sameLineCoordinate(numeric(local.get(name3), expected), expected))
|
|
43340
43502
|
fail(
|
|
43341
43503
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
@@ -43903,12 +44065,12 @@ function pathVertices(sheet, width, height, writes) {
|
|
|
43903
44065
|
return refuse();
|
|
43904
44066
|
}
|
|
43905
44067
|
}
|
|
43906
|
-
const
|
|
43907
|
-
|
|
43908
|
-
rows.set(item2.row,
|
|
44068
|
+
const entry4 = rows.get(item2.row) ?? { relative: item2.relative };
|
|
44069
|
+
entry4[item2.name === "X" ? "x" : "y"] = number6;
|
|
44070
|
+
rows.set(item2.row, entry4);
|
|
43909
44071
|
}
|
|
43910
|
-
return [...rows.values()].filter((
|
|
43911
|
-
(
|
|
44072
|
+
return [...rows.values()].filter((entry4) => entry4.x !== void 0 && entry4.y !== void 0).map(
|
|
44073
|
+
(entry4) => entry4.relative ? { x: entry4.x * width, y: entry4.y * height } : { x: entry4.x, y: entry4.y }
|
|
43912
44074
|
);
|
|
43913
44075
|
}
|
|
43914
44076
|
function layoutStencilLine(root2, pageId2, shape, ends, check) {
|
|
@@ -44669,7 +44831,7 @@ var installed;
|
|
|
44669
44831
|
function setVisioTextMeasurer(measurer) {
|
|
44670
44832
|
installed = measurer;
|
|
44671
44833
|
}
|
|
44672
|
-
function
|
|
44834
|
+
function measure3(text7, style3) {
|
|
44673
44835
|
for (const measurer of installed ? [designTextMeasurer, installed] : [designTextMeasurer]) {
|
|
44674
44836
|
const width = measurer.width(text7, style3);
|
|
44675
44837
|
if (width !== void 0 && Number.isFinite(width) && width >= 0)
|
|
@@ -44713,7 +44875,7 @@ function layoutParagraph(pieces, fallback, paragraph2, available) {
|
|
|
44713
44875
|
for (const piece of pieces) {
|
|
44714
44876
|
for (const token of piece.text.match(/ +|[^ ]+/g) ?? []) {
|
|
44715
44877
|
if (UNSUPPORTED3.test(token)) return void 0;
|
|
44716
|
-
const measured =
|
|
44878
|
+
const measured = measure3(token, piece.run);
|
|
44717
44879
|
if (!measured) return void 0;
|
|
44718
44880
|
if (token.startsWith(" ")) {
|
|
44719
44881
|
if (width > 0) pending2 += measured.width;
|
|
@@ -44729,7 +44891,7 @@ function layoutParagraph(pieces, fallback, paragraph2, available) {
|
|
|
44729
44891
|
pending2 = 0;
|
|
44730
44892
|
if (start === 0 && Number.isFinite(room()) && measured.width > room()) {
|
|
44731
44893
|
for (const character of token) {
|
|
44732
|
-
const one =
|
|
44894
|
+
const one = measure3(character, piece.run);
|
|
44733
44895
|
if (!one) return void 0;
|
|
44734
44896
|
const edge2 = room();
|
|
44735
44897
|
if (width > 0) {
|
|
@@ -44781,7 +44943,7 @@ function visioTextExtents(text7) {
|
|
|
44781
44943
|
width(maximum) {
|
|
44782
44944
|
const inner = maximum === void 0 ? Infinity : maximum - text7.margins.left - text7.margins.right;
|
|
44783
44945
|
const laid = layout(inner);
|
|
44784
|
-
const mark =
|
|
44946
|
+
const mark = measure3(" ", text7.runs.at(-1) ?? fallback);
|
|
44785
44947
|
if (!laid || !mark) return void 0;
|
|
44786
44948
|
let widest = 0;
|
|
44787
44949
|
laid.forEach((lines3, index3) => {
|
|
@@ -45542,7 +45704,9 @@ async function applyInstanceGeometryEdit(roots, edit, template, check) {
|
|
|
45542
45704
|
scope,
|
|
45543
45705
|
overrides,
|
|
45544
45706
|
check,
|
|
45545
|
-
new Map(pins.map((item2) => [item2, item2 === cell("Width") ? width : height]))
|
|
45707
|
+
new Map(pins.map((item2) => [item2, item2 === cell("Width") ? width : height])),
|
|
45708
|
+
void 0,
|
|
45709
|
+
true
|
|
45546
45710
|
);
|
|
45547
45711
|
for (const [item2, value3] of pinned) {
|
|
45548
45712
|
assertOverridable(item2, "The size");
|
|
@@ -49146,13 +49310,13 @@ function masterMediaParts(media, directory, taken, types, existing) {
|
|
|
49146
49310
|
node3.setAttribute("Target", `../media/${part.slice(folder.length)}`);
|
|
49147
49311
|
rels.appendChild(node3);
|
|
49148
49312
|
const known = Array.from(types.getElementsByTagNameNS(types.namespaceURI, "Default")).some(
|
|
49149
|
-
(
|
|
49313
|
+
(entry4) => entry4.getAttribute("Extension")?.toLowerCase() === extension2
|
|
49150
49314
|
);
|
|
49151
49315
|
if (!known) {
|
|
49152
|
-
const
|
|
49153
|
-
|
|
49154
|
-
|
|
49155
|
-
types.insertBefore(
|
|
49316
|
+
const entry4 = types.ownerDocument.createElementNS(types.namespaceURI, "Default");
|
|
49317
|
+
entry4.setAttribute("Extension", extension2);
|
|
49318
|
+
entry4.setAttribute("ContentType", MEDIA_TYPES[extension2] ?? "application/octet-stream");
|
|
49319
|
+
types.insertBefore(entry4, types.firstChild);
|
|
49156
49320
|
}
|
|
49157
49321
|
}
|
|
49158
49322
|
return { rels, parts };
|
|
@@ -49181,17 +49345,17 @@ async function addMasterToDrawing(source, spec, limits, maxOutput, deadline, che
|
|
|
49181
49345
|
if (entries.length >= MAX_MASTERS)
|
|
49182
49346
|
fail("LIMIT_EDITS", "The drawing holds too many masters to add another.");
|
|
49183
49347
|
const same8 = (value3, other) => value3?.toLowerCase() === other.toLowerCase();
|
|
49184
|
-
const ours = spec.uniqueId && entries.find((
|
|
49348
|
+
const ours = spec.uniqueId && entries.find((entry4) => same8(attribute2(entry4, "UniqueID"), spec.uniqueId));
|
|
49185
49349
|
if (ours) return { bytes: source, masterId: attribute2(ours, "ID") ?? "", changedParts: [] };
|
|
49186
49350
|
const name3 = spec.name;
|
|
49187
49351
|
const reused = await spec.reuse?.({ pkg, existingPart, entries, check });
|
|
49188
49352
|
if (reused !== void 0) return { bytes: source, masterId: reused, changedParts: [] };
|
|
49189
|
-
const ids = entries.map((
|
|
49353
|
+
const ids = entries.map((entry4) => Number(attribute2(entry4, "ID")));
|
|
49190
49354
|
if (ids.some((id5) => !Number.isSafeInteger(id5) || id5 < 0))
|
|
49191
49355
|
fail("UNSUPPORTED_EDIT_PACKAGE", "The drawing has masters without canonical IDs.");
|
|
49192
49356
|
const id4 = String(Math.max(1, ...ids.map((value3) => value3 + 1)));
|
|
49193
49357
|
const names = new Set(
|
|
49194
|
-
entries.flatMap((
|
|
49358
|
+
entries.flatMap((entry4) => [attribute2(entry4, "NameU"), attribute2(entry4, "Name")])
|
|
49195
49359
|
);
|
|
49196
49360
|
const unique2 = names.has(name3) ? `${name3}.${id4}` : name3;
|
|
49197
49361
|
const relsPart = relationshipsPartFor(mastersPart);
|
|
@@ -49231,11 +49395,11 @@ async function addMasterToDrawing(source, spec, limits, maxOutput, deadline, che
|
|
|
49231
49395
|
spec.entry(masters, id4, unique2, relId);
|
|
49232
49396
|
const documentCopy = copy3(document);
|
|
49233
49397
|
let documentTouched = false;
|
|
49234
|
-
const
|
|
49398
|
+
const contents2 = await spec.contents(documentCopy, () => documentTouched = true);
|
|
49235
49399
|
const dirty = /* @__PURE__ */ new Map([
|
|
49236
49400
|
[mastersPart, masters],
|
|
49237
49401
|
[relsPart, rels],
|
|
49238
|
-
[masterPart,
|
|
49402
|
+
[masterPart, contents2],
|
|
49239
49403
|
["[Content_Types].xml", types]
|
|
49240
49404
|
]);
|
|
49241
49405
|
if (documentTouched) dirty.set(documentPart2, documentCopy);
|
|
@@ -49550,18 +49714,18 @@ async function ensureStencilMaster(source, master2, limits, maxOutput, deadline,
|
|
|
49550
49714
|
uniqueId: builtIn.uniqueId,
|
|
49551
49715
|
name: name3,
|
|
49552
49716
|
async reuse({ pkg, existingPart, entries, check: tick }) {
|
|
49553
|
-
for (const
|
|
49717
|
+
for (const entry4 of entries) {
|
|
49554
49718
|
tick();
|
|
49555
|
-
if (!existingPart || !same8(attribute2(
|
|
49719
|
+
if (!existingPart || !same8(attribute2(entry4, "NameU") ?? attribute2(entry4, "Name"), name3))
|
|
49556
49720
|
continue;
|
|
49557
49721
|
try {
|
|
49558
|
-
const part = await indexedPart(pkg, existingPart,
|
|
49722
|
+
const part = await indexedPart(pkg, existingPart, entry4, "master");
|
|
49559
49723
|
const roots = shapesOf2(await visioXml(pkg, part, "MasterContents")).filter(
|
|
49560
49724
|
(shape) => attribute2(shape, "Del") !== "1"
|
|
49561
49725
|
);
|
|
49562
49726
|
const cells4 = new Set(children2(roots[0], "Cell").map((cell) => attribute2(cell, "N")));
|
|
49563
49727
|
if (roots.length === 1 && !cells4.has("BeginX") && !roots[0].hasAttribute("Master"))
|
|
49564
|
-
return attribute2(
|
|
49728
|
+
return attribute2(entry4, "ID") ?? "";
|
|
49565
49729
|
} catch {
|
|
49566
49730
|
}
|
|
49567
49731
|
}
|
|
@@ -49653,26 +49817,26 @@ async function importStencilMaster(source, stencil, stencilMasterId, limits, max
|
|
|
49653
49817
|
const stencilDocument = await visioXml(pkg, documentPart2, "VisioDocument");
|
|
49654
49818
|
const mastersPart = await related(pkg, documentPart2, "masters", false);
|
|
49655
49819
|
if (!mastersPart) fail("EDIT_TARGET_NOT_FOUND", "The stencil has no masters.");
|
|
49656
|
-
const
|
|
49820
|
+
const entry4 = children2(await visioXml(pkg, mastersPart, "Masters"), "Master").find(
|
|
49657
49821
|
(node3) => attribute2(node3, "ID") === stencilMasterId
|
|
49658
49822
|
);
|
|
49659
|
-
if (!
|
|
49660
|
-
const part = await indexedPart(pkg, mastersPart,
|
|
49823
|
+
if (!entry4) fail("EDIT_TARGET_NOT_FOUND", "The stencil has no such master.");
|
|
49824
|
+
const part = await indexedPart(pkg, mastersPart, entry4, "master");
|
|
49661
49825
|
const media = await masterPictures(pkg, part);
|
|
49662
|
-
const
|
|
49663
|
-
const name3 = attribute2(
|
|
49826
|
+
const contents2 = await visioXml(pkg, part, "MasterContents");
|
|
49827
|
+
const name3 = attribute2(entry4, "NameU") ?? attribute2(entry4, "Name") ?? `Master ${stencilMasterId}`;
|
|
49664
49828
|
return addMasterToDrawing(
|
|
49665
49829
|
source,
|
|
49666
49830
|
{
|
|
49667
|
-
uniqueId: attribute2(
|
|
49831
|
+
uniqueId: attribute2(entry4, "UniqueID") ?? "",
|
|
49668
49832
|
name: name3,
|
|
49669
49833
|
entry(masters, id4, unique2, relationshipId) {
|
|
49670
|
-
const node3 = masters.ownerDocument.importNode(
|
|
49834
|
+
const node3 = masters.ownerDocument.importNode(entry4, true);
|
|
49671
49835
|
if (node3.namespaceURI !== masters.namespaceURI)
|
|
49672
49836
|
fail("UNSUPPORTED_EDIT_PACKAGE", "The stencil uses another Visio namespace.");
|
|
49673
49837
|
node3.setAttribute("ID", id4);
|
|
49674
49838
|
node3.setAttribute("NameU", unique2);
|
|
49675
|
-
if (node3.hasAttribute("Name") && attribute2(
|
|
49839
|
+
if (node3.hasAttribute("Name") && attribute2(entry4, "Name") === name3)
|
|
49676
49840
|
node3.setAttribute("Name", unique2);
|
|
49677
49841
|
for (const sheet of children2(node3, "PageSheet"))
|
|
49678
49842
|
for (const style3 of STYLE_ATTRIBUTES)
|
|
@@ -49683,7 +49847,7 @@ async function importStencilMaster(source, stencil, stencilMasterId, limits, max
|
|
|
49683
49847
|
media,
|
|
49684
49848
|
contents(document, touch) {
|
|
49685
49849
|
const map = styleMapper(stencilDocument, document, touch);
|
|
49686
|
-
const root2 = copy3(
|
|
49850
|
+
const root2 = copy3(contents2);
|
|
49687
49851
|
if (root2.namespaceURI !== document.namespaceURI)
|
|
49688
49852
|
fail("UNSUPPORTED_EDIT_PACKAGE", "The stencil uses another Visio namespace.");
|
|
49689
49853
|
for (const shape of Array.from(root2.getElementsByTagNameNS(root2.namespaceURI, "Shape")))
|
|
@@ -51756,7 +51920,7 @@ function visioFallbackQuickStyle(style3) {
|
|
|
51756
51920
|
return { fill: mix2(base2, 0, 0.5), line: mix2(base2, 0, 0.5), font: light };
|
|
51757
51921
|
}
|
|
51758
51922
|
}
|
|
51759
|
-
var
|
|
51923
|
+
var rgb2 = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
|
|
51760
51924
|
function shadowWrites(preset, add) {
|
|
51761
51925
|
if (preset === "none") {
|
|
51762
51926
|
add("ShdwPattern", 0, "FillStyle");
|
|
@@ -51764,7 +51928,7 @@ function shadowWrites(preset, add) {
|
|
|
51764
51928
|
}
|
|
51765
51929
|
const { x, y, blur } = visioShadowPresetGeometry(preset);
|
|
51766
51930
|
add("ShdwPattern", 1, "FillStyle");
|
|
51767
|
-
add("ShdwForegnd", "#000000", "FillStyle", void 0,
|
|
51931
|
+
add("ShdwForegnd", "#000000", "FillStyle", void 0, rgb2("#000000"));
|
|
51768
51932
|
add("ShdwForegndTrans", 0.6, "FillStyle");
|
|
51769
51933
|
add("ShapeShdwType", 1, "FillStyle");
|
|
51770
51934
|
add("ShapeShdwOffsetX", x / 72, "FillStyle", "PT");
|
|
@@ -51793,7 +51957,7 @@ async function quickStyleWrites(pkg, document, shape, pageId2, style3, add, chec
|
|
|
51793
51957
|
);
|
|
51794
51958
|
for (const [name3, value3, category] of selectors2) add(name3, value3, category);
|
|
51795
51959
|
const fallback = visioFallbackQuickStyle(style3);
|
|
51796
|
-
const paint3 = (name3, category, color2) => themed ? add(name3, "Themed", category, void 0, "THEMEVAL()") : add(name3, color2, category, void 0,
|
|
51960
|
+
const paint3 = (name3, category, color2) => themed ? add(name3, "Themed", category, void 0, "THEMEVAL()") : add(name3, color2, category, void 0, rgb2(color2));
|
|
51797
51961
|
add("FillPattern", 1, "FillStyle");
|
|
51798
51962
|
add("FillForegndTrans", 0, "FillStyle");
|
|
51799
51963
|
add("LinePattern", 1, "LineStyle");
|
|
@@ -51861,12 +52025,12 @@ function snapshotReflection(value3) {
|
|
|
51861
52025
|
blur: bounded5(value3.blur, 100, "Reflection blur must be 0 to 100 points.")
|
|
51862
52026
|
};
|
|
51863
52027
|
}
|
|
51864
|
-
var
|
|
52028
|
+
var rgb3 = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
|
|
51865
52029
|
function effectWrites(edit, add) {
|
|
51866
52030
|
if (edit.glow) {
|
|
51867
52031
|
add("GlowSize", edit.glow.size / 72, "FillStyle", "PT");
|
|
51868
52032
|
if (edit.glow.size > 0) {
|
|
51869
|
-
add("GlowColor", edit.glow.color, "FillStyle", void 0,
|
|
52033
|
+
add("GlowColor", edit.glow.color, "FillStyle", void 0, rgb3(edit.glow.color));
|
|
51870
52034
|
add("GlowColorTrans", edit.glow.transparency / 100, "FillStyle");
|
|
51871
52035
|
}
|
|
51872
52036
|
}
|
|
@@ -52090,7 +52254,11 @@ function snapshotFormatting(edit) {
|
|
|
52090
52254
|
"softEdges",
|
|
52091
52255
|
"reflection",
|
|
52092
52256
|
"bevel",
|
|
52093
|
-
"rotation3d"
|
|
52257
|
+
"rotation3d",
|
|
52258
|
+
"extrusionDepth",
|
|
52259
|
+
"extrusionColor",
|
|
52260
|
+
"contourSize",
|
|
52261
|
+
"contourColor"
|
|
52094
52262
|
].includes(key3) && edit[key3] !== void 0
|
|
52095
52263
|
))
|
|
52096
52264
|
fail("INVALID_EDIT", "A Quick Style replaces fill, line and font paint as a whole.");
|
|
@@ -52104,6 +52272,7 @@ function snapshotFormatting(edit) {
|
|
|
52104
52272
|
if (edit.reflection !== void 0) result2.reflection = snapshotReflection(edit.reflection);
|
|
52105
52273
|
if (edit.bevel !== void 0) result2.bevel = snapshotBevel(edit.bevel);
|
|
52106
52274
|
if (edit.rotation3d !== void 0) result2.rotation3d = snapshotRotation(edit.rotation3d);
|
|
52275
|
+
Object.assign(result2, snapshotSolid(edit));
|
|
52107
52276
|
if (result2.fillColor === "none" && result2.fillPattern !== void 0 && result2.fillPattern !== 0)
|
|
52108
52277
|
fail("INVALID_EDIT", "No fill conflicts with a visible fill pattern.");
|
|
52109
52278
|
}
|
|
@@ -52276,7 +52445,8 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
52276
52445
|
endX,
|
|
52277
52446
|
endY,
|
|
52278
52447
|
...connect ? { connect } : {},
|
|
52279
|
-
...route ? { route } : {}
|
|
52448
|
+
...route ? { route } : {},
|
|
52449
|
+
...edit.text !== void 0 ? { text: text7(edit.text) } : {}
|
|
52280
52450
|
};
|
|
52281
52451
|
}
|
|
52282
52452
|
case "create-rectangle":
|
|
@@ -52325,7 +52495,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
52325
52495
|
};
|
|
52326
52496
|
}
|
|
52327
52497
|
case "delete-shape":
|
|
52328
|
-
return { ...target2, type: edit.type };
|
|
52498
|
+
return { ...target2, type: edit.type, ...edit.deferred ? { deferred: true } : {} };
|
|
52329
52499
|
default:
|
|
52330
52500
|
return fail("INVALID_EDIT", "Unsupported edit command.");
|
|
52331
52501
|
}
|
|
@@ -53569,13 +53739,13 @@ function createVisioPagePart(parts, pages, pageId2, check) {
|
|
|
53569
53739
|
override.setAttribute("PartName", `/${path3}`);
|
|
53570
53740
|
override.setAttribute("ContentType", contentType);
|
|
53571
53741
|
parts.types.appendChild(override);
|
|
53572
|
-
const
|
|
53573
|
-
|
|
53574
|
-
parts.dirty.set(path3,
|
|
53742
|
+
const contents2 = parseXml(`<PageContents xmlns="${pages.namespaceURI}"/>`).documentElement;
|
|
53743
|
+
contents2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
53744
|
+
parts.dirty.set(path3, contents2);
|
|
53575
53745
|
parts.dirty.set(parts.pagesPart, pages);
|
|
53576
53746
|
parts.dirty.set(parts.relsPart, parts.rels);
|
|
53577
53747
|
parts.dirty.set("[Content_Types].xml", parts.types);
|
|
53578
|
-
return { page, contents };
|
|
53748
|
+
return { page, contents: contents2 };
|
|
53579
53749
|
}
|
|
53580
53750
|
|
|
53581
53751
|
// visio/edit-page-decoration.ts
|
|
@@ -53977,7 +54147,7 @@ function formattingFont(document, family) {
|
|
|
53977
54147
|
var hasCharacterExtras = (edit) => textExtraCharacterKeys.some((key3) => edit[key3] !== void 0);
|
|
53978
54148
|
var hasParagraphExtras = (edit) => textExtraParagraphKeys.some((key3) => edit[key3] !== void 0);
|
|
53979
54149
|
var quoted = (text7) => `"${text7.replaceAll('"', '""')}"`;
|
|
53980
|
-
var
|
|
54150
|
+
var rgb4 = (color2) => `RGB(${[1, 3, 5].map((i) => parseInt(color2.slice(i, i + 2), 16)).join(",")})`;
|
|
53981
54151
|
var inches = (value3) => Number(value3.toFixed(10));
|
|
53982
54152
|
function characterExtraWrites(edit, name3, add) {
|
|
53983
54153
|
if (edit.fontTransparency !== void 0) add(name3("ColorTrans"), edit.fontTransparency / 100);
|
|
@@ -54030,7 +54200,7 @@ function textBlockWrites(shape, edit, add) {
|
|
|
54030
54200
|
}
|
|
54031
54201
|
if (edit.textBackground !== void 0) {
|
|
54032
54202
|
if (edit.textBackground === "none") add("TextBkgnd", 0);
|
|
54033
|
-
else add("TextBkgnd", edit.textBackground, void 0, `${
|
|
54203
|
+
else add("TextBkgnd", edit.textBackground, void 0, `${rgb4(edit.textBackground)}+1`);
|
|
54034
54204
|
}
|
|
54035
54205
|
if (edit.textBackgroundTransparency !== void 0)
|
|
54036
54206
|
add("TextBkgndTrans", edit.textBackgroundTransparency / 100);
|
|
@@ -54194,7 +54364,7 @@ function shapeFormattingWrites(edit) {
|
|
|
54194
54364
|
edit.fillColor,
|
|
54195
54365
|
"FillStyle",
|
|
54196
54366
|
void 0,
|
|
54197
|
-
edit.fillColorTheme ? visioThemeColorFormula(edit.fillColorTheme) :
|
|
54367
|
+
edit.fillColorTheme ? visioThemeColorFormula(edit.fillColorTheme) : rgb5(edit.fillColor)
|
|
54198
54368
|
);
|
|
54199
54369
|
add("FillForegndTrans", 0, "FillStyle");
|
|
54200
54370
|
}
|
|
@@ -54209,7 +54379,7 @@ function shapeFormattingWrites(edit) {
|
|
|
54209
54379
|
edit.fillBackgroundColor,
|
|
54210
54380
|
"FillStyle",
|
|
54211
54381
|
void 0,
|
|
54212
|
-
|
|
54382
|
+
rgb5(edit.fillBackgroundColor)
|
|
54213
54383
|
);
|
|
54214
54384
|
}
|
|
54215
54385
|
if (edit.fillTransparency !== void 0) {
|
|
@@ -54222,7 +54392,7 @@ function shapeFormattingWrites(edit) {
|
|
|
54222
54392
|
edit.lineColor,
|
|
54223
54393
|
"LineStyle",
|
|
54224
54394
|
void 0,
|
|
54225
|
-
edit.lineColorTheme ? visioThemeColorFormula(edit.lineColorTheme) :
|
|
54395
|
+
edit.lineColorTheme ? visioThemeColorFormula(edit.lineColorTheme) : rgb5(edit.lineColor)
|
|
54226
54396
|
);
|
|
54227
54397
|
add("LineColorTrans", 0, "LineStyle");
|
|
54228
54398
|
add("LineGradientEnabled", 0, "LineStyle");
|
|
@@ -54261,6 +54431,7 @@ async function shapeFormattingPlan(pkg, document, shape, edit, check) {
|
|
|
54261
54431
|
effectWrites(edit, add);
|
|
54262
54432
|
if (edit.bevel !== void 0) bevelWrites(edit.bevel, add);
|
|
54263
54433
|
if (edit.rotation3d !== void 0) rotationWrites(edit.rotation3d, add);
|
|
54434
|
+
solidWrites(edit, add);
|
|
54264
54435
|
return { writes: [...writes.values()], ...rows ? { rows } : {} };
|
|
54265
54436
|
}
|
|
54266
54437
|
async function assertShapeFormattingPaintScope(pkg, document, shape, edit, changed, check) {
|
|
@@ -54270,7 +54441,7 @@ async function assertShapeFormattingPaintScope(pkg, document, shape, edit, chang
|
|
|
54270
54441
|
if (edit.lineColor === void 0 && changed.has("LineColorTrans"))
|
|
54271
54442
|
await assertNonGradientPaint(pkg, document, shape, edit.pageId, "Line", check);
|
|
54272
54443
|
}
|
|
54273
|
-
function
|
|
54444
|
+
function rgb5(color2) {
|
|
54274
54445
|
return `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
|
|
54275
54446
|
}
|
|
54276
54447
|
|
|
@@ -54955,11 +55126,11 @@ async function masterEntry(pkg, masterId) {
|
|
|
54955
55126
|
async function masterIdentities(pkg, masterIds) {
|
|
54956
55127
|
const result2 = [];
|
|
54957
55128
|
for (const id4 of masterIds) {
|
|
54958
|
-
const
|
|
54959
|
-
if (!
|
|
55129
|
+
const entry4 = await masterEntry(pkg, id4);
|
|
55130
|
+
if (!entry4) fail("UNSUPPORTED_CLIPBOARD", "The master of a stencil shape cannot be resolved.");
|
|
54960
55131
|
result2.push({
|
|
54961
55132
|
id: id4,
|
|
54962
|
-
identity: ["UniqueID", "BaseID", "NameU"].map((name3) => attribute2(
|
|
55133
|
+
identity: ["UniqueID", "BaseID", "NameU"].map((name3) => attribute2(entry4.master, name3) ?? "").join("|")
|
|
54963
55134
|
});
|
|
54964
55135
|
}
|
|
54965
55136
|
return result2;
|
|
@@ -54967,11 +55138,11 @@ async function masterIdentities(pkg, masterIds) {
|
|
|
54967
55138
|
async function assertClipboardMasters(pkg, pagePath, source, captured) {
|
|
54968
55139
|
for (const id4 of instanceMasterIds(source)) {
|
|
54969
55140
|
const known = captured?.find((master2) => master2.id === id4);
|
|
54970
|
-
const
|
|
54971
|
-
if (!known || !
|
|
55141
|
+
const entry4 = await masterEntry(pkg, id4);
|
|
55142
|
+
if (!known || !entry4) fail("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
|
|
54972
55143
|
const [actual] = await masterIdentities(pkg, [id4]);
|
|
54973
55144
|
if (actual.identity !== known.identity) fail("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
|
|
54974
|
-
const masterPart = await indexedPart(pkg,
|
|
55145
|
+
const masterPart = await indexedPart(pkg, entry4.mastersPart, entry4.master, "master");
|
|
54975
55146
|
const linked = [...(await pkg.relationships(pagePath)).values()].some(
|
|
54976
55147
|
(rel) => rel.type === MASTER_RELATIONSHIP3 && rel.target === masterPart
|
|
54977
55148
|
);
|
|
@@ -55569,14 +55740,14 @@ async function editVsdxPicture(pkg, parts, pages, edit, limits, maxOutput, deadl
|
|
|
55569
55740
|
(node3) => node3.getAttribute("Extension")?.toLowerCase() === format6.extension
|
|
55570
55741
|
);
|
|
55571
55742
|
if (!declared || declared.getAttribute("ContentType") !== info.mimeType) {
|
|
55572
|
-
const
|
|
55743
|
+
const entry4 = types.ownerDocument.createElementNS(
|
|
55573
55744
|
types.namespaceURI,
|
|
55574
55745
|
declared ? "Override" : "Default"
|
|
55575
55746
|
);
|
|
55576
|
-
if (declared)
|
|
55577
|
-
else
|
|
55578
|
-
|
|
55579
|
-
types.insertBefore(
|
|
55747
|
+
if (declared) entry4.setAttribute("PartName", `/${media}`);
|
|
55748
|
+
else entry4.setAttribute("Extension", format6.extension);
|
|
55749
|
+
entry4.setAttribute("ContentType", info.mimeType);
|
|
55750
|
+
types.insertBefore(entry4, declared ? null : types.firstElementChild ?? null);
|
|
55580
55751
|
}
|
|
55581
55752
|
const dirty = /* @__PURE__ */ new Map([
|
|
55582
55753
|
[path3, root2],
|
|
@@ -55635,14 +55806,14 @@ function declareType(types, extension2, contentType2, partName) {
|
|
|
55635
55806
|
(node3) => node3.getAttribute("Extension")?.toLowerCase() === extension2
|
|
55636
55807
|
);
|
|
55637
55808
|
if (declared?.getAttribute("ContentType") === contentType2) return;
|
|
55638
|
-
const
|
|
55809
|
+
const entry4 = types.ownerDocument.createElementNS(
|
|
55639
55810
|
types.namespaceURI,
|
|
55640
55811
|
declared ? "Override" : "Default"
|
|
55641
55812
|
);
|
|
55642
|
-
if (declared)
|
|
55643
|
-
else
|
|
55644
|
-
|
|
55645
|
-
types.insertBefore(
|
|
55813
|
+
if (declared) entry4.setAttribute("PartName", `/${partName}`);
|
|
55814
|
+
else entry4.setAttribute("Extension", extension2);
|
|
55815
|
+
entry4.setAttribute("ContentType", contentType2);
|
|
55816
|
+
types.insertBefore(entry4, declared ? null : types.firstElementChild ?? null);
|
|
55646
55817
|
}
|
|
55647
55818
|
async function stage(pkg, parts) {
|
|
55648
55819
|
const types = cloneRoot(await pkg.readXml("[Content_Types].xml", "Types"));
|
|
@@ -55829,7 +56000,7 @@ function refreshThemeColorCaches(root2, colors, check) {
|
|
|
55829
56000
|
}
|
|
55830
56001
|
|
|
55831
56002
|
// visio/edit-page-theme-recolor.ts
|
|
55832
|
-
var
|
|
56003
|
+
var rgb6 = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
|
|
55833
56004
|
function formattingCell2(sheet, name3) {
|
|
55834
56005
|
const matches2 = children2(sheet, "Cell").filter((cell) => attribute2(cell, "N") === name3);
|
|
55835
56006
|
return matches2.length === 1 ? matches2[0] : void 0;
|
|
@@ -55853,14 +56024,14 @@ function style2(shape, kind) {
|
|
|
55853
56024
|
function convert(cell, fallback, mode) {
|
|
55854
56025
|
if (!cell || cell.hasAttribute("E")) return false;
|
|
55855
56026
|
if (mode === "themed") {
|
|
55856
|
-
if (normal2(attribute2(cell, "F")) !==
|
|
56027
|
+
if (normal2(attribute2(cell, "F")) !== rgb6(fallback)) return false;
|
|
55857
56028
|
cell.setAttribute("V", "Themed");
|
|
55858
56029
|
cell.setAttribute("F", "THEMEVAL()");
|
|
55859
56030
|
} else {
|
|
55860
56031
|
if (normal2(attribute2(cell, "F")) !== "THEMEVAL()" || attribute2(cell, "V") !== "Themed")
|
|
55861
56032
|
return false;
|
|
55862
56033
|
cell.setAttribute("V", fallback);
|
|
55863
|
-
cell.setAttribute("F",
|
|
56034
|
+
cell.setAttribute("F", rgb6(fallback));
|
|
55864
56035
|
}
|
|
55865
56036
|
cell.removeAttribute("U");
|
|
55866
56037
|
return true;
|
|
@@ -56079,7 +56250,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
|
|
|
56079
56250
|
});
|
|
56080
56251
|
const dirty = /* @__PURE__ */ new Map([[pagesPath, pagesRoot]]);
|
|
56081
56252
|
const created = /* @__PURE__ */ new Map();
|
|
56082
|
-
const
|
|
56253
|
+
const contents2 = copy6(await visioXml(pkg, contentsPath, "PageContents"));
|
|
56083
56254
|
let recolored = false;
|
|
56084
56255
|
const part = PAGE_THEME_PARTS.find((name3) => edit[name3] !== void 0);
|
|
56085
56256
|
if (edit.embellishment !== void 0)
|
|
@@ -56092,8 +56263,8 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
|
|
|
56092
56263
|
(style3) => attribute2(style3, "ID") === "0"
|
|
56093
56264
|
);
|
|
56094
56265
|
if (attribute2(root2, "NameU") !== "No Style")
|
|
56095
|
-
recolored = recolorQuickStyledShapes(
|
|
56096
|
-
recolored = refreshThemeColorCaches(
|
|
56266
|
+
recolored = recolorQuickStyledShapes(contents2, "fallback", check);
|
|
56267
|
+
recolored = refreshThemeColorCaches(contents2, VISIO_UNTHEMED_COLORS, check) || recolored;
|
|
56097
56268
|
} else if (edit.theme || part) {
|
|
56098
56269
|
const source = visioBuiltInTheme(edit.theme ?? edit[part]);
|
|
56099
56270
|
await ensureBuiltInThemePart(pkg, parts, documentPath, themes, source, dirty, created, check);
|
|
@@ -56102,7 +56273,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
|
|
|
56102
56273
|
if (!part || part === "colors") {
|
|
56103
56274
|
for (const name3 of ["VariationColorIndex", "VariationStyleIndex"])
|
|
56104
56275
|
setCell(sheet, name3, edit.variant ?? 0);
|
|
56105
|
-
recolored = recolorQuickStyledShapes(
|
|
56276
|
+
recolored = recolorQuickStyledShapes(contents2, "themed", check);
|
|
56106
56277
|
}
|
|
56107
56278
|
const hex = (index3) => `#${source.colors[index3].toLowerCase()}`;
|
|
56108
56279
|
const variant = visioThemeVariantColors(source, edit.variant ?? 0);
|
|
@@ -56111,7 +56282,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
|
|
|
56111
56282
|
for (let index3 = 1; index3 <= 7; index3++)
|
|
56112
56283
|
colors[`variant${index3}`] = `#${variant[index3 - 1].toLowerCase()}`;
|
|
56113
56284
|
if (!part || part === "colors")
|
|
56114
|
-
recolored = refreshThemeColorCaches(
|
|
56285
|
+
recolored = refreshThemeColorCaches(contents2, colors, check) || recolored;
|
|
56115
56286
|
} else if (edit.variant !== void 0) {
|
|
56116
56287
|
const current = pageSelectedTheme(themes, sheet);
|
|
56117
56288
|
if (!current || current.variants.length <= edit.variant)
|
|
@@ -56131,9 +56302,9 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
|
|
|
56131
56302
|
const color2 = drawingColor(current.colors.get(key3), current.colors);
|
|
56132
56303
|
if (color2) colors[slot2] = color2;
|
|
56133
56304
|
}
|
|
56134
|
-
recolored = refreshThemeColorCaches(
|
|
56305
|
+
recolored = refreshThemeColorCaches(contents2, colors, check);
|
|
56135
56306
|
}
|
|
56136
|
-
if (recolored) dirty.set(contentsPath,
|
|
56307
|
+
if (recolored) dirty.set(contentsPath, contents2);
|
|
56137
56308
|
if ((/* @__PURE__ */ new Set([...parts.keys(), ...dirty.keys(), ...created.keys()])).size > limits.maxEntries)
|
|
56138
56309
|
fail("LIMIT_ENTRIES", "The theme exceeds the package entry limit.");
|
|
56139
56310
|
let total = [...parts.values()].reduce((sum, bytes2) => sum + bytes2.length, 0);
|
|
@@ -56224,7 +56395,7 @@ async function editVsdxComments(pkg, parts, pages, edits, limits, maxOutput, dea
|
|
|
56224
56395
|
const authors = list(root2, "AuthorList");
|
|
56225
56396
|
const comments = list(root2, "CommentList");
|
|
56226
56397
|
const byId = new Map(
|
|
56227
|
-
children2(comments, "CommentEntry").map((
|
|
56398
|
+
children2(comments, "CommentEntry").map((entry4, index3) => [visioCommentId(entry4, index3), entry4])
|
|
56228
56399
|
);
|
|
56229
56400
|
const removed = /* @__PURE__ */ new Set();
|
|
56230
56401
|
for (const edit of edits) {
|
|
@@ -56247,29 +56418,29 @@ async function editVsdxComments(pkg, parts, pages, edits, limits, maxOutput, dea
|
|
|
56247
56418
|
if (edit.initials) author.setAttribute("Initials", edit.initials);
|
|
56248
56419
|
authors.appendChild(author);
|
|
56249
56420
|
}
|
|
56250
|
-
const
|
|
56251
|
-
|
|
56252
|
-
|
|
56253
|
-
if (edit.shapeId !== void 0)
|
|
56254
|
-
|
|
56255
|
-
|
|
56256
|
-
|
|
56257
|
-
comments.appendChild(
|
|
56421
|
+
const entry5 = root2.ownerDocument.createElementNS(root2.namespaceURI, "CommentEntry");
|
|
56422
|
+
entry5.setAttribute("AuthorID", attribute2(author, "ID"));
|
|
56423
|
+
entry5.setAttribute("PageID", edit.pageId);
|
|
56424
|
+
if (edit.shapeId !== void 0) entry5.setAttribute("ShapeID", edit.shapeId);
|
|
56425
|
+
entry5.setAttribute("Date", edit.date);
|
|
56426
|
+
entry5.setAttribute("CommentID", nextId(children2(comments, "CommentEntry"), "CommentID"));
|
|
56427
|
+
entry5.textContent = edit.text;
|
|
56428
|
+
comments.appendChild(entry5);
|
|
56258
56429
|
continue;
|
|
56259
56430
|
}
|
|
56260
|
-
const
|
|
56261
|
-
if (!
|
|
56431
|
+
const entry4 = byId.get(edit.commentId);
|
|
56432
|
+
if (!entry4 || removed.has(entry4) || attribute2(entry4, "PageID") !== edit.pageId)
|
|
56262
56433
|
fail("EDIT_TARGET_NOT_FOUND", "Comment does not exist on the page.");
|
|
56263
56434
|
if (edit.type === "delete-comment") {
|
|
56264
|
-
|
|
56265
|
-
removed.add(
|
|
56435
|
+
entry4.parentNode.removeChild(entry4);
|
|
56436
|
+
removed.add(entry4);
|
|
56266
56437
|
continue;
|
|
56267
56438
|
}
|
|
56268
56439
|
if (edit.text !== void 0) {
|
|
56269
|
-
|
|
56270
|
-
|
|
56440
|
+
entry4.textContent = edit.text;
|
|
56441
|
+
entry4.setAttribute("EditDate", edit.date);
|
|
56271
56442
|
}
|
|
56272
|
-
if (edit.done !== void 0)
|
|
56443
|
+
if (edit.done !== void 0) entry4.setAttribute("Done", edit.done ? "1" : "0");
|
|
56273
56444
|
}
|
|
56274
56445
|
const dirty = /* @__PURE__ */ new Map([[path3, root2]]);
|
|
56275
56446
|
if (created) {
|
|
@@ -56732,9 +56903,21 @@ var ROLES = {
|
|
|
56732
56903
|
"swimlane list": "swimlane-list",
|
|
56733
56904
|
"phase list": "phase-list"
|
|
56734
56905
|
};
|
|
56906
|
+
var CFF_AUTHORED_IDS = {
|
|
56907
|
+
frame: "{0F0C7A10-0001-0000-8E40-00608CF305B2}",
|
|
56908
|
+
"swimlane-list": "{0F0C7A10-0002-0000-8E40-00608CF305B2}",
|
|
56909
|
+
"phase-list": "{0F0C7A10-0003-0000-8E40-00608CF305B2}",
|
|
56910
|
+
lane: "{0F0C7A10-0004-0000-8E40-00608CF305B2}",
|
|
56911
|
+
separator: "{0F0C7A10-0005-0000-8E40-00608CF305B2}"
|
|
56912
|
+
};
|
|
56913
|
+
var AUTHORED_ROLES = new Map(
|
|
56914
|
+
Object.entries(CFF_AUTHORED_IDS).map(([role, id4]) => [id4, role])
|
|
56915
|
+
);
|
|
56735
56916
|
var noCffMasters = {
|
|
56736
56917
|
get: () => void 0,
|
|
56737
56918
|
roleOf: () => void 0,
|
|
56919
|
+
authoredId: () => void 0,
|
|
56920
|
+
authoredPart: () => void 0,
|
|
56738
56921
|
empty: true
|
|
56739
56922
|
};
|
|
56740
56923
|
async function loadCffMasters(pkg) {
|
|
@@ -56744,25 +56927,31 @@ async function loadCffMasters(pkg) {
|
|
|
56744
56927
|
const list2 = await visioXml(pkg, mastersPart, "Masters");
|
|
56745
56928
|
const shapes = /* @__PURE__ */ new Map();
|
|
56746
56929
|
const roles = /* @__PURE__ */ new Map();
|
|
56930
|
+
const authored = /* @__PURE__ */ new Map();
|
|
56747
56931
|
for (const master2 of children2(list2, "Master")) {
|
|
56748
56932
|
const id4 = attribute2(master2, "ID");
|
|
56749
56933
|
const role = ROLES[(attribute2(master2, "NameU") ?? attribute2(master2, "Name") ?? "").toLowerCase()];
|
|
56750
|
-
if (!id4
|
|
56751
|
-
const
|
|
56752
|
-
|
|
56753
|
-
|
|
56754
|
-
|
|
56755
|
-
|
|
56934
|
+
if (!id4) continue;
|
|
56935
|
+
const own = AUTHORED_ROLES.get((attribute2(master2, "UniqueID") ?? "").toUpperCase());
|
|
56936
|
+
if (!role && !own) continue;
|
|
56937
|
+
const part = await indexedPart(pkg, mastersPart, master2, "master");
|
|
56938
|
+
if (own) {
|
|
56939
|
+
authored.set(own, { id: id4, part });
|
|
56940
|
+
continue;
|
|
56941
|
+
}
|
|
56942
|
+
const root2 = await visioXml(pkg, part, "MasterContents");
|
|
56756
56943
|
const top = children2(children2(root2, "Shapes")[0], "Shape");
|
|
56757
56944
|
if (top.length !== 1) continue;
|
|
56758
56945
|
shapes.set(id4, top[0]);
|
|
56759
56946
|
roles.set(id4, role);
|
|
56760
56947
|
}
|
|
56761
|
-
if (!shapes.size) return noCffMasters;
|
|
56948
|
+
if (!shapes.size && !authored.size) return noCffMasters;
|
|
56762
56949
|
return {
|
|
56763
56950
|
get: (id4) => shapes.get(id4),
|
|
56764
56951
|
roleOf: (id4) => id4 ? roles.get(id4) : void 0,
|
|
56765
|
-
|
|
56952
|
+
authoredId: (role) => authored.get(role)?.id,
|
|
56953
|
+
authoredPart: (role) => authored.get(role)?.part,
|
|
56954
|
+
empty: !shapes.size
|
|
56766
56955
|
};
|
|
56767
56956
|
}
|
|
56768
56957
|
|
|
@@ -56785,10 +56974,10 @@ function turnSwimlanes(from, frame, showTitle, lanes) {
|
|
|
56785
56974
|
box: horizontal2 ? { minX: 0, maxX: size3, minY: 0, maxY: cross } : { minX: 0, maxX: cross, minY: 0, maxY: size3 }
|
|
56786
56975
|
}))
|
|
56787
56976
|
);
|
|
56788
|
-
const turned = stacking.lanes.map((
|
|
56789
|
-
id:
|
|
56977
|
+
const turned = stacking.lanes.map((entry4, index3) => ({
|
|
56978
|
+
id: entry4.id,
|
|
56790
56979
|
from: lanes[index3].box,
|
|
56791
|
-
to:
|
|
56980
|
+
to: entry4.target
|
|
56792
56981
|
}));
|
|
56793
56982
|
return {
|
|
56794
56983
|
direction: direction2,
|
|
@@ -56939,10 +57128,10 @@ function createLaneShape(root2, document, id4, frame, heading, direction2, rotat
|
|
|
56939
57128
|
return shape;
|
|
56940
57129
|
}
|
|
56941
57130
|
var swimlane_level = (kind) => kind === "swimlane" ? -30080 : -30020;
|
|
56942
|
-
function createListShape(root2, document, id4,
|
|
57131
|
+
function createListShape(root2, document, id4, area3, kind, direction2, style3) {
|
|
56943
57132
|
const shape = createShape(root2, id4);
|
|
56944
57133
|
applyShapeCreationStyles(shape, document);
|
|
56945
|
-
placeBox(shape,
|
|
57134
|
+
placeBox(shape, area3);
|
|
56946
57135
|
setCell(shape, "LinePattern", 0);
|
|
56947
57136
|
setCell(shape, "FillPattern", 0);
|
|
56948
57137
|
setCell(shape, "ObjType", 4);
|
|
@@ -57390,13 +57579,13 @@ function ensureLists(scope, frame, ids = {}) {
|
|
|
57390
57579
|
const options2 = optionsOf(frame);
|
|
57391
57580
|
const lanes = lanesOf(scope, frame, options2.direction);
|
|
57392
57581
|
const bars = separatorsOf(scope, frame);
|
|
57393
|
-
const
|
|
57582
|
+
const area3 = boundsOf(lanes) ?? boundsOf([frame]);
|
|
57394
57583
|
const fresh = freeShapeIds(scope.root, 2);
|
|
57395
57584
|
const box5 = {
|
|
57396
|
-
x: (
|
|
57397
|
-
y: (
|
|
57398
|
-
width:
|
|
57399
|
-
height:
|
|
57585
|
+
x: (area3.minX + area3.maxX) / 2,
|
|
57586
|
+
y: (area3.minY + area3.maxY) / 2,
|
|
57587
|
+
width: area3.maxX - area3.minX,
|
|
57588
|
+
height: area3.maxY - area3.minY
|
|
57400
57589
|
};
|
|
57401
57590
|
const horizontal2 = options2.direction === "horizontal";
|
|
57402
57591
|
const make = (kind, id4) => {
|
|
@@ -57532,13 +57721,13 @@ function relayout(scope, frame, order) {
|
|
|
57532
57721
|
const titleSize = native && options2.title && Number.isFinite(laneTop) ? Math.max(0, frameBox.maxY - laneTop) : void 0;
|
|
57533
57722
|
const stacking = stackSwimlanes(options2.direction, frameBox, options2.title, boxes, titleSize);
|
|
57534
57723
|
const carried = new Map(
|
|
57535
|
-
stacking.lanes.map((
|
|
57724
|
+
stacking.lanes.map((entry4, index3) => [index3, [...containerClosure(scope.root, lanes[index3])]])
|
|
57536
57725
|
);
|
|
57537
57726
|
if (scope.contents === "move") for (const ids of carried.values()) assertMovable(scope.root, ids);
|
|
57538
|
-
stacking.lanes.forEach((
|
|
57727
|
+
stacking.lanes.forEach((entry4, index3) => {
|
|
57539
57728
|
scope.check();
|
|
57540
|
-
place(scope, lanes[index3],
|
|
57541
|
-
if (scope.contents === "move") shift3(scope, carried.get(index3),
|
|
57729
|
+
place(scope, lanes[index3], entry4.target);
|
|
57730
|
+
if (scope.contents === "move") shift3(scope, carried.get(index3), entry4.dx, entry4.dy);
|
|
57542
57731
|
});
|
|
57543
57732
|
const bars = separatorsOf(scope, frame);
|
|
57544
57733
|
for (const shape of bars) {
|
|
@@ -57553,13 +57742,13 @@ function relayout(scope, frame, order) {
|
|
|
57553
57742
|
place(scope, frame, stacking.frame);
|
|
57554
57743
|
setUserRow(frame, "numLanes", String(lanes.length), "");
|
|
57555
57744
|
const { swim, phase } = listsOf(scope, frame);
|
|
57556
|
-
const
|
|
57745
|
+
const area3 = {
|
|
57557
57746
|
minX: stacking.frame.minX,
|
|
57558
57747
|
maxX: stacking.frame.maxX,
|
|
57559
57748
|
maxY: stacking.top,
|
|
57560
57749
|
minY: stacking.end
|
|
57561
57750
|
};
|
|
57562
|
-
for (const list2 of [swim, phase]) if (list2) place(scope, list2,
|
|
57751
|
+
for (const list2 of [swim, phase]) if (list2) place(scope, list2, area3);
|
|
57563
57752
|
if (swim) writeListMembers(scope.root, swim, lanes.map(shapeIdOf));
|
|
57564
57753
|
if (phase)
|
|
57565
57754
|
writeListMembers(scope.root, phase, orderSeparators(bars, options2.direction).map(shapeIdOf));
|
|
@@ -57633,17 +57822,17 @@ function turnFlowchart(scope, frame, direction2) {
|
|
|
57633
57822
|
applyLaneLabel(lane, direction2, before.rotate);
|
|
57634
57823
|
});
|
|
57635
57824
|
const t = VISIO_SEPARATOR_THICKNESS;
|
|
57636
|
-
const
|
|
57825
|
+
const area3 = turn.stacking.frame;
|
|
57637
57826
|
bars.forEach((bar, index3) => {
|
|
57638
57827
|
const at3 = turn.separator(barCentres[index3]);
|
|
57639
57828
|
place(
|
|
57640
57829
|
scope,
|
|
57641
57830
|
bar,
|
|
57642
|
-
direction2 === "horizontal" ? { minX: at3 - t / 2, maxX: at3 + t / 2, minY: turn.stacking.end, maxY: turn.stacking.top } : { minX:
|
|
57831
|
+
direction2 === "horizontal" ? { minX: at3 - t / 2, maxX: at3 + t / 2, minY: turn.stacking.end, maxY: turn.stacking.top } : { minX: area3.minX, maxX: area3.maxX, minY: at3 - t / 2, maxY: at3 + t / 2 }
|
|
57643
57832
|
);
|
|
57644
57833
|
applySeparatorLabel(bar, direction2, before.separators);
|
|
57645
57834
|
});
|
|
57646
|
-
place(scope, frame,
|
|
57835
|
+
place(scope, frame, area3);
|
|
57647
57836
|
applyFrameTitle(frame, before.title);
|
|
57648
57837
|
relayout(scope, frame);
|
|
57649
57838
|
}
|
|
@@ -57804,12 +57993,12 @@ function insertSeparator(scope, edit) {
|
|
|
57804
57993
|
const { phase } = ensureLists(scope, frame);
|
|
57805
57994
|
const options2 = optionsOf(frame);
|
|
57806
57995
|
const lanes = lanesOf(scope, frame, options2.direction);
|
|
57807
|
-
const
|
|
57808
|
-
if (!
|
|
57996
|
+
const area3 = boundsOf(lanes);
|
|
57997
|
+
if (!area3) fail("UNSUPPORTED_GEOMETRY_EDIT", "The flowchart has no lanes.");
|
|
57809
57998
|
const horizontal2 = options2.direction === "horizontal";
|
|
57810
57999
|
const thick = VISIO_SEPARATOR_THICKNESS;
|
|
57811
|
-
const low = horizontal2 ?
|
|
57812
|
-
const high = horizontal2 ?
|
|
58000
|
+
const low = horizontal2 ? area3.minX : area3.minY;
|
|
58001
|
+
const high = horizontal2 ? area3.maxX : area3.maxY;
|
|
57813
58002
|
const at3 = Math.min(Math.max(edit.at ?? (low + high) / 2, low), high);
|
|
57814
58003
|
const bar = createSeparatorShape(
|
|
57815
58004
|
scope.root,
|
|
@@ -57817,13 +58006,13 @@ function insertSeparator(scope, edit) {
|
|
|
57817
58006
|
edit.shapeId,
|
|
57818
58007
|
horizontal2 ? {
|
|
57819
58008
|
x: at3,
|
|
57820
|
-
y: (
|
|
58009
|
+
y: (area3.minY + area3.maxY) / 2,
|
|
57821
58010
|
width: thick,
|
|
57822
|
-
height:
|
|
58011
|
+
height: area3.maxY - area3.minY
|
|
57823
58012
|
} : {
|
|
57824
|
-
x: (
|
|
58013
|
+
x: (area3.minX + area3.maxX) / 2,
|
|
57825
58014
|
y: at3,
|
|
57826
|
-
width:
|
|
58015
|
+
width: area3.maxX - area3.minX,
|
|
57827
58016
|
height: thick
|
|
57828
58017
|
},
|
|
57829
58018
|
options2.style,
|
|
@@ -57891,8 +58080,8 @@ function applySwimlaneEdit(roots, document, edit, check, instances = /* @__PURE_
|
|
|
57891
58080
|
check();
|
|
57892
58081
|
const root2 = roots.get(edit.pageId);
|
|
57893
58082
|
if (!root2) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
57894
|
-
const
|
|
57895
|
-
const scope = { roots, document, root: root2, pageId: edit.pageId, check, contents, masters };
|
|
58083
|
+
const contents2 = "contents" in edit && edit.contents === "leave" ? "leave" : "move";
|
|
58084
|
+
const scope = { roots, document, root: root2, pageId: edit.pageId, check, contents: contents2, masters };
|
|
57896
58085
|
refuseBuiltByVisio(scope, edit);
|
|
57897
58086
|
if (edit.type === "create-swimlanes") createSwimlanes(scope, edit);
|
|
57898
58087
|
else if (edit.type === "insert-swimlane") insertSwimlane(scope, edit);
|
|
@@ -57902,6 +58091,251 @@ function applySwimlaneEdit(roots, document, edit, check, instances = /* @__PURE_
|
|
|
57902
58091
|
else setOptions(scope, edit);
|
|
57903
58092
|
}
|
|
57904
58093
|
|
|
58094
|
+
// visio/edit-swimlane-stamp.ts
|
|
58095
|
+
var MASTER_RELATIONSHIP4 = "http://schemas.microsoft.com/visio/2010/relationships/master";
|
|
58096
|
+
var CFF_ROLES = Object.keys(CFF_AUTHORED_IDS);
|
|
58097
|
+
function partOf(shape) {
|
|
58098
|
+
if (userValue(shape, VISIO_SWIMLANE_FRAME_ROW) === "1") return "frame";
|
|
58099
|
+
if (userValue(shape, VISIO_SWIMLANE_LANE_ROW) === "1") return "lane";
|
|
58100
|
+
if (userValue(shape, VISIO_SEPARATOR_ROW) === "1") return "separator";
|
|
58101
|
+
if (userValue(shape, "msvStructureType")?.toLowerCase() !== "list") return void 0;
|
|
58102
|
+
const kind = userValue(shape, "msvSDListRequiredCategories");
|
|
58103
|
+
return kind === "Swimlane" ? "swimlane-list" : kind === "Phase" ? "phase-list" : void 0;
|
|
58104
|
+
}
|
|
58105
|
+
function unstampCffMasters(root2, masters) {
|
|
58106
|
+
const ids = new Set(CFF_ROLES.map((role) => masters.authoredId(role)).filter(Boolean));
|
|
58107
|
+
if (!ids.size) return;
|
|
58108
|
+
for (const shape of topLevelShapes(root2))
|
|
58109
|
+
if (ids.has(attribute2(shape, "Master"))) shape.removeAttribute("Master");
|
|
58110
|
+
}
|
|
58111
|
+
function stampCffMasters(root2, masters) {
|
|
58112
|
+
const used = /* @__PURE__ */ new Set();
|
|
58113
|
+
for (const shape of topLevelShapes(root2)) {
|
|
58114
|
+
const id4 = attribute2(shape, "Master");
|
|
58115
|
+
const role = CFF_ROLES.find((item2) => masters.authoredId(item2) === id4);
|
|
58116
|
+
if (role && id4) used.add(role);
|
|
58117
|
+
}
|
|
58118
|
+
for (const shape of topLevelShapes(root2)) {
|
|
58119
|
+
if (attribute2(shape, "Master") || !shapeIdOf(shape)) continue;
|
|
58120
|
+
const role = partOf(shape);
|
|
58121
|
+
const id4 = role && masters.authoredId(role);
|
|
58122
|
+
if (!id4) continue;
|
|
58123
|
+
shape.setAttribute("Master", id4);
|
|
58124
|
+
used.add(role);
|
|
58125
|
+
}
|
|
58126
|
+
return used;
|
|
58127
|
+
}
|
|
58128
|
+
async function relateCffMasters(pkg, parts, pagePath, roles, masters) {
|
|
58129
|
+
const part = relationshipsPartFor(pagePath);
|
|
58130
|
+
const rels = parts.has(part) ? copy3(await pkg.readXml(part, "Relationships")) : parseXml(`<Relationships xmlns="${NS.rels}"/>`).documentElement;
|
|
58131
|
+
const existing = () => Array.from(rels.getElementsByTagNameNS(rels.namespaceURI, "Relationship"));
|
|
58132
|
+
let changed = false;
|
|
58133
|
+
for (const role of roles) {
|
|
58134
|
+
const target2 = masters.authoredPart(role);
|
|
58135
|
+
if (!target2) continue;
|
|
58136
|
+
const linked = existing().some(
|
|
58137
|
+
(rel) => rel.getAttribute("Type") === MASTER_RELATIONSHIP4 && rel.getAttribute("TargetMode") !== "External" && resolvePartPath(pagePath, rel.getAttribute("Target") ?? "") === target2
|
|
58138
|
+
);
|
|
58139
|
+
if (linked) continue;
|
|
58140
|
+
const ids = new Set(existing().map((rel) => rel.getAttribute("Id") ?? ""));
|
|
58141
|
+
let index3 = 1;
|
|
58142
|
+
while (ids.has(`rId${index3}`)) index3++;
|
|
58143
|
+
const relationship2 = rels.ownerDocument.createElementNS(rels.namespaceURI, "Relationship");
|
|
58144
|
+
relationship2.setAttribute("Id", `rId${index3}`);
|
|
58145
|
+
relationship2.setAttribute("Type", MASTER_RELATIONSHIP4);
|
|
58146
|
+
const from = pagePath.split("/").slice(0, -1);
|
|
58147
|
+
const to = target2.split("/");
|
|
58148
|
+
let shared = 0;
|
|
58149
|
+
while (shared < from.length && shared < to.length - 1 && from[shared] === to[shared]) shared++;
|
|
58150
|
+
relationship2.setAttribute(
|
|
58151
|
+
"Target",
|
|
58152
|
+
[...from.slice(shared).map(() => ".."), ...to.slice(shared)].join("/")
|
|
58153
|
+
);
|
|
58154
|
+
rels.appendChild(relationship2);
|
|
58155
|
+
changed = true;
|
|
58156
|
+
}
|
|
58157
|
+
return changed ? { part, rels } : void 0;
|
|
58158
|
+
}
|
|
58159
|
+
|
|
58160
|
+
// visio/cff-author.ts
|
|
58161
|
+
var MM = 1 / 25.4;
|
|
58162
|
+
var STENCIL = ["visMasterStencil", "xfunc_m.vss"];
|
|
58163
|
+
var VERSION = ["visVersion", "15", ""];
|
|
58164
|
+
var HIDDEN_LAYER = ["msvSDMembersOnHiddenLayer", "1", "BOOL"];
|
|
58165
|
+
var QUIET = [
|
|
58166
|
+
["msvSDContainerNoHighlight", "1", "BOOL"],
|
|
58167
|
+
["msvSDContainerNoRibbon", "1", "BOOL"]
|
|
58168
|
+
];
|
|
58169
|
+
var ALL_PARTS = "CFF Container;CFF List;Swimlane;Phase;NonCFF";
|
|
58170
|
+
var DEFINITIONS = {
|
|
58171
|
+
frame: {
|
|
58172
|
+
name: "CFF Container",
|
|
58173
|
+
size: { width: 150 * MM, height: 100 * MM },
|
|
58174
|
+
rows: [
|
|
58175
|
+
["msvShapeCategories", "CFF Container;DoNotContain"],
|
|
58176
|
+
["msvStructureType", "Container"],
|
|
58177
|
+
...QUIET,
|
|
58178
|
+
["msvSDContainerRequiredCategories", "CFF List"],
|
|
58179
|
+
["msvSDContainerExcludedCategories", ""],
|
|
58180
|
+
STENCIL,
|
|
58181
|
+
VERSION
|
|
58182
|
+
]
|
|
58183
|
+
},
|
|
58184
|
+
"swimlane-list": {
|
|
58185
|
+
name: "Swimlane List",
|
|
58186
|
+
size: { width: 125 * MM, height: 100 * MM },
|
|
58187
|
+
rows: [
|
|
58188
|
+
["msvStructureType", "List"],
|
|
58189
|
+
["msvShapeCategories", "CFF List;DoNotContain"],
|
|
58190
|
+
["msvSDListRequiredCategories", "Swimlane"],
|
|
58191
|
+
["msvSDContainerExcludedCategories", "CFF Container;CFF List;Phase;NonCFF"],
|
|
58192
|
+
...QUIET,
|
|
58193
|
+
["msvSDListDirection", "2", ""],
|
|
58194
|
+
HIDDEN_LAYER,
|
|
58195
|
+
STENCIL,
|
|
58196
|
+
VERSION
|
|
58197
|
+
]
|
|
58198
|
+
},
|
|
58199
|
+
"phase-list": {
|
|
58200
|
+
name: "Phase List",
|
|
58201
|
+
size: { width: 100 * MM, height: 150 * MM },
|
|
58202
|
+
rows: [
|
|
58203
|
+
["msvStructureType", "List"],
|
|
58204
|
+
["msvShapeCategories", "CFF List;DoNotContain"],
|
|
58205
|
+
["msvSDContainerRequiredCategories", "Phase"],
|
|
58206
|
+
["msvSDListRequiredCategories", "Phase"],
|
|
58207
|
+
...QUIET,
|
|
58208
|
+
["msvSDListDirection", "0", ""],
|
|
58209
|
+
HIDDEN_LAYER,
|
|
58210
|
+
STENCIL,
|
|
58211
|
+
VERSION
|
|
58212
|
+
]
|
|
58213
|
+
},
|
|
58214
|
+
lane: {
|
|
58215
|
+
name: "Swimlane",
|
|
58216
|
+
size: { width: 125 * MM, height: 30 * MM },
|
|
58217
|
+
rows: [
|
|
58218
|
+
["msvShapeCategories", "Swimlane;DoNotContain"],
|
|
58219
|
+
["msvStructureType", "Container"],
|
|
58220
|
+
["msvSDContainerNoRibbon", "1", "BOOL"],
|
|
58221
|
+
["msvSDContainerExcludedCategories", ALL_PARTS],
|
|
58222
|
+
HIDDEN_LAYER,
|
|
58223
|
+
STENCIL,
|
|
58224
|
+
VERSION
|
|
58225
|
+
]
|
|
58226
|
+
},
|
|
58227
|
+
separator: {
|
|
58228
|
+
name: "Separator",
|
|
58229
|
+
size: { width: 0.1, height: 100 * MM },
|
|
58230
|
+
rows: [
|
|
58231
|
+
["msvStructureType", "Container"],
|
|
58232
|
+
["msvShapeCategories", "Phase;DoNotContain"],
|
|
58233
|
+
["msvSDContainerExcludedCategories", ALL_PARTS],
|
|
58234
|
+
...QUIET,
|
|
58235
|
+
HIDDEN_LAYER,
|
|
58236
|
+
STENCIL,
|
|
58237
|
+
VERSION
|
|
58238
|
+
]
|
|
58239
|
+
}
|
|
58240
|
+
};
|
|
58241
|
+
var CFF_ROLES2 = [
|
|
58242
|
+
"frame",
|
|
58243
|
+
"swimlane-list",
|
|
58244
|
+
"phase-list",
|
|
58245
|
+
"lane",
|
|
58246
|
+
"separator"
|
|
58247
|
+
];
|
|
58248
|
+
var baseId = (uniqueId) => uniqueId.replace(/^\{[0-9A-F]{8}/, "{4F0C7A10");
|
|
58249
|
+
function entry3(role) {
|
|
58250
|
+
return (masters, id4, name3, relationshipId) => {
|
|
58251
|
+
const doc = masters.ownerDocument;
|
|
58252
|
+
const node3 = (parent, tag) => parent.appendChild(doc.createElementNS(masters.namespaceURI, tag));
|
|
58253
|
+
const master2 = node3(masters, "Master");
|
|
58254
|
+
const { size: size3 } = DEFINITIONS[role];
|
|
58255
|
+
for (const [attribute4, value3] of [
|
|
58256
|
+
["ID", id4],
|
|
58257
|
+
["NameU", name3],
|
|
58258
|
+
["IsCustomNameU", "1"],
|
|
58259
|
+
["Name", name3],
|
|
58260
|
+
["IsCustomName", "1"],
|
|
58261
|
+
["Prompt", ""],
|
|
58262
|
+
["IconSize", "1"],
|
|
58263
|
+
["AlignName", "2"],
|
|
58264
|
+
["MatchByName", "0"],
|
|
58265
|
+
["IconUpdate", "1"],
|
|
58266
|
+
["UniqueID", CFF_AUTHORED_IDS[role]],
|
|
58267
|
+
["BaseID", baseId(CFF_AUTHORED_IDS[role])],
|
|
58268
|
+
["PatternFlags", "0"],
|
|
58269
|
+
["Hidden", "1"],
|
|
58270
|
+
["MasterType", "34"]
|
|
58271
|
+
])
|
|
58272
|
+
master2.setAttribute(attribute4, value3);
|
|
58273
|
+
const sheet = node3(master2, "PageSheet");
|
|
58274
|
+
for (const style3 of ["LineStyle", "FillStyle", "TextStyle"]) sheet.setAttribute(style3, "0");
|
|
58275
|
+
for (const [cell, value3] of [
|
|
58276
|
+
["PageWidth", size3.width],
|
|
58277
|
+
["PageHeight", size3.height],
|
|
58278
|
+
["PageScale", 1],
|
|
58279
|
+
["DrawingScale", 1],
|
|
58280
|
+
["DrawingSizeType", 4],
|
|
58281
|
+
["DrawingScaleType", 0]
|
|
58282
|
+
])
|
|
58283
|
+
setCell(sheet, cell, value3);
|
|
58284
|
+
node3(master2, "Rel").setAttributeNS(NS.r, "r:id", relationshipId);
|
|
58285
|
+
};
|
|
58286
|
+
}
|
|
58287
|
+
function contents(role) {
|
|
58288
|
+
return (document) => {
|
|
58289
|
+
const namespace = document.namespaceURI;
|
|
58290
|
+
const root2 = parseXml(`<MasterContents xmlns="${namespace}"/>`).documentElement;
|
|
58291
|
+
root2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
58292
|
+
const doc = root2.ownerDocument;
|
|
58293
|
+
const shapes = root2.appendChild(doc.createElementNS(namespace, "Shapes"));
|
|
58294
|
+
const shape = shapes.appendChild(doc.createElementNS(namespace, "Shape"));
|
|
58295
|
+
shape.setAttribute("ID", "5");
|
|
58296
|
+
shape.setAttribute("Type", "Shape");
|
|
58297
|
+
applyShapeCreationStyles(shape, document);
|
|
58298
|
+
const { width, height } = DEFINITIONS[role].size;
|
|
58299
|
+
for (const [name3, value3, formula2] of [
|
|
58300
|
+
["PinX", width / 2],
|
|
58301
|
+
["PinY", height / 2],
|
|
58302
|
+
["Width", width],
|
|
58303
|
+
["Height", height],
|
|
58304
|
+
["LocPinX", width / 2, "Width*0.5"],
|
|
58305
|
+
["LocPinY", height / 2, "Height*0.5"],
|
|
58306
|
+
["Angle", 0],
|
|
58307
|
+
["FlipX", 0],
|
|
58308
|
+
["FlipY", 0],
|
|
58309
|
+
["ResizeMode", 0]
|
|
58310
|
+
])
|
|
58311
|
+
setCell(shape, name3, value3, formula2);
|
|
58312
|
+
shape.appendChild(userSection(shape, DEFINITIONS[role].rows));
|
|
58313
|
+
return root2;
|
|
58314
|
+
};
|
|
58315
|
+
}
|
|
58316
|
+
async function ensureCffMasters(source, limits, maxOutput, deadline, check) {
|
|
58317
|
+
let bytes = source;
|
|
58318
|
+
const changedParts = /* @__PURE__ */ new Set();
|
|
58319
|
+
for (const role of CFF_ROLES2) {
|
|
58320
|
+
const added = await addMasterToDrawing(
|
|
58321
|
+
bytes,
|
|
58322
|
+
{
|
|
58323
|
+
uniqueId: CFF_AUTHORED_IDS[role],
|
|
58324
|
+
name: DEFINITIONS[role].name,
|
|
58325
|
+
entry: entry3(role),
|
|
58326
|
+
contents: contents(role)
|
|
58327
|
+
},
|
|
58328
|
+
limits,
|
|
58329
|
+
maxOutput,
|
|
58330
|
+
deadline,
|
|
58331
|
+
check
|
|
58332
|
+
);
|
|
58333
|
+
bytes = added.bytes;
|
|
58334
|
+
for (const part of added.changedParts) changedParts.add(part);
|
|
58335
|
+
}
|
|
58336
|
+
return { bytes, changedParts: [...changedParts] };
|
|
58337
|
+
}
|
|
58338
|
+
|
|
57905
58339
|
// visio/edit-layers.ts
|
|
57906
58340
|
var copy8 = (root2) => root2.ownerDocument.cloneNode(true).documentElement;
|
|
57907
58341
|
var cellValue2 = (owner, name3) => attribute2(
|
|
@@ -58263,11 +58697,33 @@ async function editVsdx(input, edits, options2 = {}) {
|
|
|
58263
58697
|
] : [],
|
|
58264
58698
|
...prepared2.templateConverted ? [{ code: "TEMPLATE_SAVED_AS_DRAWING", message: "The template was saved as a drawing." }] : []
|
|
58265
58699
|
];
|
|
58266
|
-
const final = await
|
|
58700
|
+
const final = await editWithDeletionsLast(prepared2.bytes, snapshot2, options2, clock);
|
|
58267
58701
|
return notes.length ? { ...final, diagnostics: [...notes, ...final.diagnostics] } : final;
|
|
58268
58702
|
}
|
|
58703
|
+
async function editWithDeletionsLast(input, edits, options2, clock) {
|
|
58704
|
+
const deferred2 = edits.filter((edit) => edit.type === "delete-shape" && edit.deferred);
|
|
58705
|
+
if (!deferred2.length) return editVisioPrepared(input, edits, options2, clock);
|
|
58706
|
+
const rest = edits.filter((edit) => !deferred2.includes(edit));
|
|
58707
|
+
const first2 = rest.length ? await editVsdx(input, rest, options2) : { bytes: input, changedParts: [], diagnostics: [] };
|
|
58708
|
+
const plain3 = deferred2.map((edit) => ({ ...edit, deferred: false }));
|
|
58709
|
+
const second = await editVsdx(first2.bytes, plain3, options2);
|
|
58710
|
+
return {
|
|
58711
|
+
bytes: second.bytes,
|
|
58712
|
+
changedParts: [.../* @__PURE__ */ new Set([...first2.changedParts, ...second.changedParts])],
|
|
58713
|
+
diagnostics: [...first2.diagnostics, ...second.diagnostics]
|
|
58714
|
+
};
|
|
58715
|
+
}
|
|
58269
58716
|
async function editVisioPrepared(input, edits, options2, clock) {
|
|
58270
|
-
const
|
|
58717
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
58718
|
+
const cff = edits.some((edit) => edit.type === "create-swimlanes") ? await ensureCffMasters(
|
|
58719
|
+
input,
|
|
58720
|
+
limits,
|
|
58721
|
+
positive2(options2.maxOutputBytes ?? limits.maxInputBytes),
|
|
58722
|
+
Date.now() + limits.maxRuntimeMs,
|
|
58723
|
+
() => void 0
|
|
58724
|
+
) : void 0;
|
|
58725
|
+
const first2 = await editVsdxTransaction(cff?.bytes ?? input, edits, options2, clock);
|
|
58726
|
+
const edited = cff ? { ...first2, changedParts: [.../* @__PURE__ */ new Set([...cff.changedParts, ...first2.changedParts])] } : first2;
|
|
58271
58727
|
const resized = await refreshTextSizes(clock.textSizes, edited, options2, clock.deadline);
|
|
58272
58728
|
const result2 = await refreshLineJumpCaches(
|
|
58273
58729
|
clock.jumpPages,
|
|
@@ -58454,7 +58910,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
58454
58910
|
(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)
|
|
58455
58911
|
);
|
|
58456
58912
|
let document;
|
|
58457
|
-
const cffMasters =
|
|
58913
|
+
const cffMasters = await loadCffMasters(pkg);
|
|
58458
58914
|
let masterMovePins = emptyMasterMoveProof();
|
|
58459
58915
|
const instanceCommands = /* @__PURE__ */ new Set();
|
|
58460
58916
|
let instanceDeletes = /* @__PURE__ */ new Set();
|
|
@@ -58464,7 +58920,9 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
58464
58920
|
)) {
|
|
58465
58921
|
for (const [pageId2, path4] of pages) {
|
|
58466
58922
|
const sourceRoot = await visioXml(pkg, path4, "PageContents");
|
|
58467
|
-
|
|
58923
|
+
const root2 = sourceRoot.ownerDocument.cloneNode(true).documentElement;
|
|
58924
|
+
unstampCffMasters(root2, cffMasters);
|
|
58925
|
+
roots.set(pageId2, root2);
|
|
58468
58926
|
}
|
|
58469
58927
|
for (const [pageId2, root2] of roots) {
|
|
58470
58928
|
const ids = new Set(
|
|
@@ -58728,12 +59186,18 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
58728
59186
|
for (const shapeId2 of takeDeferredTextSizes(root2)) clock.textSizes.push({ pageId: pageId2, shapeId: shapeId2 });
|
|
58729
59187
|
let totalBytes = [...parts.values()].reduce((sum, bytes2) => sum + bytes2.length, 0);
|
|
58730
59188
|
let nodes = 0;
|
|
59189
|
+
for (const [path3, root2] of [...dirty]) {
|
|
59190
|
+
if (![...pages.values()].includes(path3)) continue;
|
|
59191
|
+
const used = stampCffMasters(root2, cffMasters);
|
|
59192
|
+
const related2 = used.size ? await relateCffMasters(pkg, parts, path3, used, cffMasters) : void 0;
|
|
59193
|
+
if (related2) dirty.set(related2.part, related2.rels);
|
|
59194
|
+
}
|
|
58731
59195
|
for (const [path3, root2] of dirty) {
|
|
58732
59196
|
const serialized = serializeEditedXml(root2, limits, check);
|
|
58733
59197
|
nodes += serialized.nodes;
|
|
58734
59198
|
if (nodes > limits.maxTotalXmlNodes)
|
|
58735
59199
|
fail("LIMIT_XML_TOTAL", "Edited XML node total exceeds limit.");
|
|
58736
|
-
totalBytes += serialized.bytes.length - parts.get(path3)
|
|
59200
|
+
totalBytes += serialized.bytes.length - (parts.get(path3)?.length ?? 0);
|
|
58737
59201
|
if (totalBytes > limits.maxTotalBytes)
|
|
58738
59202
|
fail("LIMIT_TOTAL", "Edited package total exceeds limit.");
|
|
58739
59203
|
parts.set(path3, serialized.bytes);
|
|
@@ -58749,7 +59213,8 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
58749
59213
|
{ ...limits, maxInputBytes: maxOutput, maxRuntimeMs: Math.max(1, deadline - Date.now()) },
|
|
58750
59214
|
check
|
|
58751
59215
|
);
|
|
58752
|
-
for (const path3 of dirty.keys())
|
|
59216
|
+
for (const path3 of dirty.keys())
|
|
59217
|
+
if (!path3.endsWith(".rels")) await visioXml(verified.pkg, path3, "PageContents");
|
|
58753
59218
|
check();
|
|
58754
59219
|
}
|
|
58755
59220
|
return {
|
|
@@ -59015,6 +59480,303 @@ async function createVsdx(options2 = {}) {
|
|
|
59015
59480
|
return writeEditedPackage(parts, DEFAULTS.maxInputBytes, deadline, check);
|
|
59016
59481
|
}
|
|
59017
59482
|
|
|
59483
|
+
// visio/path-segments.ts
|
|
59484
|
+
var MAX_PATH_CHARS = 2e6;
|
|
59485
|
+
var MAX_PATH_SEGMENTS = 2e5;
|
|
59486
|
+
var COUNTS = {
|
|
59487
|
+
m: 2,
|
|
59488
|
+
l: 2,
|
|
59489
|
+
h: 1,
|
|
59490
|
+
v: 1,
|
|
59491
|
+
c: 6,
|
|
59492
|
+
s: 4,
|
|
59493
|
+
q: 4,
|
|
59494
|
+
t: 2,
|
|
59495
|
+
a: 7,
|
|
59496
|
+
z: 0
|
|
59497
|
+
};
|
|
59498
|
+
function parsePath(d) {
|
|
59499
|
+
if (d.length > MAX_PATH_CHARS) return void 0;
|
|
59500
|
+
const tokens3 = d.match(/[a-zA-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/g);
|
|
59501
|
+
if (!tokens3) return [];
|
|
59502
|
+
const out = [];
|
|
59503
|
+
let x = 0, y = 0, startX = 0, startY = 0, lastC, lastQ;
|
|
59504
|
+
let command2 = "";
|
|
59505
|
+
let index3 = 0;
|
|
59506
|
+
const read = () => Number(tokens3[index3++]);
|
|
59507
|
+
while (index3 < tokens3.length) {
|
|
59508
|
+
if (out.length > MAX_PATH_SEGMENTS) return void 0;
|
|
59509
|
+
const token = tokens3[index3];
|
|
59510
|
+
if (/[a-zA-Z]/.test(token)) {
|
|
59511
|
+
command2 = token;
|
|
59512
|
+
index3++;
|
|
59513
|
+
} else if (!command2) return void 0;
|
|
59514
|
+
else if (command2 === "M") command2 = "L";
|
|
59515
|
+
else if (command2 === "m") command2 = "l";
|
|
59516
|
+
const lower3 = command2.toLowerCase();
|
|
59517
|
+
const need = COUNTS[lower3];
|
|
59518
|
+
if (need === void 0) return void 0;
|
|
59519
|
+
if (index3 + need > tokens3.length) return void 0;
|
|
59520
|
+
const relative = command2 === lower3;
|
|
59521
|
+
const ox = relative ? x : 0, oy = relative ? y : 0;
|
|
59522
|
+
let nextC, nextQ;
|
|
59523
|
+
switch (lower3) {
|
|
59524
|
+
case "m":
|
|
59525
|
+
x = ox + read();
|
|
59526
|
+
y = oy + read();
|
|
59527
|
+
startX = x;
|
|
59528
|
+
startY = y;
|
|
59529
|
+
out.push({ t: "M", x, y });
|
|
59530
|
+
break;
|
|
59531
|
+
case "l":
|
|
59532
|
+
x = ox + read();
|
|
59533
|
+
y = oy + read();
|
|
59534
|
+
out.push({ t: "L", x, y });
|
|
59535
|
+
break;
|
|
59536
|
+
case "h":
|
|
59537
|
+
x = (relative ? x : 0) + read();
|
|
59538
|
+
out.push({ t: "L", x, y });
|
|
59539
|
+
break;
|
|
59540
|
+
case "v":
|
|
59541
|
+
y = (relative ? y : 0) + read();
|
|
59542
|
+
out.push({ t: "L", x, y });
|
|
59543
|
+
break;
|
|
59544
|
+
case "c": {
|
|
59545
|
+
const x1 = ox + read(), y1 = oy + read(), x2 = ox + read(), y2 = oy + read();
|
|
59546
|
+
out.push({ t: "C", x1, y1, x2, y2, x: x = ox + read(), y: y = oy + read() });
|
|
59547
|
+
nextC = [x2, y2];
|
|
59548
|
+
break;
|
|
59549
|
+
}
|
|
59550
|
+
case "s": {
|
|
59551
|
+
const x1 = lastC ? 2 * x - lastC[0] : x, y1 = lastC ? 2 * y - lastC[1] : y;
|
|
59552
|
+
const x2 = ox + read(), y2 = oy + read();
|
|
59553
|
+
out.push({ t: "C", x1, y1, x2, y2, x: x = ox + read(), y: y = oy + read() });
|
|
59554
|
+
nextC = [x2, y2];
|
|
59555
|
+
break;
|
|
59556
|
+
}
|
|
59557
|
+
case "q":
|
|
59558
|
+
case "t": {
|
|
59559
|
+
let qx, qy;
|
|
59560
|
+
if (lower3 === "q") {
|
|
59561
|
+
qx = ox + read();
|
|
59562
|
+
qy = oy + read();
|
|
59563
|
+
} else {
|
|
59564
|
+
qx = lastQ ? 2 * x - lastQ[0] : x;
|
|
59565
|
+
qy = lastQ ? 2 * y - lastQ[1] : y;
|
|
59566
|
+
}
|
|
59567
|
+
const ex = ox + read(), ey = oy + read();
|
|
59568
|
+
out.push({
|
|
59569
|
+
t: "C",
|
|
59570
|
+
x1: x + 2 / 3 * (qx - x),
|
|
59571
|
+
y1: y + 2 / 3 * (qy - y),
|
|
59572
|
+
x2: ex + 2 / 3 * (qx - ex),
|
|
59573
|
+
y2: ey + 2 / 3 * (qy - ey),
|
|
59574
|
+
x: ex,
|
|
59575
|
+
y: ey
|
|
59576
|
+
});
|
|
59577
|
+
x = ex;
|
|
59578
|
+
y = ey;
|
|
59579
|
+
nextQ = [qx, qy];
|
|
59580
|
+
break;
|
|
59581
|
+
}
|
|
59582
|
+
case "a": {
|
|
59583
|
+
const rx = read(), ry = read(), rotation = read(), large = read(), sweep = read();
|
|
59584
|
+
const ex = ox + read(), ey = oy + read();
|
|
59585
|
+
arc3(out, x, y, rx, ry, rotation, large !== 0, sweep !== 0, ex, ey);
|
|
59586
|
+
x = ex;
|
|
59587
|
+
y = ey;
|
|
59588
|
+
break;
|
|
59589
|
+
}
|
|
59590
|
+
case "z":
|
|
59591
|
+
out.push({ t: "Z" });
|
|
59592
|
+
x = startX;
|
|
59593
|
+
y = startY;
|
|
59594
|
+
break;
|
|
59595
|
+
}
|
|
59596
|
+
lastC = nextC;
|
|
59597
|
+
lastQ = nextQ;
|
|
59598
|
+
if (lower3 === "z") command2 = "";
|
|
59599
|
+
}
|
|
59600
|
+
return out;
|
|
59601
|
+
}
|
|
59602
|
+
function arc3(out, x0, y0, rxIn, ryIn, degrees, large, sweep, x, y) {
|
|
59603
|
+
let rx = Math.abs(rxIn), ry = Math.abs(ryIn);
|
|
59604
|
+
if (x0 === x && y0 === y || rx === 0 || ry === 0) {
|
|
59605
|
+
out.push({ t: "L", x, y });
|
|
59606
|
+
return;
|
|
59607
|
+
}
|
|
59608
|
+
const phi = degrees * Math.PI / 180, cos = Math.cos(phi), sin = Math.sin(phi);
|
|
59609
|
+
const dx = (x0 - x) / 2, dy = (y0 - y) / 2;
|
|
59610
|
+
const x1 = cos * dx + sin * dy, y1 = -sin * dx + cos * dy;
|
|
59611
|
+
const lambda = x1 * x1 / (rx * rx) + y1 * y1 / (ry * ry);
|
|
59612
|
+
if (lambda > 1) {
|
|
59613
|
+
rx *= Math.sqrt(lambda);
|
|
59614
|
+
ry *= Math.sqrt(lambda);
|
|
59615
|
+
}
|
|
59616
|
+
const numerator = rx * rx * ry * ry - rx * rx * y1 * y1 - ry * ry * x1 * x1;
|
|
59617
|
+
const denominator = rx * rx * y1 * y1 + ry * ry * x1 * x1;
|
|
59618
|
+
const factor = (large === sweep ? -1 : 1) * Math.sqrt(Math.max(0, numerator / (denominator || 1)));
|
|
59619
|
+
const cx1 = factor * rx * y1 / ry, cy1 = -factor * ry * x1 / rx;
|
|
59620
|
+
const cx = cos * cx1 - sin * cy1 + (x0 + x) / 2, cy = sin * cx1 + cos * cy1 + (y0 + y) / 2;
|
|
59621
|
+
const angle = (ux, uy, vx, vy) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
|
|
59622
|
+
const start = angle(1, 0, (x1 - cx1) / rx, (y1 - cy1) / ry);
|
|
59623
|
+
let delta = angle((x1 - cx1) / rx, (y1 - cy1) / ry, (-x1 - cx1) / rx, (-y1 - cy1) / ry);
|
|
59624
|
+
if (!sweep && delta > 0) delta -= 2 * Math.PI;
|
|
59625
|
+
else if (sweep && delta < 0) delta += 2 * Math.PI;
|
|
59626
|
+
const pieces = Math.max(1, Math.ceil(Math.abs(delta) / (Math.PI / 2) - 1e-9));
|
|
59627
|
+
const step2 = delta / pieces;
|
|
59628
|
+
const k = 4 / 3 * Math.tan(step2 / 4);
|
|
59629
|
+
const point2 = (t) => {
|
|
59630
|
+
const c2 = Math.cos(t), s = Math.sin(t);
|
|
59631
|
+
return [
|
|
59632
|
+
cx + rx * c2 * cos - ry * s * sin,
|
|
59633
|
+
cy + rx * c2 * sin + ry * s * cos,
|
|
59634
|
+
-rx * s * cos - ry * c2 * sin,
|
|
59635
|
+
-rx * s * sin + ry * c2 * cos
|
|
59636
|
+
];
|
|
59637
|
+
};
|
|
59638
|
+
for (let piece = 0; piece < pieces; piece++) {
|
|
59639
|
+
const a2 = start + piece * step2, b = a2 + step2;
|
|
59640
|
+
const [px, py, dpx, dpy] = point2(a2);
|
|
59641
|
+
const [qx, qy, dqx, dqy] = point2(b);
|
|
59642
|
+
out.push({
|
|
59643
|
+
t: "C",
|
|
59644
|
+
x1: px + k * dpx,
|
|
59645
|
+
y1: py + k * dpy,
|
|
59646
|
+
x2: qx - k * dqx,
|
|
59647
|
+
y2: qy - k * dqy,
|
|
59648
|
+
x: piece === pieces - 1 ? x : qx,
|
|
59649
|
+
y: piece === pieces - 1 ? y : qy
|
|
59650
|
+
});
|
|
59651
|
+
}
|
|
59652
|
+
}
|
|
59653
|
+
|
|
59654
|
+
// visio/solid-3d.ts
|
|
59655
|
+
var VISIO_PERSPECTIVE_LIMIT = 120 * Math.PI / 180;
|
|
59656
|
+
var VISIO_CAMERA_INCHES = 6.36;
|
|
59657
|
+
var CURVE_STEPS = 12;
|
|
59658
|
+
function createProjection(turn, centre, unit4 = 1) {
|
|
59659
|
+
const [ca, sa] = [Math.cos(turn.x), Math.sin(turn.x)];
|
|
59660
|
+
const [cb, sb] = [Math.cos(turn.y), Math.sin(turn.y)];
|
|
59661
|
+
const [cc, sc] = [Math.cos(turn.z), Math.sin(turn.z)];
|
|
59662
|
+
const fov = Math.min(Math.max(turn.perspective, 0), VISIO_PERSPECTIVE_LIMIT);
|
|
59663
|
+
const camera = fov > 1e-3 ? VISIO_CAMERA_INCHES / Math.tan(fov / 2) / (unit4 || 1) : void 0;
|
|
59664
|
+
const turned = (x, y, z) => {
|
|
59665
|
+
const x1 = x * ca - z * sa;
|
|
59666
|
+
const z1 = x * sa + z * ca;
|
|
59667
|
+
return { x: x1, y: y * cb - z1 * sb, z: y * sb + z1 * cb };
|
|
59668
|
+
};
|
|
59669
|
+
return {
|
|
59670
|
+
point(x, y, z = 0) {
|
|
59671
|
+
const t = turned(x - centre.x, y - centre.y, z);
|
|
59672
|
+
const scale = camera === void 0 ? 1 : camera / Math.max(camera - t.z, camera * 0.05);
|
|
59673
|
+
const [px, py] = [t.x * scale, t.y * scale];
|
|
59674
|
+
return { x: centre.x + cc * px - sc * py, y: centre.y + sc * px + cc * py };
|
|
59675
|
+
},
|
|
59676
|
+
depth: (x, y, z = 0) => turned(x - centre.x, y - centre.y, z).z,
|
|
59677
|
+
direction(x, y) {
|
|
59678
|
+
const t = turned(x, y, 0);
|
|
59679
|
+
return { x: cc * t.x - sc * t.y, y: sc * t.x + cc * t.y, toward: t.z };
|
|
59680
|
+
}
|
|
59681
|
+
};
|
|
59682
|
+
}
|
|
59683
|
+
function flattenPath(d) {
|
|
59684
|
+
const segments = parsePath(d);
|
|
59685
|
+
if (!segments) return void 0;
|
|
59686
|
+
const result2 = [];
|
|
59687
|
+
let current;
|
|
59688
|
+
for (const segment of segments) {
|
|
59689
|
+
if (segment.t === "M") {
|
|
59690
|
+
current = { points: [{ x: segment.x, y: segment.y }], closed: false };
|
|
59691
|
+
result2.push(current);
|
|
59692
|
+
} else if (!current) return void 0;
|
|
59693
|
+
else if (segment.t === "L") current.points.push({ x: segment.x, y: segment.y });
|
|
59694
|
+
else if (segment.t === "Z") {
|
|
59695
|
+
current.closed = true;
|
|
59696
|
+
const first2 = current.points[0];
|
|
59697
|
+
current = { points: [first2], closed: false };
|
|
59698
|
+
result2.push(current);
|
|
59699
|
+
} else {
|
|
59700
|
+
const from = current.points[current.points.length - 1];
|
|
59701
|
+
for (let step2 = 1; step2 <= CURVE_STEPS; step2++) {
|
|
59702
|
+
const t = step2 / CURVE_STEPS;
|
|
59703
|
+
const u = 1 - t;
|
|
59704
|
+
const [a2, b, c2, e] = [u * u * u, 3 * u * u * t, 3 * u * t * t, t * t * t];
|
|
59705
|
+
current.points.push({
|
|
59706
|
+
x: a2 * from.x + b * segment.x1 + c2 * segment.x2 + e * segment.x,
|
|
59707
|
+
y: a2 * from.y + b * segment.y1 + c2 * segment.y2 + e * segment.y
|
|
59708
|
+
});
|
|
59709
|
+
}
|
|
59710
|
+
}
|
|
59711
|
+
}
|
|
59712
|
+
for (const sub of result2) {
|
|
59713
|
+
const [first2, last] = [sub.points[0], sub.points[sub.points.length - 1]];
|
|
59714
|
+
if (sub.points.length > 3 && Math.abs(first2.x - last.x) < 1e-9 && Math.abs(first2.y - last.y) < 1e-9)
|
|
59715
|
+
sub.closed = true;
|
|
59716
|
+
}
|
|
59717
|
+
return result2.filter((sub) => sub.closed || sub.points.length > 1);
|
|
59718
|
+
}
|
|
59719
|
+
var fixed = (value3) => String(Math.round(value3 * 1e5) / 1e5);
|
|
59720
|
+
var polygonData = (points, closed) => `${points.map((p, i) => `${i ? "L" : "M"} ${fixed(p.x)} ${fixed(p.y)}`).join(" ")}${closed ? " Z" : ""}`;
|
|
59721
|
+
function projectPathData(d, projection) {
|
|
59722
|
+
const subpaths = flattenPath(d);
|
|
59723
|
+
if (!subpaths) return void 0;
|
|
59724
|
+
return subpaths.map(
|
|
59725
|
+
(sub) => polygonData(
|
|
59726
|
+
sub.points.map((p) => projection.point(p.x, p.y)),
|
|
59727
|
+
sub.closed
|
|
59728
|
+
)
|
|
59729
|
+
).join(" ");
|
|
59730
|
+
}
|
|
59731
|
+
var area2 = (points) => {
|
|
59732
|
+
let sum = 0;
|
|
59733
|
+
for (let i = 0; i < points.length; i++) {
|
|
59734
|
+
const [p, q] = [points[i], points[(i + 1) % points.length]];
|
|
59735
|
+
sum += p.x * q.y - q.x * p.y;
|
|
59736
|
+
}
|
|
59737
|
+
return sum / 2;
|
|
59738
|
+
};
|
|
59739
|
+
function extrudePaths(paths, projection, depth) {
|
|
59740
|
+
const back = [];
|
|
59741
|
+
const sides = [];
|
|
59742
|
+
for (const d of paths) {
|
|
59743
|
+
const subpaths = flattenPath(d);
|
|
59744
|
+
if (!subpaths) return void 0;
|
|
59745
|
+
for (const sub of subpaths) {
|
|
59746
|
+
const points = [...sub.points];
|
|
59747
|
+
if (!sub.closed || points.length < 3) continue;
|
|
59748
|
+
const first2 = points[0];
|
|
59749
|
+
const last = points[points.length - 1];
|
|
59750
|
+
if (Math.abs(first2.x - last.x) < 1e-9 && Math.abs(first2.y - last.y) < 1e-9) points.pop();
|
|
59751
|
+
const turnSign = area2(points) >= 0 ? 1 : -1;
|
|
59752
|
+
back.push(points.map((p) => projection.point(p.x, p.y, -depth)));
|
|
59753
|
+
for (let i = 0; i < points.length; i++) {
|
|
59754
|
+
const [p, q] = [points[i], points[(i + 1) % points.length]];
|
|
59755
|
+
const [dx, dy] = [q.x - p.x, q.y - p.y];
|
|
59756
|
+
const length = Math.hypot(dx, dy);
|
|
59757
|
+
if (length < 1e-9) continue;
|
|
59758
|
+
const normal3 = projection.direction(turnSign * dy / length, -turnSign * dx / length);
|
|
59759
|
+
if (normal3.toward <= 1e-6) continue;
|
|
59760
|
+
const screen = Math.hypot(normal3.x, normal3.y) || 1;
|
|
59761
|
+
const shade = 0.9 - 0.18 * (normal3.y / screen) - 0.7 * Math.max(0, normal3.x / screen);
|
|
59762
|
+
sides.push({
|
|
59763
|
+
points: [
|
|
59764
|
+
projection.point(p.x, p.y),
|
|
59765
|
+
projection.point(q.x, q.y),
|
|
59766
|
+
projection.point(q.x, q.y, -depth),
|
|
59767
|
+
projection.point(p.x, p.y, -depth)
|
|
59768
|
+
],
|
|
59769
|
+
shade: Math.max(0.1, shade),
|
|
59770
|
+
depth: projection.depth((p.x + q.x) / 2, (p.y + q.y) / 2, -depth / 2)
|
|
59771
|
+
});
|
|
59772
|
+
}
|
|
59773
|
+
}
|
|
59774
|
+
}
|
|
59775
|
+
sides.sort((a2, b) => a2.depth - b.depth);
|
|
59776
|
+
return { back, sides };
|
|
59777
|
+
}
|
|
59778
|
+
var extrusionPathData = (polygons) => polygons.map((points) => polygonData(points, true)).join(" ");
|
|
59779
|
+
|
|
59018
59780
|
// visio/open-arrow.ts
|
|
59019
59781
|
function visioOpenArrowExtent(size3, lineWidth) {
|
|
59020
59782
|
const index3 = Number.isFinite(size3) ? Math.max(0, Math.min(6, Math.trunc(size3))) : 2;
|
|
@@ -59258,6 +60020,8 @@ function visioTabStarts(segments, tabs = [], origin = 0, start = 0, spacing2 = V
|
|
|
59258
60020
|
}
|
|
59259
60021
|
|
|
59260
60022
|
exports.EmfBitmapError = EmfBitmapError;
|
|
60023
|
+
exports.MAX_PATH_CHARS = MAX_PATH_CHARS;
|
|
60024
|
+
exports.MAX_PATH_SEGMENTS = MAX_PATH_SEGMENTS;
|
|
59261
60025
|
exports.VISIO_ARROW_SHAPES = VISIO_ARROW_SHAPES;
|
|
59262
60026
|
exports.VISIO_BACKGROUND_STYLES = VISIO_BACKGROUND_STYLES;
|
|
59263
60027
|
exports.VISIO_BASIC_SHAPES = VISIO_BASIC_SHAPES;
|
|
@@ -59332,6 +60096,7 @@ exports.canonicalShapeDataValue = canonicalShapeDataValue;
|
|
|
59332
60096
|
exports.captureVisioClipboard = captureVisioClipboard;
|
|
59333
60097
|
exports.checkVisioAlternativeText = checkVisioAlternativeText;
|
|
59334
60098
|
exports.convertVisioMetafile = convertVisioMetafile;
|
|
60099
|
+
exports.createProjection = createProjection;
|
|
59335
60100
|
exports.createVsdx = createVsdx;
|
|
59336
60101
|
exports.deserializeVisioClipboard = deserializeVisioClipboard;
|
|
59337
60102
|
exports.designTextMeasurer = designTextMeasurer;
|
|
@@ -59339,6 +60104,9 @@ exports.editVsdx = editVsdx;
|
|
|
59339
60104
|
exports.encodeBitmapEmf = encodeBitmapEmf;
|
|
59340
60105
|
exports.evaluateVisioFormula = evaluateVisioFormula;
|
|
59341
60106
|
exports.evaluateVisioTextField = evaluateVisioTextField;
|
|
60107
|
+
exports.extrudePaths = extrudePaths;
|
|
60108
|
+
exports.extrusionPathData = extrusionPathData;
|
|
60109
|
+
exports.flattenPath = flattenPath;
|
|
59342
60110
|
exports.formatVisioFieldValue = formatVisioFieldValue;
|
|
59343
60111
|
exports.getVisioPageLayers = getVisioPageLayers;
|
|
59344
60112
|
exports.inspectVisioEmfAdmission = inspectVisioEmfAdmission;
|
|
@@ -59358,10 +60126,12 @@ exports.loadVisio = loadVisio;
|
|
|
59358
60126
|
exports.matchRefreshedRows = matchRefreshedRows;
|
|
59359
60127
|
exports.mergeVisioPages = mergeVisioPages;
|
|
59360
60128
|
exports.parseLegacyVsd = parseLegacyVsd;
|
|
60129
|
+
exports.parsePath = parsePath;
|
|
59361
60130
|
exports.parseVisioFormula = parseVisioFormula;
|
|
59362
60131
|
exports.parseVisioThemeColorFormula = parseVisioThemeColorFormula;
|
|
59363
60132
|
exports.parseVsdx = parseVsdx;
|
|
59364
60133
|
exports.parseVsdxPages = parseVsdxPages;
|
|
60134
|
+
exports.projectPathData = projectPathData;
|
|
59365
60135
|
exports.readVisioStencil = readVisioStencil;
|
|
59366
60136
|
exports.resolveVisioPageVisibility = resolveVisioPageVisibility;
|
|
59367
60137
|
exports.resolveVisioThemeColor = resolveVisioThemeColor;
|