@aixa-transformation/pptx-viewer 2.0.31 → 2.0.35
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/{Model3DScene-BLJ7FKLP.mjs → Model3DScene-2GPBXNZQ.mjs} +2 -2
- package/dist/{Model3DScene-7DX3ENQ6.js → Model3DScene-TSBEZY4V.js} +3 -3
- package/dist/{SurfaceChart3DScene-63SAKPUY.js → SurfaceChart3DScene-IT7MXL75.js} +3 -3
- package/dist/{SurfaceChart3DScene-EQNT7LKA.mjs → SurfaceChart3DScene-UZJIMAM6.mjs} +2 -2
- package/dist/{chunk-UTBY3XQF.js → chunk-7UWYAMOP.js} +481 -481
- package/dist/{chunk-NG3CPWXD.js → chunk-F4FDQTWH.js} +41 -41
- package/dist/{chunk-FXXVW5YN.mjs → chunk-JVIT6JD7.mjs} +4 -4
- package/dist/{chunk-6SJP4DDM.mjs → chunk-PWNYNDVP.mjs} +1 -1
- package/dist/{chunk-62Y7KDX7.js → chunk-Q5EMZWLA.js} +854 -836
- package/dist/{chunk-YOOFW6LR.js → chunk-X32L7B67.js} +169 -13
- package/dist/{chunk-RT4PSAEN.mjs → chunk-XU7A5YCG.mjs} +24 -6
- package/dist/{chunk-3IIMAKXR.mjs → chunk-ZKWWCC2U.mjs} +169 -13
- package/dist/{dist-DIPQCCIK.js → dist-GJSSSVHL.js} +568 -568
- package/dist/{dist-YFPT5NJI.mjs → dist-KNXTCBMV.mjs} +1 -1
- package/dist/index.js +34 -34
- package/dist/index.mjs +4 -4
- package/dist/internals.js +78 -78
- package/dist/internals.mjs +3 -3
- package/dist/presentation.js +2 -2
- package/dist/presentation.mjs +1 -1
- package/dist/viewer/index.js +20 -20
- package/dist/viewer/index.mjs +4 -4
- package/package.json +1 -1
|
@@ -8624,7 +8624,7 @@ var PptxPresentationSlidesReconciler = class {
|
|
|
8624
8624
|
if (typeof relationshipId2 === "string" && relationshipId2.length > 0) {
|
|
8625
8625
|
usedRIds.add(relationshipId2);
|
|
8626
8626
|
}
|
|
8627
|
-
if (relationshipType
|
|
8627
|
+
if (this.isSlideRelationshipType(relationshipType, input.slideRelationshipType) && typeof relationshipId2 === "string" && typeof relationshipTarget2 === "string") {
|
|
8628
8628
|
slideTargetByRid.set(relationshipId2, relationshipTarget2);
|
|
8629
8629
|
continue;
|
|
8630
8630
|
}
|
|
@@ -8839,6 +8839,13 @@ var PptxPresentationSlidesReconciler = class {
|
|
|
8839
8839
|
}
|
|
8840
8840
|
return [value];
|
|
8841
8841
|
}
|
|
8842
|
+
/** Match equivalent Strict and Transitional slide relationship URIs. */
|
|
8843
|
+
isSlideRelationshipType(value, expected) {
|
|
8844
|
+
if (typeof value !== "string") {
|
|
8845
|
+
return false;
|
|
8846
|
+
}
|
|
8847
|
+
return value === expected || value.endsWith("/relationships/slide");
|
|
8848
|
+
}
|
|
8842
8849
|
};
|
|
8843
8850
|
function isExternalTarget(target) {
|
|
8844
8851
|
const normalized = target.trim();
|
|
@@ -16381,8 +16388,16 @@ var PptxDocumentPropertiesUpdater = class {
|
|
|
16381
16388
|
const relationships = relsData["Relationships"];
|
|
16382
16389
|
if (relationships) {
|
|
16383
16390
|
const rels = Array.isArray(relationships["Relationship"]) ? relationships["Relationship"] : relationships["Relationship"] ? [relationships["Relationship"]] : [];
|
|
16384
|
-
const
|
|
16385
|
-
|
|
16391
|
+
const customRelationships = rels.filter(
|
|
16392
|
+
(relationship) => this.isCustomPropertiesRelationship(relationship)
|
|
16393
|
+
);
|
|
16394
|
+
if (customRelationships.length > 0) {
|
|
16395
|
+
const retained = customRelationships[0];
|
|
16396
|
+
relationships["Relationship"] = rels.filter(
|
|
16397
|
+
(relationship) => !this.isCustomPropertiesRelationship(relationship) || relationship === retained
|
|
16398
|
+
);
|
|
16399
|
+
this.context.zip.file("_rels/.rels", this.context.builder.build(relsData));
|
|
16400
|
+
} else {
|
|
16386
16401
|
let maxId = 0;
|
|
16387
16402
|
for (const rel of rels) {
|
|
16388
16403
|
const id = String(rel?.["@_Id"] || "");
|
|
@@ -16411,7 +16426,6 @@ var PptxDocumentPropertiesUpdater = class {
|
|
|
16411
16426
|
* orphan content-type entry referencing a deleted part.
|
|
16412
16427
|
*/
|
|
16413
16428
|
async removeCustomPropertiesPackagingArtifacts() {
|
|
16414
|
-
const customRelType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties";
|
|
16415
16429
|
const ctFile = this.context.zip.file("[Content_Types].xml");
|
|
16416
16430
|
if (ctFile) {
|
|
16417
16431
|
try {
|
|
@@ -16439,7 +16453,9 @@ var PptxDocumentPropertiesUpdater = class {
|
|
|
16439
16453
|
const relationships = relsData["Relationships"];
|
|
16440
16454
|
if (relationships) {
|
|
16441
16455
|
const rels = Array.isArray(relationships["Relationship"]) ? relationships["Relationship"] : relationships["Relationship"] ? [relationships["Relationship"]] : [];
|
|
16442
|
-
const filtered = rels.filter(
|
|
16456
|
+
const filtered = rels.filter(
|
|
16457
|
+
(relationship) => !this.isCustomPropertiesRelationship(relationship)
|
|
16458
|
+
);
|
|
16443
16459
|
if (filtered.length !== rels.length) {
|
|
16444
16460
|
relationships["Relationship"] = filtered;
|
|
16445
16461
|
this.context.zip.file("_rels/.rels", this.context.builder.build(relsData));
|
|
@@ -16449,6 +16465,11 @@ var PptxDocumentPropertiesUpdater = class {
|
|
|
16449
16465
|
}
|
|
16450
16466
|
}
|
|
16451
16467
|
}
|
|
16468
|
+
isCustomPropertiesRelationship(relationship) {
|
|
16469
|
+
const type = String(relationship?.["@_Type"] || "");
|
|
16470
|
+
const target = String(relationship?.["@_Target"] || "").replace(/\\/gu, "/").replace(/^\.\//u, "");
|
|
16471
|
+
return target === "docProps/custom.xml" || type.endsWith("/relationships/custom-properties") || type.endsWith("/relationships/customProperties");
|
|
16472
|
+
}
|
|
16452
16473
|
normalizeCustomPropertyType(type) {
|
|
16453
16474
|
const supportedTypes = /* @__PURE__ */ new Set([
|
|
16454
16475
|
"lpwstr",
|
|
@@ -31680,6 +31701,31 @@ function readUtf16LE2(data, offset, byteLength) {
|
|
|
31680
31701
|
}
|
|
31681
31702
|
return chars.join("");
|
|
31682
31703
|
}
|
|
31704
|
+
function readUint16BE(data, offset) {
|
|
31705
|
+
return (data[offset] ?? 0) << 8 | (data[offset + 1] ?? 0);
|
|
31706
|
+
}
|
|
31707
|
+
function readUint32BE(data, offset) {
|
|
31708
|
+
return ((data[offset] ?? 0) << 24 >>> 0 | (data[offset + 1] ?? 0) << 16 | (data[offset + 2] ?? 0) << 8 | (data[offset + 3] ?? 0)) >>> 0;
|
|
31709
|
+
}
|
|
31710
|
+
function findSfntTable(data, tag) {
|
|
31711
|
+
if (data.length < 12) return null;
|
|
31712
|
+
const numTables = readUint16BE(data, 4);
|
|
31713
|
+
for (let i = 0; i < numTables; i++) {
|
|
31714
|
+
const record = 12 + i * 16;
|
|
31715
|
+
if (record + 16 > data.length) break;
|
|
31716
|
+
const recordTag = String.fromCharCode(
|
|
31717
|
+
data[record],
|
|
31718
|
+
data[record + 1],
|
|
31719
|
+
data[record + 2],
|
|
31720
|
+
data[record + 3]
|
|
31721
|
+
);
|
|
31722
|
+
if (recordTag !== tag) continue;
|
|
31723
|
+
const offset = readUint32BE(data, record + 8);
|
|
31724
|
+
const length = readUint32BE(data, record + 12);
|
|
31725
|
+
return offset + length <= data.length ? { offset, length } : null;
|
|
31726
|
+
}
|
|
31727
|
+
return null;
|
|
31728
|
+
}
|
|
31683
31729
|
function isEotFormat(data) {
|
|
31684
31730
|
if (data.length < 36) {
|
|
31685
31731
|
return false;
|
|
@@ -31687,6 +31733,70 @@ function isEotFormat(data) {
|
|
|
31687
31733
|
const magic = readUint16LE(data, EOT_MAGIC_OFFSET);
|
|
31688
31734
|
return magic === EOT_MAGIC;
|
|
31689
31735
|
}
|
|
31736
|
+
function createEotFromSfnt(fontData, options) {
|
|
31737
|
+
const encodeName2 = (value) => {
|
|
31738
|
+
const bytes = new Uint8Array((value.length + 1) * 2);
|
|
31739
|
+
const view2 = new DataView(bytes.buffer);
|
|
31740
|
+
for (let i = 0; i < value.length; i++) {
|
|
31741
|
+
view2.setUint16(i * 2, value.charCodeAt(i), true);
|
|
31742
|
+
}
|
|
31743
|
+
return bytes;
|
|
31744
|
+
};
|
|
31745
|
+
const names = [
|
|
31746
|
+
encodeName2(options.familyName),
|
|
31747
|
+
encodeName2(options.styleName ?? ""),
|
|
31748
|
+
encodeName2(""),
|
|
31749
|
+
encodeName2(options.fullName ?? options.familyName)
|
|
31750
|
+
];
|
|
31751
|
+
const headerSize = 82 + names.reduce((sum, name) => sum + 2 + name.length, 0) + 2;
|
|
31752
|
+
const result = new Uint8Array(headerSize + fontData.length);
|
|
31753
|
+
const view = new DataView(result.buffer);
|
|
31754
|
+
const os2 = findSfntTable(fontData, "OS/2");
|
|
31755
|
+
const head = findSfntTable(fontData, "head");
|
|
31756
|
+
view.setUint32(0, result.length, true);
|
|
31757
|
+
view.setUint32(4, fontData.length, true);
|
|
31758
|
+
view.setUint32(8, 131073, true);
|
|
31759
|
+
view.setUint32(12, 0, true);
|
|
31760
|
+
if (os2 && os2.length >= 42) {
|
|
31761
|
+
result.set(fontData.slice(os2.offset + 32, os2.offset + 42), 16);
|
|
31762
|
+
}
|
|
31763
|
+
result[26] = 1;
|
|
31764
|
+
result[27] = options.italic ? 1 : 0;
|
|
31765
|
+
view.setUint32(
|
|
31766
|
+
28,
|
|
31767
|
+
options.weight ?? (os2 && os2.length >= 6 ? readUint16BE(fontData, os2.offset + 4) : 400),
|
|
31768
|
+
true
|
|
31769
|
+
);
|
|
31770
|
+
view.setUint16(
|
|
31771
|
+
32,
|
|
31772
|
+
os2 && os2.length >= 10 ? readUint16BE(fontData, os2.offset + 8) : 0,
|
|
31773
|
+
true
|
|
31774
|
+
);
|
|
31775
|
+
view.setUint16(34, EOT_MAGIC, true);
|
|
31776
|
+
if (os2 && os2.length >= 58) {
|
|
31777
|
+
for (let i = 0; i < 4; i++) {
|
|
31778
|
+
view.setUint32(36 + i * 4, readUint32BE(fontData, os2.offset + 42 + i * 4), true);
|
|
31779
|
+
}
|
|
31780
|
+
}
|
|
31781
|
+
if (os2 && os2.length >= 86) {
|
|
31782
|
+
view.setUint32(52, readUint32BE(fontData, os2.offset + 78), true);
|
|
31783
|
+
view.setUint32(56, readUint32BE(fontData, os2.offset + 82), true);
|
|
31784
|
+
}
|
|
31785
|
+
if (head && head.length >= 12) {
|
|
31786
|
+
view.setUint32(60, readUint32BE(fontData, head.offset + 8), true);
|
|
31787
|
+
}
|
|
31788
|
+
let offset = 82;
|
|
31789
|
+
for (const name of names) {
|
|
31790
|
+
view.setUint16(offset, Math.max(0, name.length - 2), true);
|
|
31791
|
+
offset += 2;
|
|
31792
|
+
result.set(name, offset);
|
|
31793
|
+
offset += name.length;
|
|
31794
|
+
}
|
|
31795
|
+
view.setUint16(offset, 0, true);
|
|
31796
|
+
offset += 2;
|
|
31797
|
+
result.set(fontData, offset);
|
|
31798
|
+
return result;
|
|
31799
|
+
}
|
|
31690
31800
|
function parseEotHeader(data) {
|
|
31691
31801
|
if (!isEotFormat(data)) {
|
|
31692
31802
|
return null;
|
|
@@ -31719,8 +31829,10 @@ function parseEotHeader(data) {
|
|
|
31719
31829
|
const styleName = readNameString();
|
|
31720
31830
|
const versionName = readNameString();
|
|
31721
31831
|
const fullName = readNameString();
|
|
31722
|
-
if (version >=
|
|
31832
|
+
if (version >= 131073 && offset + 4 <= data.length && readUint16LE(data, offset) === 0 && readUint16LE(data, offset + 2) === 0) {
|
|
31723
31833
|
readNameString();
|
|
31834
|
+
}
|
|
31835
|
+
if (version >= 131074) {
|
|
31724
31836
|
offset += 8;
|
|
31725
31837
|
if (offset + 4 <= data.length) {
|
|
31726
31838
|
const signatureSize = readUint16LE(data, offset + 2);
|
|
@@ -31789,7 +31901,8 @@ function guidToKey(guid) {
|
|
|
31789
31901
|
}
|
|
31790
31902
|
const key = new Uint8Array(KEY_LENGTH);
|
|
31791
31903
|
for (let i = 0; i < KEY_LENGTH; i++) {
|
|
31792
|
-
|
|
31904
|
+
const sourceIndex = KEY_LENGTH - i - 1;
|
|
31905
|
+
key[i] = parseInt(stripped.substring(sourceIndex * 2, sourceIndex * 2 + 2), 16);
|
|
31793
31906
|
}
|
|
31794
31907
|
return key;
|
|
31795
31908
|
}
|
|
@@ -41641,9 +41754,13 @@ var NAMESPACE_PAIRS = [
|
|
|
41641
41754
|
"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"
|
|
41642
41755
|
],
|
|
41643
41756
|
[
|
|
41644
|
-
"http://purl.oclc.org/ooxml/officeDocument/
|
|
41757
|
+
"http://purl.oclc.org/ooxml/officeDocument/customProperties",
|
|
41645
41758
|
"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
|
|
41646
41759
|
],
|
|
41760
|
+
[
|
|
41761
|
+
"http://purl.oclc.org/ooxml/officeDocument/relationships/customProperties",
|
|
41762
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"
|
|
41763
|
+
],
|
|
41647
41764
|
[
|
|
41648
41765
|
"http://purl.oclc.org/ooxml/officeDocument/extended-properties",
|
|
41649
41766
|
"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
|
@@ -62249,8 +62366,14 @@ var PptxHandlerRuntime24 = class _PptxHandlerRuntime7 extends PptxHandlerRuntime
|
|
|
62249
62366
|
}
|
|
62250
62367
|
return;
|
|
62251
62368
|
}
|
|
62369
|
+
const newFontsWithData = fontsWithData.filter(
|
|
62370
|
+
(font) => !(font.originalRId && font.partPath)
|
|
62371
|
+
);
|
|
62372
|
+
if (newFontsWithData.length === 0) {
|
|
62373
|
+
return;
|
|
62374
|
+
}
|
|
62252
62375
|
const fontsByName = /* @__PURE__ */ new Map();
|
|
62253
|
-
for (const font of
|
|
62376
|
+
for (const font of newFontsWithData) {
|
|
62254
62377
|
const existing = fontsByName.get(font.name) ?? [];
|
|
62255
62378
|
existing.push(font);
|
|
62256
62379
|
fontsByName.set(font.name, existing);
|
|
@@ -62285,6 +62408,13 @@ var PptxHandlerRuntime24 = class _PptxHandlerRuntime7 extends PptxHandlerRuntime
|
|
|
62285
62408
|
};
|
|
62286
62409
|
for (const variant of variants) {
|
|
62287
62410
|
const fontData = variant.rawFontData;
|
|
62411
|
+
const isWebFont = variant.format === "woff" || variant.format === "woff2";
|
|
62412
|
+
const hasSfntSignature = fontData.length >= 4 && (fontData[0] === 0 && fontData[1] === 1 && fontData[2] === 0 && fontData[3] === 0 || String.fromCharCode(fontData[0], fontData[1], fontData[2], fontData[3]) === "OTTO" || String.fromCharCode(fontData[0], fontData[1], fontData[2], fontData[3]) === "true" || String.fromCharCode(fontData[0], fontData[1], fontData[2], fontData[3]) === "ttcf");
|
|
62413
|
+
if (!variant.originalRId && (isWebFont || !hasSfntSignature)) {
|
|
62414
|
+
throw new Error(
|
|
62415
|
+
`Cannot embed custom font "${variant.name}" in PowerPoint: use a valid .ttf or .otf font file, not WOFF/WOFF2 browser data.`
|
|
62416
|
+
);
|
|
62417
|
+
}
|
|
62288
62418
|
const hasOriginal = Boolean(variant.originalRId && variant.partPath);
|
|
62289
62419
|
const reuseObfuscation = hasOriginal && Boolean(variant.fontGuid);
|
|
62290
62420
|
const reuseVerbatim = hasOriginal && !variant.fontGuid && Boolean(variant.originalPartBytes);
|
|
@@ -62307,10 +62437,16 @@ var PptxHandlerRuntime24 = class _PptxHandlerRuntime7 extends PptxHandlerRuntime
|
|
|
62307
62437
|
bytesToWrite = variant.originalPartBytes;
|
|
62308
62438
|
} else {
|
|
62309
62439
|
guid = variant.fontGuid ?? generateFontGuid();
|
|
62310
|
-
const
|
|
62440
|
+
const usedFontNumbers = relationships.map((relationship) => /fonts\/font(?<number>\d+)\.fntdata$/iu.exec(String(relationship?.["@_Target"] || ""))?.groups?.number).map((number) => Number(number)).filter((number) => Number.isFinite(number));
|
|
62441
|
+
const fileName = `font${Math.max(0, ...usedFontNumbers) + 1}.fntdata`;
|
|
62311
62442
|
fontPartPath = `ppt/fonts/${fileName}`;
|
|
62312
62443
|
relativeTarget4 = `fonts/${fileName}`;
|
|
62313
|
-
bytesToWrite =
|
|
62444
|
+
bytesToWrite = createEotFromSfnt(fontData, {
|
|
62445
|
+
familyName: variant.name,
|
|
62446
|
+
styleName: variant.bold ? variant.italic ? "Bold Italic" : "Bold" : variant.italic ? "Italic" : "Regular",
|
|
62447
|
+
weight: variant.bold ? 700 : 400,
|
|
62448
|
+
italic: variant.italic
|
|
62449
|
+
});
|
|
62314
62450
|
const existingRel = relationships.find(
|
|
62315
62451
|
(r) => String(r?.["@_Target"] || "") === relativeTarget4
|
|
62316
62452
|
);
|
|
@@ -62339,8 +62475,28 @@ var PptxHandlerRuntime24 = class _PptxHandlerRuntime7 extends PptxHandlerRuntime
|
|
|
62339
62475
|
const generatedList = {
|
|
62340
62476
|
"p:embeddedFont": embeddedFontEntries.length === 1 ? embeddedFontEntries[0] : embeddedFontEntries
|
|
62341
62477
|
};
|
|
62342
|
-
const
|
|
62343
|
-
|
|
62478
|
+
const preservedMetadata = explicitFontList ?? this.loadedEmbeddedFontList;
|
|
62479
|
+
let metadata = generatedList;
|
|
62480
|
+
let metadataAppliedInPlace = false;
|
|
62481
|
+
if (preservedMetadata?.rawXml && !explicitFontList) {
|
|
62482
|
+
const rawList = preservedMetadata.rawXml;
|
|
62483
|
+
const embeddedFontKey = Object.keys(rawList).find(
|
|
62484
|
+
(key) => key.replace(/^.*:/u, "") === "embeddedFont"
|
|
62485
|
+
) ?? "p:embeddedFont";
|
|
62486
|
+
const preservedEntries = this.ensureArray(rawList[embeddedFontKey]);
|
|
62487
|
+
rawList[embeddedFontKey] = [...preservedEntries, ...embeddedFontEntries];
|
|
62488
|
+
metadataAppliedInPlace = true;
|
|
62489
|
+
} else if (preservedMetadata) {
|
|
62490
|
+
metadata = serializeEmbeddedFontList(preservedMetadata);
|
|
62491
|
+
const embeddedFontKey = Object.keys(metadata).find(
|
|
62492
|
+
(key) => key.replace(/^.*:/u, "") === "embeddedFont"
|
|
62493
|
+
) ?? "p:embeddedFont";
|
|
62494
|
+
const preservedEntries = this.ensureArray(metadata[embeddedFontKey]);
|
|
62495
|
+
metadata[embeddedFontKey] = [...preservedEntries, ...embeddedFontEntries];
|
|
62496
|
+
}
|
|
62497
|
+
if (!metadataAppliedInPlace) {
|
|
62498
|
+
setEmbeddedFontList(this.presentationData, metadata);
|
|
62499
|
+
}
|
|
62344
62500
|
}
|
|
62345
62501
|
const ctXml = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
62346
62502
|
if (ctXml) {
|