ooxml-core 1.18.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PptxHandler-X6AO6LKJ.mjs → PptxHandler-5GBBVJCR.mjs} +2 -2
- package/dist/{PptxHandler-5X4VOWAO.mjs → PptxHandler-H43MAMTO.mjs} +1 -1
- package/dist/{PptxHandler-4AHDZDA5.cjs → PptxHandler-ZHPGBSAF.cjs} +2 -2
- package/dist/{PresentationBuilder-UY3S4YE2.mjs → PresentationBuilder-7ZSUKCX5.mjs} +1 -1
- package/dist/{PresentationBuilder-LRX55PXA.mjs → PresentationBuilder-IJW42L3R.mjs} +2 -2
- package/dist/{PresentationBuilder-MJB4LIFS.cjs → PresentationBuilder-O4H4MMWB.cjs} +4 -4
- package/dist/automation/index.cjs +535 -266
- package/dist/automation/index.mjs +535 -266
- package/dist/chart/axis-range-auto.d.ts +10 -0
- package/dist/chart/axis-range-auto.d.ts.map +1 -0
- package/dist/chart/axis-range-types.d.ts +27 -0
- package/dist/chart/axis-range-types.d.ts.map +1 -0
- package/dist/chart/axis-range.d.ts +37 -0
- package/dist/chart/axis-range.d.ts.map +1 -0
- package/dist/chart/axis-ticks.d.ts +8 -0
- package/dist/chart/axis-ticks.d.ts.map +1 -0
- package/dist/chart/index.cjs +815 -165
- package/dist/chart/index.d.ts +6 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +795 -166
- package/dist/chart/line-dash.d.ts +2 -0
- package/dist/chart/line-dash.d.ts.map +1 -0
- package/dist/chart/marker-shape.d.ts +70 -0
- package/dist/chart/marker-shape.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-axes.d.ts +9 -0
- package/dist/chart/render/chart-svg-axes.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-markers.d.ts +6 -0
- package/dist/chart/render/chart-svg-markers.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
- package/dist/chart/render/chart-view-axes.d.ts +30 -0
- package/dist/chart/render/chart-view-axes.d.ts.map +1 -0
- package/dist/chart/render/chart-view-markers.d.ts +27 -0
- package/dist/chart/render/chart-view-markers.d.ts.map +1 -0
- package/dist/chart/render/chart-view-series.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts +4 -1
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/render/index.d.ts +2 -0
- package/dist/chart/render/index.d.ts.map +1 -1
- package/dist/chart/render/summary-from-space.d.ts.map +1 -1
- package/dist/chart/render/summary.d.ts +6 -1
- package/dist/chart/render/summary.d.ts.map +1 -1
- package/dist/{chunk-7NWQUCGX.mjs → chunk-3XFPCZKB.mjs} +1 -1
- package/dist/{chunk-Z5Y53IZD.mjs → chunk-75GLSRZE.mjs} +4 -4
- package/dist/{chunk-LT7RCEHY.mjs → chunk-BIVNVDAH.mjs} +1 -1
- package/dist/{chunk-I5ZE3VLI.mjs → chunk-QBJRB6WW.mjs} +1 -1
- package/dist/{chunk-U7IDT6VT.mjs → chunk-RUZEMWDI.mjs} +1 -1
- package/dist/docx/index.cjs +695 -168
- package/dist/docx/index.mjs +695 -168
- package/dist/docx/layout/index.cjs +697 -170
- package/dist/docx/layout/index.mjs +697 -170
- package/dist/docx/ui/index.cjs +704 -177
- package/dist/docx/ui/index.mjs +704 -177
- package/dist/index.cjs +912 -262
- package/dist/index.mjs +912 -262
- package/dist/pptx/automation/index.cjs +54 -0
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/cli/index.cjs +54 -0
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +54 -0
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +71 -5
- package/dist/teams/index.mjs +71 -5
- package/dist/visio/index.cjs +483 -214
- package/dist/visio/index.mjs +483 -214
- package/dist/visio/ui/index.cjs +504 -235
- package/dist/visio/ui/index.mjs +504 -235
- package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +818 -281
- package/dist/xlsx/index.mjs +818 -281
- package/dist/xlsx/load/index.cjs +58 -5
- package/dist/xlsx/load/index.mjs +58 -5
- package/dist/xlsx/read/chart.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +835 -298
- package/dist/xlsx/ui/index.mjs +835 -298
- package/package.json +1 -1
- /package/dist/{chunk-C363NN2C.mjs → chunk-H6TNNXJK.mjs} +0 -0
- /package/dist/{chunk-R4BCOQHB.cjs → chunk-MHMVD23Y.cjs} +0 -0
package/dist/visio/index.mjs
CHANGED
|
@@ -112,11 +112,11 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
112
112
|
throw new Error(`${label} XML exceeds the nesting depth limit of ${maxDepth}`);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
function parseXml(xml,
|
|
116
|
-
const label =
|
|
115
|
+
function parseXml(xml, options2 = {}) {
|
|
116
|
+
const label = options2.label ?? "OOXML";
|
|
117
117
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
118
118
|
throw new Error(`${label} XML with DTD or entity declarations is not supported`);
|
|
119
|
-
checkXmlLimits(xml, label,
|
|
119
|
+
checkXmlLimits(xml, label, options2.limits);
|
|
120
120
|
let parseError = "";
|
|
121
121
|
let parsed;
|
|
122
122
|
try {
|
|
@@ -687,8 +687,8 @@ var VisioPackage = class _VisioPackage {
|
|
|
687
687
|
if (Date.now() >= this.deadline)
|
|
688
688
|
fail("LIMIT_RUNTIME", "Visio package processing deadline exceeded");
|
|
689
689
|
};
|
|
690
|
-
static async open(input,
|
|
691
|
-
const limits = { ...DEFAULTS, ...
|
|
690
|
+
static async open(input, options2 = {}) {
|
|
691
|
+
const limits = { ...DEFAULTS, ...options2 };
|
|
692
692
|
for (const value3 of Object.values(limits))
|
|
693
693
|
if (!Number.isFinite(value3) || value3 <= 0)
|
|
694
694
|
fail("INVALID_LIMITS", "Package limits must be finite positive numbers");
|
|
@@ -1432,10 +1432,10 @@ function jpeg(bytes, limits) {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
return invalid2("JPEG has no image terminator.");
|
|
1434
1434
|
}
|
|
1435
|
-
function inspectVisioRasterImage(bytes,
|
|
1436
|
-
if (!
|
|
1435
|
+
function inspectVisioRasterImage(bytes, options2 = {}) {
|
|
1436
|
+
if (!options2 || typeof options2 !== "object" || Array.isArray(options2))
|
|
1437
1437
|
throw new VisioImageError("invalid-limit", "Image limits must be an options object.");
|
|
1438
|
-
const limits = { ...VISIO_RASTER_IMAGE_LIMITS, ...
|
|
1438
|
+
const limits = { ...VISIO_RASTER_IMAGE_LIMITS, ...options2 };
|
|
1439
1439
|
for (const key2 of Object.keys(VISIO_RASTER_IMAGE_LIMITS)) {
|
|
1440
1440
|
const value3 = limits[key2];
|
|
1441
1441
|
if (!Number.isSafeInteger(value3) || value3 <= 0 || value3 > VISIO_RASTER_IMAGE_LIMITS[key2])
|
|
@@ -1446,10 +1446,10 @@ function inspectVisioRasterImage(bytes, options = {}) {
|
|
|
1446
1446
|
throw new VisioImageError("image-limit", "Raster image bytes exceed the configured limit.");
|
|
1447
1447
|
return inspect(bytes, limits);
|
|
1448
1448
|
}
|
|
1449
|
-
async function readVisioImage(pkg, sourcePart, foreignData, report,
|
|
1449
|
+
async function readVisioImage(pkg, sourcePart, foreignData, report, options2 = {}) {
|
|
1450
1450
|
const limits = {
|
|
1451
1451
|
...VISIO_RASTER_IMAGE_LIMITS,
|
|
1452
|
-
...
|
|
1452
|
+
...options2
|
|
1453
1453
|
};
|
|
1454
1454
|
if (Object.values(limits).some((value3) => !Number.isSafeInteger(value3) || value3 <= 0))
|
|
1455
1455
|
throw new VisioPackageError("INVALID_LIMIT", "Image limits must be positive safe integers.");
|
|
@@ -4225,9 +4225,9 @@ function cellUnit(name3, relative) {
|
|
|
4225
4225
|
return !relative && /\.[XY]\d+$/i.test(name3) ? "length" : "scalar";
|
|
4226
4226
|
}
|
|
4227
4227
|
var isBooleanLiteral = (ref) => ref.shapeId === void 0 && /^(true|false)$/i.test(ref.cell);
|
|
4228
|
-
function indexCells(roots,
|
|
4228
|
+
function indexCells(roots, options2) {
|
|
4229
4229
|
const cells4 = /* @__PURE__ */ new Map();
|
|
4230
|
-
const maxCells = bound(
|
|
4230
|
+
const maxCells = bound(options2.maxCells, 1e5);
|
|
4231
4231
|
const add = (item) => {
|
|
4232
4232
|
const id3 = key(item);
|
|
4233
4233
|
if (cells4.has(id3)) fail("EDIT_AMBIGUOUS_CELL", "Duplicate local ShapeSheet cell.");
|
|
@@ -4253,11 +4253,11 @@ function indexCells(roots, options) {
|
|
|
4253
4253
|
const visit = (parent, inherited, nested) => {
|
|
4254
4254
|
for (const container of children2(parent, "Shapes"))
|
|
4255
4255
|
for (const node3 of children2(container, "Shape")) {
|
|
4256
|
-
|
|
4256
|
+
options2.check?.();
|
|
4257
4257
|
const shapeId2 = attribute2(node3, "ID");
|
|
4258
4258
|
if (!shapeId2 || ids.has(shapeId2)) fail("INVALID_SHAPE_ID", "Shape IDs must be unique.");
|
|
4259
4259
|
ids.add(shapeId2);
|
|
4260
|
-
const unsafe2 = inherited || nested || node3.hasAttribute("Master") || node3.hasAttribute("MasterShape") || attribute2(node3, "Type") === "Group" || !isLocalForeignFrameShape(node3) && (attribute2(node3, "Type") !== void 0 && attribute2(node3, "Type") !== "Shape" || children2(node3, "ForeignData").length > 0 || children2(node3, "Rel").length > 0) || connected.has(shapeId2) && !
|
|
4260
|
+
const unsafe2 = inherited || nested || node3.hasAttribute("Master") || node3.hasAttribute("MasterShape") || attribute2(node3, "Type") === "Group" || !isLocalForeignFrameShape(node3) && (attribute2(node3, "Type") !== void 0 && attribute2(node3, "Type") !== "Shape" || children2(node3, "ForeignData").length > 0 || children2(node3, "Rel").length > 0) || connected.has(shapeId2) && !options2.glueShapes?.has(node3) || !options2.lineEditShapes?.has(node3) && children2(node3, "Cell").some(
|
|
4261
4261
|
(cell) => /^(BeginX|BeginY|EndX|EndY)$/i.test(attribute2(cell, "N") ?? "") || attribute2(cell, "N")?.toLowerCase() === "oned" && (attribute2(cell, "V") !== "0" || !!executableCellFormula(attribute2(cell, "F")) || attribute2(cell, "F") === "Inh")
|
|
4262
4262
|
) || children2(node3, "Shapes").length > 0 || ["1", "true"].includes(attribute2(node3, "Del") ?? "");
|
|
4263
4263
|
sheets.push({ node: node3, shapeId: shapeId2, unsafe: unsafe2 });
|
|
@@ -4350,7 +4350,7 @@ function indexCells(roots, options) {
|
|
|
4350
4350
|
}
|
|
4351
4351
|
}
|
|
4352
4352
|
for (const node3 of Array.from(root2.getElementsByTagName("*"))) {
|
|
4353
|
-
|
|
4353
|
+
options2.check?.();
|
|
4354
4354
|
if (node3.hasAttribute("F") && !indexedNodes.has(node3))
|
|
4355
4355
|
fail(
|
|
4356
4356
|
"EDIT_UNKNOWN_DEPENDENCY",
|
|
@@ -4362,12 +4362,12 @@ function indexCells(roots, options) {
|
|
|
4362
4362
|
}
|
|
4363
4363
|
|
|
4364
4364
|
// visio/edit-recalculate-values.ts
|
|
4365
|
-
function createVisioCellEvaluator(cells4,
|
|
4365
|
+
function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
|
|
4366
4366
|
const active = /* @__PURE__ */ new Set(), values = /* @__PURE__ */ new Map();
|
|
4367
|
-
let steps = bound(
|
|
4368
|
-
const maxDepth = bound(
|
|
4367
|
+
let steps = bound(options2.maxSteps, 1e5);
|
|
4368
|
+
const maxDepth = bound(options2.maxDepth, 64);
|
|
4369
4369
|
const evaluate = (id3) => {
|
|
4370
|
-
|
|
4370
|
+
options2.check?.();
|
|
4371
4371
|
if (--steps < 0)
|
|
4372
4372
|
fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
4373
4373
|
const cached5 = values.get(id3);
|
|
@@ -4376,7 +4376,7 @@ function createVisioCellEvaluator(cells4, options = {}, verifyCaches = false) {
|
|
|
4376
4376
|
if (active.size >= maxDepth)
|
|
4377
4377
|
fail("LIMIT_FORMULA_DEPTH", "ShapeSheet dependency depth limit exceeded.");
|
|
4378
4378
|
const item = cells4.get(id3);
|
|
4379
|
-
if (!item || item.unsafe && (!item.node || !
|
|
4379
|
+
if (!item || item.unsafe && (!item.node || !options2.masterMovePins?.has(item.node) && !options2.groupRotationCells?.has(item.node)))
|
|
4380
4380
|
fail(
|
|
4381
4381
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
4382
4382
|
"Affected formula references missing, inherited or grouped cells."
|
|
@@ -4400,7 +4400,7 @@ function createVisioCellEvaluator(cells4, options = {}, verifyCaches = false) {
|
|
|
4400
4400
|
key({ pageId: item.pageId, shapeId: ref.shapeId ?? item.shapeId, cell: ref.cell })
|
|
4401
4401
|
),
|
|
4402
4402
|
{
|
|
4403
|
-
...
|
|
4403
|
+
...options2.pageContext?.get(item.pageId),
|
|
4404
4404
|
onStep: () => {
|
|
4405
4405
|
if (--steps < 0)
|
|
4406
4406
|
fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
@@ -4432,8 +4432,8 @@ function createVisioCellEvaluator(cells4, options = {}, verifyCaches = false) {
|
|
|
4432
4432
|
}
|
|
4433
4433
|
|
|
4434
4434
|
// visio/edit-recalculate.ts
|
|
4435
|
-
function recalculateVisioCells(roots, changed,
|
|
4436
|
-
const cells4 = indexCells(roots,
|
|
4435
|
+
function recalculateVisioCells(roots, changed, options2 = {}) {
|
|
4436
|
+
const cells4 = indexCells(roots, options2);
|
|
4437
4437
|
const reverse = /* @__PURE__ */ new Map();
|
|
4438
4438
|
for (const [id3, item] of cells4)
|
|
4439
4439
|
for (const dependency of item.dependencies) {
|
|
@@ -4443,9 +4443,9 @@ function recalculateVisioCells(roots, changed, options = {}) {
|
|
|
4443
4443
|
}
|
|
4444
4444
|
const affected = new Set(changed.map(key));
|
|
4445
4445
|
const pending2 = [...affected];
|
|
4446
|
-
const maxAffected = bound(
|
|
4446
|
+
const maxAffected = bound(options2.maxAffectedCells, 1e4);
|
|
4447
4447
|
for (let i = 0; i < pending2.length; i++) {
|
|
4448
|
-
|
|
4448
|
+
options2.check?.();
|
|
4449
4449
|
for (const id3 of reverse.get(pending2[i]) ?? [])
|
|
4450
4450
|
if (!affected.has(id3)) {
|
|
4451
4451
|
affected.add(id3);
|
|
@@ -4454,7 +4454,7 @@ function recalculateVisioCells(roots, changed, options = {}) {
|
|
|
4454
4454
|
if (affected.size > maxAffected)
|
|
4455
4455
|
fail("LIMIT_FORMULA_AFFECTED", "Affected ShapeSheet cell limit exceeded.");
|
|
4456
4456
|
}
|
|
4457
|
-
const evaluate = createVisioCellEvaluator(cells4,
|
|
4457
|
+
const evaluate = createVisioCellEvaluator(cells4, options2);
|
|
4458
4458
|
const values = /* @__PURE__ */ new Map();
|
|
4459
4459
|
for (const id3 of affected) values.set(id3, evaluate(id3));
|
|
4460
4460
|
const pages = /* @__PURE__ */ new Set();
|
|
@@ -4470,10 +4470,10 @@ function recalculateVisioCells(roots, changed, options = {}) {
|
|
|
4470
4470
|
}
|
|
4471
4471
|
return [...pages];
|
|
4472
4472
|
}
|
|
4473
|
-
function assertVisioShapesUnreferenced(roots, removed,
|
|
4474
|
-
const cells4 = indexCells(roots,
|
|
4473
|
+
function assertVisioShapesUnreferenced(roots, removed, options2 = {}) {
|
|
4474
|
+
const cells4 = indexCells(roots, options2);
|
|
4475
4475
|
for (const cell of cells4.values()) {
|
|
4476
|
-
|
|
4476
|
+
options2.check?.();
|
|
4477
4477
|
if (removed.get(cell.pageId)?.has(cell.shapeId)) continue;
|
|
4478
4478
|
if (cell.dependencies.some((id3) => {
|
|
4479
4479
|
const parts = JSON.parse(id3);
|
|
@@ -4484,24 +4484,24 @@ function assertVisioShapesUnreferenced(roots, removed, options = {}) {
|
|
|
4484
4484
|
for (const [pageId2, ids] of removed)
|
|
4485
4485
|
for (const connections2 of children2(roots.get(pageId2), "Connects"))
|
|
4486
4486
|
for (const connection of children2(connections2, "Connect")) {
|
|
4487
|
-
|
|
4487
|
+
options2.check?.();
|
|
4488
4488
|
if (["FromSheet", "ToSheet"].some((name3) => ids.has(attribute2(connection, name3) ?? "")))
|
|
4489
4489
|
fail("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
|
|
4490
4490
|
}
|
|
4491
4491
|
}
|
|
4492
|
-
function assertVisioShapeUnreferenced(roots, pageId2, shapeId2,
|
|
4493
|
-
assertVisioShapesUnreferenced(roots, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]),
|
|
4492
|
+
function assertVisioShapeUnreferenced(roots, pageId2, shapeId2, options2 = {}) {
|
|
4493
|
+
assertVisioShapesUnreferenced(roots, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
|
|
4494
4494
|
}
|
|
4495
|
-
function createVisioDependencyQuery(roots,
|
|
4496
|
-
const cells4 = indexCells(roots,
|
|
4495
|
+
function createVisioDependencyQuery(roots, options2 = {}) {
|
|
4496
|
+
const cells4 = indexCells(roots, options2);
|
|
4497
4497
|
return (source, targets) => {
|
|
4498
4498
|
const wanted = new Set(targets.map(key));
|
|
4499
4499
|
const seen = /* @__PURE__ */ new Set();
|
|
4500
4500
|
const pending2 = [key(source)];
|
|
4501
|
-
const maxSteps = bound(
|
|
4501
|
+
const maxSteps = bound(options2.maxSteps, 1e5);
|
|
4502
4502
|
let found = false;
|
|
4503
4503
|
while (pending2.length) {
|
|
4504
|
-
|
|
4504
|
+
options2.check?.();
|
|
4505
4505
|
const id3 = pending2.pop();
|
|
4506
4506
|
if (seen.has(id3)) continue;
|
|
4507
4507
|
seen.add(id3);
|
|
@@ -5796,16 +5796,16 @@ function emfInputView(input) {
|
|
|
5796
5796
|
return null;
|
|
5797
5797
|
}
|
|
5798
5798
|
}
|
|
5799
|
-
function emfInputOptions(
|
|
5800
|
-
if (!
|
|
5799
|
+
function emfInputOptions(options2) {
|
|
5800
|
+
if (!options2 || typeof options2 !== "object") return null;
|
|
5801
5801
|
try {
|
|
5802
|
-
const prototype = Object.getPrototypeOf(
|
|
5802
|
+
const prototype = Object.getPrototypeOf(options2);
|
|
5803
5803
|
if (prototype !== null && prototype !== Object.prototype) return null;
|
|
5804
5804
|
const snapshot2 = {};
|
|
5805
5805
|
for (const key2 of Object.keys(
|
|
5806
5806
|
VISIO_EMF_ADMISSION_LIMITS
|
|
5807
5807
|
)) {
|
|
5808
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
5808
|
+
const descriptor = Object.getOwnPropertyDescriptor(options2, key2);
|
|
5809
5809
|
if (!descriptor) continue;
|
|
5810
5810
|
if (!("value" in descriptor)) return null;
|
|
5811
5811
|
const value3 = descriptor.value;
|
|
@@ -5821,18 +5821,18 @@ function emfInputOptions(options) {
|
|
|
5821
5821
|
|
|
5822
5822
|
// visio/emf-admission-context.ts
|
|
5823
5823
|
var EmfAdmissionContext = class {
|
|
5824
|
-
constructor(view2,
|
|
5824
|
+
constructor(view2, options2) {
|
|
5825
5825
|
this.view = view2;
|
|
5826
5826
|
this.limits = { ...VISIO_EMF_ADMISSION_LIMITS };
|
|
5827
|
-
if (!
|
|
5827
|
+
if (!options2 || typeof options2 !== "object") {
|
|
5828
5828
|
this.emit("invalid", "limits", "Expected an options object.");
|
|
5829
5829
|
return;
|
|
5830
5830
|
}
|
|
5831
|
-
const cap =
|
|
5831
|
+
const cap = options2.maxDiagnostics;
|
|
5832
5832
|
if (cap !== void 0 && Number.isInteger(cap) && cap > 0 && cap <= this.limits.maxDiagnostics)
|
|
5833
5833
|
this.limits.maxDiagnostics = cap;
|
|
5834
5834
|
for (const key2 of Object.keys(VISIO_EMF_ADMISSION_LIMITS)) {
|
|
5835
|
-
const value3 =
|
|
5835
|
+
const value3 = options2[key2];
|
|
5836
5836
|
if (value3 === void 0) continue;
|
|
5837
5837
|
if (!Number.isSafeInteger(value3) || value3 < 1 || value3 > this.limits[key2])
|
|
5838
5838
|
this.emit("invalid", "limits", "Limits must be positive integers below the hard ceiling.");
|
|
@@ -6385,8 +6385,8 @@ function inspectEmfObjectRecord(c2) {
|
|
|
6385
6385
|
}
|
|
6386
6386
|
|
|
6387
6387
|
// visio/emf-admission.ts
|
|
6388
|
-
function inspectVisioEmfAdmission(input,
|
|
6389
|
-
const snapshot2 = emfInputOptions(
|
|
6388
|
+
function inspectVisioEmfAdmission(input, options2 = {}) {
|
|
6389
|
+
const snapshot2 = emfInputOptions(options2);
|
|
6390
6390
|
const view2 = snapshot2 === null ? null : emfInputView(input);
|
|
6391
6391
|
const c2 = new EmfAdmissionContext(view2 ?? new DataView(new ArrayBuffer(0)), snapshot2 ?? {});
|
|
6392
6392
|
if (snapshot2 === null) {
|
|
@@ -6610,9 +6610,9 @@ function record(value3, allowed) {
|
|
|
6610
6610
|
}
|
|
6611
6611
|
return result2;
|
|
6612
6612
|
}
|
|
6613
|
-
function limitsFor(
|
|
6613
|
+
function limitsFor(options2) {
|
|
6614
6614
|
const result2 = { ...VISIO_FOREIGN_VECTOR_LIMITS };
|
|
6615
|
-
const values = record(
|
|
6615
|
+
const values = record(options2, Object.keys(result2));
|
|
6616
6616
|
for (const key2 of Object.keys(values)) {
|
|
6617
6617
|
const value3 = values[key2];
|
|
6618
6618
|
if (typeof value3 !== "number" || !Number.isSafeInteger(value3) || value3 < 1 || value3 > result2[key2])
|
|
@@ -6958,9 +6958,9 @@ var PAINT = {
|
|
|
6958
6958
|
fillOpacity: "fill-opacity",
|
|
6959
6959
|
strokeOpacity: "stroke-opacity"
|
|
6960
6960
|
};
|
|
6961
|
-
function validateVisioForeignVector(value3,
|
|
6961
|
+
function validateVisioForeignVector(value3, options2 = {}) {
|
|
6962
6962
|
try {
|
|
6963
|
-
return validate(value3, limitsFor(
|
|
6963
|
+
return validate(value3, limitsFor(options2));
|
|
6964
6964
|
} catch (error) {
|
|
6965
6965
|
if (error instanceof VisioForeignVectorError) throw error;
|
|
6966
6966
|
unsafe("Unable to inspect vector scene safely.");
|
|
@@ -7122,9 +7122,9 @@ var ATTRS = {
|
|
|
7122
7122
|
clipPath: ["id", "clipPathUnits", "clip-rule", ...BASE]
|
|
7123
7123
|
};
|
|
7124
7124
|
var ID = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;
|
|
7125
|
-
function sanitizeVisioForeignVectorTree(root2,
|
|
7125
|
+
function sanitizeVisioForeignVectorTree(root2, options2 = {}) {
|
|
7126
7126
|
try {
|
|
7127
|
-
return sanitize(root2, limitsFor(
|
|
7127
|
+
return sanitize(root2, limitsFor(options2));
|
|
7128
7128
|
} catch (error) {
|
|
7129
7129
|
if (error instanceof VisioForeignVectorError) throw error;
|
|
7130
7130
|
unsafe("Unable to inspect converter output safely.");
|
|
@@ -8663,15 +8663,15 @@ function renderAbs(v, section3, generalWidth) {
|
|
|
8663
8663
|
}
|
|
8664
8664
|
return { text: text6, zero: general === "0" };
|
|
8665
8665
|
}
|
|
8666
|
-
function hashFill(
|
|
8667
|
-
const width =
|
|
8668
|
-
const one =
|
|
8666
|
+
function hashFill(options2) {
|
|
8667
|
+
const width = options2.width ?? 0;
|
|
8668
|
+
const one = options2.measure ? options2.measure("#") : 1;
|
|
8669
8669
|
return "#".repeat(Math.max(1, Math.floor(one > 0 ? width / one : width)));
|
|
8670
8670
|
}
|
|
8671
|
-
function fitNumber(value3, format5,
|
|
8672
|
-
const date1904 =
|
|
8673
|
-
const width =
|
|
8674
|
-
const fits = (text6) => (
|
|
8671
|
+
function fitNumber(value3, format5, options2) {
|
|
8672
|
+
const date1904 = options2.date1904 ?? false;
|
|
8673
|
+
const width = options2.width ?? 0;
|
|
8674
|
+
const fits = (text6) => (options2.measure ? options2.measure(text6) : text6.length) <= width;
|
|
8675
8675
|
const first2 = formatNumber2(value3, format5, date1904);
|
|
8676
8676
|
if (fits(first2.text) || first2.text === OVERFLOW_TEXT) return first2;
|
|
8677
8677
|
const choice2 = chooseSection(compileFormat(format5), value3);
|
|
@@ -8682,7 +8682,7 @@ function fitNumber(value3, format5, options) {
|
|
|
8682
8682
|
if (fits(next.text)) return next;
|
|
8683
8683
|
}
|
|
8684
8684
|
}
|
|
8685
|
-
const fill = hashFill(
|
|
8685
|
+
const fill = hashFill(options2);
|
|
8686
8686
|
return first2.color ? { text: fill, color: first2.color } : { text: fill };
|
|
8687
8687
|
}
|
|
8688
8688
|
function formatNumber2(value3, format5, date1904, generalWidth) {
|
|
@@ -8704,13 +8704,13 @@ function formatNumber2(value3, format5, date1904, generalWidth) {
|
|
|
8704
8704
|
const minus = value3 < 0 && !abs && !zero;
|
|
8705
8705
|
return result(minus ? `-${text6}` : text6, section3);
|
|
8706
8706
|
}
|
|
8707
|
-
function formatValue(value3, format5,
|
|
8707
|
+
function formatValue(value3, format5, options2 = {}) {
|
|
8708
8708
|
if (value3 === null) return { text: "" };
|
|
8709
8709
|
if (typeof value3 === "boolean") return { text: value3 ? "TRUE" : "FALSE" };
|
|
8710
8710
|
if (typeof value3 === "string") return formatText(value3, compileFormat(format5).text);
|
|
8711
8711
|
if (isCellError(value3)) return { text: value3.error };
|
|
8712
|
-
if (
|
|
8713
|
-
return formatNumber2(value3, format5,
|
|
8712
|
+
if (options2.width !== void 0) return fitNumber(value3, format5, options2);
|
|
8713
|
+
return formatNumber2(value3, format5, options2.date1904 ?? false);
|
|
8714
8714
|
}
|
|
8715
8715
|
|
|
8716
8716
|
// xlsx/formula/ast.ts
|
|
@@ -12749,8 +12749,8 @@ function rgbToHsl(r, g, b) {
|
|
|
12749
12749
|
}
|
|
12750
12750
|
return { h, s: clampUnitInterval(s), l: clampUnitInterval(l) };
|
|
12751
12751
|
}
|
|
12752
|
-
function hslToRgb(h, s, l, roundChannel = Math.round,
|
|
12753
|
-
const sC =
|
|
12752
|
+
function hslToRgb(h, s, l, roundChannel = Math.round, options2) {
|
|
12753
|
+
const sC = options2?.clampSaturation === false ? s : clampUnitInterval(s);
|
|
12754
12754
|
const lC = clampUnitInterval(l);
|
|
12755
12755
|
const hN = (h % 360 + 360) % 360;
|
|
12756
12756
|
const c2 = (1 - Math.abs(2 * lC - 1)) * sC;
|
|
@@ -12985,13 +12985,13 @@ var APPLIED = /* @__PURE__ */ new Set([
|
|
|
12985
12985
|
"lumMod",
|
|
12986
12986
|
"lumOff"
|
|
12987
12987
|
]);
|
|
12988
|
-
function resolveDrawingColor(color2, theme2,
|
|
12988
|
+
function resolveDrawingColor(color2, theme2, options2) {
|
|
12989
12989
|
const base2 = baseHex(color2, theme2);
|
|
12990
12990
|
const rgb6 = base2 ? hexToRgbChannels(base2) : null;
|
|
12991
12991
|
if (!rgb6) return void 0;
|
|
12992
|
-
if (
|
|
12992
|
+
if (options2?.transformOrder === "document") {
|
|
12993
12993
|
const value3 = orderedColorTransforms(rgb6, color2.transforms);
|
|
12994
|
-
const round3 =
|
|
12994
|
+
const round3 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
|
|
12995
12995
|
return {
|
|
12996
12996
|
hex: `#${toHex(round3(value3.r))}${toHex(round3(value3.g))}${toHex(round3(value3.b))}`,
|
|
12997
12997
|
alpha: value3.alpha,
|
|
@@ -13042,7 +13042,7 @@ function resolveDrawingColor(color2, theme2, options) {
|
|
|
13042
13042
|
if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
|
|
13043
13043
|
const lumOff = parseDrawingFraction(find("lumOff"));
|
|
13044
13044
|
if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
|
|
13045
|
-
const round3 =
|
|
13045
|
+
const round3 = options2?.hslRounding === "halfDown" ? (value3) => Math.ceil(value3 - 0.5) : Math.round;
|
|
13046
13046
|
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round3));
|
|
13047
13047
|
}
|
|
13048
13048
|
let alpha = parseDrawingPercent(find("alpha")) ?? 1;
|
|
@@ -15852,6 +15852,74 @@ function parseChartSpace(source) {
|
|
|
15852
15852
|
);
|
|
15853
15853
|
return { chartSpace, issues: context.issues };
|
|
15854
15854
|
}
|
|
15855
|
+
var AUTOMATIC_MARKER_CYCLE = [
|
|
15856
|
+
"diamond",
|
|
15857
|
+
"square",
|
|
15858
|
+
"triangle",
|
|
15859
|
+
"x",
|
|
15860
|
+
"star",
|
|
15861
|
+
"circle",
|
|
15862
|
+
"plus",
|
|
15863
|
+
"dot",
|
|
15864
|
+
"dash"
|
|
15865
|
+
];
|
|
15866
|
+
function automaticMarkerSymbol(seriesIdx) {
|
|
15867
|
+
const length = AUTOMATIC_MARKER_CYCLE.length;
|
|
15868
|
+
const normalized = (Math.trunc(seriesIdx) % length + length) % length;
|
|
15869
|
+
return AUTOMATIC_MARKER_CYCLE[Number.isFinite(normalized) ? normalized : 0];
|
|
15870
|
+
}
|
|
15871
|
+
|
|
15872
|
+
// chart/render/chart-view-markers.ts
|
|
15873
|
+
function summaryMarkers(source, group2, seriesPosition) {
|
|
15874
|
+
if (!["line", "scatter", "radar"].includes(group2.kind)) return {};
|
|
15875
|
+
const enabled = group2.kind === "line" ? group2.marker === true : group2.kind === "radar" ? group2.radarStyle === "marker" : !["line", "smooth", "none"].includes(group2.scatterStyle ?? "marker");
|
|
15876
|
+
const symbol = source.marker?.symbol;
|
|
15877
|
+
const marker3 = {
|
|
15878
|
+
...source.marker,
|
|
15879
|
+
symbol: symbol && symbol !== "auto" ? symbol : source.marker || enabled ? automaticMarkerSymbol(source.index ?? seriesPosition) : "none"
|
|
15880
|
+
};
|
|
15881
|
+
const pointMarkers = {};
|
|
15882
|
+
for (const point2 of source.dataPoints) {
|
|
15883
|
+
if (point2.index === void 0 || !point2.marker) continue;
|
|
15884
|
+
const override = point2.marker;
|
|
15885
|
+
pointMarkers[point2.index] = {
|
|
15886
|
+
...marker3,
|
|
15887
|
+
...override,
|
|
15888
|
+
...override.symbol === "auto" || !source.marker && override.symbol === void 0 ? { symbol: automaticMarkerSymbol(source.index ?? seriesPosition) } : {},
|
|
15889
|
+
...marker3.spPr || override.spPr ? {
|
|
15890
|
+
spPr: {
|
|
15891
|
+
...marker3.spPr,
|
|
15892
|
+
...override.spPr,
|
|
15893
|
+
...marker3.spPr?.line || override.spPr?.line ? { line: { ...marker3.spPr?.line, ...override.spPr?.line } } : {}
|
|
15894
|
+
}
|
|
15895
|
+
} : {}
|
|
15896
|
+
};
|
|
15897
|
+
}
|
|
15898
|
+
return { marker: marker3, ...Object.keys(pointMarkers).length ? { pointMarkers } : {} };
|
|
15899
|
+
}
|
|
15900
|
+
function seriesMarkerViews(source, drawingColor2) {
|
|
15901
|
+
const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? drawingColor2(fill.color) : void 0;
|
|
15902
|
+
const resolve = (marker3) => {
|
|
15903
|
+
const fill = fillColor(marker3.spPr?.fill);
|
|
15904
|
+
const stroke = fillColor(marker3.spPr?.line?.fill);
|
|
15905
|
+
const width = marker3.spPr?.line?.widthEmu;
|
|
15906
|
+
return {
|
|
15907
|
+
...marker3.symbol !== void 0 ? { symbol: marker3.symbol } : {},
|
|
15908
|
+
...marker3.size !== void 0 ? { size: marker3.size } : {},
|
|
15909
|
+
...fill !== void 0 ? { fill } : {},
|
|
15910
|
+
...stroke !== void 0 ? { stroke } : {},
|
|
15911
|
+
...width !== void 0 ? { strokeWidth: width / 9525 } : {}
|
|
15912
|
+
};
|
|
15913
|
+
};
|
|
15914
|
+
return {
|
|
15915
|
+
...source.marker ? { marker: resolve(source.marker) } : {},
|
|
15916
|
+
...source.pointMarkers ? {
|
|
15917
|
+
pointMarkers: Object.fromEntries(
|
|
15918
|
+
Object.entries(source.pointMarkers).map(([i, marker3]) => [i, resolve(marker3)])
|
|
15919
|
+
)
|
|
15920
|
+
} : {}
|
|
15921
|
+
};
|
|
15922
|
+
}
|
|
15855
15923
|
|
|
15856
15924
|
// chart/render/summary-analysis.ts
|
|
15857
15925
|
function summaryTrendline(source) {
|
|
@@ -16175,17 +16243,17 @@ function composeDataLabelText(input) {
|
|
|
16175
16243
|
}
|
|
16176
16244
|
|
|
16177
16245
|
// chart/render/summary-labels.ts
|
|
16178
|
-
function level(
|
|
16246
|
+
function level(options2, custom) {
|
|
16179
16247
|
const out = {};
|
|
16180
|
-
if (
|
|
16181
|
-
if (
|
|
16182
|
-
if (
|
|
16183
|
-
if (
|
|
16184
|
-
if (
|
|
16185
|
-
if (
|
|
16186
|
-
if (
|
|
16187
|
-
if (
|
|
16188
|
-
if (
|
|
16248
|
+
if (options2.deleted !== void 0) out.deleted = options2.deleted;
|
|
16249
|
+
if (options2.showValue !== void 0) out.showValue = options2.showValue;
|
|
16250
|
+
if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
|
|
16251
|
+
if (options2.showSeriesName !== void 0) out.showSeriesName = options2.showSeriesName;
|
|
16252
|
+
if (options2.showPercent !== void 0) out.showPercent = options2.showPercent;
|
|
16253
|
+
if (options2.showBubbleSize !== void 0) out.showBubbleSize = options2.showBubbleSize;
|
|
16254
|
+
if (options2.separator !== void 0) out.separator = options2.separator;
|
|
16255
|
+
if (options2.position) out.position = options2.position;
|
|
16256
|
+
if (options2.numberFormat?.formatCode) out.numberFormat = options2.numberFormat.formatCode;
|
|
16189
16257
|
if (custom?.text !== void 0) out.text = custom.text;
|
|
16190
16258
|
return out;
|
|
16191
16259
|
}
|
|
@@ -16292,7 +16360,10 @@ function extraGroups(chartSpace, firstType) {
|
|
|
16292
16360
|
const type = group2.kind === "bar" ? "column" : group2.kind;
|
|
16293
16361
|
const entry3 = {
|
|
16294
16362
|
chartType: type,
|
|
16295
|
-
series: group2.series.map((source) =>
|
|
16363
|
+
series: group2.series.map((source, index2) => ({
|
|
16364
|
+
...chartSummarySeries(source, type, group2.dataLabels),
|
|
16365
|
+
...summaryMarkers(source, group2, index2)
|
|
16366
|
+
})),
|
|
16296
16367
|
secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
|
|
16297
16368
|
};
|
|
16298
16369
|
if (group2.grouping && GROUPINGS.has(group2.grouping))
|
|
@@ -16310,13 +16381,16 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
16310
16381
|
const group2 = chartSpace.plotArea.groups[0];
|
|
16311
16382
|
let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
|
|
16312
16383
|
if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
|
|
16313
|
-
const series = (group2?.series ?? []).map(
|
|
16314
|
-
|
|
16315
|
-
|
|
16384
|
+
const series = (group2?.series ?? []).map((source, index2) => ({
|
|
16385
|
+
...chartSummarySeries(source, chartType, group2?.dataLabels),
|
|
16386
|
+
...group2 ? summaryMarkers(source, group2, index2) : {}
|
|
16387
|
+
}));
|
|
16316
16388
|
const summary = {
|
|
16317
16389
|
chartType,
|
|
16318
16390
|
series,
|
|
16319
|
-
showLegend: chartSpace.legend !== void 0
|
|
16391
|
+
showLegend: chartSpace.legend !== void 0,
|
|
16392
|
+
axes: chartSpace.plotArea.axes,
|
|
16393
|
+
axisIds: group2?.axisIds ?? []
|
|
16320
16394
|
};
|
|
16321
16395
|
const combined = extraGroups(chartSpace, chartType);
|
|
16322
16396
|
if (combined.length) summary.extraGroups = combined;
|
|
@@ -16399,6 +16473,8 @@ function parseChart(xml, anchor, partName, name3) {
|
|
|
16399
16473
|
showLegend: summary.showLegend,
|
|
16400
16474
|
partName
|
|
16401
16475
|
};
|
|
16476
|
+
if (summary.axes) object.axes = summary.axes;
|
|
16477
|
+
if (summary.axisIds) object.axisIds = summary.axisIds;
|
|
16402
16478
|
if (summary.grouping) object.grouping = summary.grouping;
|
|
16403
16479
|
if (summary.barGapWidth !== void 0) object.barGapWidth = summary.barGapWidth;
|
|
16404
16480
|
if (summary.barOverlap !== void 0) object.barOverlap = summary.barOverlap;
|
|
@@ -17819,14 +17895,14 @@ function* units2(raw) {
|
|
|
17819
17895
|
exp++;
|
|
17820
17896
|
}
|
|
17821
17897
|
}
|
|
17822
|
-
function niceScale(dataMin, dataMax,
|
|
17823
|
-
const maxIntervals = Math.max(1,
|
|
17898
|
+
function niceScale(dataMin, dataMax, options2 = {}) {
|
|
17899
|
+
const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
|
|
17824
17900
|
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
17825
17901
|
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
17826
17902
|
if (lo > hi) [lo, hi] = [hi, lo];
|
|
17827
17903
|
if (lo === hi) {
|
|
17828
17904
|
if (lo === 0) hi = 1;
|
|
17829
|
-
else if (
|
|
17905
|
+
else if (options2.noZero) {
|
|
17830
17906
|
const pad5 = Math.abs(lo) * 0.1 || 1;
|
|
17831
17907
|
lo -= pad5;
|
|
17832
17908
|
hi += pad5;
|
|
@@ -17835,7 +17911,7 @@ function niceScale(dataMin, dataMax, options = {}) {
|
|
|
17835
17911
|
}
|
|
17836
17912
|
let fixedLo = false;
|
|
17837
17913
|
let fixedHi = false;
|
|
17838
|
-
if (!
|
|
17914
|
+
if (!options2.noZero) {
|
|
17839
17915
|
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
17840
17916
|
lo = 0;
|
|
17841
17917
|
fixedLo = true;
|
|
@@ -17875,6 +17951,194 @@ function formatAxisValue(value3, percent = false) {
|
|
|
17875
17951
|
return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
|
|
17876
17952
|
}
|
|
17877
17953
|
|
|
17954
|
+
// chart/axis-range.ts
|
|
17955
|
+
function computeLogValueRange(series, logBase) {
|
|
17956
|
+
const allValues = series.flatMap((item) => item.values).filter((value3) => value3 !== null && Number.isFinite(value3) && value3 > 0);
|
|
17957
|
+
if (allValues.length === 0) {
|
|
17958
|
+
return { min: 1, max: logBase, span: 1, logScale: true, logBase };
|
|
17959
|
+
}
|
|
17960
|
+
const dataMin = Math.min(...allValues);
|
|
17961
|
+
const dataMax = Math.max(...allValues);
|
|
17962
|
+
const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
|
|
17963
|
+
const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
|
|
17964
|
+
const min = logBase ** logMin;
|
|
17965
|
+
const max = logBase ** Math.max(logMax, logMin + 1);
|
|
17966
|
+
return {
|
|
17967
|
+
min,
|
|
17968
|
+
max,
|
|
17969
|
+
span: Math.max(Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase), 1),
|
|
17970
|
+
logScale: true,
|
|
17971
|
+
logBase
|
|
17972
|
+
};
|
|
17973
|
+
}
|
|
17974
|
+
function withAxisBounds(automatic, axis, logBase) {
|
|
17975
|
+
const validMin = typeof axis?.min === "number" && Number.isFinite(axis.min) && (!logBase || axis.min > 0) ? axis.min : void 0;
|
|
17976
|
+
const validMax = typeof axis?.max === "number" && Number.isFinite(axis.max) && (!logBase || axis.max > 0) ? axis.max : void 0;
|
|
17977
|
+
const min = validMin ?? automatic.min;
|
|
17978
|
+
let max = validMax ?? automatic.max;
|
|
17979
|
+
const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
|
|
17980
|
+
if (max <= min) {
|
|
17981
|
+
max = logBase ? min * logBase : min + 1;
|
|
17982
|
+
}
|
|
17983
|
+
const span = logBase ? Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase) : max - min;
|
|
17984
|
+
return {
|
|
17985
|
+
min,
|
|
17986
|
+
max,
|
|
17987
|
+
span: Math.max(span, Number.EPSILON),
|
|
17988
|
+
...majorUnit !== void 0 ? { majorUnit } : {},
|
|
17989
|
+
...logBase ? { logScale: true, logBase } : {},
|
|
17990
|
+
...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
17991
|
+
};
|
|
17992
|
+
}
|
|
17993
|
+
|
|
17994
|
+
// chart/axis-ticks.ts
|
|
17995
|
+
var LOG_EXPONENT_TOLERANCE = 1e-12;
|
|
17996
|
+
function generateLogTicks(range2) {
|
|
17997
|
+
if (!range2.logScale || !range2.logBase) {
|
|
17998
|
+
return [];
|
|
17999
|
+
}
|
|
18000
|
+
const base2 = range2.logBase;
|
|
18001
|
+
const logMin = Math.log(range2.min) / Math.log(base2);
|
|
18002
|
+
const logMax = Math.log(range2.max) / Math.log(base2);
|
|
18003
|
+
const firstExponent = Math.ceil(logMin - LOG_EXPONENT_TOLERANCE);
|
|
18004
|
+
const lastExponent = Math.floor(logMax + LOG_EXPONENT_TOLERANCE);
|
|
18005
|
+
if (lastExponent < firstExponent) {
|
|
18006
|
+
return range2.min === range2.max ? [range2.min] : [range2.min, range2.max];
|
|
18007
|
+
}
|
|
18008
|
+
return Array.from(
|
|
18009
|
+
{ length: lastExponent - firstExponent + 1 },
|
|
18010
|
+
(_unused, index2) => base2 ** (firstExponent + index2)
|
|
18011
|
+
);
|
|
18012
|
+
}
|
|
18013
|
+
function generateIntervalTicks(range2, unit3) {
|
|
18014
|
+
if (!Number.isFinite(unit3) || unit3 <= 0 || range2.logScale) {
|
|
18015
|
+
return [];
|
|
18016
|
+
}
|
|
18017
|
+
const tolerance = Math.max(1, Math.abs(range2.min), Math.abs(range2.max)) * 1e-12;
|
|
18018
|
+
const first2 = Math.ceil((range2.min - tolerance) / unit3);
|
|
18019
|
+
const last = Math.floor((range2.max + tolerance) / unit3);
|
|
18020
|
+
const count = Math.min(Math.max(last - first2 + 1, 0), 2e3);
|
|
18021
|
+
return Array.from({ length: count }, (_, index2) => (first2 + index2) * unit3);
|
|
18022
|
+
}
|
|
18023
|
+
function generateAxisTicks(range2, axis, defaultIntervals) {
|
|
18024
|
+
if (range2.logScale && range2.logBase) {
|
|
18025
|
+
return generateLogTicks(range2);
|
|
18026
|
+
}
|
|
18027
|
+
const explicit = generateIntervalTicks(range2, axis?.majorUnit ?? 0);
|
|
18028
|
+
if (explicit.length > 0) {
|
|
18029
|
+
return explicit;
|
|
18030
|
+
}
|
|
18031
|
+
const automatic = generateIntervalTicks(range2, range2.majorUnit ?? 0);
|
|
18032
|
+
if (automatic.length > 0) {
|
|
18033
|
+
return automatic;
|
|
18034
|
+
}
|
|
18035
|
+
return Array.from(
|
|
18036
|
+
{ length: defaultIntervals + 1 },
|
|
18037
|
+
(_, index2) => range2.min + range2.span / defaultIntervals * index2
|
|
18038
|
+
);
|
|
18039
|
+
}
|
|
18040
|
+
function generateMinorAxisTicks(range2, axis) {
|
|
18041
|
+
const minor = generateIntervalTicks(range2, axis?.minorUnit ?? 0);
|
|
18042
|
+
if (minor.length === 0) {
|
|
18043
|
+
return [];
|
|
18044
|
+
}
|
|
18045
|
+
const majorUnit = axis?.majorUnit;
|
|
18046
|
+
if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
|
|
18047
|
+
return minor;
|
|
18048
|
+
}
|
|
18049
|
+
const tolerance = Math.max(1, Math.abs(range2.min), Math.abs(range2.max)) * 1e-10;
|
|
18050
|
+
return minor.filter(
|
|
18051
|
+
(value3) => Math.abs(value3 / majorUnit - Math.round(value3 / majorUnit)) > tolerance
|
|
18052
|
+
);
|
|
18053
|
+
}
|
|
18054
|
+
|
|
18055
|
+
// chart/render/chart-view-axes.ts
|
|
18056
|
+
function options(axis) {
|
|
18057
|
+
return {
|
|
18058
|
+
...axis.scaling,
|
|
18059
|
+
...axis.scaling.logBase === void 0 ? {} : { logScale: true },
|
|
18060
|
+
...axis.majorUnit === void 0 ? {} : { majorUnit: axis.majorUnit },
|
|
18061
|
+
...axis.minorUnit === void 0 ? {} : { minorUnit: axis.minorUnit }
|
|
18062
|
+
};
|
|
18063
|
+
}
|
|
18064
|
+
function applyChartAxes(model2, chart, color2) {
|
|
18065
|
+
if (!chart.axes?.length) return;
|
|
18066
|
+
const axes = chart.axes;
|
|
18067
|
+
const linked = axes.filter((axis) => axis.id !== void 0 && chart.axisIds?.includes(axis.id));
|
|
18068
|
+
const candidates = linked.length ? linked : axes;
|
|
18069
|
+
const xy = model2.type === "scatter" || model2.type === "bubble";
|
|
18070
|
+
const value3 = candidates.find((axis) => axis.kind === "val" && !["b", "t"].includes(axis.position ?? "")) ?? candidates.find((axis) => axis.kind === "val");
|
|
18071
|
+
const category = candidates.find(
|
|
18072
|
+
(axis) => xy ? axis.kind === "val" && axis !== value3 : axis.kind === "cat" || axis.kind === "date"
|
|
18073
|
+
);
|
|
18074
|
+
const secondary = axes.find((axis) => axis.kind === "val" && axis !== value3 && axis !== category);
|
|
18075
|
+
const paint2 = (shape) => {
|
|
18076
|
+
const ln = shape?.line;
|
|
18077
|
+
const fill = ln?.fill;
|
|
18078
|
+
const resolved = fill?.kind === "none" ? "none" : color2(fill?.kind === "solid" ? fill.color : void 0);
|
|
18079
|
+
return {
|
|
18080
|
+
...resolved === void 0 ? {} : { color: resolved },
|
|
18081
|
+
...ln?.widthEmu === void 0 ? {} : { width: ln.widthEmu / EMU_PER_PIXEL },
|
|
18082
|
+
...ln?.dash === void 0 ? {} : { dash: ln.dash }
|
|
18083
|
+
};
|
|
18084
|
+
};
|
|
18085
|
+
const bind = (axis, scale, values) => {
|
|
18086
|
+
const opts = options(axis);
|
|
18087
|
+
const automatic = opts.logScale ? computeLogValueRange(
|
|
18088
|
+
[{ values: values ?? [] }],
|
|
18089
|
+
opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
|
|
18090
|
+
) : {
|
|
18091
|
+
min: scale?.min ?? 0,
|
|
18092
|
+
max: scale?.max ?? 1,
|
|
18093
|
+
span: (scale?.max ?? 1) - (scale?.min ?? 0),
|
|
18094
|
+
...scale ? { majorUnit: scale.majorUnit } : {}
|
|
18095
|
+
};
|
|
18096
|
+
const logBase = automatic.logBase;
|
|
18097
|
+
const range2 = withAxisBounds(automatic, opts, logBase);
|
|
18098
|
+
if (scale) {
|
|
18099
|
+
scale.min = range2.min;
|
|
18100
|
+
scale.max = range2.max;
|
|
18101
|
+
scale.ticks = generateAxisTicks(range2, opts, 5);
|
|
18102
|
+
}
|
|
18103
|
+
return {
|
|
18104
|
+
source: axis,
|
|
18105
|
+
range: range2,
|
|
18106
|
+
minorTicks: generateMinorAxisTicks(range2, opts),
|
|
18107
|
+
line: paint2(axis.spPr),
|
|
18108
|
+
majorGrid: paint2(axis.majorGridlinesSpPr),
|
|
18109
|
+
minorGrid: paint2(axis.minorGridlinesSpPr)
|
|
18110
|
+
};
|
|
18111
|
+
};
|
|
18112
|
+
const out = {};
|
|
18113
|
+
if (value3)
|
|
18114
|
+
out.value = bind(
|
|
18115
|
+
value3,
|
|
18116
|
+
model2.valueAxis,
|
|
18117
|
+
[
|
|
18118
|
+
...model2.series,
|
|
18119
|
+
...model2.extraGroups?.filter((g) => !g.secondary).flatMap((g) => g.series) ?? []
|
|
18120
|
+
].flatMap((s) => s.values)
|
|
18121
|
+
);
|
|
18122
|
+
if (category)
|
|
18123
|
+
out.category = bind(
|
|
18124
|
+
category,
|
|
18125
|
+
model2.xAxis ?? {
|
|
18126
|
+
min: 0,
|
|
18127
|
+
max: Math.max(1, model2.categories.length - 1),
|
|
18128
|
+
majorUnit: 1,
|
|
18129
|
+
ticks: []
|
|
18130
|
+
},
|
|
18131
|
+
model2.series.flatMap((s) => s.xValues ?? [])
|
|
18132
|
+
);
|
|
18133
|
+
if (secondary)
|
|
18134
|
+
out.secondary = bind(
|
|
18135
|
+
secondary,
|
|
18136
|
+
model2.secondaryAxis,
|
|
18137
|
+
model2.extraGroups?.filter((g) => g.secondary).flatMap((g) => g.series.flatMap((s) => s.values))
|
|
18138
|
+
);
|
|
18139
|
+
model2.axes = out;
|
|
18140
|
+
}
|
|
18141
|
+
|
|
17878
18142
|
// chart/hierarchy.ts
|
|
17879
18143
|
function normalizeLevels(levels, pointCount) {
|
|
17880
18144
|
return levels.map((level2) => {
|
|
@@ -18097,15 +18361,15 @@ function seriesName(series, index2, evaluateRef2) {
|
|
|
18097
18361
|
const fromRef = resolveRef(series.nameRef, evaluateRef2)?.map(toText).filter((t) => t !== "").join(" ");
|
|
18098
18362
|
return fromRef || series.name || `Series${index2 + 1}`;
|
|
18099
18363
|
}
|
|
18100
|
-
function seriesContext(chart, theme2,
|
|
18364
|
+
function seriesContext(chart, theme2, options2) {
|
|
18101
18365
|
const scheme = chartColorScheme(theme2);
|
|
18102
18366
|
const resolver = { scheme: (name3) => scheme[name3] };
|
|
18103
18367
|
return {
|
|
18104
18368
|
theme: theme2,
|
|
18105
18369
|
scheme,
|
|
18106
18370
|
palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
|
|
18107
|
-
evaluateRef:
|
|
18108
|
-
seriesColor:
|
|
18371
|
+
evaluateRef: options2.evaluateRef ?? (() => []),
|
|
18372
|
+
seriesColor: options2.seriesColor,
|
|
18109
18373
|
drawingColor: (color2) => color2 && drawingColorCss(resolveDrawingColor(color2, resolver, { transformOrder: "document" })),
|
|
18110
18374
|
gradient: (fill) => fill?.kind === "gradient" ? resolveChartGradient(
|
|
18111
18375
|
fill,
|
|
@@ -18131,7 +18395,11 @@ function seriesView(ctx, s, index2, total, categoriesOf) {
|
|
|
18131
18395
|
})
|
|
18132
18396
|
);
|
|
18133
18397
|
if (Object.keys(points).length) view2.pointGradients = points;
|
|
18134
|
-
Object.assign(
|
|
18398
|
+
Object.assign(
|
|
18399
|
+
view2,
|
|
18400
|
+
analysisView(s, color2, ctx.drawingColor),
|
|
18401
|
+
seriesMarkerViews(s, ctx.drawingColor)
|
|
18402
|
+
);
|
|
18135
18403
|
return view2;
|
|
18136
18404
|
}
|
|
18137
18405
|
|
|
@@ -18396,14 +18664,14 @@ function scottBinCount(values, min, max) {
|
|
|
18396
18664
|
const width = 3.49 * sd * values.length ** (-1 / 3);
|
|
18397
18665
|
return Math.max(1, Math.ceil((max - min) / width));
|
|
18398
18666
|
}
|
|
18399
|
-
function computeHistogramBins(values,
|
|
18400
|
-
const closed =
|
|
18667
|
+
function computeHistogramBins(values, options2, format5 = String) {
|
|
18668
|
+
const closed = options2.intervalClosed ?? "l";
|
|
18401
18669
|
const finite4 = values.map((value3, sourceIndex) => ({ value: value3, sourceIndex })).filter((item) => Number.isFinite(item.value));
|
|
18402
18670
|
if (finite4.length === 0) {
|
|
18403
18671
|
return [];
|
|
18404
18672
|
}
|
|
18405
|
-
const underflow = typeof
|
|
18406
|
-
const overflow = typeof
|
|
18673
|
+
const underflow = typeof options2.underflow === "number" ? options2.underflow : void 0;
|
|
18674
|
+
const overflow = typeof options2.overflow === "number" ? options2.overflow : void 0;
|
|
18407
18675
|
const under = underflow === void 0 ? [] : finite4.filter(
|
|
18408
18676
|
(item) => closed === "r" ? item.value <= underflow : item.value < underflow
|
|
18409
18677
|
);
|
|
@@ -18420,8 +18688,8 @@ function computeHistogramBins(values, options, format5 = String) {
|
|
|
18420
18688
|
if (regular.length > 0) {
|
|
18421
18689
|
const min = Math.min(...regular.map((item) => item.value));
|
|
18422
18690
|
const max = Math.max(...regular.map((item) => item.value));
|
|
18423
|
-
const requestedSize =
|
|
18424
|
-
const requestedCount =
|
|
18691
|
+
const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
|
|
18692
|
+
const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
|
|
18425
18693
|
const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
|
|
18426
18694
|
const count = requestedSize ? Math.max(
|
|
18427
18695
|
closed === "l" ? Math.floor((max - start) / requestedSize) + 1 : Math.ceil((max - start) / requestedSize),
|
|
@@ -18472,9 +18740,9 @@ function aggregateByCategory(values, rawCategories) {
|
|
|
18472
18740
|
}
|
|
18473
18741
|
|
|
18474
18742
|
// chart/waterfall.ts
|
|
18475
|
-
function buildWaterfallSteps(values,
|
|
18743
|
+
function buildWaterfallSteps(values, options2) {
|
|
18476
18744
|
const subtotalIndices = new Set(
|
|
18477
|
-
|
|
18745
|
+
options2?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
|
|
18478
18746
|
);
|
|
18479
18747
|
const steps = [];
|
|
18480
18748
|
let runningTotal = 0;
|
|
@@ -18558,11 +18826,11 @@ function histogramView(chart, model2) {
|
|
|
18558
18826
|
const first2 = model2.series[0];
|
|
18559
18827
|
if (!first2) return;
|
|
18560
18828
|
const raw = first2.values.map((v) => v ?? Number.NaN);
|
|
18561
|
-
const
|
|
18562
|
-
const bins =
|
|
18829
|
+
const options2 = chart.histogram ?? {};
|
|
18830
|
+
const bins = options2.aggregateByCategory ? aggregateByCategory(
|
|
18563
18831
|
first2.values.map((v) => v ?? 0),
|
|
18564
18832
|
model2.categories
|
|
18565
|
-
) : computeHistogramBins(raw,
|
|
18833
|
+
) : computeHistogramBins(raw, options2, formatAxisValue);
|
|
18566
18834
|
model2.categories = bins.map((bin) => bin.label);
|
|
18567
18835
|
first2.values = bins.map((bin) => bin.value);
|
|
18568
18836
|
model2.barGapWidth = 0;
|
|
@@ -18586,11 +18854,11 @@ var SUPPORTED = /* @__PURE__ */ new Set([
|
|
|
18586
18854
|
"treemap",
|
|
18587
18855
|
"sunburst"
|
|
18588
18856
|
]);
|
|
18589
|
-
function chartSummaryView(chart, theme2,
|
|
18857
|
+
function chartSummaryView(chart, theme2, options2 = {}) {
|
|
18590
18858
|
const type = chart.chartType;
|
|
18591
18859
|
const radial = type === "pie" || type === "doughnut";
|
|
18592
18860
|
const byPoint = radial || type === "treemap" || type === "sunburst";
|
|
18593
|
-
const ctx = seriesContext(chart, theme2,
|
|
18861
|
+
const ctx = seriesContext(chart, theme2, options2);
|
|
18594
18862
|
const { palette, scheme, drawingColor: drawingColor2 } = ctx;
|
|
18595
18863
|
const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
|
|
18596
18864
|
const rawCategories = [];
|
|
@@ -18676,6 +18944,7 @@ function chartSummaryView(chart, theme2, options = {}) {
|
|
|
18676
18944
|
else if (!byPoint) model2.valueAxis = valueAxis(model2);
|
|
18677
18945
|
applyDataLabels(model2, chart.series, extra);
|
|
18678
18946
|
chartExtraAxes(model2);
|
|
18947
|
+
applyChartAxes(model2, chart, ctx.drawingColor);
|
|
18679
18948
|
return model2;
|
|
18680
18949
|
}
|
|
18681
18950
|
|
|
@@ -18807,7 +19076,7 @@ async function readEmbeddedChartObject(pkg, sourcePart, foreignData, report) {
|
|
|
18807
19076
|
}
|
|
18808
19077
|
|
|
18809
19078
|
// visio/prepare-images.ts
|
|
18810
|
-
async function prepareImages(shapes, pkg, sourcePart, report,
|
|
19079
|
+
async function prepareImages(shapes, pkg, sourcePart, report, options2, converter) {
|
|
18811
19080
|
for (const shape of shapes) {
|
|
18812
19081
|
if (shape.deleted) continue;
|
|
18813
19082
|
const localReport = (code, message, extra) => report(code, message, { part: sourcePart, shapeId: shape.id, ...extra });
|
|
@@ -18835,12 +19104,12 @@ async function prepareImages(shapes, pkg, sourcePart, report, options, converter
|
|
|
18835
19104
|
sourcePart,
|
|
18836
19105
|
shape.foreignData,
|
|
18837
19106
|
localReport,
|
|
18838
|
-
|
|
19107
|
+
options2
|
|
18839
19108
|
);
|
|
18840
19109
|
if (image) shape.image = image;
|
|
18841
19110
|
}
|
|
18842
19111
|
}
|
|
18843
|
-
await prepareImages(shape.children, pkg, sourcePart, report,
|
|
19112
|
+
await prepareImages(shape.children, pkg, sourcePart, report, options2, converter);
|
|
18844
19113
|
}
|
|
18845
19114
|
}
|
|
18846
19115
|
|
|
@@ -22164,8 +22433,8 @@ function readVisioAnnotations(sheet, pageId2) {
|
|
|
22164
22433
|
}
|
|
22165
22434
|
|
|
22166
22435
|
// visio/shape-metadata.ts
|
|
22167
|
-
function createMetadataBudget(
|
|
22168
|
-
const maxRows =
|
|
22436
|
+
function createMetadataBudget(options2 = {}) {
|
|
22437
|
+
const maxRows = options2.maxRows ?? 1e5, maxCharacters = options2.maxCharacters ?? 5e6;
|
|
22169
22438
|
if (![maxRows, maxCharacters].every((v) => Number.isSafeInteger(v) && v > 0))
|
|
22170
22439
|
throw new VisioPackageError("INVALID_LIMIT", "Metadata limits must be positive safe integers.");
|
|
22171
22440
|
let rows = 0, characters = 0;
|
|
@@ -23601,21 +23870,21 @@ function option(value3, fallback) {
|
|
|
23601
23870
|
throw new VisioPackageError("INVALID_LIMIT", "Parser limits must be positive safe integers.");
|
|
23602
23871
|
return value3;
|
|
23603
23872
|
}
|
|
23604
|
-
async function parseVsdx(input,
|
|
23605
|
-
const deadline = Date.now() + (
|
|
23873
|
+
async function parseVsdx(input, options2 = {}) {
|
|
23874
|
+
const deadline = Date.now() + (options2.limits?.maxRuntimeMs ?? 1e4);
|
|
23606
23875
|
const checkTime = () => {
|
|
23607
23876
|
if (Date.now() >= deadline)
|
|
23608
23877
|
throw new VisioPackageError("LIMIT_RUNTIME", "Visio parsing deadline exceeded.");
|
|
23609
23878
|
};
|
|
23610
|
-
const maxShapes = option(
|
|
23611
|
-
const maxCurveWork = option(
|
|
23879
|
+
const maxShapes = option(options2.maxShapes, 25e3), maxShapeDepth = option(options2.maxShapeDepth, 64);
|
|
23880
|
+
const maxCurveWork = option(options2.maxCurveWork, 2e7);
|
|
23612
23881
|
let curveWork = 0;
|
|
23613
|
-
const maxGeometry = option(
|
|
23614
|
-
const maxDiagnostics = option(
|
|
23615
|
-
const maxRuns = option(
|
|
23882
|
+
const maxGeometry = option(options2.maxGeometryCommands, 5e5), maxText = option(options2.maxTextCharacters, 5e6);
|
|
23883
|
+
const maxDiagnostics = option(options2.maxDiagnostics, 2e3);
|
|
23884
|
+
const maxRuns = option(options2.maxTextRuns, 1e5), maxParagraphs = option(options2.maxParagraphs, 5e4);
|
|
23616
23885
|
const diagnosticState = diagnosticCollector(maxDiagnostics);
|
|
23617
23886
|
const report = diagnosticState.report;
|
|
23618
|
-
const pkg = await VisioPackage.open(input,
|
|
23887
|
+
const pkg = await VisioPackage.open(input, options2.limits);
|
|
23619
23888
|
const types = await pkg.readXml("[Content_Types].xml", "Types");
|
|
23620
23889
|
if (types.namespaceURI !== "http://schemas.openxmlformats.org/package/2006/content-types")
|
|
23621
23890
|
throw new VisioPackageError("INVALID_CONTENT_TYPES", "Invalid content type namespace.");
|
|
@@ -23625,7 +23894,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
23625
23894
|
const documentType = elements(types).find(
|
|
23626
23895
|
(node3) => node3.localName === "Override" && attribute2(node3, "PartName") === `/${documentPart2}`
|
|
23627
23896
|
)?.getAttribute("ContentType");
|
|
23628
|
-
if (documentType !== "application/vnd.ms-visio.drawing.main+xml" && !(
|
|
23897
|
+
if (documentType !== "application/vnd.ms-visio.drawing.main+xml" && !(options2.stencil && documentType && STENCIL_MAIN_TYPES.has(documentType)))
|
|
23629
23898
|
throw new VisioPackageError(
|
|
23630
23899
|
"UNSUPPORTED_FORMAT",
|
|
23631
23900
|
"Only VSDX drawing packages are supported; VSD, VDX, VSDM and templates are not supported."
|
|
@@ -23698,8 +23967,8 @@ async function parseVsdx(input, options = {}) {
|
|
|
23698
23967
|
pkg,
|
|
23699
23968
|
part,
|
|
23700
23969
|
report,
|
|
23701
|
-
|
|
23702
|
-
|
|
23970
|
+
options2.images,
|
|
23971
|
+
options2.metafileConverter
|
|
23703
23972
|
);
|
|
23704
23973
|
masters.set(id3, masterShapes2);
|
|
23705
23974
|
masterRecords.push({ id: id3, node: master2, shapes: masterShapes2 });
|
|
@@ -23707,7 +23976,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
23707
23976
|
}
|
|
23708
23977
|
let geometryCount = 0, textCount = 0, expansionCount = 0, textRuns = 0, paragraphCount = 0;
|
|
23709
23978
|
const context = {
|
|
23710
|
-
metadataBudget: createMetadataBudget(
|
|
23979
|
+
metadataBudget: createMetadataBudget(options2.metadata),
|
|
23711
23980
|
layerBudget: createLayerBudget(),
|
|
23712
23981
|
masters,
|
|
23713
23982
|
layers: /* @__PURE__ */ new Map(),
|
|
@@ -23759,11 +24028,11 @@ async function parseVsdx(input, options = {}) {
|
|
|
23759
24028
|
}
|
|
23760
24029
|
};
|
|
23761
24030
|
const documentMasters = listVisioMasters(masterRecords, context, {
|
|
23762
|
-
metadataBudget: createMetadataBudget(
|
|
24031
|
+
metadataBudget: createMetadataBudget(options2.metadata),
|
|
23763
24032
|
layerBudget: createLayerBudget()
|
|
23764
24033
|
});
|
|
23765
|
-
const pagesPart = await related(pkg, documentPart2, "pages", !
|
|
23766
|
-
if (!pagesPart && !
|
|
24034
|
+
const pagesPart = await related(pkg, documentPart2, "pages", !options2.stencil);
|
|
24035
|
+
if (!pagesPart && !options2.stencil)
|
|
23767
24036
|
throw new VisioPackageError("INVALID_DOCUMENT", "Missing Visio pages part.");
|
|
23768
24037
|
const pages = [], pageIds2 = /* @__PURE__ */ new Set();
|
|
23769
24038
|
const comments = [];
|
|
@@ -23817,8 +24086,8 @@ async function parseVsdx(input, options = {}) {
|
|
|
23817
24086
|
pkg,
|
|
23818
24087
|
part,
|
|
23819
24088
|
localReport,
|
|
23820
|
-
|
|
23821
|
-
|
|
24089
|
+
options2.images,
|
|
24090
|
+
options2.metafileConverter
|
|
23822
24091
|
);
|
|
23823
24092
|
const shapes = normalizeShapes(rawShapes, context);
|
|
23824
24093
|
normalizeVisioPageGeometry(shapes, drawingToPageScale, checkTime);
|
|
@@ -23935,13 +24204,13 @@ function getVisioPageLayers(document, pageId2) {
|
|
|
23935
24204
|
|
|
23936
24205
|
// visio/stencil-file.ts
|
|
23937
24206
|
var isCompoundFile = (bytes) => [208, 207, 17, 224].every((value3, index2) => bytes[index2] === value3);
|
|
23938
|
-
async function readVisioStencil(input,
|
|
24207
|
+
async function readVisioStencil(input, options2 = {}) {
|
|
23939
24208
|
if (isCompoundFile(input))
|
|
23940
24209
|
throw new VisioPackageError(
|
|
23941
24210
|
"UNSUPPORTED_FORMAT",
|
|
23942
24211
|
"Legacy binary stencils (.vss) are not supported; open a .vssx stencil."
|
|
23943
24212
|
);
|
|
23944
|
-
const document = await parseVsdx(input, { ...
|
|
24213
|
+
const document = await parseVsdx(input, { ...options2, stencil: true });
|
|
23945
24214
|
return { masters: document.masters ?? [], diagnostics: document.diagnostics };
|
|
23946
24215
|
}
|
|
23947
24216
|
|
|
@@ -24250,8 +24519,8 @@ function findStreamByName(entries, name3, isReadable) {
|
|
|
24250
24519
|
}
|
|
24251
24520
|
|
|
24252
24521
|
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
|
|
24253
|
-
function parseOle2(buffer,
|
|
24254
|
-
const strict =
|
|
24522
|
+
function parseOle2(buffer, options2 = {}) {
|
|
24523
|
+
const strict = options2.strict === true;
|
|
24255
24524
|
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
24256
24525
|
const view2 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
24257
24526
|
const warnings = [];
|
|
@@ -27600,16 +27869,16 @@ function joinedData(record5) {
|
|
|
27600
27869
|
}
|
|
27601
27870
|
|
|
27602
27871
|
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg.js
|
|
27603
|
-
function decodeFormula(rgce, extra, context,
|
|
27872
|
+
function decodeFormula(rgce, extra, context, options2) {
|
|
27604
27873
|
try {
|
|
27605
|
-
return decode2(rgce, new ByteReader(extra), context,
|
|
27874
|
+
return decode2(rgce, new ByteReader(extra), context, options2);
|
|
27606
27875
|
} catch {
|
|
27607
27876
|
return void 0;
|
|
27608
27877
|
}
|
|
27609
27878
|
}
|
|
27610
27879
|
var Unsupported = class extends Error {
|
|
27611
27880
|
};
|
|
27612
|
-
function decode2(rgce, extra, context,
|
|
27881
|
+
function decode2(rgce, extra, context, options2) {
|
|
27613
27882
|
const reader2 = new ByteReader(rgce);
|
|
27614
27883
|
const stack = [];
|
|
27615
27884
|
let space = "";
|
|
@@ -27736,7 +28005,7 @@ function decode2(rgce, extra, context, options) {
|
|
|
27736
28005
|
case 4:
|
|
27737
28006
|
case 12: {
|
|
27738
28007
|
const row2 = reader2.u16();
|
|
27739
|
-
push(cellText(readLoc(row2, reader2.u16(), base2 === 12,
|
|
28008
|
+
push(cellText(readLoc(row2, reader2.u16(), base2 === 12, options2)));
|
|
27740
28009
|
break;
|
|
27741
28010
|
}
|
|
27742
28011
|
case 5:
|
|
@@ -27744,7 +28013,7 @@ function decode2(rgce, extra, context, options) {
|
|
|
27744
28013
|
const rows = [reader2.u16(), reader2.u16()];
|
|
27745
28014
|
const cols = [reader2.u16(), reader2.u16()];
|
|
27746
28015
|
const relative = base2 === 13;
|
|
27747
|
-
push(areaText(readLoc(rows[0], cols[0], relative,
|
|
28016
|
+
push(areaText(readLoc(rows[0], cols[0], relative, options2), readLoc(rows[1], cols[1], relative, options2)));
|
|
27748
28017
|
break;
|
|
27749
28018
|
}
|
|
27750
28019
|
case 6:
|
|
@@ -27779,15 +28048,15 @@ function decode2(rgce, extra, context, options) {
|
|
|
27779
28048
|
case 26: {
|
|
27780
28049
|
const sheet = prefix2(reader2.u16());
|
|
27781
28050
|
const row2 = reader2.u16();
|
|
27782
|
-
push(sheet + cellText(readLoc(row2, reader2.u16(),
|
|
28051
|
+
push(sheet + cellText(readLoc(row2, reader2.u16(), options2.shared === true, options2)));
|
|
27783
28052
|
break;
|
|
27784
28053
|
}
|
|
27785
28054
|
case 27: {
|
|
27786
28055
|
const sheet = prefix2(reader2.u16());
|
|
27787
28056
|
const rows = [reader2.u16(), reader2.u16()];
|
|
27788
28057
|
const cols = [reader2.u16(), reader2.u16()];
|
|
27789
|
-
const relative =
|
|
27790
|
-
push(sheet + areaText(readLoc(rows[0], cols[0], relative,
|
|
28058
|
+
const relative = options2.shared === true;
|
|
28059
|
+
push(sheet + areaText(readLoc(rows[0], cols[0], relative, options2), readLoc(rows[1], cols[1], relative, options2)));
|
|
27791
28060
|
break;
|
|
27792
28061
|
}
|
|
27793
28062
|
case 28:
|
|
@@ -33203,19 +33472,19 @@ function detect(bytes) {
|
|
|
33203
33472
|
formats.push("vsd");
|
|
33204
33473
|
return { format: formats.length === 1 ? formats[0] : void 0, ambiguous: formats.length > 1 || workbook && book };
|
|
33205
33474
|
}
|
|
33206
|
-
function parseOle22(input,
|
|
33475
|
+
function parseOle22(input, options2) {
|
|
33207
33476
|
const bytes = bytesOf2(input);
|
|
33208
33477
|
const container = new CfbDocument(bytes);
|
|
33209
33478
|
const detected = detect(bytes);
|
|
33210
|
-
if (
|
|
33479
|
+
if (options2?.expect === "cfb")
|
|
33211
33480
|
return new CfbDocument(bytes, detected.format, detected.ambiguous ? [{ code: "ambiguous-format", message: "Multiple root format identities; container inspection only." }] : []);
|
|
33212
33481
|
if (detected.ambiguous) {
|
|
33213
|
-
if (
|
|
33482
|
+
if (options2)
|
|
33214
33483
|
throw new Ole2DocumentError("ambiguous-format", "Multiple root format identities; no format model can be selected.");
|
|
33215
33484
|
return new CfbDocument(bytes, void 0, [{ code: "ambiguous-format", message: "Multiple root format identities; container inspection only." }]);
|
|
33216
33485
|
}
|
|
33217
|
-
if (
|
|
33218
|
-
throw new Ole2DocumentError("format-mismatch", `Expected ${
|
|
33486
|
+
if (options2 && options2.expect !== detected.format)
|
|
33487
|
+
throw new Ole2DocumentError("format-mismatch", `Expected ${options2.expect}; detected ${detected.format ?? "cfb"}.`);
|
|
33219
33488
|
if (!detected.format)
|
|
33220
33489
|
return container;
|
|
33221
33490
|
try {
|
|
@@ -33230,7 +33499,7 @@ function parseOle22(input, options) {
|
|
|
33230
33499
|
return new VsdDocument(bytes);
|
|
33231
33500
|
}
|
|
33232
33501
|
} catch (error) {
|
|
33233
|
-
if (
|
|
33502
|
+
if (options2)
|
|
33234
33503
|
throw new Ole2DocumentError("unsupported-model", `Cannot decode ${detected.format} model: ${error instanceof Error ? error.message : String(error)}`);
|
|
33235
33504
|
return new CfbDocument(bytes, detected.format, [{ code: "unsupported-model", message: error instanceof Error ? error.message : String(error) }]);
|
|
33236
33505
|
}
|
|
@@ -33249,11 +33518,11 @@ function limit2(value3, fallback) {
|
|
|
33249
33518
|
);
|
|
33250
33519
|
return resolved;
|
|
33251
33520
|
}
|
|
33252
|
-
function normalizeLegacyVsd(document,
|
|
33253
|
-
const maxShapes = limit2(
|
|
33254
|
-
const maxGeometry = limit2(
|
|
33255
|
-
const maxText = limit2(
|
|
33256
|
-
const diagnostics = diagnosticCollector(limit2(
|
|
33521
|
+
function normalizeLegacyVsd(document, options2 = {}) {
|
|
33522
|
+
const maxShapes = limit2(options2.maxShapes, 25e3);
|
|
33523
|
+
const maxGeometry = limit2(options2.maxGeometryCommands, 5e5);
|
|
33524
|
+
const maxText = limit2(options2.maxTextCharacters, 5e6);
|
|
33525
|
+
const diagnostics = diagnosticCollector(limit2(options2.maxDiagnostics, 2e3));
|
|
33257
33526
|
const report = diagnostics.report;
|
|
33258
33527
|
let shapeCount = 0, geometryCount = 0, textCount = 0;
|
|
33259
33528
|
report(
|
|
@@ -33398,15 +33667,15 @@ function normalizeLegacyVsd(document, options = {}) {
|
|
|
33398
33667
|
throw new VisioPackageError("LEGACY_PAGE_GEOMETRY", "Legacy drawing has no decoded pages.");
|
|
33399
33668
|
return { format: "vsd", pages, diagnostics: diagnostics.finish() };
|
|
33400
33669
|
}
|
|
33401
|
-
function parseLegacyVsd(input,
|
|
33670
|
+
function parseLegacyVsd(input, options2 = {}) {
|
|
33402
33671
|
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
33403
|
-
const maxInput = limit2(
|
|
33404
|
-
const maxRuntime = limit2(
|
|
33672
|
+
const maxInput = limit2(options2.limits?.maxInputBytes, 32 * 1024 * 1024);
|
|
33673
|
+
const maxRuntime = limit2(options2.limits?.maxRuntimeMs, 1e4), start = Date.now();
|
|
33405
33674
|
if (bytes.byteLength > maxInput)
|
|
33406
33675
|
throw new VisioPackageError("LIMIT_INPUT", "Legacy Visio input exceeds limit.");
|
|
33407
33676
|
try {
|
|
33408
33677
|
const document = parseVsd(bytes);
|
|
33409
|
-
const scene = normalizeLegacyVsd(document,
|
|
33678
|
+
const scene = normalizeLegacyVsd(document, options2);
|
|
33410
33679
|
if (Date.now() - start >= maxRuntime)
|
|
33411
33680
|
throw new VisioPackageError("LIMIT_RUNTIME", "Legacy Visio processing deadline exceeded.");
|
|
33412
33681
|
return scene;
|
|
@@ -33420,11 +33689,11 @@ function parseLegacyVsd(input, options = {}) {
|
|
|
33420
33689
|
}
|
|
33421
33690
|
|
|
33422
33691
|
// visio/load.ts
|
|
33423
|
-
async function loadVisio(input,
|
|
33692
|
+
async function loadVisio(input, options2 = {}) {
|
|
33424
33693
|
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
33425
33694
|
if ([208, 207, 17, 224, 161, 177, 26, 225].every((value3, index2) => bytes[index2] === value3))
|
|
33426
|
-
return parseLegacyVsd(bytes,
|
|
33427
|
-
if (bytes[0] === 80 && bytes[1] === 75) return parseVsdx(input,
|
|
33695
|
+
return parseLegacyVsd(bytes, options2);
|
|
33696
|
+
if (bytes[0] === 80 && bytes[1] === 75) return parseVsdx(input, options2);
|
|
33428
33697
|
throw new VisioPackageError(
|
|
33429
33698
|
"UNSUPPORTED_FORMAT",
|
|
33430
33699
|
"Expected a VSD compound file or VSDX ZIP package."
|
|
@@ -33451,7 +33720,7 @@ function layerId(id3) {
|
|
|
33451
33720
|
if (typeof id3 !== "string" || !id3.length) invalid3("Layer IDs must be nonempty strings.");
|
|
33452
33721
|
bounded4(id3.length, VISIO_VISIBILITY_LIMITS.maxLayerIdLength, "layer ID length");
|
|
33453
33722
|
}
|
|
33454
|
-
function resolveVisioPageVisibility(page,
|
|
33723
|
+
function resolveVisioPageVisibility(page, options2 = {}) {
|
|
33455
33724
|
const limits = VISIO_VISIBILITY_LIMITS;
|
|
33456
33725
|
const sourceLayers = page.layers ?? [];
|
|
33457
33726
|
if (!Array.isArray(sourceLayers) || !Array.isArray(page.shapes))
|
|
@@ -33464,8 +33733,8 @@ function resolveVisioPageVisibility(page, options = {}) {
|
|
|
33464
33733
|
if (!layers.has(layer.id)) layers.set(layer.id, layer);
|
|
33465
33734
|
}
|
|
33466
33735
|
const overrides = /* @__PURE__ */ new Map();
|
|
33467
|
-
if (
|
|
33468
|
-
const source =
|
|
33736
|
+
if (options2.layerVisibilityOverrides !== void 0) {
|
|
33737
|
+
const source = options2.layerVisibilityOverrides;
|
|
33469
33738
|
if (!source || typeof source[Symbol.iterator] !== "function")
|
|
33470
33739
|
invalid3("Layer visibility overrides must be an iterable map.");
|
|
33471
33740
|
bounded4(source.size, limits.maxLayers, "override count");
|
|
@@ -34005,13 +34274,13 @@ function unique(items, key2, what) {
|
|
|
34005
34274
|
return result2;
|
|
34006
34275
|
}
|
|
34007
34276
|
var cellMap2 = (parent) => unique(children2(parent, "Cell"), (cell) => attribute2(cell, "N") ?? "", "cell");
|
|
34008
|
-
function instanceSheet(instance, template,
|
|
34277
|
+
function instanceSheet(instance, template, options2 = {}) {
|
|
34009
34278
|
for (const node3 of [instance, template]) {
|
|
34010
34279
|
const type = attribute2(node3, "Type");
|
|
34011
|
-
if (!(
|
|
34280
|
+
if (!(options2.group ? ["Shape", "Group", void 0] : ["Shape", void 0]).includes(type) || !options2.group && children2(node3, "Shapes").length > 0 || children2(node3, "ForeignData").length || deleted2(node3))
|
|
34012
34281
|
fail(
|
|
34013
34282
|
"UNSUPPORTED_INSTANCE_EDIT",
|
|
34014
|
-
|
|
34283
|
+
options2.group ? "A stencil shape that holds a picture or a deleted part cannot be changed." : "Only stencil shapes made of one plain shape can be changed; grouped, picture and deleted ones cannot."
|
|
34015
34284
|
);
|
|
34016
34285
|
}
|
|
34017
34286
|
if (template.hasAttribute("Master") || template.hasAttribute("MasterShape"))
|
|
@@ -34090,7 +34359,7 @@ function effectiveFormula(cell) {
|
|
|
34090
34359
|
return own === "Inh" ? executableCellFormula(attribute2(cell.inherited, "F")) : executableCellFormula(own);
|
|
34091
34360
|
}
|
|
34092
34361
|
var AFTER_SECTIONS = ["Text", "Data1", "Data2", "Data3", "ForeignData", "Shapes"];
|
|
34093
|
-
function writeInstanceCell(sheet, cell, value3,
|
|
34362
|
+
function writeInstanceCell(sheet, cell, value3, options2 = {}) {
|
|
34094
34363
|
const { instance } = sheet;
|
|
34095
34364
|
const create2 = (name3) => instance.ownerDocument.createElementNS(instance.namespaceURI, name3);
|
|
34096
34365
|
let node3 = cell.local;
|
|
@@ -34136,9 +34405,9 @@ function writeInstanceCell(sheet, cell, value3, options = {}) {
|
|
|
34136
34405
|
}
|
|
34137
34406
|
node3.setAttribute("V", value3);
|
|
34138
34407
|
node3.removeAttribute("E");
|
|
34139
|
-
const unit3 =
|
|
34140
|
-
if (unit3 !== void 0 && (created ||
|
|
34141
|
-
if (
|
|
34408
|
+
const unit3 = options2.unit ?? attribute2(cell.inherited, "U");
|
|
34409
|
+
if (unit3 !== void 0 && (created || options2.unit !== void 0)) node3.setAttribute("U", unit3);
|
|
34410
|
+
if (options2.formula) node3.setAttribute("F", options2.formula);
|
|
34142
34411
|
else node3.removeAttribute("F");
|
|
34143
34412
|
return node3;
|
|
34144
34413
|
}
|
|
@@ -36298,7 +36567,7 @@ function proveConnectorShape(shape, route = routeOf(shape)) {
|
|
|
36298
36567
|
"Only right-angle and curved connectors drawn here can be rerouted."
|
|
36299
36568
|
);
|
|
36300
36569
|
}
|
|
36301
|
-
function rerouteConnector(roots, pageId2, glue, check,
|
|
36570
|
+
function rerouteConnector(roots, pageId2, glue, check, options2 = {}) {
|
|
36302
36571
|
const root2 = roots.get(pageId2);
|
|
36303
36572
|
const shape = glue.shape;
|
|
36304
36573
|
const stencil = isStencilConnector(shape);
|
|
@@ -36310,7 +36579,7 @@ function rerouteConnector(roots, pageId2, glue, check, options = {}) {
|
|
|
36310
36579
|
if (target2) return glueSites(root2, target2);
|
|
36311
36580
|
return [
|
|
36312
36581
|
{
|
|
36313
|
-
point:
|
|
36582
|
+
point: options2.free?.[end] ?? {
|
|
36314
36583
|
x: numeric(local.get(`${prefix(end)}X`)),
|
|
36315
36584
|
y: numeric(local.get(`${prefix(end)}Y`))
|
|
36316
36585
|
}
|
|
@@ -36319,7 +36588,7 @@ function rerouteConnector(roots, pageId2, glue, check, options = {}) {
|
|
|
36319
36588
|
};
|
|
36320
36589
|
const chosen = chooseSites(sites("begin"), sites("end"));
|
|
36321
36590
|
if (isStencilLine(shape)) {
|
|
36322
|
-
if (
|
|
36591
|
+
if (options2.route && options2.route !== "straight")
|
|
36323
36592
|
fail(
|
|
36324
36593
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
36325
36594
|
"This connector is a straight line from a stencil; only Visio's Dynamic connector can be restyled."
|
|
@@ -36338,12 +36607,12 @@ function rerouteConnector(roots, pageId2, glue, check, options = {}) {
|
|
|
36338
36607
|
const target2 = glue.ends[end];
|
|
36339
36608
|
return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target)) : { point: sites(end)[0].point };
|
|
36340
36609
|
};
|
|
36341
|
-
const route =
|
|
36610
|
+
const route = options2.route ?? current;
|
|
36342
36611
|
if (route === "straight" && current === "straight" && ENDS.every(
|
|
36343
36612
|
(end) => sameLineCoordinate(numeric(local.get(`${prefix(end)}X`)), chosen[end].point.x) && sameLineCoordinate(numeric(local.get(`${prefix(end)}Y`)), chosen[end].point.y)
|
|
36344
36613
|
))
|
|
36345
36614
|
return [];
|
|
36346
|
-
if (
|
|
36615
|
+
if (options2.route) setRouteCells(shape, options2.route);
|
|
36347
36616
|
const obstacles = route === "right-angle" ? connectorObstacles(
|
|
36348
36617
|
root2,
|
|
36349
36618
|
/* @__PURE__ */ new Set([
|
|
@@ -36699,14 +36968,14 @@ async function measuresOwnText(root2, shapeId2, template, check) {
|
|
|
36699
36968
|
return false;
|
|
36700
36969
|
}
|
|
36701
36970
|
}
|
|
36702
|
-
async function refreshTextSizes(targets, result2,
|
|
36971
|
+
async function refreshTextSizes(targets, result2, options2, deadline) {
|
|
36703
36972
|
if (!targets.length || !result2.changedParts.length) return result2;
|
|
36704
36973
|
const check = () => {
|
|
36705
36974
|
if (Date.now() >= deadline) throw new VisioPackageError("LIMIT_RUNTIME", "Deadline exceeded.");
|
|
36706
36975
|
};
|
|
36707
36976
|
const limits = {
|
|
36708
36977
|
...DEFAULTS,
|
|
36709
|
-
...
|
|
36978
|
+
...options2.limits,
|
|
36710
36979
|
maxInputBytes: Math.max(DEFAULTS.maxInputBytes, result2.bytes.length),
|
|
36711
36980
|
maxRuntimeMs: Math.max(1, deadline - Date.now())
|
|
36712
36981
|
};
|
|
@@ -36796,7 +37065,7 @@ async function refreshTextSizes(targets, result2, options, deadline) {
|
|
|
36796
37065
|
}
|
|
36797
37066
|
const bytes = await writeEditedPackage(
|
|
36798
37067
|
parts,
|
|
36799
|
-
|
|
37068
|
+
options2.maxOutputBytes ?? limits.maxInputBytes,
|
|
36800
37069
|
deadline,
|
|
36801
37070
|
check
|
|
36802
37071
|
);
|
|
@@ -37068,14 +37337,14 @@ function cacheRows(path2) {
|
|
|
37068
37337
|
}
|
|
37069
37338
|
return rows.every((row2) => Number.isFinite(row2.x) && Number.isFinite(row2.y)) ? rows : [];
|
|
37070
37339
|
}
|
|
37071
|
-
async function refreshLineJumpCaches(pageIds2, source, result2,
|
|
37340
|
+
async function refreshLineJumpCaches(pageIds2, source, result2, options2, deadline) {
|
|
37072
37341
|
if (!pageIds2.size || !result2.changedParts.length) return result2;
|
|
37073
37342
|
const check = () => {
|
|
37074
37343
|
if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
37075
37344
|
};
|
|
37076
37345
|
const limits = {
|
|
37077
37346
|
...DEFAULTS,
|
|
37078
|
-
...
|
|
37347
|
+
...options2.limits,
|
|
37079
37348
|
maxRuntimeMs: Math.max(1, deadline - Date.now())
|
|
37080
37349
|
};
|
|
37081
37350
|
const { pkg, parts, pages } = await openEditablePackage(result2.bytes, limits, check);
|
|
@@ -37155,7 +37424,7 @@ async function refreshLineJumpCaches(pageIds2, source, result2, options, deadlin
|
|
|
37155
37424
|
return {
|
|
37156
37425
|
bytes: await writeEditedPackage(
|
|
37157
37426
|
parts,
|
|
37158
|
-
|
|
37427
|
+
options2.maxOutputBytes ?? limits.maxInputBytes,
|
|
37159
37428
|
deadline,
|
|
37160
37429
|
check
|
|
37161
37430
|
),
|
|
@@ -41070,9 +41339,9 @@ function snapshotStencilMasterDrop(edit) {
|
|
|
41070
41339
|
y: edit.y
|
|
41071
41340
|
};
|
|
41072
41341
|
}
|
|
41073
|
-
async function editVsdxMasterDrops(source, commands,
|
|
41074
|
-
const limits = { ...DEFAULTS, ...
|
|
41075
|
-
const maxOutput =
|
|
41342
|
+
async function editVsdxMasterDrops(source, commands, options2, lone, apply3) {
|
|
41343
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
41344
|
+
const maxOutput = options2.maxOutputBytes ?? limits.maxInputBytes;
|
|
41076
41345
|
const deadline = Date.now() + limits.maxRuntimeMs;
|
|
41077
41346
|
const check = () => {
|
|
41078
41347
|
if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
@@ -42287,12 +42556,12 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
42287
42556
|
}
|
|
42288
42557
|
|
|
42289
42558
|
// visio/edit-transform-formula.ts
|
|
42290
|
-
function editableTransformCell(roots, edit, node3, check,
|
|
42559
|
+
function editableTransformCell(roots, edit, node3, check, options2 = {}) {
|
|
42291
42560
|
const formula = executableCellFormula(attribute2(node3, "F"));
|
|
42292
42561
|
if (!formula || !analyzeVisioFormula(formula).references.length) return editableCell(node3);
|
|
42293
42562
|
const evaluate = createVisioCellEvaluator(
|
|
42294
|
-
indexCells(roots, { ...
|
|
42295
|
-
{ ...
|
|
42563
|
+
indexCells(roots, { ...options2, check }),
|
|
42564
|
+
{ ...options2, check },
|
|
42296
42565
|
true
|
|
42297
42566
|
);
|
|
42298
42567
|
editableCell(
|
|
@@ -42761,7 +43030,7 @@ async function assertDuplicateScope(pkg, pagePaths, targetPage, newIds, check, s
|
|
|
42761
43030
|
}
|
|
42762
43031
|
|
|
42763
43032
|
// visio/formula-master.ts
|
|
42764
|
-
function analyzeVisioMasterFormula(source,
|
|
43033
|
+
function analyzeVisioMasterFormula(source, options2) {
|
|
42765
43034
|
const ast = parseVisioFormula(source);
|
|
42766
43035
|
const analysis = analyzeVisioFormula(ast);
|
|
42767
43036
|
const references = /* @__PURE__ */ new Map();
|
|
@@ -42782,7 +43051,7 @@ function analyzeVisioMasterFormula(source, options) {
|
|
|
42782
43051
|
if (["TEXTWIDTH", "TEXTHEIGHT", "SHAPETEXT"].includes(node3.name)) {
|
|
42783
43052
|
const text6 = node3.args[0];
|
|
42784
43053
|
const count = node3.name === "TEXTHEIGHT" ? node3.args.length === 2 : node3.args.length === 1;
|
|
42785
|
-
local =
|
|
43054
|
+
local = options2.textFieldFree && count && text6?.kind === "reference" && text6.reference.shapeId === void 0 && text6.reference.cell.toLowerCase() === "thetext";
|
|
42786
43055
|
readsText = true;
|
|
42787
43056
|
}
|
|
42788
43057
|
if (["LUM", "HUE", "SAT"].includes(node3.name)) {
|
|
@@ -43417,16 +43686,16 @@ async function recalculatePageFormulas(pkg, pagesPart, pages, paths, dirty, chec
|
|
|
43417
43686
|
);
|
|
43418
43687
|
}
|
|
43419
43688
|
if (!needed) return;
|
|
43420
|
-
const
|
|
43689
|
+
const options2 = { check, pageContext: after };
|
|
43421
43690
|
const changed = [];
|
|
43422
|
-
for (const cell of indexCells(roots,
|
|
43691
|
+
for (const cell of indexCells(roots, options2).values()) {
|
|
43423
43692
|
if (!cell.node) continue;
|
|
43424
43693
|
const functions = pageFunctions(attribute2(cell.node, "F") ?? "");
|
|
43425
43694
|
const old = before.get(cell.pageId), current = after.get(cell.pageId);
|
|
43426
43695
|
if (functions.has("PAGENUMBER") && old?.pageNumber !== current.pageNumber || functions.has("PAGECOUNT") && old?.pageCount !== current.pageCount)
|
|
43427
43696
|
changed.push(cell);
|
|
43428
43697
|
}
|
|
43429
|
-
for (const id3 of recalculateVisioCells(roots, changed,
|
|
43698
|
+
for (const id3 of recalculateVisioCells(roots, changed, options2)) {
|
|
43430
43699
|
const root2 = roots.get(id3);
|
|
43431
43700
|
const sheet = sheets.get(id3);
|
|
43432
43701
|
if (sheet) {
|
|
@@ -46749,14 +47018,14 @@ async function editVsdxComments(pkg, parts, pages, edits, limits, maxOutput, dea
|
|
|
46749
47018
|
}
|
|
46750
47019
|
|
|
46751
47020
|
// visio/clipboard.ts
|
|
46752
|
-
async function captureVisioClipboard(input, pageId2, shapeIds2,
|
|
47021
|
+
async function captureVisioClipboard(input, pageId2, shapeIds2, options2 = {}) {
|
|
46753
47022
|
pageId2 = clipboardId(pageId2);
|
|
46754
47023
|
if (!Array.isArray(shapeIds2) || !shapeIds2.length || shapeIds2.length > 1e3)
|
|
46755
47024
|
fail("INVALID_CLIPBOARD", "Capture requires one to 1000 selected shapes.");
|
|
46756
47025
|
const selected = shapeIds2.map(clipboardId);
|
|
46757
47026
|
if (new Set(selected).size !== selected.length)
|
|
46758
47027
|
fail("INVALID_CLIPBOARD", "Capture selection must be unique.");
|
|
46759
|
-
const limits = { ...DEFAULTS, ...
|
|
47028
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
46760
47029
|
for (const value3 of Object.values(limits))
|
|
46761
47030
|
if (!Number.isSafeInteger(value3) || value3 <= 0)
|
|
46762
47031
|
fail("INVALID_LIMITS", "Capture limits require positive safe integers.");
|
|
@@ -46843,13 +47112,13 @@ async function retarget(clipboard, bytes, pageId2, limits) {
|
|
|
46843
47112
|
fail("UNSUPPORTED_SUBPROCESS", "The new page does not share the source page settings.");
|
|
46844
47113
|
return { ...clipboard, pageContext: target2.xml };
|
|
46845
47114
|
}
|
|
46846
|
-
async function editVsdxSubprocess(source, edit,
|
|
46847
|
-
const limits = { ...DEFAULTS, ...
|
|
47115
|
+
async function editVsdxSubprocess(source, edit, options2) {
|
|
47116
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
46848
47117
|
const deadline = Date.now() + limits.maxRuntimeMs;
|
|
46849
47118
|
const remaining = () => {
|
|
46850
47119
|
const time = deadline - Date.now();
|
|
46851
47120
|
if (time <= 0) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
46852
|
-
return { ...
|
|
47121
|
+
return { ...options2, limits: { ...options2.limits, maxRuntimeMs: time } };
|
|
46853
47122
|
};
|
|
46854
47123
|
const changed = /* @__PURE__ */ new Set();
|
|
46855
47124
|
const diagnostics = /* @__PURE__ */ new Map();
|
|
@@ -47436,7 +47705,7 @@ function positive2(value3) {
|
|
|
47436
47705
|
fail("INVALID_LIMITS", "Edit limits must be positive safe integers.");
|
|
47437
47706
|
return value3;
|
|
47438
47707
|
}
|
|
47439
|
-
async function editVsdx(input, edits,
|
|
47708
|
+
async function editVsdx(input, edits, options2 = {}) {
|
|
47440
47709
|
const clock = {
|
|
47441
47710
|
deadline: 0,
|
|
47442
47711
|
autoSize: /* @__PURE__ */ new Set(),
|
|
@@ -47444,36 +47713,36 @@ async function editVsdx(input, edits, options = {}) {
|
|
|
47444
47713
|
jumpPages: /* @__PURE__ */ new Set(),
|
|
47445
47714
|
jumpSource: void 0
|
|
47446
47715
|
};
|
|
47447
|
-
const edited = await editVsdxTransaction(input, edits,
|
|
47448
|
-
const resized = await refreshTextSizes(clock.textSizes, edited,
|
|
47716
|
+
const edited = await editVsdxTransaction(input, edits, options2, clock);
|
|
47717
|
+
const resized = await refreshTextSizes(clock.textSizes, edited, options2, clock.deadline);
|
|
47449
47718
|
const result2 = await refreshLineJumpCaches(
|
|
47450
47719
|
clock.jumpPages,
|
|
47451
47720
|
clock.jumpSource,
|
|
47452
47721
|
resized,
|
|
47453
|
-
|
|
47722
|
+
options2,
|
|
47454
47723
|
clock.deadline
|
|
47455
47724
|
);
|
|
47456
47725
|
return growAutoSizePages(
|
|
47457
47726
|
clock.autoSize,
|
|
47458
47727
|
result2,
|
|
47459
47728
|
(bytes, growth) => editVsdxTransaction(bytes, growth, {
|
|
47460
|
-
...
|
|
47461
|
-
limits: { ...
|
|
47729
|
+
...options2,
|
|
47730
|
+
limits: { ...options2.limits, maxRuntimeMs: Math.max(1, clock.deadline - Date.now()) }
|
|
47462
47731
|
})
|
|
47463
47732
|
);
|
|
47464
47733
|
}
|
|
47465
|
-
async function editVsdxTransaction(input, edits,
|
|
47734
|
+
async function editVsdxTransaction(input, edits, options2, clock = {
|
|
47466
47735
|
deadline: 0,
|
|
47467
47736
|
autoSize: /* @__PURE__ */ new Set(),
|
|
47468
47737
|
textSizes: [],
|
|
47469
47738
|
jumpPages: /* @__PURE__ */ new Set(),
|
|
47470
47739
|
jumpSource: void 0
|
|
47471
47740
|
}) {
|
|
47472
|
-
const limits = { ...DEFAULTS, ...
|
|
47741
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
47473
47742
|
for (const value3 of Object.values(limits)) positive2(value3);
|
|
47474
|
-
const maxEdits = positive2(
|
|
47475
|
-
const maxText = positive2(
|
|
47476
|
-
const maxOutput = positive2(
|
|
47743
|
+
const maxEdits = positive2(options2.maxEdits ?? 1e3);
|
|
47744
|
+
const maxText = positive2(options2.maxTextCharacters ?? 1e6);
|
|
47745
|
+
const maxOutput = positive2(options2.maxOutputBytes ?? limits.maxInputBytes);
|
|
47477
47746
|
const deadline = Date.now() + limits.maxRuntimeMs;
|
|
47478
47747
|
clock.deadline = deadline;
|
|
47479
47748
|
const check = () => {
|
|
@@ -47492,13 +47761,13 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
47492
47761
|
if (subprocess) {
|
|
47493
47762
|
if (allCommands.length !== 1)
|
|
47494
47763
|
fail("EDIT_MIXED_SUBPROCESS_TRANSACTION", "A subprocess requires its own transaction.");
|
|
47495
|
-
return editVsdxSubprocess(original, subprocess,
|
|
47764
|
+
return editVsdxSubprocess(original, subprocess, options2);
|
|
47496
47765
|
}
|
|
47497
47766
|
if (allCommands.some(isVisioMasterDrop))
|
|
47498
47767
|
return editVsdxMasterDrops(
|
|
47499
47768
|
original,
|
|
47500
47769
|
allCommands,
|
|
47501
|
-
|
|
47770
|
+
options2,
|
|
47502
47771
|
async (bytes2, instance, info) => {
|
|
47503
47772
|
const opened = await openEditablePackage(bytes2, limits, check);
|
|
47504
47773
|
return editVsdxMasterInstance(
|
|
@@ -47513,7 +47782,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
47513
47782
|
info
|
|
47514
47783
|
);
|
|
47515
47784
|
},
|
|
47516
|
-
(bytes2, rest) => editVsdx(bytes2, rest,
|
|
47785
|
+
(bytes2, rest) => editVsdx(bytes2, rest, options2)
|
|
47517
47786
|
);
|
|
47518
47787
|
const { pkg, parts, pages } = await openEditablePackage(original, limits, check);
|
|
47519
47788
|
const builtIn = await changeStencilShapeToBuiltIn(
|
|
@@ -47522,7 +47791,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
47522
47791
|
pages,
|
|
47523
47792
|
allCommands,
|
|
47524
47793
|
{ limits, maxOutput, deadline, check },
|
|
47525
|
-
(bytes2, edits2) => editVsdx(bytes2, edits2,
|
|
47794
|
+
(bytes2, edits2) => editVsdx(bytes2, edits2, options2)
|
|
47526
47795
|
);
|
|
47527
47796
|
if (builtIn) return builtIn;
|
|
47528
47797
|
if (allCommands.some(isVisioCommentEdit)) {
|
|
@@ -47605,8 +47874,8 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
47605
47874
|
check
|
|
47606
47875
|
);
|
|
47607
47876
|
const moved = await editVsdxTransaction(resized.bytes, commands, {
|
|
47608
|
-
...
|
|
47609
|
-
limits: { ...
|
|
47877
|
+
...options2,
|
|
47878
|
+
limits: { ...options2.limits, maxRuntimeMs: Math.max(1, deadline - Date.now()) }
|
|
47610
47879
|
});
|
|
47611
47880
|
return {
|
|
47612
47881
|
bytes: moved.bytes,
|
|
@@ -48048,8 +48317,8 @@ function documentPart() {
|
|
|
48048
48317
|
});
|
|
48049
48318
|
return document;
|
|
48050
48319
|
}
|
|
48051
|
-
async function createVsdx(
|
|
48052
|
-
const width =
|
|
48320
|
+
async function createVsdx(options2 = {}) {
|
|
48321
|
+
const width = options2.width ?? 8.5, height = options2.height ?? 11;
|
|
48053
48322
|
if (![width, height].every(
|
|
48054
48323
|
(value3) => typeof value3 === "number" && Number.isFinite(value3) && value3 > 0 && value3 <= 1e6
|
|
48055
48324
|
))
|
|
@@ -48122,7 +48391,7 @@ async function createVsdx(options = {}) {
|
|
|
48122
48391
|
Page: "0",
|
|
48123
48392
|
ViewScale: "-1"
|
|
48124
48393
|
});
|
|
48125
|
-
const stencils = [...new Set(
|
|
48394
|
+
const stencils = [...new Set(options2.stencils ?? [])];
|
|
48126
48395
|
if (stencils.some((id3) => !Object.hasOwn(VISIO_STENCIL_FILES, id3)))
|
|
48127
48396
|
fail("INVALID_EDIT", "Unknown built-in stencil.");
|
|
48128
48397
|
stencils.forEach((id3, index2) => {
|