ooxml-core 1.27.2 → 1.28.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-WRJXTPGV.mjs → PptxHandler-AFVUHNJO.mjs} +3 -3
- package/dist/PptxHandler-EZW4YAWL.mjs +4 -0
- package/dist/{PptxHandler-FRQKHTCM.cjs → PptxHandler-WI23AJHM.cjs} +3 -3
- package/dist/{PresentationBuilder-POXKHTV7.mjs → PresentationBuilder-DYEHCRHX.mjs} +2 -2
- package/dist/{PresentationBuilder-YO5YOTA3.cjs → PresentationBuilder-KUNPJTRL.cjs} +5 -5
- package/dist/{PresentationBuilder-LWR5X3JA.mjs → PresentationBuilder-WGTZPVOG.mjs} +3 -3
- package/dist/automation/index.cjs +16 -7
- package/dist/automation/index.mjs +16 -7
- package/dist/chart/index.cjs +16 -7
- package/dist/chart/index.mjs +16 -7
- package/dist/{chunk-36TR3PER.cjs → chunk-A2PC3CBO.cjs} +28 -7
- package/dist/{chunk-XW4XB6P4.mjs → chunk-D7CAHL6J.mjs} +1 -1
- package/dist/{chunk-JJ37PCNR.mjs → chunk-EYCM7RVL.mjs} +28 -7
- package/dist/{chunk-K6DNX3YC.cjs → chunk-IQ7CB7BJ.cjs} +1581 -1232
- package/dist/{chunk-G67MARDL.mjs → chunk-LGSBK3BV.mjs} +258 -258
- package/dist/{chunk-I57SMSU6.mjs → chunk-LNPVKKR5.mjs} +28 -7
- package/dist/{chunk-RNUYMB73.mjs → chunk-N5ROEHEQ.mjs} +509 -160
- package/dist/{chunk-TIQWSSGI.mjs → chunk-RCEHCVLC.mjs} +1 -1
- package/dist/{chunk-3VIPI6IA.mjs → chunk-V33RUK4D.mjs} +5 -5
- package/dist/{chunk-6LCBTFNL.mjs → chunk-YNGMSNF4.mjs} +528 -159
- package/dist/docx/embedded.cjs +16 -7
- package/dist/docx/embedded.mjs +16 -7
- package/dist/docx/index.cjs +16 -7
- package/dist/docx/index.mjs +16 -7
- package/dist/docx/load/index.cjs +16 -7
- package/dist/docx/load/index.mjs +16 -7
- package/dist/index.cjs +16 -7
- package/dist/index.mjs +16 -7
- package/dist/opc/index.cjs +16 -7
- package/dist/opc/index.mjs +16 -7
- package/dist/opc/zip-limits.d.ts +8 -1
- package/dist/opc/zip-limits.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +807 -418
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +6 -6
- package/dist/pptx/chunks/{index-D_d4NTVP.d.ts → index-0slnMhMO.d.ts} +126 -10
- package/dist/pptx/chunks/index-0slnMhMO.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CdRlUz-v.d.ts → index-DP-R2qY1.d.ts} +3 -3
- package/dist/pptx/chunks/{index-CdRlUz-v.d.ts.map → index-DP-R2qY1.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-lwMA6pP5.d.ts → index-OQwOyNYK.d.ts} +4 -4
- package/dist/pptx/chunks/{index-lwMA6pP5.d.ts.map → index-OQwOyNYK.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts → text-operations-dyvh8gyE.d.ts} +23 -1
- package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts.map → text-operations-dyvh8gyE.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +632 -246
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +5 -5
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +1047 -639
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +6 -6
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/pptx/signature-node/index.cjs +28 -7
- package/dist/pptx/signature-node/index.mjs +2 -2
- package/dist/visio/index.cjs +14 -6
- package/dist/visio/index.mjs +14 -6
- package/dist/visio/ui/index.cjs +14 -6
- package/dist/visio/ui/index.mjs +14 -6
- package/dist/xlsx/index.cjs +14 -6
- package/dist/xlsx/index.mjs +14 -6
- package/dist/xlsx/load/index.cjs +14 -6
- package/dist/xlsx/load/index.mjs +14 -6
- package/dist/xlsx/ui/index.cjs +14 -6
- package/dist/xlsx/ui/index.mjs +14 -6
- package/package.json +5 -5
- package/dist/PptxHandler-RETSKQ5E.mjs +0 -4
- package/dist/pptx/chunks/index-D_d4NTVP.d.ts.map +0 -1
|
@@ -1261,7 +1261,7 @@ function ensureArrayLocal(value) {
|
|
|
1261
1261
|
return Array.isArray(value) ? value : value === void 0 ? [] : [value];
|
|
1262
1262
|
}
|
|
1263
1263
|
function countsSignature(counts) {
|
|
1264
|
-
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name,
|
|
1264
|
+
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name, count2]) => `${name}:${count2}`).join(",");
|
|
1265
1265
|
}
|
|
1266
1266
|
function pathSignature(path4) {
|
|
1267
1267
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -4501,7 +4501,7 @@ function resolveLimits(limits) {
|
|
|
4501
4501
|
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
4502
4502
|
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
4503
4503
|
label: limits.label ?? "ZIP",
|
|
4504
|
-
fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
|
|
4504
|
+
fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
|
|
4505
4505
|
};
|
|
4506
4506
|
}
|
|
4507
4507
|
async function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
@@ -4555,7 +4555,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
|
|
|
4555
4555
|
r.fail(
|
|
4556
4556
|
`${r.label} part ${entry2.name} inflates past its declared size`,
|
|
4557
4557
|
r.maxEntryBytes,
|
|
4558
|
-
size > declared ? "declaredSize" : "maxEntryBytes"
|
|
4558
|
+
size > declared ? "declaredSize" : "maxEntryBytes",
|
|
4559
|
+
size
|
|
4559
4560
|
)
|
|
4560
4561
|
);
|
|
4561
4562
|
if (alreadyRead + size > r.maxTotalBytes)
|
|
@@ -4563,7 +4564,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
|
|
|
4563
4564
|
r.fail(
|
|
4564
4565
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
4565
4566
|
r.maxTotalBytes,
|
|
4566
|
-
"maxTotalBytes"
|
|
4567
|
+
"maxTotalBytes",
|
|
4568
|
+
alreadyRead + size
|
|
4567
4569
|
)
|
|
4568
4570
|
);
|
|
4569
4571
|
queue.push(chunk2);
|
|
@@ -4610,7 +4612,8 @@ function guardZip(zip, limits = {}) {
|
|
|
4610
4612
|
throw r.fail(
|
|
4611
4613
|
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
4612
4614
|
r.maxEntries,
|
|
4613
|
-
"maxEntries"
|
|
4615
|
+
"maxEntries",
|
|
4616
|
+
entries.length
|
|
4614
4617
|
);
|
|
4615
4618
|
let declared = 0;
|
|
4616
4619
|
for (const entry2 of entries) {
|
|
@@ -4623,7 +4626,8 @@ function guardZip(zip, limits = {}) {
|
|
|
4623
4626
|
throw r.fail(
|
|
4624
4627
|
`${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
|
|
4625
4628
|
r.maxEntryBytes,
|
|
4626
|
-
"maxEntryBytes"
|
|
4629
|
+
"maxEntryBytes",
|
|
4630
|
+
size
|
|
4627
4631
|
);
|
|
4628
4632
|
declared += size;
|
|
4629
4633
|
}
|
|
@@ -4631,7 +4635,8 @@ function guardZip(zip, limits = {}) {
|
|
|
4631
4635
|
throw r.fail(
|
|
4632
4636
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
4633
4637
|
r.maxTotalBytes,
|
|
4634
|
-
"maxTotalBytes"
|
|
4638
|
+
"maxTotalBytes",
|
|
4639
|
+
declared
|
|
4635
4640
|
);
|
|
4636
4641
|
const produced = /* @__PURE__ */ new Map();
|
|
4637
4642
|
let total = 0;
|
|
@@ -4670,7 +4675,8 @@ async function openZip(input2, limits = {}) {
|
|
|
4670
4675
|
throw r.fail(
|
|
4671
4676
|
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
4672
4677
|
maxInput,
|
|
4673
|
-
"maxInputBytes"
|
|
4678
|
+
"maxInputBytes",
|
|
4679
|
+
bytes.byteLength
|
|
4674
4680
|
);
|
|
4675
4681
|
return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
|
|
4676
4682
|
}
|
|
@@ -4688,11 +4694,14 @@ var init_zip_limits = __esm({
|
|
|
4688
4694
|
limit;
|
|
4689
4695
|
/** The check that failed (absent when the error was built without one). */
|
|
4690
4696
|
kind;
|
|
4697
|
+
/** The observed value, when known (a lower bound for a size found while inflating). */
|
|
4698
|
+
actual;
|
|
4691
4699
|
constructor(message, details) {
|
|
4692
4700
|
super(message);
|
|
4693
4701
|
this.name = "ZipLimitError";
|
|
4694
4702
|
this.limit = details.limit;
|
|
4695
4703
|
this.kind = details.kind;
|
|
4704
|
+
this.actual = details.actual;
|
|
4696
4705
|
}
|
|
4697
4706
|
};
|
|
4698
4707
|
mib = (bytes) => Math.round(bytes / 1048576);
|
|
@@ -4708,15 +4717,27 @@ var init_types2 = __esm({
|
|
|
4708
4717
|
MAX_ZIP_ENTRY_COUNT = 65536;
|
|
4709
4718
|
ZipBombError = class extends Error {
|
|
4710
4719
|
code = "ZIP_BOMB";
|
|
4720
|
+
/** Inflated bytes declared or read when a size limit failed (a lower bound while streaming). */
|
|
4711
4721
|
uncompressedBytes;
|
|
4722
|
+
/** The value of the limit that failed. */
|
|
4712
4723
|
limit;
|
|
4724
|
+
/** Number of archive entries, when the entry-count limit failed. */
|
|
4713
4725
|
entryCount;
|
|
4726
|
+
/**
|
|
4727
|
+
* The `PptxLoadLimits` field behind this error (`maxUncompressedBytes` or
|
|
4728
|
+
* `maxEntries`); `undefined` for a forged size or an unsafe part name.
|
|
4729
|
+
*/
|
|
4730
|
+
loadLimit;
|
|
4731
|
+
/** The observed value for {@link loadLimit}, when known. */
|
|
4732
|
+
actual;
|
|
4714
4733
|
constructor(message, details) {
|
|
4715
4734
|
super(message);
|
|
4716
4735
|
this.name = "ZipBombError";
|
|
4717
4736
|
this.uncompressedBytes = details.uncompressedBytes;
|
|
4718
4737
|
this.limit = details.limit;
|
|
4719
4738
|
this.entryCount = details.entryCount;
|
|
4739
|
+
this.loadLimit = details.loadLimit;
|
|
4740
|
+
this.actual = details.actual;
|
|
4720
4741
|
}
|
|
4721
4742
|
};
|
|
4722
4743
|
}
|
|
@@ -5295,6 +5316,330 @@ var init_PresentationBuilder = __esm({
|
|
|
5295
5316
|
}
|
|
5296
5317
|
});
|
|
5297
5318
|
|
|
5319
|
+
// pptx/core/utils/element-utils.ts
|
|
5320
|
+
function createEditorId(prefix) {
|
|
5321
|
+
const random = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
|
|
5322
|
+
const sequence = (nextEditorIdSequence++).toString(36);
|
|
5323
|
+
return `${prefix}-${Date.now()}-${random}${sequence}`;
|
|
5324
|
+
}
|
|
5325
|
+
function ensureArrayValue(value) {
|
|
5326
|
+
if (!value) {
|
|
5327
|
+
return [];
|
|
5328
|
+
}
|
|
5329
|
+
return Array.isArray(value) ? value : [value];
|
|
5330
|
+
}
|
|
5331
|
+
var nextEditorIdSequence;
|
|
5332
|
+
var init_element_utils = __esm({
|
|
5333
|
+
"pptx/core/utils/element-utils.ts"() {
|
|
5334
|
+
nextEditorIdSequence = 0;
|
|
5335
|
+
}
|
|
5336
|
+
});
|
|
5337
|
+
|
|
5338
|
+
// pptx/core/utils/group-ops.ts
|
|
5339
|
+
function isTemplateElementId(elementId) {
|
|
5340
|
+
return elementId.startsWith("layout-") || elementId.startsWith("master-");
|
|
5341
|
+
}
|
|
5342
|
+
function makeStoreAwareId(intoTemplate, sourceId) {
|
|
5343
|
+
if (!intoTemplate) {
|
|
5344
|
+
return createEditorId("el");
|
|
5345
|
+
}
|
|
5346
|
+
return sourceId.startsWith("master-") ? `master-${createEditorId("el")}` : `layout-${createEditorId("el")}`;
|
|
5347
|
+
}
|
|
5348
|
+
function reassignDescendantIds(element, mintId) {
|
|
5349
|
+
if (element.type !== "group") {
|
|
5350
|
+
return;
|
|
5351
|
+
}
|
|
5352
|
+
for (const child31 of element.children) {
|
|
5353
|
+
const next = mintId(child31);
|
|
5354
|
+
if (next !== void 0) {
|
|
5355
|
+
child31.id = next;
|
|
5356
|
+
}
|
|
5357
|
+
reassignDescendantIds(child31, mintId);
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
function groupElements(elements3, ids, groupId) {
|
|
5361
|
+
const idSet = new Set(ids);
|
|
5362
|
+
const gathered = [];
|
|
5363
|
+
let insertionIndex = -1;
|
|
5364
|
+
for (let i2 = 0; i2 < elements3.length; i2++) {
|
|
5365
|
+
const el = elements3[i2];
|
|
5366
|
+
if (idSet.has(el.id)) {
|
|
5367
|
+
gathered.push(el);
|
|
5368
|
+
if (insertionIndex === -1) {
|
|
5369
|
+
insertionIndex = i2;
|
|
5370
|
+
}
|
|
5371
|
+
}
|
|
5372
|
+
}
|
|
5373
|
+
if (gathered.length < 2) {
|
|
5374
|
+
return { elements: [...elements3], groupId: null };
|
|
5375
|
+
}
|
|
5376
|
+
let minX = gathered[0].x;
|
|
5377
|
+
let minY = gathered[0].y;
|
|
5378
|
+
let maxX = gathered[0].x + gathered[0].width;
|
|
5379
|
+
let maxY = gathered[0].y + gathered[0].height;
|
|
5380
|
+
for (let i2 = 1; i2 < gathered.length; i2++) {
|
|
5381
|
+
const el = gathered[i2];
|
|
5382
|
+
if (el.x < minX) {
|
|
5383
|
+
minX = el.x;
|
|
5384
|
+
}
|
|
5385
|
+
if (el.y < minY) {
|
|
5386
|
+
minY = el.y;
|
|
5387
|
+
}
|
|
5388
|
+
const rx = el.x + el.width;
|
|
5389
|
+
const ry = el.y + el.height;
|
|
5390
|
+
if (rx > maxX) {
|
|
5391
|
+
maxX = rx;
|
|
5392
|
+
}
|
|
5393
|
+
if (ry > maxY) {
|
|
5394
|
+
maxY = ry;
|
|
5395
|
+
}
|
|
5396
|
+
}
|
|
5397
|
+
const children16 = gathered.map((el) => {
|
|
5398
|
+
const child31 = cloneElement(el);
|
|
5399
|
+
child31.x = el.x - minX;
|
|
5400
|
+
child31.y = el.y - minY;
|
|
5401
|
+
return child31;
|
|
5402
|
+
});
|
|
5403
|
+
const group = {
|
|
5404
|
+
type: "group",
|
|
5405
|
+
id: groupId,
|
|
5406
|
+
name: "Group",
|
|
5407
|
+
x: minX,
|
|
5408
|
+
y: minY,
|
|
5409
|
+
width: maxX - minX,
|
|
5410
|
+
height: maxY - minY,
|
|
5411
|
+
children: children16
|
|
5412
|
+
};
|
|
5413
|
+
const remaining = elements3.filter((el) => !idSet.has(el.id));
|
|
5414
|
+
let adjustedIndex = 0;
|
|
5415
|
+
for (let i2 = 0; i2 < insertionIndex; i2++) {
|
|
5416
|
+
if (!idSet.has(elements3[i2].id)) {
|
|
5417
|
+
adjustedIndex++;
|
|
5418
|
+
}
|
|
5419
|
+
}
|
|
5420
|
+
return {
|
|
5421
|
+
elements: [...remaining.slice(0, adjustedIndex), group, ...remaining.slice(adjustedIndex)],
|
|
5422
|
+
groupId
|
|
5423
|
+
};
|
|
5424
|
+
}
|
|
5425
|
+
function ungroupElements(elements3, groupId, childIds, options = {}) {
|
|
5426
|
+
const groupIndex = elements3.findIndex((el) => el.id === groupId);
|
|
5427
|
+
if (groupIndex === -1) {
|
|
5428
|
+
return { elements: [...elements3], childIds: [] };
|
|
5429
|
+
}
|
|
5430
|
+
const group = elements3[groupIndex];
|
|
5431
|
+
if (group.type !== "group") {
|
|
5432
|
+
return { elements: [...elements3], childIds: [] };
|
|
5433
|
+
}
|
|
5434
|
+
const intoTemplate = options.intoTemplate ?? isTemplateElementId(group.id);
|
|
5435
|
+
const usedChildIds = [];
|
|
5436
|
+
const expanded = group.children.map((child31, index2) => {
|
|
5437
|
+
const newChildId = childIds[index2] ?? child31.id;
|
|
5438
|
+
usedChildIds.push(newChildId);
|
|
5439
|
+
const promoted = cloneElement(child31);
|
|
5440
|
+
promoted.id = newChildId;
|
|
5441
|
+
promoted.x = child31.x + group.x;
|
|
5442
|
+
promoted.y = child31.y + group.y;
|
|
5443
|
+
reassignDescendantIds(
|
|
5444
|
+
promoted,
|
|
5445
|
+
(descendant) => isTemplateElementId(descendant.id) === intoTemplate ? void 0 : makeStoreAwareId(intoTemplate, newChildId)
|
|
5446
|
+
);
|
|
5447
|
+
return promoted;
|
|
5448
|
+
});
|
|
5449
|
+
return {
|
|
5450
|
+
elements: [...elements3.slice(0, groupIndex), ...expanded, ...elements3.slice(groupIndex + 1)],
|
|
5451
|
+
childIds: usedChildIds
|
|
5452
|
+
};
|
|
5453
|
+
}
|
|
5454
|
+
var init_group_ops = __esm({
|
|
5455
|
+
"pptx/core/utils/group-ops.ts"() {
|
|
5456
|
+
init_clone_utils();
|
|
5457
|
+
init_element_utils();
|
|
5458
|
+
}
|
|
5459
|
+
});
|
|
5460
|
+
|
|
5461
|
+
// pptx/core/core/load-limits.ts
|
|
5462
|
+
function resolvePptxLoadLimits(options = {}) {
|
|
5463
|
+
const resolved = { ...DEFAULT_PPTX_LOAD_LIMITS };
|
|
5464
|
+
const legacy = options.maxUncompressedBytes;
|
|
5465
|
+
if (typeof legacy === "number" && legacy > 0) {
|
|
5466
|
+
resolved.maxUncompressedBytes = legacy;
|
|
5467
|
+
}
|
|
5468
|
+
const limits = options.limits;
|
|
5469
|
+
if (limits === void 0 || limits === null) {
|
|
5470
|
+
return resolved;
|
|
5471
|
+
}
|
|
5472
|
+
for (const name of LIMIT_NAMES) {
|
|
5473
|
+
const value = limits[name];
|
|
5474
|
+
if (value === void 0) {
|
|
5475
|
+
continue;
|
|
5476
|
+
}
|
|
5477
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
5478
|
+
throw new RangeError(`limits.${name} must be a positive finite number`);
|
|
5479
|
+
}
|
|
5480
|
+
if (name === "maxEntries" && value > MAX_ZIP_ENTRY_COUNT) {
|
|
5481
|
+
throw new RangeError(`limits.maxEntries must not exceed ${MAX_ZIP_ENTRY_COUNT}`);
|
|
5482
|
+
}
|
|
5483
|
+
resolved[name] = value;
|
|
5484
|
+
}
|
|
5485
|
+
return resolved;
|
|
5486
|
+
}
|
|
5487
|
+
function createPptxZipBombError(message, details) {
|
|
5488
|
+
const { limit, kind, actual } = details;
|
|
5489
|
+
if (kind === "maxEntries") {
|
|
5490
|
+
return new ZipBombError(message, {
|
|
5491
|
+
limit,
|
|
5492
|
+
loadLimit: "maxEntries",
|
|
5493
|
+
...actual === void 0 ? {} : { entryCount: actual, actual }
|
|
5494
|
+
});
|
|
5495
|
+
}
|
|
5496
|
+
if (kind === "maxEntryBytes" || kind === "maxTotalBytes") {
|
|
5497
|
+
return new ZipBombError(message, {
|
|
5498
|
+
limit,
|
|
5499
|
+
loadLimit: "maxUncompressedBytes",
|
|
5500
|
+
...actual === void 0 ? {} : { uncompressedBytes: actual, actual }
|
|
5501
|
+
});
|
|
5502
|
+
}
|
|
5503
|
+
return new ZipBombError(message, { limit });
|
|
5504
|
+
}
|
|
5505
|
+
function assertPptxInputWithinLimits(byteLength, limits) {
|
|
5506
|
+
if (byteLength > limits.maxInputBytes) {
|
|
5507
|
+
throw new PptxLoadLimitError(
|
|
5508
|
+
`PPTX input is ${count(byteLength)} bytes, more than the maxInputBytes limit of ${count(limits.maxInputBytes)}`,
|
|
5509
|
+
"maxInputBytes",
|
|
5510
|
+
limits.maxInputBytes,
|
|
5511
|
+
byteLength
|
|
5512
|
+
);
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
function assertPptxTextWithinLimits(text2, limits) {
|
|
5516
|
+
const maximum = limits.maxInputBytes;
|
|
5517
|
+
if (text2.length * 3 <= maximum) {
|
|
5518
|
+
return;
|
|
5519
|
+
}
|
|
5520
|
+
const bytes = text2.length > maximum ? text2.length : utf8ByteLengthPast(text2, maximum);
|
|
5521
|
+
if (bytes > maximum) {
|
|
5522
|
+
throw new PptxLoadLimitError(
|
|
5523
|
+
`PPTX input is at least ${count(bytes)} bytes, more than the maxInputBytes limit of ${count(maximum)}`,
|
|
5524
|
+
"maxInputBytes",
|
|
5525
|
+
maximum,
|
|
5526
|
+
bytes
|
|
5527
|
+
);
|
|
5528
|
+
}
|
|
5529
|
+
}
|
|
5530
|
+
function utf8ByteLengthPast(text2, maximum) {
|
|
5531
|
+
let bytes = 0;
|
|
5532
|
+
for (let index2 = 0; index2 < text2.length && bytes <= maximum; index2++) {
|
|
5533
|
+
const unit = text2.charCodeAt(index2);
|
|
5534
|
+
if (unit < 128) {
|
|
5535
|
+
bytes += 1;
|
|
5536
|
+
} else if (unit < 2048) {
|
|
5537
|
+
bytes += 2;
|
|
5538
|
+
} else if (unit >= 55296 && unit <= 56319 && isLowSurrogate(text2.charCodeAt(index2 + 1))) {
|
|
5539
|
+
bytes += 4;
|
|
5540
|
+
index2++;
|
|
5541
|
+
} else {
|
|
5542
|
+
bytes += 3;
|
|
5543
|
+
}
|
|
5544
|
+
}
|
|
5545
|
+
return bytes;
|
|
5546
|
+
}
|
|
5547
|
+
function isLowSurrogate(unit) {
|
|
5548
|
+
return unit >= 56320 && unit <= 57343;
|
|
5549
|
+
}
|
|
5550
|
+
function assertPptxSlideCountWithinLimits(slideCount, limits) {
|
|
5551
|
+
if (slideCount > limits.maxSlides) {
|
|
5552
|
+
throw new PptxLoadLimitError(
|
|
5553
|
+
`PPTX presentation has ${count(slideCount)} slides, more than the maxSlides limit of ${count(limits.maxSlides)}`,
|
|
5554
|
+
"maxSlides",
|
|
5555
|
+
limits.maxSlides,
|
|
5556
|
+
slideCount
|
|
5557
|
+
);
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
function countPptxShapesWithinLimits(counted, elements3, limits) {
|
|
5561
|
+
const maximum = limits.maxShapes;
|
|
5562
|
+
if (maximum === Number.POSITIVE_INFINITY) {
|
|
5563
|
+
return counted;
|
|
5564
|
+
}
|
|
5565
|
+
const total = counted + countAuthoredElements(elements3);
|
|
5566
|
+
if (total > maximum) {
|
|
5567
|
+
throw new PptxLoadLimitError(
|
|
5568
|
+
`PPTX presentation has at least ${count(total)} shapes, more than the maxShapes limit of ${count(maximum)}`,
|
|
5569
|
+
"maxShapes",
|
|
5570
|
+
maximum,
|
|
5571
|
+
total
|
|
5572
|
+
);
|
|
5573
|
+
}
|
|
5574
|
+
return total;
|
|
5575
|
+
}
|
|
5576
|
+
function countAuthoredElements(elements3) {
|
|
5577
|
+
let total = 0;
|
|
5578
|
+
const lists = [elements3];
|
|
5579
|
+
const positions = [0];
|
|
5580
|
+
while (lists.length > 0) {
|
|
5581
|
+
const top = lists.length - 1;
|
|
5582
|
+
const list3 = lists[top];
|
|
5583
|
+
const position3 = positions[top];
|
|
5584
|
+
if (position3 >= list3.length) {
|
|
5585
|
+
lists.pop();
|
|
5586
|
+
positions.pop();
|
|
5587
|
+
continue;
|
|
5588
|
+
}
|
|
5589
|
+
positions[top] = position3 + 1;
|
|
5590
|
+
const element = list3[position3];
|
|
5591
|
+
if (typeof element !== "object" || element === null) {
|
|
5592
|
+
continue;
|
|
5593
|
+
}
|
|
5594
|
+
const { id, type, children: children16 } = element;
|
|
5595
|
+
if (typeof id === "string" && isTemplateElementId(id)) {
|
|
5596
|
+
continue;
|
|
5597
|
+
}
|
|
5598
|
+
total++;
|
|
5599
|
+
if (type === "group" && Array.isArray(children16) && children16.length > 0) {
|
|
5600
|
+
lists.push(children16);
|
|
5601
|
+
positions.push(0);
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
return total;
|
|
5605
|
+
}
|
|
5606
|
+
var DEFAULT_PPTX_LOAD_LIMITS, LIMIT_NAMES, PptxLoadLimitError, count;
|
|
5607
|
+
var init_load_limits = __esm({
|
|
5608
|
+
"pptx/core/core/load-limits.ts"() {
|
|
5609
|
+
init_group_ops();
|
|
5610
|
+
init_types2();
|
|
5611
|
+
DEFAULT_PPTX_LOAD_LIMITS = Object.freeze({
|
|
5612
|
+
maxInputBytes: Number.POSITIVE_INFINITY,
|
|
5613
|
+
maxUncompressedBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
5614
|
+
maxEntries: MAX_ZIP_ENTRY_COUNT,
|
|
5615
|
+
maxSlides: Number.POSITIVE_INFINITY,
|
|
5616
|
+
maxShapes: Number.POSITIVE_INFINITY
|
|
5617
|
+
});
|
|
5618
|
+
LIMIT_NAMES = Object.keys(DEFAULT_PPTX_LOAD_LIMITS);
|
|
5619
|
+
PptxLoadLimitError = class extends Error {
|
|
5620
|
+
code = "PPTX_LOAD_LIMIT";
|
|
5621
|
+
/** The limit that was exceeded. */
|
|
5622
|
+
limit;
|
|
5623
|
+
/** The value of that limit. */
|
|
5624
|
+
maximum;
|
|
5625
|
+
/**
|
|
5626
|
+
* The observed value: exact for `maxSlides` and for `maxInputBytes` on
|
|
5627
|
+
* `load()`; for `maxShapes`, and for `maxInputBytes` on `loadFromJson()`
|
|
5628
|
+
* (which stops counting once past the limit), a lower bound.
|
|
5629
|
+
*/
|
|
5630
|
+
actual;
|
|
5631
|
+
constructor(message, limit, maximum, actual) {
|
|
5632
|
+
super(message);
|
|
5633
|
+
this.name = "PptxLoadLimitError";
|
|
5634
|
+
this.limit = limit;
|
|
5635
|
+
this.maximum = maximum;
|
|
5636
|
+
this.actual = actual;
|
|
5637
|
+
}
|
|
5638
|
+
};
|
|
5639
|
+
count = (value) => value.toLocaleString("en-US");
|
|
5640
|
+
}
|
|
5641
|
+
});
|
|
5642
|
+
|
|
5298
5643
|
// geometry/indexed.ts
|
|
5299
5644
|
function at(items, index2) {
|
|
5300
5645
|
const value = items[index2];
|
|
@@ -15213,148 +15558,6 @@ var init_preset_adjustment_validation = __esm({
|
|
|
15213
15558
|
}
|
|
15214
15559
|
});
|
|
15215
15560
|
|
|
15216
|
-
// pptx/core/utils/element-utils.ts
|
|
15217
|
-
function createEditorId(prefix) {
|
|
15218
|
-
const random = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
|
|
15219
|
-
const sequence = (nextEditorIdSequence++).toString(36);
|
|
15220
|
-
return `${prefix}-${Date.now()}-${random}${sequence}`;
|
|
15221
|
-
}
|
|
15222
|
-
function ensureArrayValue(value) {
|
|
15223
|
-
if (!value) {
|
|
15224
|
-
return [];
|
|
15225
|
-
}
|
|
15226
|
-
return Array.isArray(value) ? value : [value];
|
|
15227
|
-
}
|
|
15228
|
-
var nextEditorIdSequence;
|
|
15229
|
-
var init_element_utils = __esm({
|
|
15230
|
-
"pptx/core/utils/element-utils.ts"() {
|
|
15231
|
-
nextEditorIdSequence = 0;
|
|
15232
|
-
}
|
|
15233
|
-
});
|
|
15234
|
-
|
|
15235
|
-
// pptx/core/utils/group-ops.ts
|
|
15236
|
-
function isTemplateElementId(elementId) {
|
|
15237
|
-
return elementId.startsWith("layout-") || elementId.startsWith("master-");
|
|
15238
|
-
}
|
|
15239
|
-
function makeStoreAwareId(intoTemplate, sourceId) {
|
|
15240
|
-
if (!intoTemplate) {
|
|
15241
|
-
return createEditorId("el");
|
|
15242
|
-
}
|
|
15243
|
-
return sourceId.startsWith("master-") ? `master-${createEditorId("el")}` : `layout-${createEditorId("el")}`;
|
|
15244
|
-
}
|
|
15245
|
-
function reassignDescendantIds(element, mintId) {
|
|
15246
|
-
if (element.type !== "group") {
|
|
15247
|
-
return;
|
|
15248
|
-
}
|
|
15249
|
-
for (const child31 of element.children) {
|
|
15250
|
-
const next = mintId(child31);
|
|
15251
|
-
if (next !== void 0) {
|
|
15252
|
-
child31.id = next;
|
|
15253
|
-
}
|
|
15254
|
-
reassignDescendantIds(child31, mintId);
|
|
15255
|
-
}
|
|
15256
|
-
}
|
|
15257
|
-
function groupElements(elements3, ids, groupId) {
|
|
15258
|
-
const idSet = new Set(ids);
|
|
15259
|
-
const gathered = [];
|
|
15260
|
-
let insertionIndex = -1;
|
|
15261
|
-
for (let i2 = 0; i2 < elements3.length; i2++) {
|
|
15262
|
-
const el = elements3[i2];
|
|
15263
|
-
if (idSet.has(el.id)) {
|
|
15264
|
-
gathered.push(el);
|
|
15265
|
-
if (insertionIndex === -1) {
|
|
15266
|
-
insertionIndex = i2;
|
|
15267
|
-
}
|
|
15268
|
-
}
|
|
15269
|
-
}
|
|
15270
|
-
if (gathered.length < 2) {
|
|
15271
|
-
return { elements: [...elements3], groupId: null };
|
|
15272
|
-
}
|
|
15273
|
-
let minX = gathered[0].x;
|
|
15274
|
-
let minY = gathered[0].y;
|
|
15275
|
-
let maxX = gathered[0].x + gathered[0].width;
|
|
15276
|
-
let maxY = gathered[0].y + gathered[0].height;
|
|
15277
|
-
for (let i2 = 1; i2 < gathered.length; i2++) {
|
|
15278
|
-
const el = gathered[i2];
|
|
15279
|
-
if (el.x < minX) {
|
|
15280
|
-
minX = el.x;
|
|
15281
|
-
}
|
|
15282
|
-
if (el.y < minY) {
|
|
15283
|
-
minY = el.y;
|
|
15284
|
-
}
|
|
15285
|
-
const rx = el.x + el.width;
|
|
15286
|
-
const ry = el.y + el.height;
|
|
15287
|
-
if (rx > maxX) {
|
|
15288
|
-
maxX = rx;
|
|
15289
|
-
}
|
|
15290
|
-
if (ry > maxY) {
|
|
15291
|
-
maxY = ry;
|
|
15292
|
-
}
|
|
15293
|
-
}
|
|
15294
|
-
const children16 = gathered.map((el) => {
|
|
15295
|
-
const child31 = cloneElement(el);
|
|
15296
|
-
child31.x = el.x - minX;
|
|
15297
|
-
child31.y = el.y - minY;
|
|
15298
|
-
return child31;
|
|
15299
|
-
});
|
|
15300
|
-
const group = {
|
|
15301
|
-
type: "group",
|
|
15302
|
-
id: groupId,
|
|
15303
|
-
name: "Group",
|
|
15304
|
-
x: minX,
|
|
15305
|
-
y: minY,
|
|
15306
|
-
width: maxX - minX,
|
|
15307
|
-
height: maxY - minY,
|
|
15308
|
-
children: children16
|
|
15309
|
-
};
|
|
15310
|
-
const remaining = elements3.filter((el) => !idSet.has(el.id));
|
|
15311
|
-
let adjustedIndex = 0;
|
|
15312
|
-
for (let i2 = 0; i2 < insertionIndex; i2++) {
|
|
15313
|
-
if (!idSet.has(elements3[i2].id)) {
|
|
15314
|
-
adjustedIndex++;
|
|
15315
|
-
}
|
|
15316
|
-
}
|
|
15317
|
-
return {
|
|
15318
|
-
elements: [...remaining.slice(0, adjustedIndex), group, ...remaining.slice(adjustedIndex)],
|
|
15319
|
-
groupId
|
|
15320
|
-
};
|
|
15321
|
-
}
|
|
15322
|
-
function ungroupElements(elements3, groupId, childIds, options = {}) {
|
|
15323
|
-
const groupIndex = elements3.findIndex((el) => el.id === groupId);
|
|
15324
|
-
if (groupIndex === -1) {
|
|
15325
|
-
return { elements: [...elements3], childIds: [] };
|
|
15326
|
-
}
|
|
15327
|
-
const group = elements3[groupIndex];
|
|
15328
|
-
if (group.type !== "group") {
|
|
15329
|
-
return { elements: [...elements3], childIds: [] };
|
|
15330
|
-
}
|
|
15331
|
-
const intoTemplate = options.intoTemplate ?? isTemplateElementId(group.id);
|
|
15332
|
-
const usedChildIds = [];
|
|
15333
|
-
const expanded = group.children.map((child31, index2) => {
|
|
15334
|
-
const newChildId = childIds[index2] ?? child31.id;
|
|
15335
|
-
usedChildIds.push(newChildId);
|
|
15336
|
-
const promoted = cloneElement(child31);
|
|
15337
|
-
promoted.id = newChildId;
|
|
15338
|
-
promoted.x = child31.x + group.x;
|
|
15339
|
-
promoted.y = child31.y + group.y;
|
|
15340
|
-
reassignDescendantIds(
|
|
15341
|
-
promoted,
|
|
15342
|
-
(descendant) => isTemplateElementId(descendant.id) === intoTemplate ? void 0 : makeStoreAwareId(intoTemplate, newChildId)
|
|
15343
|
-
);
|
|
15344
|
-
return promoted;
|
|
15345
|
-
});
|
|
15346
|
-
return {
|
|
15347
|
-
elements: [...elements3.slice(0, groupIndex), ...expanded, ...elements3.slice(groupIndex + 1)],
|
|
15348
|
-
childIds: usedChildIds
|
|
15349
|
-
};
|
|
15350
|
-
}
|
|
15351
|
-
var init_group_ops = __esm({
|
|
15352
|
-
"pptx/core/utils/group-ops.ts"() {
|
|
15353
|
-
init_clone_utils();
|
|
15354
|
-
init_element_utils();
|
|
15355
|
-
}
|
|
15356
|
-
});
|
|
15357
|
-
|
|
15358
15561
|
// pptx/core/utils/presentation-collections.ts
|
|
15359
15562
|
function remapReferenceList(references, mapping, removed) {
|
|
15360
15563
|
const result = [];
|
|
@@ -16735,9 +16938,9 @@ function decodeSlot(dir, id, majorVersion, warnings) {
|
|
|
16735
16938
|
};
|
|
16736
16939
|
}
|
|
16737
16940
|
function readDirectory(dir, majorVersion, strict, warnings) {
|
|
16738
|
-
const
|
|
16941
|
+
const count2 = Math.floor(dir.length / DIR_ENTRY_SIZE);
|
|
16739
16942
|
const slots = [];
|
|
16740
|
-
for (let id = 0; id <
|
|
16943
|
+
for (let id = 0; id < count2; id++)
|
|
16741
16944
|
slots.push(decodeSlot(dir, id, majorVersion, warnings));
|
|
16742
16945
|
const roots = slots.filter((slot) => slot.type === ENTRY_TYPE_ROOT);
|
|
16743
16946
|
if (roots.length !== 1 || !roots[0].nameValid)
|
|
@@ -17278,10 +17481,10 @@ function writeFatChain(fat, chain2) {
|
|
|
17278
17481
|
fat[chain2.sectors[i2]] = i2 < chain2.sectors.length - 1 ? chain2.sectors[i2 + 1] : ENDOFCHAIN;
|
|
17279
17482
|
}
|
|
17280
17483
|
}
|
|
17281
|
-
function writeFatRun(fat, firstSector,
|
|
17282
|
-
for (let i2 = 0; i2 <
|
|
17484
|
+
function writeFatRun(fat, firstSector, count2) {
|
|
17485
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
17283
17486
|
const sector = firstSector + i2;
|
|
17284
|
-
fat[sector] = i2 <
|
|
17487
|
+
fat[sector] = i2 < count2 - 1 ? sector + 1 : ENDOFCHAIN;
|
|
17285
17488
|
}
|
|
17286
17489
|
}
|
|
17287
17490
|
function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorSize) {
|
|
@@ -17799,21 +18002,21 @@ function parseChartFormulaRange(formula2) {
|
|
|
17799
18002
|
}
|
|
17800
18003
|
return { sheetName, start, end };
|
|
17801
18004
|
}
|
|
17802
|
-
function expandRangeAddresses(range,
|
|
18005
|
+
function expandRangeAddresses(range, count2) {
|
|
17803
18006
|
const { start, end } = range;
|
|
17804
|
-
if (
|
|
18007
|
+
if (count2 <= 0) {
|
|
17805
18008
|
return void 0;
|
|
17806
18009
|
}
|
|
17807
18010
|
if (start.col === end.col && start.row === end.row) {
|
|
17808
|
-
return
|
|
18011
|
+
return count2 === 1 ? [formatCellAddress(start)] : void 0;
|
|
17809
18012
|
}
|
|
17810
18013
|
if (start.col === end.col) {
|
|
17811
18014
|
const length = end.row - start.row + 1;
|
|
17812
|
-
return length ===
|
|
18015
|
+
return length === count2 ? Array.from({ length }, (_, i2) => formatCellAddress({ col: start.col, row: start.row + i2 })) : void 0;
|
|
17813
18016
|
}
|
|
17814
18017
|
if (start.row === end.row) {
|
|
17815
18018
|
const length = end.col - start.col + 1;
|
|
17816
|
-
return length ===
|
|
18019
|
+
return length === count2 ? Array.from({ length }, (_, i2) => formatCellAddress({ col: start.col + i2, row: start.row })) : void 0;
|
|
17817
18020
|
}
|
|
17818
18021
|
return void 0;
|
|
17819
18022
|
}
|
|
@@ -19729,8 +19932,8 @@ function fcLcbFieldOffset(fib, key2) {
|
|
|
19729
19932
|
}
|
|
19730
19933
|
function readFcLcbAt(wordDoc, fib, index2) {
|
|
19731
19934
|
const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
|
|
19732
|
-
const
|
|
19733
|
-
if (!Number.isInteger(index2) || index2 < 0 || index2 >=
|
|
19935
|
+
const count2 = view.getUint16(fib.fibRgFcLcbOffset - 2, true);
|
|
19936
|
+
if (!Number.isInteger(index2) || index2 < 0 || index2 >= count2 || fib.fibRgFcLcbCount !== void 0 && fib.fibRgFcLcbCount !== count2)
|
|
19734
19937
|
throw new Error("FIB fc/lcb index outside declared array");
|
|
19735
19938
|
const off = fib.fibRgFcLcbOffset + index2 * 8;
|
|
19736
19939
|
return { fc: view.getUint32(off, true), lcb: view.getUint32(off + 4, true) };
|
|
@@ -19962,7 +20165,7 @@ function appendCompoundAllocations(input2, existingFatIds, payloads, sectorSize
|
|
|
19962
20165
|
const sectorCount = input2.length / sectorSize - 1;
|
|
19963
20166
|
const entriesPerFat = sectorSize / 4;
|
|
19964
20167
|
const counts = payloads.map((payload) => Math.ceil(payload.length / sectorSize));
|
|
19965
|
-
const payloadSectors = counts.reduce((sum,
|
|
20168
|
+
const payloadSectors = counts.reduce((sum, count2) => sum + count2, 0);
|
|
19966
20169
|
let fatCount = existingFatIds.length;
|
|
19967
20170
|
while (sectorCount + payloadSectors + fatCount - existingFatIds.length > fatCount * entriesPerFat)
|
|
19968
20171
|
fatCount++;
|
|
@@ -20047,21 +20250,21 @@ function resizeMiniCompoundStream(input2, fat, fatIds, root, target, replacement
|
|
|
20047
20250
|
output3.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20048
20251
|
return output3.bytes;
|
|
20049
20252
|
}
|
|
20050
|
-
const firstMini = Math.ceil(root.size / MINI),
|
|
20051
|
-
const newRootSize =
|
|
20253
|
+
const firstMini = Math.ceil(root.size / MINI), count2 = Math.ceil(replacement.length / MINI);
|
|
20254
|
+
const newRootSize = count2 ? (firstMini + count2) * MINI : root.size;
|
|
20052
20255
|
const newRoot = new Uint8Array(newRootSize);
|
|
20053
20256
|
rootSectors.forEach((id, i2) => newRoot.set(input2.subarray((id + 1) * SECTOR, (id + 1) * SECTOR + Math.min(SECTOR, root.size - i2 * SECTOR)), i2 * SECTOR));
|
|
20054
|
-
if (
|
|
20257
|
+
if (count2)
|
|
20055
20258
|
newRoot.set(replacement, firstMini * MINI);
|
|
20056
|
-
const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini +
|
|
20259
|
+
const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini + count2) / 128));
|
|
20057
20260
|
const newMiniFat = new Uint8Array(newMiniFatCount * SECTOR).fill(255);
|
|
20058
20261
|
miniFatSectors.forEach((id, i2) => newMiniFat.set(input2.subarray((id + 1) * SECTOR, (id + 2) * SECTOR), i2 * SECTOR));
|
|
20059
20262
|
const miniView = new DataView(newMiniFat.buffer);
|
|
20060
20263
|
if (wasMini)
|
|
20061
20264
|
for (const id of oldChain)
|
|
20062
20265
|
miniView.setUint32(id * 4, FREE2, true);
|
|
20063
|
-
for (let i2 = 0; i2 <
|
|
20064
|
-
miniView.setUint32((firstMini + i2) * 4, i2 + 1 ===
|
|
20266
|
+
for (let i2 = 0; i2 < count2; i2++)
|
|
20267
|
+
miniView.setUint32((firstMini + i2) * 4, i2 + 1 === count2 ? END3 : firstMini + i2 + 1, true);
|
|
20065
20268
|
const output2 = appendCompoundAllocations(input2, fatIds, [newRoot, newMiniFat]);
|
|
20066
20269
|
if (!output2)
|
|
20067
20270
|
return void 0;
|
|
@@ -20071,7 +20274,7 @@ function resizeMiniCompoundStream(input2, fat, fatIds, root, target, replacement
|
|
|
20071
20274
|
output2.view.setUint32(root.offset + 120, newRootSize, true);
|
|
20072
20275
|
output2.view.setUint32(60, output2.chains[1][0] ?? END3, true);
|
|
20073
20276
|
output2.view.setUint32(64, newMiniFatCount, true);
|
|
20074
|
-
output2.view.setUint32(target.offset + 116,
|
|
20277
|
+
output2.view.setUint32(target.offset + 116, count2 ? firstMini : END3, true);
|
|
20075
20278
|
output2.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20076
20279
|
return output2.bytes;
|
|
20077
20280
|
}
|
|
@@ -21572,9 +21775,9 @@ var init_deflate_encode = __esm({
|
|
|
21572
21775
|
len = 0;
|
|
21573
21776
|
acc = 0;
|
|
21574
21777
|
nbits = 0;
|
|
21575
|
-
bits(value,
|
|
21778
|
+
bits(value, count2) {
|
|
21576
21779
|
this.acc |= value << this.nbits;
|
|
21577
|
-
this.nbits +=
|
|
21780
|
+
this.nbits += count2;
|
|
21578
21781
|
while (this.nbits >= 8) {
|
|
21579
21782
|
this.push(this.acc & 255);
|
|
21580
21783
|
this.acc >>>= 8;
|
|
@@ -21582,12 +21785,12 @@ var init_deflate_encode = __esm({
|
|
|
21582
21785
|
}
|
|
21583
21786
|
}
|
|
21584
21787
|
/** Huffman codes are packed most-significant bit first. */
|
|
21585
|
-
code(value,
|
|
21788
|
+
code(value, count2) {
|
|
21586
21789
|
let reversed = 0;
|
|
21587
|
-
for (let i2 = 0; i2 <
|
|
21790
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
21588
21791
|
reversed = reversed << 1 | value >>> i2 & 1;
|
|
21589
21792
|
}
|
|
21590
|
-
this.bits(reversed,
|
|
21793
|
+
this.bits(reversed, count2);
|
|
21591
21794
|
}
|
|
21592
21795
|
finish() {
|
|
21593
21796
|
if (this.nbits > 0) {
|
|
@@ -25959,12 +26162,12 @@ function functionValue(condition, point2, lookup) {
|
|
|
25959
26162
|
if (!target) {
|
|
25960
26163
|
return void 0;
|
|
25961
26164
|
}
|
|
25962
|
-
const { pos: pos2, count } = siblingPosition(target, ptType);
|
|
26165
|
+
const { pos: pos2, count: count2 } = siblingPosition(target, ptType);
|
|
25963
26166
|
if (condition.func === "pos") {
|
|
25964
26167
|
return pos2;
|
|
25965
26168
|
}
|
|
25966
26169
|
if (condition.func === "revPos") {
|
|
25967
|
-
return
|
|
26170
|
+
return count2 - pos2 + 1;
|
|
25968
26171
|
}
|
|
25969
26172
|
return condition.func === "posEven" ? pos2 % 2 === 0 ? 1 : 0 : pos2 % 2 === 1 ? 1 : 0;
|
|
25970
26173
|
}
|
|
@@ -29051,19 +29254,19 @@ function pointTypeMatches(node2, pointType2) {
|
|
|
29051
29254
|
}
|
|
29052
29255
|
return node2.nodeType === pointType2;
|
|
29053
29256
|
}
|
|
29054
|
-
function selectRange(nodes, start,
|
|
29055
|
-
if (start === void 0 &&
|
|
29257
|
+
function selectRange(nodes, start, count2) {
|
|
29258
|
+
if (start === void 0 && count2 === void 0) {
|
|
29056
29259
|
return nodes;
|
|
29057
29260
|
}
|
|
29058
29261
|
const zeroBasedStart = Math.max(0, (start ?? 1) - 1);
|
|
29059
|
-
const take2 =
|
|
29262
|
+
const take2 = count2 !== void 0 && count2 > 0 ? count2 : nodes.length - zeroBasedStart;
|
|
29060
29263
|
return nodes.slice(zeroBasedStart, zeroBasedStart + take2);
|
|
29061
29264
|
}
|
|
29062
|
-
function applyPointTypeAndRange(nodes, pointType2, start,
|
|
29265
|
+
function applyPointTypeAndRange(nodes, pointType2, start, count2) {
|
|
29063
29266
|
const filtered = pointType2 ? nodes.filter((n) => pointTypeMatches(n, pointType2)) : nodes;
|
|
29064
|
-
return selectRange(filtered, start,
|
|
29267
|
+
return selectRange(filtered, start, count2);
|
|
29065
29268
|
}
|
|
29066
|
-
function resolveAxisNodes(nodes, axis, pointTypes, start,
|
|
29269
|
+
function resolveAxisNodes(nodes, axis, pointTypes, start, count2, context) {
|
|
29067
29270
|
if (axis.length === 0) {
|
|
29068
29271
|
return void 0;
|
|
29069
29272
|
}
|
|
@@ -29093,21 +29296,21 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
29093
29296
|
let current;
|
|
29094
29297
|
let nextHop;
|
|
29095
29298
|
if (axis[0] === "root" && axis.length > 1) {
|
|
29096
|
-
current = applyPointTypeAndRange(roots, pointTypes?.[1], start?.[1],
|
|
29299
|
+
current = applyPointTypeAndRange(roots, pointTypes?.[1], start?.[1], count2?.[1]);
|
|
29097
29300
|
nextHop = 2;
|
|
29098
29301
|
} else if (axis[0] === "root") {
|
|
29099
|
-
current = applyPointTypeAndRange(roots, pointTypes?.[0], start?.[0],
|
|
29302
|
+
current = applyPointTypeAndRange(roots, pointTypes?.[0], start?.[0], count2?.[0]);
|
|
29100
29303
|
nextHop = 1;
|
|
29101
29304
|
} else if (context !== void 0) {
|
|
29102
29305
|
current = applyPointTypeAndRange(
|
|
29103
29306
|
navigateAxisHop(context, axis[0], nodes, childrenOf, parentOf, roots),
|
|
29104
29307
|
pointTypes?.[0],
|
|
29105
29308
|
start?.[0],
|
|
29106
|
-
|
|
29309
|
+
count2?.[0]
|
|
29107
29310
|
);
|
|
29108
29311
|
nextHop = 1;
|
|
29109
29312
|
} else {
|
|
29110
|
-
current = applyPointTypeAndRange(roots, pointTypes?.[0], start?.[0],
|
|
29313
|
+
current = applyPointTypeAndRange(roots, pointTypes?.[0], start?.[0], count2?.[0]);
|
|
29111
29314
|
nextHop = 1;
|
|
29112
29315
|
}
|
|
29113
29316
|
for (let hop = nextHop; hop < axis.length; hop += 1) {
|
|
@@ -29115,13 +29318,13 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
29115
29318
|
navigateAxisHop(current, axis[hop], nodes, childrenOf, parentOf, roots),
|
|
29116
29319
|
pointTypes?.[hop],
|
|
29117
29320
|
start?.[hop],
|
|
29118
|
-
|
|
29321
|
+
count2?.[hop]
|
|
29119
29322
|
);
|
|
29120
29323
|
}
|
|
29121
29324
|
return current;
|
|
29122
29325
|
}
|
|
29123
|
-
function resolveAxisCount(nodes, axis, pointTypes, start,
|
|
29124
|
-
return resolveAxisNodes(nodes, axis, pointTypes, start,
|
|
29326
|
+
function resolveAxisCount(nodes, axis, pointTypes, start, count2, context) {
|
|
29327
|
+
return resolveAxisNodes(nodes, axis, pointTypes, start, count2, context)?.length;
|
|
29125
29328
|
}
|
|
29126
29329
|
var init_smartart_layout_interpreter_axis_count = __esm({
|
|
29127
29330
|
"diagram/layout/smartart-layout-interpreter-axis-count.ts"() {
|
|
@@ -29147,14 +29350,14 @@ function depthFromAnchor(node2, anchorId, byId) {
|
|
|
29147
29350
|
}
|
|
29148
29351
|
return void 0;
|
|
29149
29352
|
}
|
|
29150
|
-
function resolveAxisMaxDepth(nodes, axis, pointTypes, start,
|
|
29353
|
+
function resolveAxisMaxDepth(nodes, axis, pointTypes, start, count2, anchor2) {
|
|
29151
29354
|
if (anchor2.length === 0) {
|
|
29152
29355
|
return void 0;
|
|
29153
29356
|
}
|
|
29154
29357
|
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
29155
29358
|
let max = 0;
|
|
29156
29359
|
for (const anchorPoint of anchor2) {
|
|
29157
|
-
const resolved = resolveAxisNodes(nodes, axis, pointTypes, start,
|
|
29360
|
+
const resolved = resolveAxisNodes(nodes, axis, pointTypes, start, count2, [anchorPoint]);
|
|
29158
29361
|
if (resolved === void 0) {
|
|
29159
29362
|
return void 0;
|
|
29160
29363
|
}
|
|
@@ -29640,8 +29843,8 @@ function selectArrangedNodes(node2, flat, roots) {
|
|
|
29640
29843
|
const followSibCounts = collectFollowSibNodeCounts(node2);
|
|
29641
29844
|
if (followSibCounts.length > 0) {
|
|
29642
29845
|
for (const i2 of [...indices]) {
|
|
29643
|
-
for (const
|
|
29644
|
-
for (let k = 1; k <=
|
|
29846
|
+
for (const count2 of followSibCounts) {
|
|
29847
|
+
for (let k = 1; k <= count2; k++) {
|
|
29645
29848
|
const j = i2 + k;
|
|
29646
29849
|
if (j < base2.length) {
|
|
29647
29850
|
indices.add(j);
|
|
@@ -31216,12 +31419,12 @@ function buildCycleRingExtensions(parentCentre, parentNode, context, path4) {
|
|
|
31216
31419
|
const baseAngleRad = dist > 1e-6 ? Math.atan2(dy, dx) : 0;
|
|
31217
31420
|
const halfExtent = Math.max(context.itemWidth, context.itemHeight) / 2;
|
|
31218
31421
|
const radius = context.itemWidth / 2 + Math.max(0, context.gapPx) + halfExtent;
|
|
31219
|
-
const
|
|
31422
|
+
const count2 = children16.length;
|
|
31220
31423
|
const spanRad = context.fanSpanDeg * DEG_TO_RAD2;
|
|
31221
31424
|
const nodes = [];
|
|
31222
31425
|
const connectors2 = [];
|
|
31223
31426
|
children16.forEach((child31, i2) => {
|
|
31224
|
-
const angle =
|
|
31427
|
+
const angle = count2 === 1 ? baseAngleRad : baseAngleRad - spanRad / 2 + spanRad * i2 / (count2 - 1);
|
|
31225
31428
|
const cx = parentCentre.x + Math.cos(angle) * radius;
|
|
31226
31429
|
const cy = parentCentre.y + Math.sin(angle) * radius;
|
|
31227
31430
|
const key2 = `${context.elementId}-cycle-ext-${path4}-${i2}`;
|
|
@@ -31234,7 +31437,7 @@ function buildCycleRingExtensions(parentCentre, parentNode, context, path4) {
|
|
|
31234
31437
|
height: context.itemHeight,
|
|
31235
31438
|
node: child31,
|
|
31236
31439
|
index: i2,
|
|
31237
|
-
total:
|
|
31440
|
+
total: count2,
|
|
31238
31441
|
palette: context.palette,
|
|
31239
31442
|
style: context.style,
|
|
31240
31443
|
ctx: context.ctx,
|
|
@@ -32411,12 +32614,12 @@ var init_smartart_layout_interpreter_linear_content_size = __esm({
|
|
|
32411
32614
|
});
|
|
32412
32615
|
|
|
32413
32616
|
// diagram/layout/smartart-layout-interpreter-axis-range.ts
|
|
32414
|
-
function positionRange(start,
|
|
32617
|
+
function positionRange(start, count2, step, total) {
|
|
32415
32618
|
const out = [];
|
|
32416
32619
|
const s = step > 0 ? step : 1;
|
|
32417
32620
|
for (let i2 = Math.max(0, start - 1); i2 < total; i2 += s) {
|
|
32418
32621
|
out.push(i2 + 1);
|
|
32419
|
-
if (
|
|
32622
|
+
if (count2 !== void 0 && count2 > 0 && out.length >= count2) {
|
|
32420
32623
|
break;
|
|
32421
32624
|
}
|
|
32422
32625
|
}
|
|
@@ -32436,8 +32639,8 @@ function compoundChildIds(role, node2, childrenOf) {
|
|
|
32436
32639
|
}
|
|
32437
32640
|
const children16 = childrenOf.get(node2.id) ?? [];
|
|
32438
32641
|
const start = role.presentationOf?.start?.[chIndex] ?? 1;
|
|
32439
|
-
const
|
|
32440
|
-
const positions = positionRange(start,
|
|
32642
|
+
const count2 = role.presentationOf?.count?.[chIndex];
|
|
32643
|
+
const positions = positionRange(start, count2, 1, children16.length);
|
|
32441
32644
|
const ids = [];
|
|
32442
32645
|
for (const position3 of positions) {
|
|
32443
32646
|
const child31 = children16[position3 - 1];
|
|
@@ -33011,9 +33214,9 @@ function arrangeSnake2(plan, nodes, box, palette, style, elementId, index2 = EMP
|
|
|
33011
33214
|
let y = INSET + row * (cellH + gapY);
|
|
33012
33215
|
if (centerIncompleteLines) {
|
|
33013
33216
|
const key2 = flowDir === "row" ? row : col;
|
|
33014
|
-
const
|
|
33015
|
-
if (
|
|
33016
|
-
const shift = (fullLineCount -
|
|
33217
|
+
const count2 = lineCounts.get(key2) ?? fullLineCount;
|
|
33218
|
+
if (count2 < fullLineCount) {
|
|
33219
|
+
const shift = (fullLineCount - count2) * (flowDir === "row" ? cellW + gapX : cellH + gapY) / 2;
|
|
33017
33220
|
if (flowDir === "row") {
|
|
33018
33221
|
x += shift;
|
|
33019
33222
|
} else {
|
|
@@ -33927,26 +34130,26 @@ var init_smartart_layout_interpreter_composite_foreach = __esm({
|
|
|
33927
34130
|
});
|
|
33928
34131
|
|
|
33929
34132
|
// diagram/hierarchy/smartart-hierarchy-pitch.ts
|
|
33930
|
-
function computeAxisPitch(dimension, margin, itemSize,
|
|
33931
|
-
const n = Math.max(1,
|
|
34133
|
+
function computeAxisPitch(dimension, margin, itemSize, count2, fixedGapRatio) {
|
|
34134
|
+
const n = Math.max(1, count2);
|
|
33932
34135
|
const gap = n <= 1 ? 0 : fixedGapRatio !== void 0 ? itemSize * Math.max(0, fixedGapRatio) : Math.max(0, (dimension - margin - n * itemSize) / (n - 1));
|
|
33933
34136
|
const pitch = itemSize + gap;
|
|
33934
34137
|
const centeredShift = (dimension - n * pitch + margin) / 2;
|
|
33935
34138
|
const maxShift = dimension - n * itemSize - gap * (n - 0.5);
|
|
33936
34139
|
return { pitch, shift: Math.min(centeredShift, maxShift) };
|
|
33937
34140
|
}
|
|
33938
|
-
function centeredAxisPitch(dimension, itemSize, gapRatio,
|
|
33939
|
-
const n = Math.max(1,
|
|
34141
|
+
function centeredAxisPitch(dimension, itemSize, gapRatio, count2) {
|
|
34142
|
+
const n = Math.max(1, count2);
|
|
33940
34143
|
const gap = n > 1 ? itemSize * Math.max(0, gapRatio) : 0;
|
|
33941
34144
|
const pitch = itemSize + gap;
|
|
33942
34145
|
const span = n * itemSize + Math.max(0, n - 1) * gap;
|
|
33943
34146
|
const shift = (dimension - span) / 2;
|
|
33944
34147
|
return { pitch, shift };
|
|
33945
34148
|
}
|
|
33946
|
-
function compositeFanPitch(dimension, boxW, compositeWidthFactor, cardOffsetXRatio, sibSpRatio,
|
|
34149
|
+
function compositeFanPitch(dimension, boxW, compositeWidthFactor, cardOffsetXRatio, sibSpRatio, count2) {
|
|
33947
34150
|
const compositeW = compositeWidthFactor ? boxW / compositeWidthFactor : boxW;
|
|
33948
34151
|
const cardOffsetX = cardOffsetXRatio * compositeW;
|
|
33949
|
-
const centred = centeredAxisPitch(dimension, compositeW, sibSpRatio,
|
|
34152
|
+
const centred = centeredAxisPitch(dimension, compositeW, sibSpRatio, count2);
|
|
33950
34153
|
const correction = cardOffsetX + boxW / 2 - centred.pitch / 2;
|
|
33951
34154
|
return { pitch: centred.pitch, shift: centred.shift + correction };
|
|
33952
34155
|
}
|
|
@@ -34047,16 +34250,16 @@ function childAxisSpec(template, childCount) {
|
|
|
34047
34250
|
const ownIndex = axis.indexOf("ch");
|
|
34048
34251
|
if (ownIndex >= 0) {
|
|
34049
34252
|
const start = template.presentationOf?.start?.[ownIndex] ?? 1;
|
|
34050
|
-
const
|
|
34051
|
-
return { positions: positionRange(start,
|
|
34253
|
+
const count2 = template.presentationOf?.count?.[ownIndex];
|
|
34254
|
+
return { positions: positionRange(start, count2, 1, childCount), fold };
|
|
34052
34255
|
}
|
|
34053
34256
|
const origin = template.forEachOrigin;
|
|
34054
34257
|
const originIndex = origin?.axis?.indexOf("ch") ?? -1;
|
|
34055
34258
|
if (origin && originIndex >= 0) {
|
|
34056
34259
|
const start = origin.start?.[originIndex] ?? 1;
|
|
34057
|
-
const
|
|
34260
|
+
const count2 = origin.count?.[originIndex];
|
|
34058
34261
|
const step = origin.step?.[originIndex] ?? 1;
|
|
34059
|
-
return { positions: positionRange(start,
|
|
34262
|
+
return { positions: positionRange(start, count2, step, childCount), fold };
|
|
34060
34263
|
}
|
|
34061
34264
|
return void 0;
|
|
34062
34265
|
}
|
|
@@ -34252,8 +34455,8 @@ function slotRect(slot, box, absX, absY) {
|
|
|
34252
34455
|
}
|
|
34253
34456
|
function arrangeByOrder(slotted, nodes, box, absX, absY, ctx, fontCtx) {
|
|
34254
34457
|
const perPoint = representativeSlotsPerPoint(slotted, nodes.length);
|
|
34255
|
-
const
|
|
34256
|
-
const slots = perPoint.slice(0,
|
|
34458
|
+
const count2 = Math.min(perPoint.length, nodes.length);
|
|
34459
|
+
const slots = perPoint.slice(0, count2).map((entry2) => slotRect(entry2, box, absX, absY));
|
|
34257
34460
|
const fontFit = fontCtx ? resolveSharedFontFit(
|
|
34258
34461
|
fontCtx,
|
|
34259
34462
|
perPoint[0]?.node,
|
|
@@ -34265,7 +34468,7 @@ function arrangeByOrder(slotted, nodes, box, absX, absY, ctx, fontCtx) {
|
|
|
34265
34468
|
}))
|
|
34266
34469
|
) : void 0;
|
|
34267
34470
|
const rendered = [];
|
|
34268
|
-
for (let i2 = 0; i2 <
|
|
34471
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
34269
34472
|
const slot = slots[i2];
|
|
34270
34473
|
rendered.push(
|
|
34271
34474
|
presetBoxNode({
|
|
@@ -34276,7 +34479,7 @@ function arrangeByOrder(slotted, nodes, box, absX, absY, ctx, fontCtx) {
|
|
|
34276
34479
|
height: slot.height,
|
|
34277
34480
|
node: nodes[i2],
|
|
34278
34481
|
index: i2,
|
|
34279
|
-
total:
|
|
34482
|
+
total: count2,
|
|
34280
34483
|
palette: ctx.palette,
|
|
34281
34484
|
style: ctx.style,
|
|
34282
34485
|
fontSizeOverride: fontFit?.rootSizePx,
|
|
@@ -34321,9 +34524,9 @@ var init_smartart_layout_interpreter_composite_ring = __esm({
|
|
|
34321
34524
|
});
|
|
34322
34525
|
|
|
34323
34526
|
// diagram/layout/smartart-layout-interpreter-composite-pairs.ts
|
|
34324
|
-
function collectSelfDesPairs(selfSlots, desSlots, allChildren, nodes, box, absX, absY, childrenOf,
|
|
34527
|
+
function collectSelfDesPairs(selfSlots, desSlots, allChildren, nodes, box, absX, absY, childrenOf, count2) {
|
|
34325
34528
|
const pairs = [];
|
|
34326
|
-
for (let i2 = 0; i2 <
|
|
34529
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
34327
34530
|
const node2 = nodes[i2];
|
|
34328
34531
|
const selfRect = resolveSlot(selfSlots[i2].dims, box, absX, absY);
|
|
34329
34532
|
const desSlotted = desSlots[i2];
|
|
@@ -34416,7 +34619,7 @@ function arrangeByPresentationOf(view, slotted, allChildren, nodes, flat, box, a
|
|
|
34416
34619
|
}
|
|
34417
34620
|
const desSlots = slotsWithAxis(slotted, "des");
|
|
34418
34621
|
const childRepeaterSlots = slotted.filter((slot) => !slot.node.presentationOf);
|
|
34419
|
-
const
|
|
34622
|
+
const count2 = Math.min(selfSlots.length, nodes.length);
|
|
34420
34623
|
const pairs = collectSelfDesPairs(
|
|
34421
34624
|
selfSlots,
|
|
34422
34625
|
desSlots,
|
|
@@ -34426,14 +34629,14 @@ function arrangeByPresentationOf(view, slotted, allChildren, nodes, flat, box, a
|
|
|
34426
34629
|
absX,
|
|
34427
34630
|
absY,
|
|
34428
34631
|
childrenOf,
|
|
34429
|
-
|
|
34632
|
+
count2
|
|
34430
34633
|
);
|
|
34431
34634
|
const fontFit = resolveFontFitFromPairs(fontCtx, selfSlots[0]?.node, pairs);
|
|
34432
34635
|
const rendered = [];
|
|
34433
|
-
for (let i2 = 0; i2 <
|
|
34636
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
34434
34637
|
const { node: node2, selfRect, selfLayoutNode, desSlot } = pairs[i2];
|
|
34435
34638
|
rendered.push(
|
|
34436
|
-
...renderAnchoredPair(node2, i2,
|
|
34639
|
+
...renderAnchoredPair(node2, i2, count2, selfRect, selfLayoutNode, desSlot, ctx, fontFit)
|
|
34437
34640
|
);
|
|
34438
34641
|
for (const wrapperSlot of childRepeaterSlots) {
|
|
34439
34642
|
rendered.push(
|
|
@@ -34466,7 +34669,7 @@ function arrangeByPresentationOf(view, slotted, allChildren, nodes, flat, box, a
|
|
|
34466
34669
|
absY,
|
|
34467
34670
|
childrenOf,
|
|
34468
34671
|
ctx,
|
|
34469
|
-
|
|
34672
|
+
count2
|
|
34470
34673
|
)
|
|
34471
34674
|
);
|
|
34472
34675
|
return rendered;
|
|
@@ -35183,11 +35386,11 @@ var init_smartart_hierarchy_orgchart_tree = __esm({
|
|
|
35183
35386
|
// diagram/hierarchy/smartart-hierarchy-hang-depth.ts
|
|
35184
35387
|
function countDescendants(t, orgChart) {
|
|
35185
35388
|
const { normal } = partitionChildren(t, orgChart);
|
|
35186
|
-
let
|
|
35389
|
+
let count2 = normal.length;
|
|
35187
35390
|
for (const child31 of normal) {
|
|
35188
|
-
|
|
35391
|
+
count2 += countDescendants(child31, orgChart);
|
|
35189
35392
|
}
|
|
35190
|
-
return
|
|
35393
|
+
return count2;
|
|
35191
35394
|
}
|
|
35192
35395
|
function fanContinues(t, perRow, orgChart, siblingCount, normalCount) {
|
|
35193
35396
|
const chPrefFanEligible = Number.isFinite(perRow) && siblingCount === perRow && normalCount >= perRow;
|
|
@@ -35324,7 +35527,7 @@ var init_smartart_hierarchy_fan_aware_width = __esm({
|
|
|
35324
35527
|
});
|
|
35325
35528
|
|
|
35326
35529
|
// diagram/hierarchy/smartart-hierarchy-fold-depth.ts
|
|
35327
|
-
function endsInUnboundedDescendantHop(axis,
|
|
35530
|
+
function endsInUnboundedDescendantHop(axis, count2) {
|
|
35328
35531
|
if (!axis || axis.length === 0) {
|
|
35329
35532
|
return false;
|
|
35330
35533
|
}
|
|
@@ -35333,7 +35536,7 @@ function endsInUnboundedDescendantHop(axis, count) {
|
|
|
35333
35536
|
if (lastAxis !== "des" && lastAxis !== "desOrSelf") {
|
|
35334
35537
|
return false;
|
|
35335
35538
|
}
|
|
35336
|
-
const lastCount =
|
|
35539
|
+
const lastCount = count2?.[lastIndex];
|
|
35337
35540
|
return lastCount === void 0 || lastCount === 0;
|
|
35338
35541
|
}
|
|
35339
35542
|
function hierarchyLeafFoldsDescendants(node2) {
|
|
@@ -35665,17 +35868,17 @@ var init_smartart_hierarchy_hanging_box = __esm({
|
|
|
35665
35868
|
// diagram/hierarchy/smartart-hierarchy-hanging-fold.ts
|
|
35666
35869
|
function countRows(t, level2, orgChart, fold) {
|
|
35667
35870
|
const { assistants, normal } = partitionChildren(t, orgChart);
|
|
35668
|
-
let
|
|
35871
|
+
let count2 = 1 + assistants.length;
|
|
35669
35872
|
if (normal.length === 0) {
|
|
35670
|
-
return
|
|
35873
|
+
return count2;
|
|
35671
35874
|
}
|
|
35672
35875
|
if (fold && level2 >= 1) {
|
|
35673
|
-
return
|
|
35876
|
+
return count2;
|
|
35674
35877
|
}
|
|
35675
35878
|
for (const child31 of normal) {
|
|
35676
|
-
|
|
35879
|
+
count2 += countRows(child31, level2 + 1, orgChart, fold);
|
|
35677
35880
|
}
|
|
35678
|
-
return
|
|
35881
|
+
return count2;
|
|
35679
35882
|
}
|
|
35680
35883
|
function countHangingRows(roots, orgChart, fold) {
|
|
35681
35884
|
return roots.reduce((sum, root) => sum + countRows(root, 0, orgChart, fold), 0);
|
|
@@ -40576,8 +40779,8 @@ function readPairs(element, vt) {
|
|
|
40576
40779
|
const out = [];
|
|
40577
40780
|
for (let i2 = 0; i2 + 1 < variants.length; i2 += 2) {
|
|
40578
40781
|
const name = variants[i2]?.textContent ?? "";
|
|
40579
|
-
const
|
|
40580
|
-
out.push({ name, count: Number.isFinite(
|
|
40782
|
+
const count2 = Number.parseInt(variants[i2 + 1]?.textContent ?? "", 10);
|
|
40783
|
+
out.push({ name, count: Number.isFinite(count2) ? count2 : 0 });
|
|
40581
40784
|
}
|
|
40582
40785
|
return out;
|
|
40583
40786
|
}
|
|
@@ -40794,9 +40997,9 @@ var init_custom = __esm({
|
|
|
40794
40997
|
function titleGroups(headingPairs, titlesOfParts) {
|
|
40795
40998
|
let offset = 0;
|
|
40796
40999
|
return headingPairs.map((pair) => {
|
|
40797
|
-
const
|
|
40798
|
-
const titles = titlesOfParts.slice(offset, offset +
|
|
40799
|
-
offset +=
|
|
41000
|
+
const count2 = Math.max(0, pair.count);
|
|
41001
|
+
const titles = titlesOfParts.slice(offset, offset + count2);
|
|
41002
|
+
offset += count2;
|
|
40800
41003
|
return { name: pair.name, titles };
|
|
40801
41004
|
});
|
|
40802
41005
|
}
|
|
@@ -66691,7 +66894,7 @@ function parsedParagraphSignature(paragraph2) {
|
|
|
66691
66894
|
return signatureOf(counts);
|
|
66692
66895
|
}
|
|
66693
66896
|
function signatureOf(counts) {
|
|
66694
|
-
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name,
|
|
66897
|
+
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name, count2]) => `${name}:${count2}`).join(",");
|
|
66695
66898
|
}
|
|
66696
66899
|
function collectParsedParagraphs2(root) {
|
|
66697
66900
|
const result = [];
|
|
@@ -70038,23 +70241,23 @@ function classify(chars, index2) {
|
|
|
70038
70241
|
}
|
|
70039
70242
|
function countParagraphWords(text2) {
|
|
70040
70243
|
const chars = Array.from(text2);
|
|
70041
|
-
let
|
|
70244
|
+
let count2 = 0;
|
|
70042
70245
|
let previous = "none";
|
|
70043
70246
|
for (let index2 = 0; index2 < chars.length; index2++) {
|
|
70044
70247
|
const kind = classify(chars, index2);
|
|
70045
70248
|
if (kind === "space") {
|
|
70046
70249
|
if (previous === "none" || previous === "control") {
|
|
70047
|
-
|
|
70250
|
+
count2++;
|
|
70048
70251
|
}
|
|
70049
70252
|
previous = "space";
|
|
70050
70253
|
continue;
|
|
70051
70254
|
}
|
|
70052
70255
|
if (kind === "ideograph" || kind === "control" || kind !== previous) {
|
|
70053
|
-
|
|
70256
|
+
count2++;
|
|
70054
70257
|
}
|
|
70055
70258
|
previous = kind;
|
|
70056
70259
|
}
|
|
70057
|
-
return
|
|
70260
|
+
return count2;
|
|
70058
70261
|
}
|
|
70059
70262
|
var LINE_BREAK_CHAR, WORD_CHAR, DIGIT_CHAR, IDEOGRAPH_CHAR, SPACE_CHAR, WORD_JOINERS, NUMBER_JOINERS;
|
|
70060
70263
|
var init_app_properties_word_count = __esm({
|
|
@@ -72955,10 +73158,10 @@ function assertAfterAnimationClearSupported(effectCTn) {
|
|
|
72955
73158
|
if (!isXmlObject5(sub)) return;
|
|
72956
73159
|
const countAfterFlags = (value) => {
|
|
72957
73160
|
if (Array.isArray(value))
|
|
72958
|
-
return value.reduce((
|
|
73161
|
+
return value.reduce((count2, child31) => count2 + countAfterFlags(child31), 0);
|
|
72959
73162
|
if (!isXmlObject5(value)) return 0;
|
|
72960
73163
|
return Object.entries(value).reduce(
|
|
72961
|
-
(
|
|
73164
|
+
(count2, [key2, child31]) => count2 + (key2 === "@_afterEffect" && ["1", "true"].includes(String(child31)) ? 1 : countAfterFlags(child31)),
|
|
72962
73165
|
0
|
|
72963
73166
|
);
|
|
72964
73167
|
};
|
|
@@ -94802,8 +95005,8 @@ function reorderContainer(node2, rawInner) {
|
|
|
94802
95005
|
if (isGroupedByTag(children16.map((child31) => child31.tag))) {
|
|
94803
95006
|
return;
|
|
94804
95007
|
}
|
|
94805
|
-
for (const [tag,
|
|
94806
|
-
if (ensureItems(node2[tag]).length !==
|
|
95008
|
+
for (const [tag, count2] of occurrence) {
|
|
95009
|
+
if (ensureItems(node2[tag]).length !== count2) {
|
|
94807
95010
|
return;
|
|
94808
95011
|
}
|
|
94809
95012
|
}
|
|
@@ -94825,8 +95028,8 @@ function annotateOmmlSiblingOrder(xml, parsed) {
|
|
|
94825
95028
|
return;
|
|
94826
95029
|
}
|
|
94827
95030
|
const nodes = collectParsedOmathNodes(parsed);
|
|
94828
|
-
const
|
|
94829
|
-
for (let index2 = 0; index2 <
|
|
95031
|
+
const count2 = Math.min(fragments.length, nodes.length);
|
|
95032
|
+
for (let index2 = 0; index2 < count2; index2++) {
|
|
94830
95033
|
if (fragments[index2]) {
|
|
94831
95034
|
reorderContainer(nodes[index2], fragments[index2]);
|
|
94832
95035
|
}
|
|
@@ -95966,6 +96169,180 @@ var init_eot_parser = __esm({
|
|
|
95966
96169
|
}
|
|
95967
96170
|
});
|
|
95968
96171
|
|
|
96172
|
+
// pptx/core/utils/deferred-embedded-font.ts
|
|
96173
|
+
function resolveEmbeddedFontGuid(source) {
|
|
96174
|
+
if (isEotFormat(source.originalPartBytes)) {
|
|
96175
|
+
return void 0;
|
|
96176
|
+
}
|
|
96177
|
+
const { fontKey } = source;
|
|
96178
|
+
const fromKey = fontKey ? extractGuidFromPartName(fontKey) ?? fontKey.replace(/[{}]/g, "").trim() : null;
|
|
96179
|
+
return fromKey || extractGuidFromPartName(source.partPath) || void 0;
|
|
96180
|
+
}
|
|
96181
|
+
function hasSfntSignature(bytes) {
|
|
96182
|
+
if (bytes.length < 4) {
|
|
96183
|
+
return false;
|
|
96184
|
+
}
|
|
96185
|
+
const [v0, v1, v2, v3] = bytes;
|
|
96186
|
+
return v0 === 0 && v1 === 1 && v2 === 0 && v3 === 0 || v0 === 79 && v1 === 84 && v2 === 84 && v3 === 79 || v0 === 116 && v1 === 116 && v2 === 99 && v3 === 102 || v0 === 119 && v1 === 79 && v2 === 70 && (v3 === 70 || v3 === 50);
|
|
96187
|
+
}
|
|
96188
|
+
function warnInvalidSignature(name, bytes) {
|
|
96189
|
+
const hex5 = Array.from(bytes.subarray(0, 4), (b) => b.toString(16)).join(",");
|
|
96190
|
+
console.warn(
|
|
96191
|
+
`[pptx-viewer] Embedded font "${name}" has invalid sfnt header [${hex5}] after processing; skipping (web font fallback will be used)`
|
|
96192
|
+
);
|
|
96193
|
+
}
|
|
96194
|
+
function isEmbeddedFontPartPlausible(source) {
|
|
96195
|
+
const bytes = source.originalPartBytes;
|
|
96196
|
+
if (bytes.length === 0) {
|
|
96197
|
+
return false;
|
|
96198
|
+
}
|
|
96199
|
+
if (isEotFormat(bytes)) {
|
|
96200
|
+
return true;
|
|
96201
|
+
}
|
|
96202
|
+
const guid3 = resolveEmbeddedFontGuid(source);
|
|
96203
|
+
if (!guid3) {
|
|
96204
|
+
console.warn(
|
|
96205
|
+
`[pptx-viewer] Embedded font "${source.name}" at "${source.partPath}" has no fontKey attribute and no GUID in filename; skipping`
|
|
96206
|
+
);
|
|
96207
|
+
return false;
|
|
96208
|
+
}
|
|
96209
|
+
const header = deobfuscateFont(bytes.subarray(0, Math.min(bytes.length, 32)), guid3);
|
|
96210
|
+
if (header.length < 4) {
|
|
96211
|
+
return false;
|
|
96212
|
+
}
|
|
96213
|
+
if (!hasSfntSignature(header)) {
|
|
96214
|
+
warnInvalidSignature(source.name, header);
|
|
96215
|
+
return false;
|
|
96216
|
+
}
|
|
96217
|
+
return true;
|
|
96218
|
+
}
|
|
96219
|
+
function uint8ArrayToBase64(bytes) {
|
|
96220
|
+
let binary = "";
|
|
96221
|
+
const chunkSize = 8192;
|
|
96222
|
+
for (let i2 = 0; i2 < bytes.length; i2 += chunkSize) {
|
|
96223
|
+
const chunk2 = bytes.subarray(i2, Math.min(i2 + chunkSize, bytes.length));
|
|
96224
|
+
for (let j = 0; j < chunk2.length; j++) {
|
|
96225
|
+
binary += String.fromCharCode(chunk2[j]);
|
|
96226
|
+
}
|
|
96227
|
+
}
|
|
96228
|
+
return btoa(binary);
|
|
96229
|
+
}
|
|
96230
|
+
function decodeEmbeddedFontPart(source) {
|
|
96231
|
+
const { name, partPath, originalPartBytes } = source;
|
|
96232
|
+
try {
|
|
96233
|
+
let fontData;
|
|
96234
|
+
const fontGuid = resolveEmbeddedFontGuid(source);
|
|
96235
|
+
if (isEotFormat(originalPartBytes)) {
|
|
96236
|
+
const extracted = extractFontFromEot(originalPartBytes);
|
|
96237
|
+
if (!extracted) {
|
|
96238
|
+
const header = parseEotHeader(originalPartBytes);
|
|
96239
|
+
console.info(
|
|
96240
|
+
`[pptx-viewer] Embedded font "${name}" uses EOT format${header?.isCompressed ? " with MTX compression" : ""}; extraction failed, will use web font fallback`
|
|
96241
|
+
);
|
|
96242
|
+
return null;
|
|
96243
|
+
}
|
|
96244
|
+
fontData = extracted.fontData;
|
|
96245
|
+
} else if (fontGuid) {
|
|
96246
|
+
fontData = deobfuscateFont(originalPartBytes, fontGuid);
|
|
96247
|
+
} else {
|
|
96248
|
+
console.warn(
|
|
96249
|
+
`[pptx-viewer] Embedded font "${name}" at "${partPath}" has no fontKey attribute and no GUID in filename; skipping`
|
|
96250
|
+
);
|
|
96251
|
+
return null;
|
|
96252
|
+
}
|
|
96253
|
+
if (fontData.length < 4) {
|
|
96254
|
+
return null;
|
|
96255
|
+
}
|
|
96256
|
+
if (!hasSfntSignature(fontData)) {
|
|
96257
|
+
warnInvalidSignature(name, fontData);
|
|
96258
|
+
return null;
|
|
96259
|
+
}
|
|
96260
|
+
const format = detectFontFormat(fontData);
|
|
96261
|
+
const mimeType = format === "woff2" ? "font/woff2" : format === "woff" ? "font/woff" : format === "opentype" ? "font/otf" : "font/ttf";
|
|
96262
|
+
return {
|
|
96263
|
+
name,
|
|
96264
|
+
dataUrl: `data:${mimeType};base64,${uint8ArrayToBase64(fontData)}`,
|
|
96265
|
+
bold: source.bold,
|
|
96266
|
+
italic: source.italic,
|
|
96267
|
+
format,
|
|
96268
|
+
rawFontData: fontData,
|
|
96269
|
+
partPath,
|
|
96270
|
+
fontGuid,
|
|
96271
|
+
originalRId: source.originalRId,
|
|
96272
|
+
originalPartBytes
|
|
96273
|
+
};
|
|
96274
|
+
} catch {
|
|
96275
|
+
return null;
|
|
96276
|
+
}
|
|
96277
|
+
}
|
|
96278
|
+
function createDeferredEmbeddedFont(source) {
|
|
96279
|
+
const fontGuid = resolveEmbeddedFontGuid(source);
|
|
96280
|
+
let fields;
|
|
96281
|
+
let pending;
|
|
96282
|
+
const decode3 = () => {
|
|
96283
|
+
if (!fields) {
|
|
96284
|
+
const decoded = decodeEmbeddedFontPart(source);
|
|
96285
|
+
fields = {
|
|
96286
|
+
dataUrl: decoded?.dataUrl ?? "",
|
|
96287
|
+
format: decoded?.format,
|
|
96288
|
+
rawFontData: decoded?.rawFontData
|
|
96289
|
+
};
|
|
96290
|
+
}
|
|
96291
|
+
return fields;
|
|
96292
|
+
};
|
|
96293
|
+
const font = {
|
|
96294
|
+
name: source.name,
|
|
96295
|
+
get dataUrl() {
|
|
96296
|
+
return decode3().dataUrl;
|
|
96297
|
+
},
|
|
96298
|
+
set dataUrl(value) {
|
|
96299
|
+
decode3().dataUrl = value;
|
|
96300
|
+
},
|
|
96301
|
+
bold: source.bold,
|
|
96302
|
+
italic: source.italic,
|
|
96303
|
+
get format() {
|
|
96304
|
+
return decode3().format;
|
|
96305
|
+
},
|
|
96306
|
+
set format(value) {
|
|
96307
|
+
decode3().format = value;
|
|
96308
|
+
},
|
|
96309
|
+
get rawFontData() {
|
|
96310
|
+
return decode3().rawFontData;
|
|
96311
|
+
},
|
|
96312
|
+
set rawFontData(value) {
|
|
96313
|
+
decode3().rawFontData = value;
|
|
96314
|
+
},
|
|
96315
|
+
partPath: source.partPath,
|
|
96316
|
+
fontGuid,
|
|
96317
|
+
originalRId: source.originalRId,
|
|
96318
|
+
originalPartBytes: source.originalPartBytes
|
|
96319
|
+
};
|
|
96320
|
+
Object.defineProperties(font, {
|
|
96321
|
+
load: {
|
|
96322
|
+
value: () => pending ??= Promise.resolve().then(
|
|
96323
|
+
() => decode3().rawFontData?.length || decode3().dataUrl ? font : null
|
|
96324
|
+
)
|
|
96325
|
+
},
|
|
96326
|
+
isLoaded: { get: () => fields !== void 0 }
|
|
96327
|
+
});
|
|
96328
|
+
return font;
|
|
96329
|
+
}
|
|
96330
|
+
function shouldSaveEmbeddedFontVerbatim(font) {
|
|
96331
|
+
if (font.isLoaded === void 0 || !font.originalPartBytes?.length) {
|
|
96332
|
+
return false;
|
|
96333
|
+
}
|
|
96334
|
+
if (!font.originalRId || !font.partPath) {
|
|
96335
|
+
return false;
|
|
96336
|
+
}
|
|
96337
|
+
return font.isLoaded === false || !font.rawFontData?.length;
|
|
96338
|
+
}
|
|
96339
|
+
var init_deferred_embedded_font = __esm({
|
|
96340
|
+
"pptx/core/utils/deferred-embedded-font.ts"() {
|
|
96341
|
+
init_eot_parser();
|
|
96342
|
+
init_font_deobfuscation();
|
|
96343
|
+
}
|
|
96344
|
+
});
|
|
96345
|
+
|
|
95969
96346
|
// pptx/core/core/runtime/header-footer-parts.ts
|
|
95970
96347
|
function asArray3(value) {
|
|
95971
96348
|
if (Array.isArray(value)) {
|
|
@@ -98008,10 +98385,10 @@ function collectFilteredSeriesIndices(container2, xmlLookup) {
|
|
|
98008
98385
|
}
|
|
98009
98386
|
return reserved;
|
|
98010
98387
|
}
|
|
98011
|
-
function assignSeriesIndices(
|
|
98388
|
+
function assignSeriesIndices(count2, reservedIndices) {
|
|
98012
98389
|
const assigned = [];
|
|
98013
98390
|
let cursor = 0;
|
|
98014
|
-
for (let i2 = 0; i2 <
|
|
98391
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
98015
98392
|
while (reservedIndices.has(cursor)) {
|
|
98016
98393
|
cursor++;
|
|
98017
98394
|
}
|
|
@@ -98700,8 +99077,8 @@ function parseCache(node2) {
|
|
|
98700
99077
|
return point2;
|
|
98701
99078
|
})
|
|
98702
99079
|
};
|
|
98703
|
-
const
|
|
98704
|
-
if (Number.isInteger(
|
|
99080
|
+
const count2 = Number(cVal(node2, "ptCount") ?? Number.NaN);
|
|
99081
|
+
if (Number.isInteger(count2) && count2 >= 0) cache.pointCount = count2;
|
|
98705
99082
|
const formatCode2 = cChild(node2, "formatCode")?.textContent;
|
|
98706
99083
|
if (formatCode2) cache.formatCode = formatCode2;
|
|
98707
99084
|
return cache;
|
|
@@ -98719,8 +99096,8 @@ function parseDataSource(element) {
|
|
|
98719
99096
|
const levels = cChild(ref, "multiLvlStrCache");
|
|
98720
99097
|
if (levels) {
|
|
98721
99098
|
source.levels = children2(levels, "lvl", NS.c).map(parseCache);
|
|
98722
|
-
const
|
|
98723
|
-
if (Number.isInteger(
|
|
99099
|
+
const count2 = Number(cVal(levels, "ptCount") ?? Number.NaN);
|
|
99100
|
+
if (Number.isInteger(count2) && count2 >= 0) source.levelPointCount = count2;
|
|
98724
99101
|
}
|
|
98725
99102
|
return source;
|
|
98726
99103
|
}
|
|
@@ -108443,9 +108820,9 @@ function buildFopt(simple, complex = []) {
|
|
|
108443
108820
|
payload.bytes(bytes);
|
|
108444
108821
|
}
|
|
108445
108822
|
}
|
|
108446
|
-
const
|
|
108823
|
+
const count2 = simple.length + complex.length;
|
|
108447
108824
|
const data = new ByteWriter().append(entries).append(payload).toBytes();
|
|
108448
|
-
return record(OA.FOPT, data,
|
|
108825
|
+
return record(OA.FOPT, data, count2, false, 3);
|
|
108449
108826
|
}
|
|
108450
108827
|
function buildMetroBlobTertiaryFopt(metroBlob) {
|
|
108451
108828
|
const data = new ByteWriter().u16(METRO_BLOB_OPID | 32768 | FBID_FLAG).u32(metroBlob.length >>> 0).bytes(metroBlob).toBytes();
|
|
@@ -108509,9 +108886,9 @@ function buildDgg(shapesPerDrawing, totalShapes) {
|
|
|
108509
108886
|
const cidcl = drawingCount + 1;
|
|
108510
108887
|
const cspSaved = totalShapes - drawingCount;
|
|
108511
108888
|
const w = new ByteWriter().u32(maxShapeId).u32(cidcl).u32(cspSaved).u32(drawingCount);
|
|
108512
|
-
shapesPerDrawing.forEach((
|
|
108889
|
+
shapesPerDrawing.forEach((count2, i2) => {
|
|
108513
108890
|
const drawingId = i2 + 1;
|
|
108514
|
-
w.u32(drawingId).u32(
|
|
108891
|
+
w.u32(drawingId).u32(count2);
|
|
108515
108892
|
});
|
|
108516
108893
|
return record(OA.Dgg, w.toBytes(), 0, false, 0);
|
|
108517
108894
|
}
|
|
@@ -109339,8 +109716,8 @@ function atom(recType, data) {
|
|
|
109339
109716
|
function textHeader(textType) {
|
|
109340
109717
|
return atom(RT.TextHeaderAtom, new ByteWriter().u32(textType).toBytes());
|
|
109341
109718
|
}
|
|
109342
|
-
function textSpecInfo(
|
|
109343
|
-
return atom(RT.TextSpecInfoAtom, new ByteWriter().u32(
|
|
109719
|
+
function textSpecInfo(count2) {
|
|
109720
|
+
return atom(RT.TextSpecInfoAtom, new ByteWriter().u32(count2).u32(1).u16(0).toBytes());
|
|
109344
109721
|
}
|
|
109345
109722
|
function promptText(textType, paragraphs) {
|
|
109346
109723
|
const text2 = paragraphs.join("\r");
|
|
@@ -110151,17 +110528,17 @@ function slideMasterIndex(masterIndex, masterCount) {
|
|
|
110151
110528
|
return masterIndex !== void 0 && Number.isInteger(masterIndex) && masterIndex >= 0 && masterIndex < masterCount ? masterIndex : 0;
|
|
110152
110529
|
}
|
|
110153
110530
|
function countDrawingShapes(shapes) {
|
|
110154
|
-
let
|
|
110531
|
+
let count2 = 1;
|
|
110155
110532
|
const walk3 = (list3) => {
|
|
110156
110533
|
for (const shape of list3) {
|
|
110157
|
-
|
|
110534
|
+
count2++;
|
|
110158
110535
|
if (shape.kind === "group") {
|
|
110159
110536
|
walk3(shape.children);
|
|
110160
110537
|
}
|
|
110161
110538
|
}
|
|
110162
110539
|
};
|
|
110163
110540
|
walk3(shapes);
|
|
110164
|
-
return
|
|
110541
|
+
return count2;
|
|
110165
110542
|
}
|
|
110166
110543
|
function collectFonts(deck, masters) {
|
|
110167
110544
|
const collect = (shape) => {
|
|
@@ -110742,7 +111119,7 @@ function toLevel(style = {}, themeFonts = {}) {
|
|
|
110742
111119
|
}
|
|
110743
111120
|
};
|
|
110744
111121
|
}
|
|
110745
|
-
function toLevels(levels,
|
|
111122
|
+
function toLevels(levels, count2, themeFonts) {
|
|
110746
111123
|
if (!levels) {
|
|
110747
111124
|
return void 0;
|
|
110748
111125
|
}
|
|
@@ -110752,7 +111129,7 @@ function toLevels(levels, count, themeFonts) {
|
|
|
110752
111129
|
}
|
|
110753
111130
|
const base2 = levels[-1];
|
|
110754
111131
|
return Array.from(
|
|
110755
|
-
{ length:
|
|
111132
|
+
{ length: count2 },
|
|
110756
111133
|
(_, i2) => toLevel(base2 || levels[i2] ? { ...base2, ...levels[i2] } : void 0, themeFonts)
|
|
110757
111134
|
);
|
|
110758
111135
|
}
|
|
@@ -111661,12 +112038,12 @@ function visitGraphicData(node2, relationshipId2, extended2, getLocalName2) {
|
|
|
111661
112038
|
}
|
|
111662
112039
|
if (Array.isArray(node2)) {
|
|
111663
112040
|
return node2.reduce(
|
|
111664
|
-
(
|
|
112041
|
+
(count3, entry2) => count3 + visitGraphicData(entry2, relationshipId2, extended2, getLocalName2),
|
|
111665
112042
|
0
|
|
111666
112043
|
);
|
|
111667
112044
|
}
|
|
111668
112045
|
const object2 = node2;
|
|
111669
|
-
let
|
|
112046
|
+
let count2 = 0;
|
|
111670
112047
|
for (const key2 of Object.keys(object2)) {
|
|
111671
112048
|
if (key2.startsWith("@_")) {
|
|
111672
112049
|
continue;
|
|
@@ -111678,14 +112055,14 @@ function visitGraphicData(node2, relationshipId2, extended2, getLocalName2) {
|
|
|
111678
112055
|
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
111679
112056
|
if (chart && String(chart["@_r:id"]) === relationshipId2) {
|
|
111680
112057
|
rebindGraphicData(candidate, relationshipId2, extended2);
|
|
111681
|
-
|
|
112058
|
+
count2 += 1;
|
|
111682
112059
|
}
|
|
111683
112060
|
}
|
|
111684
112061
|
continue;
|
|
111685
112062
|
}
|
|
111686
|
-
|
|
112063
|
+
count2 += visitGraphicData(value, relationshipId2, extended2, getLocalName2);
|
|
111687
112064
|
}
|
|
111688
|
-
return
|
|
112065
|
+
return count2;
|
|
111689
112066
|
}
|
|
111690
112067
|
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended2) {
|
|
111691
112068
|
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
@@ -111693,11 +112070,11 @@ async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, exten
|
|
|
111693
112070
|
return 0;
|
|
111694
112071
|
}
|
|
111695
112072
|
const tree = deps.parser.parse(xml);
|
|
111696
|
-
const
|
|
111697
|
-
if (
|
|
112073
|
+
const count2 = visitGraphicData(tree, relationshipId2, extended2, deps.getLocalName);
|
|
112074
|
+
if (count2 > 0) {
|
|
111698
112075
|
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
111699
112076
|
}
|
|
111700
|
-
return
|
|
112077
|
+
return count2;
|
|
111701
112078
|
}
|
|
111702
112079
|
var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R;
|
|
111703
112080
|
var init_chart_part_registration = __esm({
|
|
@@ -120013,6 +120390,8 @@ var init_PptxHandlerRuntimeState = __esm({
|
|
|
120013
120390
|
alternateContentBlockByRawXml = /* @__PURE__ */ new WeakMap();
|
|
120014
120391
|
/** Embedded fonts extracted during load, preserved for automatic re-embedding on save. */
|
|
120015
120392
|
loadedEmbeddedFonts = [];
|
|
120393
|
+
/** Decode every embedded font variant during load (see `PptxHandlerLoadOptions`). */
|
|
120394
|
+
eagerDecodeEmbeddedFonts = false;
|
|
120016
120395
|
/** Typed source metadata for lossless embedded-font list round trips. */
|
|
120017
120396
|
loadedEmbeddedFontList;
|
|
120018
120397
|
/**
|
|
@@ -124832,10 +125211,10 @@ function detectDominantScript(text2) {
|
|
|
124832
125211
|
}
|
|
124833
125212
|
let best;
|
|
124834
125213
|
let bestCount = 0;
|
|
124835
|
-
for (const [cat,
|
|
124836
|
-
if (
|
|
125214
|
+
for (const [cat, count2] of Object.entries(counts)) {
|
|
125215
|
+
if (count2 > bestCount) {
|
|
124837
125216
|
best = cat;
|
|
124838
|
-
bestCount =
|
|
125217
|
+
bestCount = count2;
|
|
124839
125218
|
}
|
|
124840
125219
|
}
|
|
124841
125220
|
return best;
|
|
@@ -127535,9 +127914,9 @@ function applyTableStructureEditXml(table, source, next, edit) {
|
|
|
127535
127914
|
if (axis !== "row" && axis !== "column" || action !== "insert" && action !== "delete") {
|
|
127536
127915
|
return false;
|
|
127537
127916
|
}
|
|
127538
|
-
const
|
|
127917
|
+
const count2 = axis === "row" ? rows.length : columns.length;
|
|
127539
127918
|
const delta2 = action === "insert" ? 1 : -1;
|
|
127540
|
-
if (!grid || !Number.isInteger(index2) || index2 < 0 || index2 >
|
|
127919
|
+
if (!grid || !Number.isInteger(index2) || index2 < 0 || index2 > count2 - (action === "delete" ? 1 : 0) || action === "delete" && count2 <= 1 || next.rows.length !== rows.length + (axis === "row" ? delta2 : 0) || next.columnWidths.length !== columns.length + (axis === "column" ? delta2 : 0)) {
|
|
127541
127920
|
return false;
|
|
127542
127921
|
}
|
|
127543
127922
|
if (axis === "row") {
|
|
@@ -130011,6 +130390,7 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
130011
130390
|
"pptx/core/core/runtime/PptxHandlerRuntimeSaveDocumentParts.ts"() {
|
|
130012
130391
|
init_utils();
|
|
130013
130392
|
init_customer_data_package();
|
|
130393
|
+
init_deferred_embedded_font();
|
|
130014
130394
|
init_embedded_font_list();
|
|
130015
130395
|
init_font_deobfuscation();
|
|
130016
130396
|
init_safe_path();
|
|
@@ -130472,7 +130852,9 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
130472
130852
|
return;
|
|
130473
130853
|
}
|
|
130474
130854
|
const fonts = explicitFonts ?? this.loadedEmbeddedFonts;
|
|
130475
|
-
const fontsWithData = fonts.filter(
|
|
130855
|
+
const fontsWithData = fonts.filter(
|
|
130856
|
+
(f6) => shouldSaveEmbeddedFontVerbatim(f6) || f6.rawFontData && f6.rawFontData.length > 0
|
|
130857
|
+
);
|
|
130476
130858
|
if (fontsWithData.length === 0) {
|
|
130477
130859
|
const metadata = explicitFontList ?? this.loadedEmbeddedFontList;
|
|
130478
130860
|
if (metadata && this.presentationData) {
|
|
@@ -130515,10 +130897,11 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
130515
130897
|
"p:font": { "@_typeface": typeface }
|
|
130516
130898
|
};
|
|
130517
130899
|
for (const variant of variants) {
|
|
130518
|
-
const
|
|
130900
|
+
const verbatim = shouldSaveEmbeddedFontVerbatim(variant);
|
|
130901
|
+
const fontData = verbatim ? void 0 : variant.rawFontData;
|
|
130519
130902
|
const hasOriginal = Boolean(variant.originalRId && variant.partPath);
|
|
130520
|
-
const reuseObfuscation = hasOriginal && Boolean(variant.fontGuid);
|
|
130521
|
-
const reuseVerbatim = hasOriginal && !variant.fontGuid && Boolean(variant.originalPartBytes);
|
|
130903
|
+
const reuseObfuscation = hasOriginal && !verbatim && Boolean(variant.fontGuid);
|
|
130904
|
+
const reuseVerbatim = hasOriginal && (verbatim || !variant.fontGuid) && Boolean(variant.originalPartBytes);
|
|
130522
130905
|
let guid3;
|
|
130523
130906
|
let fontPartPath;
|
|
130524
130907
|
let relativeTarget4;
|
|
@@ -134134,13 +134517,13 @@ function countDeclaredIds(node2, counts, ensureArray20) {
|
|
|
134134
134517
|
if (!countDeclaredIds(branch, branchCounts, ensureArray20)) {
|
|
134135
134518
|
return false;
|
|
134136
134519
|
}
|
|
134137
|
-
for (const [id,
|
|
134138
|
-
merged.set(id, Math.max(merged.get(id) ?? 0,
|
|
134520
|
+
for (const [id, count2] of branchCounts) {
|
|
134521
|
+
merged.set(id, Math.max(merged.get(id) ?? 0, count2));
|
|
134139
134522
|
}
|
|
134140
134523
|
}
|
|
134141
134524
|
}
|
|
134142
|
-
for (const [id,
|
|
134143
|
-
counts.set(id, (counts.get(id) ?? 0) +
|
|
134525
|
+
for (const [id, count2] of merged) {
|
|
134526
|
+
counts.set(id, (counts.get(id) ?? 0) + count2);
|
|
134144
134527
|
}
|
|
134145
134528
|
}
|
|
134146
134529
|
return true;
|
|
@@ -134150,8 +134533,8 @@ function hasStructuralIdDefects(spTree, ensureArray20) {
|
|
|
134150
134533
|
if (!countDeclaredIds(spTree, counts, ensureArray20)) {
|
|
134151
134534
|
return true;
|
|
134152
134535
|
}
|
|
134153
|
-
for (const
|
|
134154
|
-
if (
|
|
134536
|
+
for (const count2 of counts.values()) {
|
|
134537
|
+
if (count2 > 1) {
|
|
134155
134538
|
return true;
|
|
134156
134539
|
}
|
|
134157
134540
|
}
|
|
@@ -149092,8 +149475,7 @@ var init_PptxHandlerRuntimePresentationStructure = __esm({
|
|
|
149092
149475
|
var PptxHandlerRuntime99;
|
|
149093
149476
|
var init_PptxHandlerRuntimeEmbeddedFonts = __esm({
|
|
149094
149477
|
"pptx/core/core/runtime/PptxHandlerRuntimeEmbeddedFonts.ts"() {
|
|
149095
|
-
|
|
149096
|
-
init_font_deobfuscation();
|
|
149478
|
+
init_deferred_embedded_font();
|
|
149097
149479
|
init_layout_display_name();
|
|
149098
149480
|
init_strip_parent_dir_segments();
|
|
149099
149481
|
init_xml_access();
|
|
@@ -149169,7 +149551,13 @@ var init_PptxHandlerRuntimeEmbeddedFonts = __esm({
|
|
|
149169
149551
|
}
|
|
149170
149552
|
return map2;
|
|
149171
149553
|
}
|
|
149172
|
-
/**
|
|
149554
|
+
/**
|
|
149555
|
+
* Read one variant's part. By default the result is a deferred descriptor
|
|
149556
|
+
* that decodes on first use (see `createDeferredEmbeddedFont`); parts that
|
|
149557
|
+
* fail the checks possible without decoding are skipped, as before. With
|
|
149558
|
+
* `eagerDecodeEmbeddedFonts` the variant is decoded now and skipped when
|
|
149559
|
+
* decoding fails.
|
|
149560
|
+
*/
|
|
149173
149561
|
async extractEmbeddedFontVariant(typeface, rId, bold, italic, relsMap, fontKey) {
|
|
149174
149562
|
const fontPath = relsMap.get(rId);
|
|
149175
149563
|
if (!fontPath) {
|
|
@@ -149180,80 +149568,25 @@ var init_PptxHandlerRuntimeEmbeddedFonts = __esm({
|
|
|
149180
149568
|
if (!fontBinary || fontBinary.length === 0) {
|
|
149181
149569
|
return null;
|
|
149182
149570
|
}
|
|
149183
|
-
const
|
|
149184
|
-
let fontData;
|
|
149185
|
-
let resolvedGuid;
|
|
149186
|
-
if (isEotFormat(fontBinary)) {
|
|
149187
|
-
const extracted = extractFontFromEot(fontBinary);
|
|
149188
|
-
if (extracted) {
|
|
149189
|
-
fontData = extracted.fontData;
|
|
149190
|
-
} else {
|
|
149191
|
-
const header = parseEotHeader(fontBinary);
|
|
149192
|
-
console.info(
|
|
149193
|
-
`[pptx-viewer] Embedded font "${typeface}" uses EOT format${header?.isCompressed ? " with MTX compression" : ""} \u2014 extraction failed, will use web font fallback`
|
|
149194
|
-
);
|
|
149195
|
-
return null;
|
|
149196
|
-
}
|
|
149197
|
-
} else {
|
|
149198
|
-
const guidFromKey = fontKey ? extractGuidFromPartName(fontKey) ?? fontKey.replace(/[{}]/g, "").trim() : null;
|
|
149199
|
-
const guidFromPath = extractGuidFromPartName(fontPath);
|
|
149200
|
-
const guid3 = guidFromKey || guidFromPath;
|
|
149201
|
-
if (guid3) {
|
|
149202
|
-
fontData = deobfuscateFont(fontBinary, guid3);
|
|
149203
|
-
resolvedGuid = guid3;
|
|
149204
|
-
} else {
|
|
149205
|
-
console.warn(
|
|
149206
|
-
`[pptx-viewer] Embedded font "${typeface}" at "${fontPath}" has no fontKey attribute and no GUID in filename \u2014 skipping`
|
|
149207
|
-
);
|
|
149208
|
-
return null;
|
|
149209
|
-
}
|
|
149210
|
-
}
|
|
149211
|
-
if (fontData.length < 4) {
|
|
149212
|
-
return null;
|
|
149213
|
-
}
|
|
149214
|
-
const v0 = fontData[0], v1 = fontData[1], v2 = fontData[2], v3 = fontData[3];
|
|
149215
|
-
const isTrueType = v0 === 0 && v1 === 1 && v2 === 0 && v3 === 0;
|
|
149216
|
-
const isOTTO = v0 === 79 && v1 === 84 && v2 === 84 && v3 === 79;
|
|
149217
|
-
const isTTC = v0 === 116 && v1 === 116 && v2 === 99 && v3 === 102;
|
|
149218
|
-
const isWOFF = v0 === 119 && v1 === 79 && v2 === 70 && (v3 === 70 || v3 === 50);
|
|
149219
|
-
if (!(isTrueType || isOTTO || isTTC || isWOFF)) {
|
|
149220
|
-
console.warn(
|
|
149221
|
-
`[pptx-viewer] Embedded font "${typeface}" has invalid sfnt header [${v0.toString(16)},${v1.toString(16)},${v2.toString(16)},${v3.toString(16)}] after processing \u2014 skipping (web font fallback will be used)`
|
|
149222
|
-
);
|
|
149223
|
-
return null;
|
|
149224
|
-
}
|
|
149225
|
-
const format = detectFontFormat(fontData);
|
|
149226
|
-
const mimeType = format === "woff2" ? "font/woff2" : format === "woff" ? "font/woff" : format === "opentype" ? "font/otf" : "font/ttf";
|
|
149227
|
-
const base643 = this.uint8ArrayToBase64(fontData);
|
|
149228
|
-
const dataUrl = `data:${mimeType};base64,${base643}`;
|
|
149229
|
-
return {
|
|
149571
|
+
const source = {
|
|
149230
149572
|
name: typeface,
|
|
149231
|
-
dataUrl,
|
|
149232
149573
|
bold,
|
|
149233
149574
|
italic,
|
|
149234
|
-
format,
|
|
149235
|
-
rawFontData: fontData,
|
|
149236
|
-
partPath: fontPath,
|
|
149237
|
-
fontGuid: resolvedGuid,
|
|
149238
149575
|
originalRId: rId,
|
|
149239
|
-
|
|
149576
|
+
partPath: fontPath,
|
|
149577
|
+
// The descriptor owns a copy, so it outlives this handler's ZIP and
|
|
149578
|
+
// the save pipeline can write it back verbatim.
|
|
149579
|
+
originalPartBytes: new Uint8Array(fontBinary),
|
|
149580
|
+
fontKey
|
|
149240
149581
|
};
|
|
149582
|
+
if (this.eagerDecodeEmbeddedFonts) {
|
|
149583
|
+
return decodeEmbeddedFontPart(source);
|
|
149584
|
+
}
|
|
149585
|
+
return isEmbeddedFontPartPlausible(source) ? createDeferredEmbeddedFont(source) : null;
|
|
149241
149586
|
} catch {
|
|
149242
149587
|
return null;
|
|
149243
149588
|
}
|
|
149244
149589
|
}
|
|
149245
|
-
/** Convert Uint8Array to base64 string. */
|
|
149246
|
-
uint8ArrayToBase64(bytes) {
|
|
149247
|
-
let binary = "";
|
|
149248
|
-
const chunkSize = 8192;
|
|
149249
|
-
for (let i2 = 0; i2 < bytes.length; i2 += chunkSize) {
|
|
149250
|
-
const chunk2 = bytes.subarray(i2, Math.min(i2 + chunkSize, bytes.length));
|
|
149251
|
-
for (let j = 0; j < chunk2.length; j++) {
|
|
149252
|
-
binary += String.fromCharCode(chunk2[j]);
|
|
149253
|
-
}
|
|
149254
|
-
}
|
|
149255
|
-
return btoa(binary);
|
|
149256
|
-
}
|
|
149257
149590
|
getLayoutOptions() {
|
|
149258
149591
|
const options = [];
|
|
149259
149592
|
for (const [path4, xmlObj] of this.layoutXmlMap.entries()) {
|
|
@@ -149306,12 +149639,16 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149306
149639
|
init_ole_embedded_extract();
|
|
149307
149640
|
init_ole_utils();
|
|
149308
149641
|
init_signature_detection();
|
|
149309
|
-
|
|
149642
|
+
init_load_limits();
|
|
149310
149643
|
init_authored_slide_background();
|
|
149311
149644
|
init_bullet_picture_image_enrichment();
|
|
149312
149645
|
init_PptxHandlerRuntimeEmbeddedFonts();
|
|
149313
149646
|
MAX_OLE_EMBEDDING_BYTES = 25 * 1024 * 1024;
|
|
149314
149647
|
PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime99 {
|
|
149648
|
+
/** The limits of the load in progress (see `PptxHandlerLoadOptions.limits`). */
|
|
149649
|
+
loadLimits = { ...DEFAULT_PPTX_LOAD_LIMITS };
|
|
149650
|
+
/** Slide elements parsed so far by the load in progress, for `maxShapes`. */
|
|
149651
|
+
loadedShapeCount = 0;
|
|
149315
149652
|
isZipContainer(data) {
|
|
149316
149653
|
const bytes = new Uint8Array(data);
|
|
149317
149654
|
if (bytes.byteLength < 4) {
|
|
@@ -149320,7 +149657,9 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149320
149657
|
return bytes[0] === 80 && bytes[1] === 75 && (bytes[2] === 3 && bytes[3] === 4 || bytes[2] === 5 && bytes[3] === 6 || bytes[2] === 7 && bytes[3] === 8);
|
|
149321
149658
|
}
|
|
149322
149659
|
async initializeLoadSession(data, options) {
|
|
149660
|
+
const limits = resolvePptxLoadLimits(options);
|
|
149323
149661
|
this.eagerDecodeImages = options.eagerDecodeImages ?? false;
|
|
149662
|
+
this.eagerDecodeEmbeddedFonts = options.eagerDecodeEmbeddedFonts === true;
|
|
149324
149663
|
this.allowExternalImages = options.allowExternalImages === true;
|
|
149325
149664
|
if (data.byteLength < 4) {
|
|
149326
149665
|
throw new Error("Invalid PPTX binary: file is empty or truncated.");
|
|
@@ -149330,7 +149669,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149330
149669
|
"Invalid PPTX binary: not a ZIP/OpenXML package. The file is neither an OpenXML archive nor an OLE compound file (which is how legacy .ppt and encrypted presentations arrive), so it is most likely corrupt, truncated, or not a presentation at all."
|
|
149331
149670
|
);
|
|
149332
149671
|
}
|
|
149333
|
-
const maxBytes =
|
|
149672
|
+
const maxBytes = limits.maxUncompressedBytes;
|
|
149334
149673
|
let loaded;
|
|
149335
149674
|
try {
|
|
149336
149675
|
loaded = await JSZip__default.default.loadAsync(data);
|
|
@@ -149340,11 +149679,13 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149340
149679
|
}
|
|
149341
149680
|
this.zip = guardZip(loaded, {
|
|
149342
149681
|
label: "PPTX",
|
|
149343
|
-
maxEntries:
|
|
149682
|
+
maxEntries: limits.maxEntries,
|
|
149344
149683
|
maxEntryBytes: maxBytes,
|
|
149345
149684
|
maxTotalBytes: maxBytes,
|
|
149346
|
-
createError:
|
|
149685
|
+
createError: createPptxZipBombError
|
|
149347
149686
|
});
|
|
149687
|
+
this.loadLimits = limits;
|
|
149688
|
+
this.loadedShapeCount = 0;
|
|
149348
149689
|
try {
|
|
149349
149690
|
this.documentPropertiesUpdater = this.dependencyFactory.createDocumentPropertiesUpdater(
|
|
149350
149691
|
this.zip,
|
|
@@ -149510,6 +149851,11 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149510
149851
|
}
|
|
149511
149852
|
this.presentationData = this.parser.parse(presentationXml3);
|
|
149512
149853
|
this.detectAndSetStrictConformance(this.presentationData);
|
|
149854
|
+
const slideIds = this.presentationData?.["p:presentation"]?.["p:sldIdLst"]?.["p:sldId"];
|
|
149855
|
+
assertPptxSlideCountWithinLimits(
|
|
149856
|
+
Array.isArray(slideIds) ? slideIds.length : slideIds ? 1 : 0,
|
|
149857
|
+
this.loadLimits
|
|
149858
|
+
);
|
|
149513
149859
|
await this.loadThemeData();
|
|
149514
149860
|
this.parsePresentationDefaultTextStyle();
|
|
149515
149861
|
await this.loadCommentAuthors();
|
|
@@ -149639,7 +149985,17 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149639
149985
|
loadThemeOverride: (partBasePath) => this.loadThemeOverride(partBasePath),
|
|
149640
149986
|
applyThemeOverrideState: (override) => this.applyThemeOverrideState(override),
|
|
149641
149987
|
getLayoutElements: (slidePath) => this.getLayoutElements(slidePath),
|
|
149642
|
-
|
|
149988
|
+
// `maxShapes`: each slide's own elements are counted as soon as they are
|
|
149989
|
+
// parsed, before that slide's media is resolved and before the next slide.
|
|
149990
|
+
parseSlide: async (slideXml3, slidePath) => {
|
|
149991
|
+
const elements3 = await this.parseSlide(slideXml3, slidePath);
|
|
149992
|
+
this.loadedShapeCount = countPptxShapesWithinLimits(
|
|
149993
|
+
this.loadedShapeCount,
|
|
149994
|
+
elements3,
|
|
149995
|
+
this.loadLimits
|
|
149996
|
+
);
|
|
149997
|
+
return elements3;
|
|
149998
|
+
},
|
|
149643
149999
|
extractMediaTimingMap: (slideXml3, slidePath) => this.extractMediaTimingMap(slideXml3, slidePath),
|
|
149644
150000
|
enrichMediaElementsWithTiming: (elements3, timingMap) => this.enrichMediaElementsWithTiming(elements3, timingMap),
|
|
149645
150001
|
enrichOleElementsWithEmbeddedData: (elements3, slidePath) => this.enrichOleElementsWithEmbeddedData(elements3, slidePath),
|
|
@@ -149692,6 +150048,7 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
|
|
|
149692
150048
|
init_smart_tags_parser();
|
|
149693
150049
|
init_strip_parent_dir_segments();
|
|
149694
150050
|
init_builders();
|
|
150051
|
+
init_load_limits();
|
|
149695
150052
|
init_authored_slide_background();
|
|
149696
150053
|
init_layout_switch_placeholder_prompts();
|
|
149697
150054
|
init_PptxHandlerRuntimeLoadSession();
|
|
@@ -149894,21 +150251,31 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
|
|
|
149894
150251
|
try {
|
|
149895
150252
|
await this.initializeLoadSession(data, options);
|
|
149896
150253
|
reader2 = this.beginPartReads();
|
|
149897
|
-
|
|
149898
|
-
|
|
149899
|
-
|
|
149900
|
-
|
|
149901
|
-
|
|
149902
|
-
|
|
149903
|
-
|
|
149904
|
-
|
|
149905
|
-
this.resetElementIdCounter(slides);
|
|
149906
|
-
recordSlideFingerprints(this.savedSlideFingerprints, slidesWithWarnings);
|
|
149907
|
-
return await this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
|
|
150254
|
+
try {
|
|
150255
|
+
return await this.loadInitializedSession();
|
|
150256
|
+
} catch (error62) {
|
|
150257
|
+
if (error62 instanceof PptxLoadLimitError) {
|
|
150258
|
+
this.dispose();
|
|
150259
|
+
}
|
|
150260
|
+
throw error62;
|
|
150261
|
+
}
|
|
149908
150262
|
} finally {
|
|
149909
150263
|
this.endPartReads(reader2);
|
|
149910
150264
|
}
|
|
149911
150265
|
}
|
|
150266
|
+
async loadInitializedSession() {
|
|
150267
|
+
await this.detectAndPreserveVbaProject();
|
|
150268
|
+
this.detectDigitalSignatureParts();
|
|
150269
|
+
await this.parseCustomXmlParts();
|
|
150270
|
+
const presentationState = await this.loadPresentationState();
|
|
150271
|
+
const slideMasters = await this.parseSlideMasters();
|
|
150272
|
+
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
150273
|
+
const slides = await this.loadSlidesForPresentation(presentationState.sectionBySlideId);
|
|
150274
|
+
const slidesWithWarnings = this.attachSlideWarnings(slides);
|
|
150275
|
+
this.resetElementIdCounter(slides);
|
|
150276
|
+
recordSlideFingerprints(this.savedSlideFingerprints, slidesWithWarnings);
|
|
150277
|
+
return this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
|
|
150278
|
+
}
|
|
149912
150279
|
/**
|
|
149913
150280
|
* Retrieve the current background colour for a layout or master.
|
|
149914
150281
|
*/
|
|
@@ -151345,24 +151712,24 @@ function parseStyleTextPropAtom(view, dataOffset, dataLen, textLength, scheme) {
|
|
|
151345
151712
|
const charRuns = [];
|
|
151346
151713
|
let covered = 0;
|
|
151347
151714
|
while (covered < total && c.canRead(6)) {
|
|
151348
|
-
const
|
|
151715
|
+
const count2 = c.u32();
|
|
151349
151716
|
const indentLevel = c.u16();
|
|
151350
|
-
const props = { count, indentLevel };
|
|
151717
|
+
const props = { count: count2, indentLevel };
|
|
151351
151718
|
if (!parsePfException(c, scheme, props)) {
|
|
151352
151719
|
break;
|
|
151353
151720
|
}
|
|
151354
151721
|
paragraphRuns.push(props);
|
|
151355
|
-
covered +=
|
|
151722
|
+
covered += count2;
|
|
151356
151723
|
}
|
|
151357
151724
|
covered = 0;
|
|
151358
151725
|
while (covered < total && c.canRead(8)) {
|
|
151359
|
-
const
|
|
151360
|
-
const props = { count };
|
|
151726
|
+
const count2 = c.u32();
|
|
151727
|
+
const props = { count: count2 };
|
|
151361
151728
|
if (!parseCfException(c, scheme, props)) {
|
|
151362
151729
|
break;
|
|
151363
151730
|
}
|
|
151364
151731
|
charRuns.push(props);
|
|
151365
|
-
covered +=
|
|
151732
|
+
covered += count2;
|
|
151366
151733
|
}
|
|
151367
151734
|
return { paragraphRuns, charRuns };
|
|
151368
151735
|
}
|
|
@@ -152424,13 +152791,13 @@ var init_geometry_map = __esm({
|
|
|
152424
152791
|
function parseProperties2(view, data, rec) {
|
|
152425
152792
|
const values = /* @__PURE__ */ new Map();
|
|
152426
152793
|
const complex = /* @__PURE__ */ new Map();
|
|
152427
|
-
const
|
|
152428
|
-
const entriesEnd = rec.dataOffset +
|
|
152794
|
+
const count2 = rec.recInstance;
|
|
152795
|
+
const entriesEnd = rec.dataOffset + count2 * 6;
|
|
152429
152796
|
if (entriesEnd > rec.dataOffset + rec.recLen) {
|
|
152430
152797
|
return { values, complex };
|
|
152431
152798
|
}
|
|
152432
152799
|
const complexRefs = [];
|
|
152433
|
-
for (let i2 = 0; i2 <
|
|
152800
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
152434
152801
|
const at2 = rec.dataOffset + i2 * 6;
|
|
152435
152802
|
const opid = view.getUint16(at2, true);
|
|
152436
152803
|
const value = view.getUint32(at2 + 2, true);
|
|
@@ -153631,8 +153998,8 @@ function levelXml(tag, level2, fallbackSizePt) {
|
|
|
153631
153998
|
}
|
|
153632
153999
|
function styleLevels(levels, fallbackSizePt) {
|
|
153633
154000
|
const result = [];
|
|
153634
|
-
const
|
|
153635
|
-
for (let i2 = 0; i2 <
|
|
154001
|
+
const count2 = Math.max(1, Math.min(levels.length, 9));
|
|
154002
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
153636
154003
|
result.push(levelXml(`lvl${i2 + 1}pPr`, levels[i2] ?? {}, fallbackSizePt));
|
|
153637
154004
|
}
|
|
153638
154005
|
return result.join("");
|
|
@@ -154128,6 +154495,7 @@ var PptxHandlerCore;
|
|
|
154128
154495
|
var init_PptxHandlerCore = __esm({
|
|
154129
154496
|
"pptx/core/PptxHandlerCore.ts"() {
|
|
154130
154497
|
init_core2();
|
|
154498
|
+
init_load_limits();
|
|
154131
154499
|
init_ppt();
|
|
154132
154500
|
init_encryption_detection();
|
|
154133
154501
|
init_ole2_parser();
|
|
@@ -154517,6 +154885,7 @@ var init_PptxHandlerCore = __esm({
|
|
|
154517
154885
|
* ```
|
|
154518
154886
|
*/
|
|
154519
154887
|
async load(data, options = {}) {
|
|
154888
|
+
assertPptxInputWithinLimits(data.byteLength, resolvePptxLoadLimits(options));
|
|
154520
154889
|
const detection = detectFileFormat(data);
|
|
154521
154890
|
if (detection.format === "ole") {
|
|
154522
154891
|
let ole;
|
|
@@ -154769,6 +155138,7 @@ var init_PptxHandler = __esm({
|
|
|
154769
155138
|
"pptx/core/PptxHandler.ts"() {
|
|
154770
155139
|
init_json();
|
|
154771
155140
|
init_PresentationBuilder();
|
|
155141
|
+
init_load_limits();
|
|
154772
155142
|
init_PptxHandlerCore();
|
|
154773
155143
|
PptxHandler = class extends PptxHandlerCore {
|
|
154774
155144
|
/**
|
|
@@ -154840,13 +155210,15 @@ var init_PptxHandler = __esm({
|
|
|
154840
155210
|
* archives and portable `pptx-viewer-json` documents.
|
|
154841
155211
|
*
|
|
154842
155212
|
* The buffer is sniffed first: JSON documents (leading `{` plus the
|
|
154843
|
-
* `"pptx-viewer-json"` format marker) are
|
|
154844
|
-
* everything else goes through the regular ZIP/OLE2 pipeline.
|
|
155213
|
+
* `"pptx-viewer-json"` format marker) are imported as {@link loadFromJson}
|
|
155214
|
+
* does; everything else goes through the regular ZIP/OLE2 pipeline.
|
|
154845
155215
|
*/
|
|
154846
155216
|
async load(data, options = {}) {
|
|
155217
|
+
const limits = resolvePptxLoadLimits(options);
|
|
155218
|
+
assertPptxInputWithinLimits(data.byteLength, limits);
|
|
154847
155219
|
const jsonText = decodePptxJsonText(data);
|
|
154848
155220
|
if (jsonText !== null) {
|
|
154849
|
-
return this.
|
|
155221
|
+
return this.importJson(jsonText, options, limits);
|
|
154850
155222
|
}
|
|
154851
155223
|
return super.load(data, options);
|
|
154852
155224
|
}
|
|
@@ -154857,9 +155229,26 @@ var init_PptxHandler = __esm({
|
|
|
154857
155229
|
* handler keeps a valid in-memory archive (editing and {@link save} keep
|
|
154858
155230
|
* working), then the imported model is overlaid on top: imported
|
|
154859
155231
|
* presentation fields win, and the slide array is replaced wholesale.
|
|
155232
|
+
*
|
|
155233
|
+
* `options.limits` applies as it does for {@link load}: `maxInputBytes` to
|
|
155234
|
+
* the UTF-8 size of `text` (checked before it is parsed), and `maxSlides`
|
|
155235
|
+
* and `maxShapes` to the document's slides with the same counting rule as
|
|
155236
|
+
* a `.pptx` package (layout and master elements are not counted).
|
|
154860
155237
|
*/
|
|
154861
155238
|
async loadFromJson(text2, options = {}) {
|
|
154862
|
-
const
|
|
155239
|
+
const limits = resolvePptxLoadLimits(options);
|
|
155240
|
+
assertPptxTextWithinLimits(text2, limits);
|
|
155241
|
+
return this.importJson(text2, options, limits);
|
|
155242
|
+
}
|
|
155243
|
+
async importJson(text2, options, limits) {
|
|
155244
|
+
const document2 = parsePptxJson(text2);
|
|
155245
|
+
assertPptxSlideCountWithinLimits(document2.slides.length, limits);
|
|
155246
|
+
let shapes = 0;
|
|
155247
|
+
for (const slide of document2.slides) {
|
|
155248
|
+
const elements3 = Array.isArray(slide.elements) ? slide.elements : [];
|
|
155249
|
+
shapes = countPptxShapesWithinLimits(shapes, elements3, limits);
|
|
155250
|
+
}
|
|
155251
|
+
const imported = pptxDataFromJsonDocument(document2);
|
|
154863
155252
|
const blankBytes = await buildBlankPresentationArchive({
|
|
154864
155253
|
width: imported.widthEmu,
|
|
154865
155254
|
height: imported.heightEmu,
|
|
@@ -154867,7 +155256,7 @@ var init_PptxHandler = __esm({
|
|
|
154867
155256
|
// the overlaid model, so the archive must carry the value itself.
|
|
154868
155257
|
firstSlideNumber: imported.firstSlideNumber
|
|
154869
155258
|
});
|
|
154870
|
-
const base2 = await super.load(blankBytes, options);
|
|
155259
|
+
const base2 = await super.load(blankBytes, { ...options, limits: void 0 });
|
|
154871
155260
|
return applyImportedPptxData(base2, imported);
|
|
154872
155261
|
}
|
|
154873
155262
|
};
|
|
@@ -156004,10 +156393,10 @@ function ensureChartData2(element) {
|
|
|
156004
156393
|
}
|
|
156005
156394
|
function validateShapeIndex(element, index2) {
|
|
156006
156395
|
ensureChartData2(element);
|
|
156007
|
-
const
|
|
156008
|
-
if (index2 < 0 || index2 >=
|
|
156396
|
+
const count2 = element.chartData.userShapes?.length ?? 0;
|
|
156397
|
+
if (index2 < 0 || index2 >= count2) {
|
|
156009
156398
|
throw new RangeError(
|
|
156010
|
-
`Overlay-shape index ${index2} is out of range. Chart has ${
|
|
156399
|
+
`Overlay-shape index ${index2} is out of range. Chart has ${count2} overlay shape(s) (indices 0-${count2 - 1}).`
|
|
156011
156400
|
);
|
|
156012
156401
|
}
|
|
156013
156402
|
}
|
|
@@ -160943,7 +161332,7 @@ function batchUpdateElements(ctx, params) {
|
|
|
160943
161332
|
}
|
|
160944
161333
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
160945
161334
|
const idSet = new Set(params.elementIds);
|
|
160946
|
-
let
|
|
161335
|
+
let count2 = 0;
|
|
160947
161336
|
for (const el of slide.elements) {
|
|
160948
161337
|
if (!idSet.has(el.id)) {
|
|
160949
161338
|
continue;
|
|
@@ -160969,12 +161358,12 @@ function batchUpdateElements(ctx, params) {
|
|
|
160969
161358
|
if (params.hidden !== void 0) {
|
|
160970
161359
|
el.hidden = params.hidden;
|
|
160971
161360
|
}
|
|
160972
|
-
|
|
161361
|
+
count2++;
|
|
160973
161362
|
}
|
|
160974
161363
|
return {
|
|
160975
161364
|
pptxData: ctx.pptxData,
|
|
160976
161365
|
dirty: true,
|
|
160977
|
-
result: { updatedCount:
|
|
161366
|
+
result: { updatedCount: count2 }
|
|
160978
161367
|
};
|
|
160979
161368
|
}
|
|
160980
161369
|
|
|
@@ -161001,7 +161390,7 @@ function updateTableCells(ctx, params) {
|
|
|
161001
161390
|
if (!tbl.tableData) {
|
|
161002
161391
|
throw new Error(`Table '${params.elementId}' has no tableData.`);
|
|
161003
161392
|
}
|
|
161004
|
-
let
|
|
161393
|
+
let count2 = 0;
|
|
161005
161394
|
for (const cellUpdate of params.cells) {
|
|
161006
161395
|
const row = tbl.tableData.rows[cellUpdate.row];
|
|
161007
161396
|
if (!row) {
|
|
@@ -161014,12 +161403,12 @@ function updateTableCells(ctx, params) {
|
|
|
161014
161403
|
throw new Error(`Column ${cellUpdate.col} out of range (row has ${row.cells.length} cells).`);
|
|
161015
161404
|
}
|
|
161016
161405
|
cell.text = cellUpdate.text;
|
|
161017
|
-
|
|
161406
|
+
count2++;
|
|
161018
161407
|
}
|
|
161019
161408
|
return {
|
|
161020
161409
|
pptxData: ctx.pptxData,
|
|
161021
161410
|
dirty: true,
|
|
161022
|
-
result: { updatedCount:
|
|
161411
|
+
result: { updatedCount: count2 }
|
|
161023
161412
|
};
|
|
161024
161413
|
}
|
|
161025
161414
|
function manageTableStructure(ctx, params) {
|
|
@@ -161404,7 +161793,7 @@ function replaceText(ctx, params) {
|
|
|
161404
161793
|
};
|
|
161405
161794
|
}
|
|
161406
161795
|
const targetIndexes = params.slideIndexes ? params.slideIndexes : ctx.pptxData.slides.map((_, i2) => i2);
|
|
161407
|
-
let
|
|
161796
|
+
let count2 = 0;
|
|
161408
161797
|
for (const si of targetIndexes) {
|
|
161409
161798
|
const err = validateSlideIndex(si, ctx.pptxData.slides.length);
|
|
161410
161799
|
if (err) {
|
|
@@ -161419,7 +161808,7 @@ function replaceText(ctx, params) {
|
|
|
161419
161808
|
const after = before.replace(regex, params.replacement);
|
|
161420
161809
|
if (after !== before) {
|
|
161421
161810
|
const matchCount = Array.from(before.matchAll(regex)).length;
|
|
161422
|
-
|
|
161811
|
+
count2 += matchCount;
|
|
161423
161812
|
replaceElementText(textEl, regex, params.replacement);
|
|
161424
161813
|
}
|
|
161425
161814
|
}
|
|
@@ -161433,7 +161822,7 @@ function replaceText(ctx, params) {
|
|
|
161433
161822
|
const before = cell.text;
|
|
161434
161823
|
const after = before.replace(regex, params.replacement);
|
|
161435
161824
|
if (after !== before) {
|
|
161436
|
-
|
|
161825
|
+
count2 += Array.from(before.matchAll(regex)).length;
|
|
161437
161826
|
cell.text = after;
|
|
161438
161827
|
}
|
|
161439
161828
|
}
|
|
@@ -161446,18 +161835,18 @@ function replaceText(ctx, params) {
|
|
|
161446
161835
|
const before = slide.notes;
|
|
161447
161836
|
const after = before.replace(regex, params.replacement);
|
|
161448
161837
|
if (after !== before) {
|
|
161449
|
-
|
|
161838
|
+
count2 += Array.from(before.matchAll(regex)).length;
|
|
161450
161839
|
slide.notes = after;
|
|
161451
161840
|
}
|
|
161452
161841
|
}
|
|
161453
161842
|
}
|
|
161454
161843
|
return {
|
|
161455
161844
|
pptxData: ctx.pptxData,
|
|
161456
|
-
dirty:
|
|
161845
|
+
dirty: count2 > 0,
|
|
161457
161846
|
result: {
|
|
161458
161847
|
query: params.query,
|
|
161459
161848
|
replacement: params.replacement,
|
|
161460
|
-
replacementCount:
|
|
161849
|
+
replacementCount: count2
|
|
161461
161850
|
}
|
|
161462
161851
|
};
|
|
161463
161852
|
}
|
|
@@ -163806,7 +164195,7 @@ __export(util_exports, {
|
|
|
163806
164195
|
slugify: () => slugify,
|
|
163807
164196
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
163808
164197
|
toZod: () => toZod,
|
|
163809
|
-
uint8ArrayToBase64: () =>
|
|
164198
|
+
uint8ArrayToBase64: () => uint8ArrayToBase642,
|
|
163810
164199
|
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
163811
164200
|
uint8ArrayToHex: () => uint8ArrayToHex,
|
|
163812
164201
|
unwrapMessage: () => unwrapMessage
|
|
@@ -164378,14 +164767,14 @@ function codePointLength(str) {
|
|
|
164378
164767
|
const units = str.length;
|
|
164379
164768
|
if (!highSurrogate.test(str))
|
|
164380
164769
|
return units;
|
|
164381
|
-
let
|
|
164770
|
+
let count2 = units;
|
|
164382
164771
|
for (let i2 = 0; i2 < units - 1; i2++) {
|
|
164383
164772
|
if ((str.charCodeAt(i2) & 64512) === 55296 && (str.charCodeAt(i2 + 1) & 64512) === 56320) {
|
|
164384
|
-
|
|
164773
|
+
count2--;
|
|
164385
164774
|
i2++;
|
|
164386
164775
|
}
|
|
164387
164776
|
}
|
|
164388
|
-
return
|
|
164777
|
+
return count2;
|
|
164389
164778
|
}
|
|
164390
164779
|
function getLengthableOrigin(input2) {
|
|
164391
164780
|
if (Array.isArray(input2))
|
|
@@ -164440,7 +164829,7 @@ function base64ToUint8Array(base643) {
|
|
|
164440
164829
|
}
|
|
164441
164830
|
return bytes;
|
|
164442
164831
|
}
|
|
164443
|
-
function
|
|
164832
|
+
function uint8ArrayToBase642(bytes) {
|
|
164444
164833
|
let binaryString = "";
|
|
164445
164834
|
for (let i2 = 0; i2 < bytes.length; i2++) {
|
|
164446
164835
|
binaryString += String.fromCharCode(bytes[i2]);
|
|
@@ -164453,7 +164842,7 @@ function base64urlToUint8Array(base64url3) {
|
|
|
164453
164842
|
return base64ToUint8Array(base643 + padding);
|
|
164454
164843
|
}
|
|
164455
164844
|
function uint8ArrayToBase64url(bytes) {
|
|
164456
|
-
return
|
|
164845
|
+
return uint8ArrayToBase642(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
164457
164846
|
}
|
|
164458
164847
|
function hexToUint8Array(hex5) {
|
|
164459
164848
|
const cleanHex = hex5.replace(/^0x/, "");
|
|
@@ -168767,8 +169156,8 @@ function az_default() {
|
|
|
168767
169156
|
}
|
|
168768
169157
|
|
|
168769
169158
|
// ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/be.js
|
|
168770
|
-
function getBelarusianPlural(
|
|
168771
|
-
const absCount = Math.abs(
|
|
169159
|
+
function getBelarusianPlural(count2, one, few, many) {
|
|
169160
|
+
const absCount = Math.abs(count2);
|
|
168772
169161
|
const lastDigit = absCount % 10;
|
|
168773
169162
|
const lastTwoDigits = absCount % 100;
|
|
168774
169163
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -171415,8 +171804,8 @@ function hu_default() {
|
|
|
171415
171804
|
}
|
|
171416
171805
|
|
|
171417
171806
|
// ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/hy.js
|
|
171418
|
-
function getArmenianPlural(
|
|
171419
|
-
return Math.abs(
|
|
171807
|
+
function getArmenianPlural(count2, one, many) {
|
|
171808
|
+
return Math.abs(count2) === 1 ? one : many;
|
|
171420
171809
|
}
|
|
171421
171810
|
function withDefiniteArticle(word) {
|
|
171422
171811
|
if (!word)
|
|
@@ -174154,8 +174543,8 @@ function ro_default() {
|
|
|
174154
174543
|
}
|
|
174155
174544
|
|
|
174156
174545
|
// ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ru.js
|
|
174157
|
-
function getRussianPlural(
|
|
174158
|
-
const absCount = Math.abs(
|
|
174546
|
+
function getRussianPlural(count2, one, few, many) {
|
|
174547
|
+
const absCount = Math.abs(count2);
|
|
174159
174548
|
const lastDigit = absCount % 10;
|
|
174160
174549
|
const lastTwoDigits = absCount % 100;
|
|
174161
174550
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|