ooxml-core 1.23.0 → 1.24.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 +553 -335
- package/dist/automation/index.d.ts +1 -0
- package/dist/automation/index.d.ts.map +1 -1
- package/dist/automation/index.mjs +552 -336
- package/dist/automation/live.d.ts +89 -0
- package/dist/automation/live.d.ts.map +1 -0
- package/dist/docx/ui/customization.d.ts +30 -0
- package/dist/docx/ui/customization.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +51 -0
- package/dist/docx/ui/index.d.ts +1 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +46 -1
- package/dist/embedding/backstage.d.ts +48 -0
- package/dist/embedding/backstage.d.ts.map +1 -0
- package/dist/embedding/capabilities.d.ts +60 -0
- package/dist/embedding/capabilities.d.ts.map +1 -0
- package/dist/embedding/customization.d.ts +32 -0
- package/dist/embedding/customization.d.ts.map +1 -0
- package/dist/embedding/index.cjs +229 -0
- package/dist/embedding/index.d.ts +7 -0
- package/dist/embedding/index.d.ts.map +1 -0
- package/dist/embedding/index.mjs +204 -0
- package/dist/embedding/menu-commands.d.ts +66 -0
- package/dist/embedding/menu-commands.d.ts.map +1 -0
- package/dist/embedding/regions.d.ts +58 -0
- package/dist/embedding/regions.d.ts.map +1 -0
- package/dist/embedding/storage.d.ts +111 -0
- package/dist/embedding/storage.d.ts.map +1 -0
- package/dist/index.cjs +233 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +233 -1
- package/dist/visio/collab/compose.d.ts.map +1 -1
- package/dist/visio/collab/fixups.d.ts.map +1 -1
- package/dist/visio/collab/index.cjs +167 -62
- package/dist/visio/collab/index.mjs +167 -62
- package/dist/visio/collab/keys.d.ts +2 -0
- package/dist/visio/collab/keys.d.ts.map +1 -1
- package/dist/visio/collab/pieces.d.ts +7 -0
- package/dist/visio/collab/pieces.d.ts.map +1 -1
- package/dist/visio/collab/read-ids.d.ts +7 -1
- package/dist/visio/collab/read-ids.d.ts.map +1 -1
- package/dist/visio/collab/read-parts.d.ts.map +1 -1
- package/dist/visio/collab/read-shapes.d.ts +0 -1
- package/dist/visio/collab/read-shapes.d.ts.map +1 -1
- package/dist/visio/collab/read.d.ts.map +1 -1
- package/dist/visio/collab/schema.d.ts +1 -1
- package/dist/visio/collab/schema.d.ts.map +1 -1
- package/dist/visio/collab/snapshot-contents.d.ts.map +1 -1
- package/dist/visio/collab/write-shapes.d.ts.map +1 -1
- package/dist/visio/collab/zip-store.d.ts +4 -0
- package/dist/visio/collab/zip-store.d.ts.map +1 -0
- package/dist/visio/document-level.d.ts +57 -0
- package/dist/visio/document-level.d.ts.map +1 -0
- package/dist/visio/index.cjs +543 -444
- package/dist/visio/index.d.ts +1 -0
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +543 -444
- package/dist/visio/layers.d.ts +3 -0
- package/dist/visio/layers.d.ts.map +1 -1
- package/dist/visio/package.d.ts +9 -0
- package/dist/visio/package.d.ts.map +1 -1
- package/dist/visio/parser.d.ts +7 -0
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/shape-metadata.d.ts +3 -0
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/ui/contract.d.ts +27 -2
- package/dist/visio/ui/contract.d.ts.map +1 -1
- package/dist/visio/ui/customization.d.ts +46 -0
- package/dist/visio/ui/customization.d.ts.map +1 -0
- package/dist/visio/ui/index.cjs +454 -316
- package/dist/visio/ui/index.d.ts +1 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +452 -317
- package/dist/xlsx/ui/commands.d.ts +2 -0
- package/dist/xlsx/ui/commands.d.ts.map +1 -1
- package/dist/xlsx/ui/customization.d.ts +49 -0
- package/dist/xlsx/ui/customization.d.ts.map +1 -0
- package/dist/xlsx/ui/index.cjs +39 -1
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +37 -2
- package/package.json +6 -1
package/dist/visio/index.cjs
CHANGED
|
@@ -740,6 +740,7 @@ var VisioPackage = class _VisioPackage {
|
|
|
740
740
|
relationshipCache = /* @__PURE__ */ new Map();
|
|
741
741
|
byteCache = /* @__PURE__ */ new Map();
|
|
742
742
|
decodedNames = /* @__PURE__ */ new Map();
|
|
743
|
+
noted;
|
|
743
744
|
totalOutput = 0;
|
|
744
745
|
totalXmlNodes = 0;
|
|
745
746
|
check = () => {
|
|
@@ -774,7 +775,26 @@ var VisioPackage = class _VisioPackage {
|
|
|
774
775
|
);
|
|
775
776
|
}
|
|
776
777
|
}
|
|
778
|
+
/**
|
|
779
|
+
* Starts noting every part this package is asked about (read, listed in a relationship, or
|
|
780
|
+
* checked for). The returned function stops noting and gives each part with a print of its
|
|
781
|
+
* declared CRC-32 and size (empty when absent), which is what {@link printOf} compares.
|
|
782
|
+
*/
|
|
783
|
+
record() {
|
|
784
|
+
const noted = /* @__PURE__ */ new Set();
|
|
785
|
+
this.noted = noted;
|
|
786
|
+
return () => {
|
|
787
|
+
if (this.noted === noted) this.noted = void 0;
|
|
788
|
+
return [...noted].sort().map((path2) => [path2, this.printOf(path2)]);
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
/** The declared CRC-32 and size of a part, or an empty string when the package lacks it. */
|
|
792
|
+
printOf(path2) {
|
|
793
|
+
const entry3 = this.entries.get(path2);
|
|
794
|
+
return entry3 && !entry3.directory ? `${entry3.crc}:${entry3.size}` : "";
|
|
795
|
+
}
|
|
777
796
|
has(path2) {
|
|
797
|
+
this.noted?.add(path2);
|
|
778
798
|
return this.entries.get(path2)?.directory === false;
|
|
779
799
|
}
|
|
780
800
|
paths() {
|
|
@@ -782,6 +802,7 @@ var VisioPackage = class _VisioPackage {
|
|
|
782
802
|
}
|
|
783
803
|
async readXml(path2, expectedRoot) {
|
|
784
804
|
this.check();
|
|
805
|
+
this.noted?.add(path2);
|
|
785
806
|
safePath(path2);
|
|
786
807
|
let pending2 = this.cache.get(path2);
|
|
787
808
|
if (!pending2) {
|
|
@@ -797,6 +818,7 @@ var VisioPackage = class _VisioPackage {
|
|
|
797
818
|
/** Validated declared size, so resource-specific limits can reject before inflation. */
|
|
798
819
|
getPartByteLength(path2) {
|
|
799
820
|
this.check();
|
|
821
|
+
this.noted?.add(path2);
|
|
800
822
|
safePath(path2);
|
|
801
823
|
const entry3 = this.entries.get(path2);
|
|
802
824
|
if (!entry3 || entry3.directory) fail("MISSING_PART", `Missing package part: ${path2}`);
|
|
@@ -805,6 +827,7 @@ var VisioPackage = class _VisioPackage {
|
|
|
805
827
|
/** Shared package-owned bytes. Treat the returned buffer as immutable. */
|
|
806
828
|
async readBytes(path2) {
|
|
807
829
|
this.check();
|
|
830
|
+
this.noted?.add(path2);
|
|
808
831
|
safePath(path2);
|
|
809
832
|
let pending2 = this.byteCache.get(path2);
|
|
810
833
|
if (!pending2) {
|
|
@@ -898,6 +921,10 @@ var VisioPackage = class _VisioPackage {
|
|
|
898
921
|
}
|
|
899
922
|
async relationships(sourcePart) {
|
|
900
923
|
this.check();
|
|
924
|
+
if (this.noted && sourcePart) {
|
|
925
|
+
const slash = sourcePart.lastIndexOf("/");
|
|
926
|
+
this.noted.add(`${sourcePart.slice(0, slash + 1)}_rels/${sourcePart.slice(slash + 1)}.rels`);
|
|
927
|
+
} else this.noted?.add("_rels/.rels");
|
|
901
928
|
let pending2 = this.relationshipCache.get(sourcePart);
|
|
902
929
|
if (!pending2) {
|
|
903
930
|
pending2 = this.loadRelationships(sourcePart);
|
|
@@ -931,6 +958,7 @@ var VisioPackage = class _VisioPackage {
|
|
|
931
958
|
const actual = mode === "Internal" ? this.decodedNames.get(resolved) : void 0;
|
|
932
959
|
if (mode === "Internal" && !actual)
|
|
933
960
|
fail("INVALID_RELATIONSHIP", `Missing relationship target: ${resolved}`);
|
|
961
|
+
if (actual) this.noted?.add(actual);
|
|
934
962
|
result2.set(id3, { id: id3, type, target: actual ?? resolved, mode });
|
|
935
963
|
}
|
|
936
964
|
return result2;
|
|
@@ -22204,6 +22232,10 @@ function createLayerBudget() {
|
|
|
22204
22232
|
memberships += count;
|
|
22205
22233
|
if (memberships > 1e5)
|
|
22206
22234
|
throw new VisioPackageError("METADATA_LIMIT", "Layer membership budget exceeded.");
|
|
22235
|
+
},
|
|
22236
|
+
state: () => [memberships, characters],
|
|
22237
|
+
restore(state) {
|
|
22238
|
+
[memberships, characters] = state;
|
|
22207
22239
|
}
|
|
22208
22240
|
};
|
|
22209
22241
|
}
|
|
@@ -22275,97 +22307,6 @@ function shapeLayers(sheet, layers, report, budget = createLayerBudget()) {
|
|
|
22275
22307
|
};
|
|
22276
22308
|
}
|
|
22277
22309
|
|
|
22278
|
-
// visio/theme.ts
|
|
22279
|
-
var VISIO_SCHEME_SLOTS = [
|
|
22280
|
-
"dk1",
|
|
22281
|
-
"lt1",
|
|
22282
|
-
"accent1",
|
|
22283
|
-
"accent2",
|
|
22284
|
-
"accent3",
|
|
22285
|
-
"accent4",
|
|
22286
|
-
"accent5",
|
|
22287
|
-
"accent6"
|
|
22288
|
-
];
|
|
22289
|
-
var componentId = (node3) => integer3(themeChild(node3, "schemeID", THEME_NS)?.getAttribute("schemeEnum"));
|
|
22290
|
-
async function loadVisioThemes(pkg, source, report) {
|
|
22291
|
-
const result2 = [];
|
|
22292
|
-
for (const rel of (await pkg.relationships(source)).values()) {
|
|
22293
|
-
if (rel.type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" || rel.mode === "External")
|
|
22294
|
-
continue;
|
|
22295
|
-
const root2 = await pkg.readXml(rel.target, "theme");
|
|
22296
|
-
if (root2.namespaceURI !== DRAWING_NS) {
|
|
22297
|
-
report("unsupported-theme", "A theme uses an unsupported XML namespace.", {
|
|
22298
|
-
part: rel.target
|
|
22299
|
-
});
|
|
22300
|
-
continue;
|
|
22301
|
-
}
|
|
22302
|
-
const base2 = themeChild(root2, "themeElements");
|
|
22303
|
-
const palette = themeChild(base2, "clrScheme");
|
|
22304
|
-
const scheme = parseTheme(root2).colorScheme.colors;
|
|
22305
|
-
const colors = /* @__PURE__ */ new Map();
|
|
22306
|
-
for (const name4 of VISIO_SCHEME_SLOTS) {
|
|
22307
|
-
const color2 = scheme[name4];
|
|
22308
|
-
if (color2 && parsedColorChoice(themeChild(palette, name4))) colors.set(name4, color2);
|
|
22309
|
-
}
|
|
22310
|
-
const background2 = parsedColorChoice(extension(palette, "bkgnd"));
|
|
22311
|
-
if (background2) colors.set("bkgnd", background2);
|
|
22312
|
-
const variants = themeChildren(
|
|
22313
|
-
extension(palette, "variationClrSchemeLst"),
|
|
22314
|
-
"variationClrScheme",
|
|
22315
|
-
THEME_NS
|
|
22316
|
-
).slice(0, 4).map((variant) => {
|
|
22317
|
-
const entries = /* @__PURE__ */ new Map();
|
|
22318
|
-
for (let index2 = 1; index2 <= 7; index2++) {
|
|
22319
|
-
const choice2 = parsedColorChoice(themeChild(variant, `varColor${index2}`, THEME_NS));
|
|
22320
|
-
if (choice2) entries.set(String(index2), choice2);
|
|
22321
|
-
}
|
|
22322
|
-
return entries;
|
|
22323
|
-
});
|
|
22324
|
-
const format5 = themeChild(base2, "fmtScheme");
|
|
22325
|
-
const connector2 = extension(base2, "fmtConnectorScheme");
|
|
22326
|
-
const fonts = extension(base2, "fontStylesGroup");
|
|
22327
|
-
const name3 = root2.getAttribute("name");
|
|
22328
|
-
result2.push({
|
|
22329
|
-
...name3 ? { name: name3.slice(0, 256) } : {},
|
|
22330
|
-
colorId: integer3(extension(palette, "schemeID")?.getAttribute("schemeEnum")),
|
|
22331
|
-
effectId: componentId(extension(base2, "fmtSchemeEx")),
|
|
22332
|
-
connectorId: componentId(extension(base2, "fmtConnectorSchemeEx")),
|
|
22333
|
-
colors,
|
|
22334
|
-
variants,
|
|
22335
|
-
variationStyles: themeChildren(
|
|
22336
|
-
extension(base2, "variationStyleSchemeLst"),
|
|
22337
|
-
"variationStyleScheme",
|
|
22338
|
-
THEME_NS
|
|
22339
|
-
).slice(0, 4).map((variant) => themeChildren(variant, "varStyle", THEME_NS).slice(0, 4)),
|
|
22340
|
-
fills: formatList(format5, "fillStyleLst"),
|
|
22341
|
-
effects: themeChildren(themeChild(format5, "effectStyleLst"), "effectStyle").slice(0, 6),
|
|
22342
|
-
lines: themeChildren(themeChild(format5, "lnStyleLst"), "ln").slice(0, 6),
|
|
22343
|
-
fonts: themeChildren(themeChild(fonts, "fontStyles", THEME_NS), "fontProps", THEME_NS).slice(
|
|
22344
|
-
0,
|
|
22345
|
-
6
|
|
22346
|
-
),
|
|
22347
|
-
connectorFills: formatList(connector2, "fillStyleLst"),
|
|
22348
|
-
connectorEffects: themeChildren(themeChild(connector2, "effectStyleLst"), "effectStyle").slice(
|
|
22349
|
-
0,
|
|
22350
|
-
6
|
|
22351
|
-
),
|
|
22352
|
-
connectorLines: themeChildren(themeChild(connector2, "lnStyleLst"), "ln").slice(0, 6),
|
|
22353
|
-
connectorFonts: themeChildren(
|
|
22354
|
-
themeChild(fonts, "connectorFontStyles", THEME_NS),
|
|
22355
|
-
"fontProps",
|
|
22356
|
-
THEME_NS
|
|
22357
|
-
).slice(0, 6)
|
|
22358
|
-
});
|
|
22359
|
-
}
|
|
22360
|
-
return result2;
|
|
22361
|
-
}
|
|
22362
|
-
function formatList(parent, name3) {
|
|
22363
|
-
const list2 = themeChild(parent, name3);
|
|
22364
|
-
return list2 ? Array.from(list2.childNodes).filter(
|
|
22365
|
-
(node3) => node3.nodeType === 1 && node3.namespaceURI === DRAWING_NS
|
|
22366
|
-
).slice(0, 6) : [];
|
|
22367
|
-
}
|
|
22368
|
-
|
|
22369
22310
|
// visio/theme-builtins.ts
|
|
22370
22311
|
var VISIO_BUILT_IN_THEME_IDS = [
|
|
22371
22312
|
"office",
|
|
@@ -22529,125 +22470,469 @@ function diagnosticCollector(maxCount) {
|
|
|
22529
22470
|
};
|
|
22530
22471
|
}
|
|
22531
22472
|
|
|
22532
|
-
// visio/
|
|
22533
|
-
var
|
|
22534
|
-
|
|
22535
|
-
|
|
22536
|
-
|
|
22537
|
-
|
|
22538
|
-
|
|
22539
|
-
|
|
22540
|
-
|
|
22541
|
-
|
|
22542
|
-
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
|
|
22546
|
-
|
|
22547
|
-
|
|
22548
|
-
|
|
22549
|
-
|
|
22550
|
-
|
|
22551
|
-
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22473
|
+
// visio/print-settings.ts
|
|
22474
|
+
var NAMES = [
|
|
22475
|
+
"PaperKind",
|
|
22476
|
+
"PrintPageOrientation",
|
|
22477
|
+
"PageLeftMargin",
|
|
22478
|
+
"PageRightMargin",
|
|
22479
|
+
"PageTopMargin",
|
|
22480
|
+
"PageBottomMargin",
|
|
22481
|
+
"ScaleX",
|
|
22482
|
+
"ScaleY",
|
|
22483
|
+
"OnPage",
|
|
22484
|
+
"PagesX",
|
|
22485
|
+
"PagesY",
|
|
22486
|
+
"CenterX",
|
|
22487
|
+
"CenterY"
|
|
22488
|
+
];
|
|
22489
|
+
var BOOLEAN = /* @__PURE__ */ new Set(["OnPage", "CenterX", "CenterY"]);
|
|
22490
|
+
var LENGTH = /* @__PURE__ */ new Set(["PageLeftMargin", "PageRightMargin", "PageTopMargin", "PageBottomMargin"]);
|
|
22491
|
+
var CANONICAL = new Map(
|
|
22492
|
+
[...NAMES, "PageWidth", "PageHeight", "PageScale", "DrawingScale"].map((name3) => [
|
|
22493
|
+
name3.toLowerCase(),
|
|
22494
|
+
name3
|
|
22495
|
+
])
|
|
22496
|
+
);
|
|
22497
|
+
function indexCells2(sheet) {
|
|
22498
|
+
const cells4 = /* @__PURE__ */ new Map();
|
|
22499
|
+
let duplicate = false;
|
|
22500
|
+
for (const node3 of children2(sheet, "Cell")) {
|
|
22501
|
+
const name3 = attribute2(node3, "N") ?? "", canonical2 = CANONICAL.get(name3.toLowerCase());
|
|
22502
|
+
if (!canonical2) continue;
|
|
22503
|
+
if (canonical2 !== name3) duplicate = true;
|
|
22504
|
+
const values = cells4.get(canonical2) ?? [];
|
|
22505
|
+
if (values.length < 2) values.push(node3);
|
|
22506
|
+
cells4.set(canonical2, values);
|
|
22507
|
+
if (values.length > 1) duplicate = true;
|
|
22561
22508
|
}
|
|
22562
|
-
|
|
22563
|
-
const ids = /* @__PURE__ */ new Set();
|
|
22564
|
-
let characters = 0;
|
|
22565
|
-
entries.slice(0, VISIO_COMMENT_LIMIT).forEach((entry3, index2) => {
|
|
22566
|
-
const pageId2 = unsigned(attribute2(entry3, "PageID"));
|
|
22567
|
-
const id3 = visioCommentId(entry3, index2);
|
|
22568
|
-
const text6 = entry3.textContent ?? "";
|
|
22569
|
-
characters += text6.length;
|
|
22570
|
-
if (pageId2 === void 0 || ids.has(id3) || characters > 1e6) {
|
|
22571
|
-
report(
|
|
22572
|
-
"invalid-comment",
|
|
22573
|
-
"A comment without a page, with a repeated ID or over the text budget was omitted.",
|
|
22574
|
-
{
|
|
22575
|
-
part: path2
|
|
22576
|
-
}
|
|
22577
|
-
);
|
|
22578
|
-
return;
|
|
22579
|
-
}
|
|
22580
|
-
ids.add(id3);
|
|
22581
|
-
const shapeId2 = unsigned(attribute2(entry3, "ShapeID"));
|
|
22582
|
-
const author = authors.get(attribute2(entry3, "AuthorID") ?? "");
|
|
22583
|
-
const date2 = attribute2(entry3, "Date");
|
|
22584
|
-
const editDate = attribute2(entry3, "EditDate");
|
|
22585
|
-
comments.push({
|
|
22586
|
-
id: id3,
|
|
22587
|
-
pageId: pageId2,
|
|
22588
|
-
...shapeId2 && shapeId2 !== "0" ? { shapeId: shapeId2 } : {},
|
|
22589
|
-
author: author?.name ?? "",
|
|
22590
|
-
...author?.initials ? { initials: author.initials } : {},
|
|
22591
|
-
...date2 ? { date: date2.slice(0, 64) } : {},
|
|
22592
|
-
...editDate ? { editDate: editDate.slice(0, 64) } : {},
|
|
22593
|
-
text: text6.slice(0, VISIO_COMMENT_TEXT_LIMIT),
|
|
22594
|
-
...yes(attribute2(entry3, "Done")) ? { done: true } : {}
|
|
22595
|
-
});
|
|
22596
|
-
});
|
|
22597
|
-
return comments;
|
|
22509
|
+
return { cells: cells4, duplicate };
|
|
22598
22510
|
}
|
|
22599
|
-
function
|
|
22600
|
-
|
|
22601
|
-
|
|
22602
|
-
if (!text6) return [];
|
|
22603
|
-
return [
|
|
22604
|
-
{
|
|
22605
|
-
id: `a${pageId2}-${index2}`,
|
|
22606
|
-
pageId: pageId2,
|
|
22607
|
-
author: "",
|
|
22608
|
-
text: text6.slice(0, VISIO_COMMENT_TEXT_LIMIT),
|
|
22609
|
-
legacy: true
|
|
22610
|
-
}
|
|
22611
|
-
];
|
|
22612
|
-
});
|
|
22511
|
+
function createVisioPrintSettingsReader(documentSheets, rootStyles) {
|
|
22512
|
+
const indexes = { document: indexCells2(documentSheets[0]), root: indexCells2(rootStyles[0]) };
|
|
22513
|
+
return (pageSheets) => readVisioPrintCountSettings(pageSheets, documentSheets, rootStyles, indexes);
|
|
22613
22514
|
}
|
|
22614
|
-
|
|
22615
|
-
|
|
22616
|
-
|
|
22617
|
-
|
|
22618
|
-
if (![maxRows, maxCharacters].every((v) => Number.isSafeInteger(v) && v > 0))
|
|
22619
|
-
throw new VisioPackageError("INVALID_LIMIT", "Metadata limits must be positive safe integers.");
|
|
22620
|
-
let rows = 0, characters = 0;
|
|
22621
|
-
return {
|
|
22622
|
-
consumeRow() {
|
|
22623
|
-
if (++rows > maxRows)
|
|
22624
|
-
throw new VisioPackageError("METADATA_LIMIT", "Shape metadata row budget exceeded.");
|
|
22625
|
-
},
|
|
22626
|
-
retain(value3) {
|
|
22627
|
-
metadata(value3, 8192, "Shape metadata string");
|
|
22628
|
-
characters += value3.length;
|
|
22629
|
-
if (characters > maxCharacters)
|
|
22630
|
-
throw new VisioPackageError("METADATA_LIMIT", "Shape metadata character budget exceeded.");
|
|
22631
|
-
return value3;
|
|
22632
|
-
}
|
|
22515
|
+
function readVisioPrintCountSettings(pageSheets, documentSheets, rootStyles, indexes) {
|
|
22516
|
+
let refusal;
|
|
22517
|
+
const refuse4 = (reason) => {
|
|
22518
|
+
refusal ??= reason;
|
|
22633
22519
|
};
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
"
|
|
22637
|
-
"
|
|
22638
|
-
|
|
22639
|
-
"
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
22643
|
-
|
|
22644
|
-
]
|
|
22645
|
-
|
|
22646
|
-
|
|
22647
|
-
|
|
22648
|
-
|
|
22649
|
-
|
|
22650
|
-
|
|
22520
|
+
if (pageSheets.length !== 1) refuse4("ambiguous-page-sheet");
|
|
22521
|
+
if (documentSheets.length > 1) refuse4("ambiguous-document-sheet");
|
|
22522
|
+
if (!documentSheets.length) refuse4("missing-setting");
|
|
22523
|
+
if (rootStyles.length > 1) refuse4("duplicate-setting");
|
|
22524
|
+
const root2 = rootStyles[0];
|
|
22525
|
+
if (!root2 || attribute2(root2, "ID") !== "0" || attribute2(root2, "NameU") !== "No Style")
|
|
22526
|
+
refuse4("unsupported-print-style");
|
|
22527
|
+
for (const sheet of [...pageSheets, ...documentSheets])
|
|
22528
|
+
for (const name3 of ["LineStyle", "FillStyle", "TextStyle"])
|
|
22529
|
+
if (attribute2(sheet, name3) !== "0") refuse4("unsupported-print-style");
|
|
22530
|
+
for (const name3 of ["LineStyle", "FillStyle", "TextStyle"])
|
|
22531
|
+
if (attribute2(root2, name3) !== void 0) refuse4("unsupported-print-style");
|
|
22532
|
+
const localIndex = indexCells2(pageSheets[0]), rootIndex = indexes?.root ?? indexCells2(root2);
|
|
22533
|
+
const documentIndex = indexes?.document ?? indexCells2(documentSheets[0]);
|
|
22534
|
+
if (localIndex.duplicate || rootIndex.duplicate || documentIndex.duplicate)
|
|
22535
|
+
refuse4("duplicate-setting");
|
|
22536
|
+
const local = localIndex.cells, inherited = rootIndex.cells;
|
|
22537
|
+
const read = (node3, name3, origin) => {
|
|
22538
|
+
const invalid4 = () => {
|
|
22539
|
+
refuse4(origin === "local" ? "invalid-local-setting" : "invalid-document-setting");
|
|
22540
|
+
return void 0;
|
|
22541
|
+
};
|
|
22542
|
+
if (node3.hasAttribute("E")) return invalid4();
|
|
22543
|
+
let raw = (attribute2(node3, "V") ?? "").trim();
|
|
22544
|
+
if (!raw || raw.length > 128) return invalid4();
|
|
22545
|
+
if (BOOLEAN.has(name3)) {
|
|
22546
|
+
if (!["0", "1", "false", "true"].includes(raw)) return invalid4();
|
|
22547
|
+
raw = raw === "true" ? "1" : raw === "false" ? "0" : raw;
|
|
22548
|
+
}
|
|
22549
|
+
try {
|
|
22550
|
+
const value3 = visioFormulaCachedValue(raw, attribute2(node3, "U"));
|
|
22551
|
+
const length = LENGTH.has(name3) || /^(PageWidth|PageHeight|PageScale|DrawingScale)$/.test(name3);
|
|
22552
|
+
if (!["scalar", ...length ? ["length"] : []].includes(value3.unit) || Math.abs(value3.value) > 1e9)
|
|
22553
|
+
return invalid4();
|
|
22554
|
+
const formula = attribute2(node3, "F");
|
|
22555
|
+
if (formula !== void 0) {
|
|
22556
|
+
const source = formula.trim();
|
|
22557
|
+
if (/^(true|false)$/i.test(source)) {
|
|
22558
|
+
if ((source.toLowerCase() === "true" ? 1 : 0) !== value3.value) return invalid4();
|
|
22559
|
+
} else {
|
|
22560
|
+
if (!source || source === "Inh") return invalid4();
|
|
22561
|
+
const limits = { maxLength: 512, maxNodes: 64, maxDepth: 16, maxSteps: 128 };
|
|
22562
|
+
const analysis = analyzeVisioFormula(source, limits);
|
|
22563
|
+
if (analysis.dynamic || analysis.guarded || analysis.references.length || analysis.unsupportedFunctions.length) {
|
|
22564
|
+
refuse4("dynamic-setting");
|
|
22565
|
+
return void 0;
|
|
22566
|
+
}
|
|
22567
|
+
const evaluated = evaluateVisioFormula(
|
|
22568
|
+
source,
|
|
22569
|
+
() => {
|
|
22570
|
+
throw new Error("Unexpected reference");
|
|
22571
|
+
},
|
|
22572
|
+
limits
|
|
22573
|
+
);
|
|
22574
|
+
if (evaluated.value !== value3.value || !["scalar", ...length ? ["length"] : []].includes(evaluated.unit))
|
|
22575
|
+
return invalid4();
|
|
22576
|
+
}
|
|
22577
|
+
}
|
|
22578
|
+
return value3.value;
|
|
22579
|
+
} catch {
|
|
22580
|
+
return invalid4();
|
|
22581
|
+
}
|
|
22582
|
+
};
|
|
22583
|
+
const values = /* @__PURE__ */ new Map();
|
|
22584
|
+
for (const name3 of NAMES) {
|
|
22585
|
+
const nodes = local.get(name3) ?? inherited.get(name3);
|
|
22586
|
+
if (!nodes?.length) continue;
|
|
22587
|
+
if (nodes.length !== 1) continue;
|
|
22588
|
+
const value3 = read(nodes[0], name3, local.has(name3) ? "local" : "document");
|
|
22589
|
+
if (value3 !== void 0) values.set(name3, value3);
|
|
22590
|
+
}
|
|
22591
|
+
for (const name3 of ["PageWidth", "PageHeight", "PageScale", "DrawingScale"]) {
|
|
22592
|
+
const nodes = local.get(name3);
|
|
22593
|
+
if (!nodes || nodes.length !== 1 || !(read(nodes[0], name3, "local") > 0))
|
|
22594
|
+
refuse4("unusable-drawing-scale");
|
|
22595
|
+
}
|
|
22596
|
+
const setup = {};
|
|
22597
|
+
const paper = values.get("PaperKind");
|
|
22598
|
+
if (paper !== void 0 && Number.isSafeInteger(paper) && paper >= 0 && paper <= 65535)
|
|
22599
|
+
setup.paperKind = paper;
|
|
22600
|
+
else if (paper !== void 0)
|
|
22601
|
+
refuse4(local.has("PaperKind") ? "invalid-local-setting" : "invalid-document-setting");
|
|
22602
|
+
const orientation = values.get("PrintPageOrientation");
|
|
22603
|
+
if (orientation === 0 || orientation === 1 || orientation === 2)
|
|
22604
|
+
setup.printPageOrientation = orientation;
|
|
22605
|
+
else if (orientation !== void 0)
|
|
22606
|
+
refuse4(
|
|
22607
|
+
local.has("PrintPageOrientation") ? "invalid-local-setting" : "invalid-document-setting"
|
|
22608
|
+
);
|
|
22609
|
+
const margins = ["Left", "Right", "Top", "Bottom"].map((side2) => values.get(`Page${side2}Margin`));
|
|
22610
|
+
if (margins.every((n) => n !== void 0 && n >= 0 && n <= 1e3))
|
|
22611
|
+
setup.margins = {
|
|
22612
|
+
left: margins[0],
|
|
22613
|
+
right: margins[1],
|
|
22614
|
+
top: margins[2],
|
|
22615
|
+
bottom: margins[3]
|
|
22616
|
+
};
|
|
22617
|
+
else if (margins.some((n) => n !== void 0 && (n < 0 || n > 1e3)))
|
|
22618
|
+
refuse4("unusable-print-area");
|
|
22619
|
+
for (const [name3, key2] of [
|
|
22620
|
+
["ScaleX", "printZoom"],
|
|
22621
|
+
["ScaleY", "printZoomY"],
|
|
22622
|
+
["PagesX", "printPagesAcross"],
|
|
22623
|
+
["PagesY", "printPagesDown"]
|
|
22624
|
+
]) {
|
|
22625
|
+
const value3 = values.get(name3);
|
|
22626
|
+
if (value3 !== void 0) {
|
|
22627
|
+
if ((name3 === "PagesX" || name3 === "PagesY") && (!Number.isSafeInteger(value3) || value3 < 1))
|
|
22628
|
+
refuse4(local.has(name3) ? "invalid-local-setting" : "invalid-document-setting");
|
|
22629
|
+
else setup[key2] = value3;
|
|
22630
|
+
}
|
|
22631
|
+
}
|
|
22632
|
+
for (const [name3, key2] of [
|
|
22633
|
+
["OnPage", "printFitToPages"],
|
|
22634
|
+
["CenterX", "printCenterX"],
|
|
22635
|
+
["CenterY", "printCenterY"]
|
|
22636
|
+
]) {
|
|
22637
|
+
const value3 = values.get(name3);
|
|
22638
|
+
if (value3 !== void 0) setup[key2] = value3 === 1;
|
|
22639
|
+
}
|
|
22640
|
+
if (refusal) setup.printCountRefusal = refusal;
|
|
22641
|
+
return setup;
|
|
22642
|
+
}
|
|
22643
|
+
|
|
22644
|
+
// visio/theme.ts
|
|
22645
|
+
var VISIO_SCHEME_SLOTS = [
|
|
22646
|
+
"dk1",
|
|
22647
|
+
"lt1",
|
|
22648
|
+
"accent1",
|
|
22649
|
+
"accent2",
|
|
22650
|
+
"accent3",
|
|
22651
|
+
"accent4",
|
|
22652
|
+
"accent5",
|
|
22653
|
+
"accent6"
|
|
22654
|
+
];
|
|
22655
|
+
var componentId = (node3) => integer3(themeChild(node3, "schemeID", THEME_NS)?.getAttribute("schemeEnum"));
|
|
22656
|
+
async function loadVisioThemes(pkg, source, report) {
|
|
22657
|
+
const result2 = [];
|
|
22658
|
+
for (const rel of (await pkg.relationships(source)).values()) {
|
|
22659
|
+
if (rel.type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" || rel.mode === "External")
|
|
22660
|
+
continue;
|
|
22661
|
+
const root2 = await pkg.readXml(rel.target, "theme");
|
|
22662
|
+
if (root2.namespaceURI !== DRAWING_NS) {
|
|
22663
|
+
report("unsupported-theme", "A theme uses an unsupported XML namespace.", {
|
|
22664
|
+
part: rel.target
|
|
22665
|
+
});
|
|
22666
|
+
continue;
|
|
22667
|
+
}
|
|
22668
|
+
const base2 = themeChild(root2, "themeElements");
|
|
22669
|
+
const palette = themeChild(base2, "clrScheme");
|
|
22670
|
+
const scheme = parseTheme(root2).colorScheme.colors;
|
|
22671
|
+
const colors = /* @__PURE__ */ new Map();
|
|
22672
|
+
for (const name4 of VISIO_SCHEME_SLOTS) {
|
|
22673
|
+
const color2 = scheme[name4];
|
|
22674
|
+
if (color2 && parsedColorChoice(themeChild(palette, name4))) colors.set(name4, color2);
|
|
22675
|
+
}
|
|
22676
|
+
const background2 = parsedColorChoice(extension(palette, "bkgnd"));
|
|
22677
|
+
if (background2) colors.set("bkgnd", background2);
|
|
22678
|
+
const variants = themeChildren(
|
|
22679
|
+
extension(palette, "variationClrSchemeLst"),
|
|
22680
|
+
"variationClrScheme",
|
|
22681
|
+
THEME_NS
|
|
22682
|
+
).slice(0, 4).map((variant) => {
|
|
22683
|
+
const entries = /* @__PURE__ */ new Map();
|
|
22684
|
+
for (let index2 = 1; index2 <= 7; index2++) {
|
|
22685
|
+
const choice2 = parsedColorChoice(themeChild(variant, `varColor${index2}`, THEME_NS));
|
|
22686
|
+
if (choice2) entries.set(String(index2), choice2);
|
|
22687
|
+
}
|
|
22688
|
+
return entries;
|
|
22689
|
+
});
|
|
22690
|
+
const format5 = themeChild(base2, "fmtScheme");
|
|
22691
|
+
const connector2 = extension(base2, "fmtConnectorScheme");
|
|
22692
|
+
const fonts = extension(base2, "fontStylesGroup");
|
|
22693
|
+
const name3 = root2.getAttribute("name");
|
|
22694
|
+
result2.push({
|
|
22695
|
+
...name3 ? { name: name3.slice(0, 256) } : {},
|
|
22696
|
+
colorId: integer3(extension(palette, "schemeID")?.getAttribute("schemeEnum")),
|
|
22697
|
+
effectId: componentId(extension(base2, "fmtSchemeEx")),
|
|
22698
|
+
connectorId: componentId(extension(base2, "fmtConnectorSchemeEx")),
|
|
22699
|
+
colors,
|
|
22700
|
+
variants,
|
|
22701
|
+
variationStyles: themeChildren(
|
|
22702
|
+
extension(base2, "variationStyleSchemeLst"),
|
|
22703
|
+
"variationStyleScheme",
|
|
22704
|
+
THEME_NS
|
|
22705
|
+
).slice(0, 4).map((variant) => themeChildren(variant, "varStyle", THEME_NS).slice(0, 4)),
|
|
22706
|
+
fills: formatList(format5, "fillStyleLst"),
|
|
22707
|
+
effects: themeChildren(themeChild(format5, "effectStyleLst"), "effectStyle").slice(0, 6),
|
|
22708
|
+
lines: themeChildren(themeChild(format5, "lnStyleLst"), "ln").slice(0, 6),
|
|
22709
|
+
fonts: themeChildren(themeChild(fonts, "fontStyles", THEME_NS), "fontProps", THEME_NS).slice(
|
|
22710
|
+
0,
|
|
22711
|
+
6
|
|
22712
|
+
),
|
|
22713
|
+
connectorFills: formatList(connector2, "fillStyleLst"),
|
|
22714
|
+
connectorEffects: themeChildren(themeChild(connector2, "effectStyleLst"), "effectStyle").slice(
|
|
22715
|
+
0,
|
|
22716
|
+
6
|
|
22717
|
+
),
|
|
22718
|
+
connectorLines: themeChildren(themeChild(connector2, "lnStyleLst"), "ln").slice(0, 6),
|
|
22719
|
+
connectorFonts: themeChildren(
|
|
22720
|
+
themeChild(fonts, "connectorFontStyles", THEME_NS),
|
|
22721
|
+
"fontProps",
|
|
22722
|
+
THEME_NS
|
|
22723
|
+
).slice(0, 6)
|
|
22724
|
+
});
|
|
22725
|
+
}
|
|
22726
|
+
return result2;
|
|
22727
|
+
}
|
|
22728
|
+
function formatList(parent, name3) {
|
|
22729
|
+
const list2 = themeChild(parent, name3);
|
|
22730
|
+
return list2 ? Array.from(list2.childNodes).filter(
|
|
22731
|
+
(node3) => node3.nodeType === 1 && node3.namespaceURI === DRAWING_NS
|
|
22732
|
+
).slice(0, 6) : [];
|
|
22733
|
+
}
|
|
22734
|
+
|
|
22735
|
+
// visio/document-level.ts
|
|
22736
|
+
function optionsKey(options2) {
|
|
22737
|
+
const { metafileConverter: _converter, pages: _pages, documentCache: _cache, ...rest } = options2;
|
|
22738
|
+
return JSON.stringify(rest);
|
|
22739
|
+
}
|
|
22740
|
+
var cacheMatches = (entry3, pkg, options2) => entry3 !== void 0 && entry3.options === optionsKey(options2) && entry3.converter === options2.metafileConverter && entry3.reads.every(([path2, print]) => pkg.printOf(path2) === print);
|
|
22741
|
+
async function readDocumentLevel(pkg, documentPart2, options2, checkTime, forward) {
|
|
22742
|
+
const reports = [];
|
|
22743
|
+
const report = (...args) => {
|
|
22744
|
+
reports.push(args);
|
|
22745
|
+
forward(...args);
|
|
22746
|
+
};
|
|
22747
|
+
const documentRoot = await visioXml(pkg, documentPart2, "VisioDocument");
|
|
22748
|
+
const resources = {
|
|
22749
|
+
colors: /* @__PURE__ */ new Map(),
|
|
22750
|
+
fonts: /* @__PURE__ */ new Map(),
|
|
22751
|
+
themes: await loadVisioThemes(pkg, documentPart2, report)
|
|
22752
|
+
};
|
|
22753
|
+
for (const color2 of children2(child(documentRoot, "Colors"), "ColorEntry"))
|
|
22754
|
+
resources.colors.set(attribute2(color2, "IX") ?? "", attribute2(color2, "RGB") ?? "");
|
|
22755
|
+
const faceNames = children2(child(documentRoot, "FaceNames"), "FaceName");
|
|
22756
|
+
if (faceNames.length > 1e4)
|
|
22757
|
+
throw new VisioPackageError(
|
|
22758
|
+
"METADATA_LIMIT",
|
|
22759
|
+
"Document font count exceeds its metadata limit."
|
|
22760
|
+
);
|
|
22761
|
+
let fontCharacters = 0;
|
|
22762
|
+
faceNames.forEach((font, index2) => {
|
|
22763
|
+
checkTime();
|
|
22764
|
+
fontCharacters += (attribute2(font, "Name") ?? attribute2(font, "NameU") ?? "Arial").length;
|
|
22765
|
+
if (fontCharacters > 1e6)
|
|
22766
|
+
throw new VisioPackageError(
|
|
22767
|
+
"METADATA_LIMIT",
|
|
22768
|
+
"Document fonts exceed aggregate metadata limits."
|
|
22769
|
+
);
|
|
22770
|
+
resources.fonts.set(
|
|
22771
|
+
metadata(attribute2(font, "ID") ?? String(index2), 256, "Font ID"),
|
|
22772
|
+
metadata(attribute2(font, "Name") ?? attribute2(font, "NameU") ?? "Arial", 1024, "Font name")
|
|
22773
|
+
);
|
|
22774
|
+
});
|
|
22775
|
+
const styles = /* @__PURE__ */ new Map();
|
|
22776
|
+
for (const style2 of children2(child(documentRoot, "StyleSheets"), "StyleSheet"))
|
|
22777
|
+
styles.set(metadata(attribute2(style2, "ID") ?? "", 256, "Style ID"), {
|
|
22778
|
+
sheet: readSheet(style2),
|
|
22779
|
+
attributes: metadataAttributes(style2)
|
|
22780
|
+
});
|
|
22781
|
+
const rootStyle = styles.get("0");
|
|
22782
|
+
if (rootStyle?.attributes.get("NameU") === "No Style") resources.rootSheet = rootStyle.sheet;
|
|
22783
|
+
const printStyleGroups = children2(documentRoot, "StyleSheets");
|
|
22784
|
+
const readPrintSettings = createVisioPrintSettingsReader(
|
|
22785
|
+
children2(documentRoot, "DocumentSheet"),
|
|
22786
|
+
printStyleGroups.length === 1 ? children2(printStyleGroups[0], "StyleSheet").filter((node3) => attribute2(node3, "ID") === "0") : []
|
|
22787
|
+
);
|
|
22788
|
+
const masters = /* @__PURE__ */ new Map();
|
|
22789
|
+
const masterRecords = [];
|
|
22790
|
+
const mastersPart = await related(pkg, documentPart2, "masters", false);
|
|
22791
|
+
if (mastersPart) {
|
|
22792
|
+
for (const master2 of children2(await visioXml(pkg, mastersPart, "Masters"), "Master")) {
|
|
22793
|
+
const part = await indexedPart(pkg, mastersPart, master2, "master");
|
|
22794
|
+
const id3 = metadata(attribute2(master2, "ID") ?? "", 256, "Master ID");
|
|
22795
|
+
if (!id3 || masters.has(id3))
|
|
22796
|
+
throw new VisioPackageError("INVALID_MASTER_ID", "Master IDs must be present and unique.");
|
|
22797
|
+
const masterShapes2 = readShapes(await visioXml(pkg, part, "MasterContents"));
|
|
22798
|
+
await prepareImages(
|
|
22799
|
+
masterShapes2,
|
|
22800
|
+
pkg,
|
|
22801
|
+
part,
|
|
22802
|
+
report,
|
|
22803
|
+
options2.images,
|
|
22804
|
+
options2.metafileConverter
|
|
22805
|
+
);
|
|
22806
|
+
masters.set(id3, masterShapes2);
|
|
22807
|
+
masterRecords.push({ id: id3, node: master2, shapes: masterShapes2 });
|
|
22808
|
+
}
|
|
22809
|
+
}
|
|
22810
|
+
return { documentRoot, resources, styles, readPrintSettings, masters, masterRecords, reports };
|
|
22811
|
+
}
|
|
22812
|
+
|
|
22813
|
+
// visio/comments.ts
|
|
22814
|
+
var VISIO_COMMENTS_CONTENT_TYPE = "application/vnd.ms-visio.comments+xml";
|
|
22815
|
+
var VISIO_COMMENTS_RELATIONSHIP = "http://schemas.microsoft.com/visio/2010/relationships/comments";
|
|
22816
|
+
var VISIO_COMMENT_LIMIT = 1e4;
|
|
22817
|
+
var VISIO_COMMENT_TEXT_LIMIT = 16384;
|
|
22818
|
+
var VISIO_COMMENT_AUTHOR_LIMIT = 256;
|
|
22819
|
+
var unsigned = (value3) => value3 !== void 0 && /^(0|[1-9]\d{0,9})$/.test(value3) && Number(value3) <= 4294967295 ? value3 : void 0;
|
|
22820
|
+
function visioCommentId(entry3, index2) {
|
|
22821
|
+
return unsigned(attribute2(entry3, "CommentID")) ?? `n${index2}`;
|
|
22822
|
+
}
|
|
22823
|
+
async function readVisioComments(pkg, documentPart2, report) {
|
|
22824
|
+
const path2 = await related(pkg, documentPart2, "comments", false);
|
|
22825
|
+
if (!path2) return [];
|
|
22826
|
+
const root2 = await visioXml(pkg, path2, "Comments");
|
|
22827
|
+
const authors = /* @__PURE__ */ new Map();
|
|
22828
|
+
for (const author of children2(child(root2, "AuthorList"), "AuthorEntry")) {
|
|
22829
|
+
const id3 = unsigned(attribute2(author, "ID"));
|
|
22830
|
+
if (id3 === void 0) continue;
|
|
22831
|
+
const initials = attribute2(author, "Initials");
|
|
22832
|
+
authors.set(id3, {
|
|
22833
|
+
name: (attribute2(author, "Name") ?? "").slice(0, VISIO_COMMENT_AUTHOR_LIMIT),
|
|
22834
|
+
...initials ? { initials: initials.slice(0, 64) } : {}
|
|
22835
|
+
});
|
|
22836
|
+
}
|
|
22837
|
+
const entries = children2(child(root2, "CommentList"), "CommentEntry");
|
|
22838
|
+
if (entries.length > VISIO_COMMENT_LIMIT) {
|
|
22839
|
+
report("comment-limit", `Only the first ${VISIO_COMMENT_LIMIT} comments are shown.`, {
|
|
22840
|
+
part: path2
|
|
22841
|
+
});
|
|
22842
|
+
}
|
|
22843
|
+
const comments = [];
|
|
22844
|
+
const ids = /* @__PURE__ */ new Set();
|
|
22845
|
+
let characters = 0;
|
|
22846
|
+
entries.slice(0, VISIO_COMMENT_LIMIT).forEach((entry3, index2) => {
|
|
22847
|
+
const pageId2 = unsigned(attribute2(entry3, "PageID"));
|
|
22848
|
+
const id3 = visioCommentId(entry3, index2);
|
|
22849
|
+
const text6 = entry3.textContent ?? "";
|
|
22850
|
+
characters += text6.length;
|
|
22851
|
+
if (pageId2 === void 0 || ids.has(id3) || characters > 1e6) {
|
|
22852
|
+
report(
|
|
22853
|
+
"invalid-comment",
|
|
22854
|
+
"A comment without a page, with a repeated ID or over the text budget was omitted.",
|
|
22855
|
+
{
|
|
22856
|
+
part: path2
|
|
22857
|
+
}
|
|
22858
|
+
);
|
|
22859
|
+
return;
|
|
22860
|
+
}
|
|
22861
|
+
ids.add(id3);
|
|
22862
|
+
const shapeId2 = unsigned(attribute2(entry3, "ShapeID"));
|
|
22863
|
+
const author = authors.get(attribute2(entry3, "AuthorID") ?? "");
|
|
22864
|
+
const date2 = attribute2(entry3, "Date");
|
|
22865
|
+
const editDate = attribute2(entry3, "EditDate");
|
|
22866
|
+
comments.push({
|
|
22867
|
+
id: id3,
|
|
22868
|
+
pageId: pageId2,
|
|
22869
|
+
...shapeId2 && shapeId2 !== "0" ? { shapeId: shapeId2 } : {},
|
|
22870
|
+
author: author?.name ?? "",
|
|
22871
|
+
...author?.initials ? { initials: author.initials } : {},
|
|
22872
|
+
...date2 ? { date: date2.slice(0, 64) } : {},
|
|
22873
|
+
...editDate ? { editDate: editDate.slice(0, 64) } : {},
|
|
22874
|
+
text: text6.slice(0, VISIO_COMMENT_TEXT_LIMIT),
|
|
22875
|
+
...yes(attribute2(entry3, "Done")) ? { done: true } : {}
|
|
22876
|
+
});
|
|
22877
|
+
});
|
|
22878
|
+
return comments;
|
|
22879
|
+
}
|
|
22880
|
+
function readVisioAnnotations(sheet, pageId2) {
|
|
22881
|
+
return sectionRows(sheet, "Annotation").slice(0, 1e3).flatMap((row2, index2) => {
|
|
22882
|
+
const text6 = row2.cells.get("Comment")?.value;
|
|
22883
|
+
if (!text6) return [];
|
|
22884
|
+
return [
|
|
22885
|
+
{
|
|
22886
|
+
id: `a${pageId2}-${index2}`,
|
|
22887
|
+
pageId: pageId2,
|
|
22888
|
+
author: "",
|
|
22889
|
+
text: text6.slice(0, VISIO_COMMENT_TEXT_LIMIT),
|
|
22890
|
+
legacy: true
|
|
22891
|
+
}
|
|
22892
|
+
];
|
|
22893
|
+
});
|
|
22894
|
+
}
|
|
22895
|
+
|
|
22896
|
+
// visio/shape-metadata.ts
|
|
22897
|
+
function createMetadataBudget(options2 = {}) {
|
|
22898
|
+
const maxRows = options2.maxRows ?? 1e5, maxCharacters = options2.maxCharacters ?? 5e6;
|
|
22899
|
+
if (![maxRows, maxCharacters].every((v) => Number.isSafeInteger(v) && v > 0))
|
|
22900
|
+
throw new VisioPackageError("INVALID_LIMIT", "Metadata limits must be positive safe integers.");
|
|
22901
|
+
let rows = 0, characters = 0;
|
|
22902
|
+
return {
|
|
22903
|
+
consumeRow() {
|
|
22904
|
+
if (++rows > maxRows)
|
|
22905
|
+
throw new VisioPackageError("METADATA_LIMIT", "Shape metadata row budget exceeded.");
|
|
22906
|
+
},
|
|
22907
|
+
retain(value3) {
|
|
22908
|
+
metadata(value3, 8192, "Shape metadata string");
|
|
22909
|
+
characters += value3.length;
|
|
22910
|
+
if (characters > maxCharacters)
|
|
22911
|
+
throw new VisioPackageError("METADATA_LIMIT", "Shape metadata character budget exceeded.");
|
|
22912
|
+
return value3;
|
|
22913
|
+
},
|
|
22914
|
+
state: () => [rows, characters],
|
|
22915
|
+
restore(state) {
|
|
22916
|
+
[rows, characters] = state;
|
|
22917
|
+
}
|
|
22918
|
+
};
|
|
22919
|
+
}
|
|
22920
|
+
var kinds = [
|
|
22921
|
+
"string",
|
|
22922
|
+
"fixed-list",
|
|
22923
|
+
"number",
|
|
22924
|
+
"boolean",
|
|
22925
|
+
"variable-list",
|
|
22926
|
+
"date",
|
|
22927
|
+
"duration",
|
|
22928
|
+
"currency"
|
|
22929
|
+
];
|
|
22930
|
+
var numeric3 = (text6) => {
|
|
22931
|
+
if (text6 === void 0 || text6.length > 128 || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(text6.trim()))
|
|
22932
|
+
return void 0;
|
|
22933
|
+
const value3 = Number(text6);
|
|
22934
|
+
return Number.isFinite(value3) ? value3 : void 0;
|
|
22935
|
+
};
|
|
22651
22936
|
function cached(cells4, key2, budget, report) {
|
|
22652
22937
|
const cell = cells4.get(key2);
|
|
22653
22938
|
if (!cell) return void 0;
|
|
@@ -23601,177 +23886,6 @@ function readVisioPageSetup(cells4) {
|
|
|
23601
23886
|
return Object.keys(result2).length ? result2 : void 0;
|
|
23602
23887
|
}
|
|
23603
23888
|
|
|
23604
|
-
// visio/print-settings.ts
|
|
23605
|
-
var NAMES = [
|
|
23606
|
-
"PaperKind",
|
|
23607
|
-
"PrintPageOrientation",
|
|
23608
|
-
"PageLeftMargin",
|
|
23609
|
-
"PageRightMargin",
|
|
23610
|
-
"PageTopMargin",
|
|
23611
|
-
"PageBottomMargin",
|
|
23612
|
-
"ScaleX",
|
|
23613
|
-
"ScaleY",
|
|
23614
|
-
"OnPage",
|
|
23615
|
-
"PagesX",
|
|
23616
|
-
"PagesY",
|
|
23617
|
-
"CenterX",
|
|
23618
|
-
"CenterY"
|
|
23619
|
-
];
|
|
23620
|
-
var BOOLEAN = /* @__PURE__ */ new Set(["OnPage", "CenterX", "CenterY"]);
|
|
23621
|
-
var LENGTH = /* @__PURE__ */ new Set(["PageLeftMargin", "PageRightMargin", "PageTopMargin", "PageBottomMargin"]);
|
|
23622
|
-
var CANONICAL = new Map(
|
|
23623
|
-
[...NAMES, "PageWidth", "PageHeight", "PageScale", "DrawingScale"].map((name3) => [
|
|
23624
|
-
name3.toLowerCase(),
|
|
23625
|
-
name3
|
|
23626
|
-
])
|
|
23627
|
-
);
|
|
23628
|
-
function indexCells2(sheet) {
|
|
23629
|
-
const cells4 = /* @__PURE__ */ new Map();
|
|
23630
|
-
let duplicate = false;
|
|
23631
|
-
for (const node3 of children2(sheet, "Cell")) {
|
|
23632
|
-
const name3 = attribute2(node3, "N") ?? "", canonical2 = CANONICAL.get(name3.toLowerCase());
|
|
23633
|
-
if (!canonical2) continue;
|
|
23634
|
-
if (canonical2 !== name3) duplicate = true;
|
|
23635
|
-
const values = cells4.get(canonical2) ?? [];
|
|
23636
|
-
if (values.length < 2) values.push(node3);
|
|
23637
|
-
cells4.set(canonical2, values);
|
|
23638
|
-
if (values.length > 1) duplicate = true;
|
|
23639
|
-
}
|
|
23640
|
-
return { cells: cells4, duplicate };
|
|
23641
|
-
}
|
|
23642
|
-
function createVisioPrintSettingsReader(documentSheets, rootStyles) {
|
|
23643
|
-
const indexes = { document: indexCells2(documentSheets[0]), root: indexCells2(rootStyles[0]) };
|
|
23644
|
-
return (pageSheets) => readVisioPrintCountSettings(pageSheets, documentSheets, rootStyles, indexes);
|
|
23645
|
-
}
|
|
23646
|
-
function readVisioPrintCountSettings(pageSheets, documentSheets, rootStyles, indexes) {
|
|
23647
|
-
let refusal;
|
|
23648
|
-
const refuse4 = (reason) => {
|
|
23649
|
-
refusal ??= reason;
|
|
23650
|
-
};
|
|
23651
|
-
if (pageSheets.length !== 1) refuse4("ambiguous-page-sheet");
|
|
23652
|
-
if (documentSheets.length > 1) refuse4("ambiguous-document-sheet");
|
|
23653
|
-
if (!documentSheets.length) refuse4("missing-setting");
|
|
23654
|
-
if (rootStyles.length > 1) refuse4("duplicate-setting");
|
|
23655
|
-
const root2 = rootStyles[0];
|
|
23656
|
-
if (!root2 || attribute2(root2, "ID") !== "0" || attribute2(root2, "NameU") !== "No Style")
|
|
23657
|
-
refuse4("unsupported-print-style");
|
|
23658
|
-
for (const sheet of [...pageSheets, ...documentSheets])
|
|
23659
|
-
for (const name3 of ["LineStyle", "FillStyle", "TextStyle"])
|
|
23660
|
-
if (attribute2(sheet, name3) !== "0") refuse4("unsupported-print-style");
|
|
23661
|
-
for (const name3 of ["LineStyle", "FillStyle", "TextStyle"])
|
|
23662
|
-
if (attribute2(root2, name3) !== void 0) refuse4("unsupported-print-style");
|
|
23663
|
-
const localIndex = indexCells2(pageSheets[0]), rootIndex = indexes?.root ?? indexCells2(root2);
|
|
23664
|
-
const documentIndex = indexes?.document ?? indexCells2(documentSheets[0]);
|
|
23665
|
-
if (localIndex.duplicate || rootIndex.duplicate || documentIndex.duplicate)
|
|
23666
|
-
refuse4("duplicate-setting");
|
|
23667
|
-
const local = localIndex.cells, inherited = rootIndex.cells;
|
|
23668
|
-
const read = (node3, name3, origin) => {
|
|
23669
|
-
const invalid4 = () => {
|
|
23670
|
-
refuse4(origin === "local" ? "invalid-local-setting" : "invalid-document-setting");
|
|
23671
|
-
return void 0;
|
|
23672
|
-
};
|
|
23673
|
-
if (node3.hasAttribute("E")) return invalid4();
|
|
23674
|
-
let raw = (attribute2(node3, "V") ?? "").trim();
|
|
23675
|
-
if (!raw || raw.length > 128) return invalid4();
|
|
23676
|
-
if (BOOLEAN.has(name3)) {
|
|
23677
|
-
if (!["0", "1", "false", "true"].includes(raw)) return invalid4();
|
|
23678
|
-
raw = raw === "true" ? "1" : raw === "false" ? "0" : raw;
|
|
23679
|
-
}
|
|
23680
|
-
try {
|
|
23681
|
-
const value3 = visioFormulaCachedValue(raw, attribute2(node3, "U"));
|
|
23682
|
-
const length = LENGTH.has(name3) || /^(PageWidth|PageHeight|PageScale|DrawingScale)$/.test(name3);
|
|
23683
|
-
if (!["scalar", ...length ? ["length"] : []].includes(value3.unit) || Math.abs(value3.value) > 1e9)
|
|
23684
|
-
return invalid4();
|
|
23685
|
-
const formula = attribute2(node3, "F");
|
|
23686
|
-
if (formula !== void 0) {
|
|
23687
|
-
const source = formula.trim();
|
|
23688
|
-
if (/^(true|false)$/i.test(source)) {
|
|
23689
|
-
if ((source.toLowerCase() === "true" ? 1 : 0) !== value3.value) return invalid4();
|
|
23690
|
-
} else {
|
|
23691
|
-
if (!source || source === "Inh") return invalid4();
|
|
23692
|
-
const limits = { maxLength: 512, maxNodes: 64, maxDepth: 16, maxSteps: 128 };
|
|
23693
|
-
const analysis = analyzeVisioFormula(source, limits);
|
|
23694
|
-
if (analysis.dynamic || analysis.guarded || analysis.references.length || analysis.unsupportedFunctions.length) {
|
|
23695
|
-
refuse4("dynamic-setting");
|
|
23696
|
-
return void 0;
|
|
23697
|
-
}
|
|
23698
|
-
const evaluated = evaluateVisioFormula(
|
|
23699
|
-
source,
|
|
23700
|
-
() => {
|
|
23701
|
-
throw new Error("Unexpected reference");
|
|
23702
|
-
},
|
|
23703
|
-
limits
|
|
23704
|
-
);
|
|
23705
|
-
if (evaluated.value !== value3.value || !["scalar", ...length ? ["length"] : []].includes(evaluated.unit))
|
|
23706
|
-
return invalid4();
|
|
23707
|
-
}
|
|
23708
|
-
}
|
|
23709
|
-
return value3.value;
|
|
23710
|
-
} catch {
|
|
23711
|
-
return invalid4();
|
|
23712
|
-
}
|
|
23713
|
-
};
|
|
23714
|
-
const values = /* @__PURE__ */ new Map();
|
|
23715
|
-
for (const name3 of NAMES) {
|
|
23716
|
-
const nodes = local.get(name3) ?? inherited.get(name3);
|
|
23717
|
-
if (!nodes?.length) continue;
|
|
23718
|
-
if (nodes.length !== 1) continue;
|
|
23719
|
-
const value3 = read(nodes[0], name3, local.has(name3) ? "local" : "document");
|
|
23720
|
-
if (value3 !== void 0) values.set(name3, value3);
|
|
23721
|
-
}
|
|
23722
|
-
for (const name3 of ["PageWidth", "PageHeight", "PageScale", "DrawingScale"]) {
|
|
23723
|
-
const nodes = local.get(name3);
|
|
23724
|
-
if (!nodes || nodes.length !== 1 || !(read(nodes[0], name3, "local") > 0))
|
|
23725
|
-
refuse4("unusable-drawing-scale");
|
|
23726
|
-
}
|
|
23727
|
-
const setup = {};
|
|
23728
|
-
const paper = values.get("PaperKind");
|
|
23729
|
-
if (paper !== void 0 && Number.isSafeInteger(paper) && paper >= 0 && paper <= 65535)
|
|
23730
|
-
setup.paperKind = paper;
|
|
23731
|
-
else if (paper !== void 0)
|
|
23732
|
-
refuse4(local.has("PaperKind") ? "invalid-local-setting" : "invalid-document-setting");
|
|
23733
|
-
const orientation = values.get("PrintPageOrientation");
|
|
23734
|
-
if (orientation === 0 || orientation === 1 || orientation === 2)
|
|
23735
|
-
setup.printPageOrientation = orientation;
|
|
23736
|
-
else if (orientation !== void 0)
|
|
23737
|
-
refuse4(
|
|
23738
|
-
local.has("PrintPageOrientation") ? "invalid-local-setting" : "invalid-document-setting"
|
|
23739
|
-
);
|
|
23740
|
-
const margins = ["Left", "Right", "Top", "Bottom"].map((side2) => values.get(`Page${side2}Margin`));
|
|
23741
|
-
if (margins.every((n) => n !== void 0 && n >= 0 && n <= 1e3))
|
|
23742
|
-
setup.margins = {
|
|
23743
|
-
left: margins[0],
|
|
23744
|
-
right: margins[1],
|
|
23745
|
-
top: margins[2],
|
|
23746
|
-
bottom: margins[3]
|
|
23747
|
-
};
|
|
23748
|
-
else if (margins.some((n) => n !== void 0 && (n < 0 || n > 1e3)))
|
|
23749
|
-
refuse4("unusable-print-area");
|
|
23750
|
-
for (const [name3, key2] of [
|
|
23751
|
-
["ScaleX", "printZoom"],
|
|
23752
|
-
["ScaleY", "printZoomY"],
|
|
23753
|
-
["PagesX", "printPagesAcross"],
|
|
23754
|
-
["PagesY", "printPagesDown"]
|
|
23755
|
-
]) {
|
|
23756
|
-
const value3 = values.get(name3);
|
|
23757
|
-
if (value3 !== void 0) {
|
|
23758
|
-
if ((name3 === "PagesX" || name3 === "PagesY") && (!Number.isSafeInteger(value3) || value3 < 1))
|
|
23759
|
-
refuse4(local.has(name3) ? "invalid-local-setting" : "invalid-document-setting");
|
|
23760
|
-
else setup[key2] = value3;
|
|
23761
|
-
}
|
|
23762
|
-
}
|
|
23763
|
-
for (const [name3, key2] of [
|
|
23764
|
-
["OnPage", "printFitToPages"],
|
|
23765
|
-
["CenterX", "printCenterX"],
|
|
23766
|
-
["CenterY", "printCenterY"]
|
|
23767
|
-
]) {
|
|
23768
|
-
const value3 = values.get(name3);
|
|
23769
|
-
if (value3 !== void 0) setup[key2] = value3 === 1;
|
|
23770
|
-
}
|
|
23771
|
-
if (refusal) setup.printCountRefusal = refusal;
|
|
23772
|
-
return setup;
|
|
23773
|
-
}
|
|
23774
|
-
|
|
23775
23889
|
// visio/page-layout.ts
|
|
23776
23890
|
var VISIO_GRID_DENSITIES = Object.freeze([0, 2, 4, 8]);
|
|
23777
23891
|
var VISIO_RULER_DENSITIES = Object.freeze([8, 16, 32]);
|
|
@@ -24091,69 +24205,18 @@ async function parseVsdx(input, options2 = {}) {
|
|
|
24091
24205
|
);
|
|
24092
24206
|
}
|
|
24093
24207
|
}
|
|
24094
|
-
const
|
|
24095
|
-
const
|
|
24096
|
-
|
|
24097
|
-
|
|
24098
|
-
|
|
24099
|
-
|
|
24100
|
-
|
|
24101
|
-
|
|
24102
|
-
const
|
|
24103
|
-
|
|
24104
|
-
|
|
24105
|
-
|
|
24106
|
-
"Document font count exceeds its metadata limit."
|
|
24107
|
-
);
|
|
24108
|
-
let fontCharacters = 0;
|
|
24109
|
-
faceNames.forEach((font, index2) => {
|
|
24110
|
-
checkTime();
|
|
24111
|
-
fontCharacters += (attribute2(font, "Name") ?? attribute2(font, "NameU") ?? "Arial").length;
|
|
24112
|
-
if (fontCharacters > 1e6)
|
|
24113
|
-
throw new VisioPackageError(
|
|
24114
|
-
"METADATA_LIMIT",
|
|
24115
|
-
"Document fonts exceed aggregate metadata limits."
|
|
24116
|
-
);
|
|
24117
|
-
resources.fonts.set(
|
|
24118
|
-
metadata(attribute2(font, "ID") ?? String(index2), 256, "Font ID"),
|
|
24119
|
-
metadata(attribute2(font, "Name") ?? attribute2(font, "NameU") ?? "Arial", 1024, "Font name")
|
|
24120
|
-
);
|
|
24121
|
-
});
|
|
24122
|
-
const styles = /* @__PURE__ */ new Map();
|
|
24123
|
-
for (const style2 of children2(child(documentRoot, "StyleSheets"), "StyleSheet"))
|
|
24124
|
-
styles.set(metadata(attribute2(style2, "ID") ?? "", 256, "Style ID"), {
|
|
24125
|
-
sheet: readSheet(style2),
|
|
24126
|
-
attributes: metadataAttributes(style2)
|
|
24127
|
-
});
|
|
24128
|
-
const rootStyle = styles.get("0");
|
|
24129
|
-
if (rootStyle?.attributes.get("NameU") === "No Style") resources.rootSheet = rootStyle.sheet;
|
|
24130
|
-
const printStyleGroups = children2(documentRoot, "StyleSheets");
|
|
24131
|
-
const readPrintSettings = createVisioPrintSettingsReader(
|
|
24132
|
-
children2(documentRoot, "DocumentSheet"),
|
|
24133
|
-
printStyleGroups.length === 1 ? children2(printStyleGroups[0], "StyleSheet").filter((node3) => attribute2(node3, "ID") === "0") : []
|
|
24134
|
-
);
|
|
24135
|
-
const masters = /* @__PURE__ */ new Map();
|
|
24136
|
-
const masterRecords = [];
|
|
24137
|
-
const mastersPart = await related(pkg, documentPart2, "masters", false);
|
|
24138
|
-
if (mastersPart) {
|
|
24139
|
-
for (const master2 of children2(await visioXml(pkg, mastersPart, "Masters"), "Master")) {
|
|
24140
|
-
const part = await indexedPart(pkg, mastersPart, master2, "master");
|
|
24141
|
-
const id3 = metadata(attribute2(master2, "ID") ?? "", 256, "Master ID");
|
|
24142
|
-
if (!id3 || masters.has(id3))
|
|
24143
|
-
throw new VisioPackageError("INVALID_MASTER_ID", "Master IDs must be present and unique.");
|
|
24144
|
-
const masterShapes2 = readShapes(await visioXml(pkg, part, "MasterContents"));
|
|
24145
|
-
await prepareImages(
|
|
24146
|
-
masterShapes2,
|
|
24147
|
-
pkg,
|
|
24148
|
-
part,
|
|
24149
|
-
report,
|
|
24150
|
-
options2.images,
|
|
24151
|
-
options2.metafileConverter
|
|
24152
|
-
);
|
|
24153
|
-
masters.set(id3, masterShapes2);
|
|
24154
|
-
masterRecords.push({ id: id3, node: master2, shapes: masterShapes2 });
|
|
24155
|
-
}
|
|
24156
|
-
}
|
|
24208
|
+
const cache2 = options2.documentCache;
|
|
24209
|
+
const cached5 = cacheMatches(cache2?.entry, pkg, options2) ? cache2.entry : void 0;
|
|
24210
|
+
const stopRecording = cache2 && !cached5 ? pkg.record() : void 0;
|
|
24211
|
+
let level2;
|
|
24212
|
+
if (cached5) {
|
|
24213
|
+
level2 = cached5.level;
|
|
24214
|
+
for (const args of level2.reports) report(...args);
|
|
24215
|
+
} else level2 = await readDocumentLevel(pkg, documentPart2, options2, checkTime, report);
|
|
24216
|
+
const { documentRoot, styles, readPrintSettings, masters, masterRecords } = level2;
|
|
24217
|
+
const resources = { ...level2.resources };
|
|
24218
|
+
delete resources.pageCells;
|
|
24219
|
+
delete resources.fieldContext;
|
|
24157
24220
|
let geometryCount = 0, textCount = 0, expansionCount = 0, textRuns = 0, paragraphCount = 0;
|
|
24158
24221
|
const context = {
|
|
24159
24222
|
metadataBudget: createMetadataBudget(options2.metadata),
|
|
@@ -24207,10 +24270,46 @@ async function parseVsdx(input, options2 = {}) {
|
|
|
24207
24270
|
throw new VisioPackageError("TEXT_LIMIT", "Text character limit exceeded.");
|
|
24208
24271
|
}
|
|
24209
24272
|
};
|
|
24210
|
-
|
|
24211
|
-
|
|
24212
|
-
|
|
24213
|
-
|
|
24273
|
+
let documentMasters;
|
|
24274
|
+
if (cached5) {
|
|
24275
|
+
const { counters } = cached5.listed;
|
|
24276
|
+
curveWork = counters.curveWork;
|
|
24277
|
+
geometryCount = counters.geometry;
|
|
24278
|
+
textCount = counters.text;
|
|
24279
|
+
expansionCount = counters.expansion;
|
|
24280
|
+
textRuns = counters.textRuns;
|
|
24281
|
+
paragraphCount = counters.paragraphs;
|
|
24282
|
+
context.shapeCount = counters.shapes;
|
|
24283
|
+
context.metadataBudget.restore(counters.metadata);
|
|
24284
|
+
context.layerBudget.restore(counters.layers);
|
|
24285
|
+
documentMasters = cached5.listed.documentMasters;
|
|
24286
|
+
} else {
|
|
24287
|
+
documentMasters = listVisioMasters(masterRecords, context, {
|
|
24288
|
+
metadataBudget: createMetadataBudget(options2.metadata),
|
|
24289
|
+
layerBudget: createLayerBudget()
|
|
24290
|
+
});
|
|
24291
|
+
if (cache2 && stopRecording)
|
|
24292
|
+
cache2.entry = {
|
|
24293
|
+
options: optionsKey(options2),
|
|
24294
|
+
converter: options2.metafileConverter,
|
|
24295
|
+
reads: stopRecording(),
|
|
24296
|
+
level: { ...level2, resources: { ...resources } },
|
|
24297
|
+
listed: {
|
|
24298
|
+
documentMasters,
|
|
24299
|
+
counters: {
|
|
24300
|
+
curveWork,
|
|
24301
|
+
geometry: geometryCount,
|
|
24302
|
+
text: textCount,
|
|
24303
|
+
expansion: expansionCount,
|
|
24304
|
+
textRuns,
|
|
24305
|
+
paragraphs: paragraphCount,
|
|
24306
|
+
shapes: context.shapeCount,
|
|
24307
|
+
metadata: context.metadataBudget.state(),
|
|
24308
|
+
layers: context.layerBudget.state()
|
|
24309
|
+
}
|
|
24310
|
+
}
|
|
24311
|
+
};
|
|
24312
|
+
}
|
|
24214
24313
|
const pagesPart = await related(pkg, documentPart2, "pages", !options2.stencil);
|
|
24215
24314
|
if (!pagesPart && !options2.stencil)
|
|
24216
24315
|
throw new VisioPackageError("INVALID_DOCUMENT", "Missing Visio pages part.");
|