pptx-viewer-core 1.3.0 → 1.4.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/CHANGELOG.md +8 -0
- package/dist/cli/index.js +0 -0
- package/dist/cli/index.mjs +0 -0
- package/dist/converter/index.js +0 -0
- package/dist/converter/index.mjs +0 -0
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +156 -98
- package/dist/index.mjs +156 -98
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ All notable changes to this project are documented here.
|
|
|
4
4
|
This file is generated from [Conventional Commits](https://www.conventionalcommits.org)
|
|
5
5
|
by [git-cliff](https://git-cliff.org); do not edit it by hand.
|
|
6
6
|
|
|
7
|
+
## [1.3.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-core@1.3.1) - 2026-07-13
|
|
8
|
+
|
|
9
|
+
## [1.3.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-core@1.3.0) - 2026-07-11
|
|
10
|
+
|
|
11
|
+
### Other
|
|
12
|
+
|
|
13
|
+
- Reconcile with origin/main before push (by @ChristopherVR) ([0ecd3d9](https://github.com/ChristopherVR/pptx-viewer/commit/0ecd3d935f97c78e8b0a62bebc8bf610c42414ab))
|
|
14
|
+
|
|
7
15
|
## [1.2.8](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-core@1.2.8) - 2026-07-10
|
|
8
16
|
|
|
9
17
|
## [1.2.7](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-core@1.2.7) - 2026-07-09
|
package/dist/cli/index.js
CHANGED
|
Binary file
|
package/dist/cli/index.mjs
CHANGED
|
Binary file
|
package/dist/converter/index.js
CHANGED
|
Binary file
|
package/dist/converter/index.mjs
CHANGED
|
Binary file
|
package/dist/index.d.mts
CHANGED
|
@@ -2958,7 +2958,7 @@ declare function hasNonTrivialOverride(override: Record<string, string> | null |
|
|
|
2958
2958
|
* (which indicates an encrypted OOXML package) rather than a normal ZIP.
|
|
2959
2959
|
*
|
|
2960
2960
|
* Encrypted OOXML files are wrapped in OLE structured storage format.
|
|
2961
|
-
* The OLE magic bytes are: D0 CF 11 E0 A1
|
|
2961
|
+
* The OLE magic bytes are: D0 CF 11 E0 A1 B1 1A E1
|
|
2962
2962
|
* Normal PPTX files start with ZIP magic: 50 4B (PK)
|
|
2963
2963
|
*/
|
|
2964
2964
|
type FileFormatDetection = {
|
|
@@ -6571,7 +6571,7 @@ declare class PptxHandlerRuntime$10 extends PptxHandlerRuntime$11 {
|
|
|
6571
6571
|
}
|
|
6572
6572
|
|
|
6573
6573
|
declare class PptxHandlerRuntime$$ extends PptxHandlerRuntime$10 {
|
|
6574
|
-
protected extractTextRunStyle(runProperties: XmlObject | undefined, align: TextStyle['align'], relationshipMap?: Map<string, string
|
|
6574
|
+
protected extractTextRunStyle(runProperties: XmlObject | undefined, align: TextStyle['align'], relationshipMap?: Map<string, string>, includeDefaultAlignment?: boolean): TextStyle;
|
|
6575
6575
|
/**
|
|
6576
6576
|
* Copy `@panose` / `@pitchFamily` / `@charset` from a font child node
|
|
6577
6577
|
* (`a:latin`, `a:ea`, `a:cs`, `a:sym`) onto the matching `*Font*`
|
|
@@ -7570,6 +7570,7 @@ declare class PptxHandlerRuntime$D extends PptxHandlerRuntime$E {
|
|
|
7570
7570
|
* merges them so that layout values take priority over master values.
|
|
7571
7571
|
*/
|
|
7572
7572
|
protected lookupPlaceholderDefaults(slidePath: string, phInfo: PlaceholderInfo): PlaceholderDefaults | undefined;
|
|
7573
|
+
private mergePlaceholderLevelStyles;
|
|
7573
7574
|
}
|
|
7574
7575
|
|
|
7575
7576
|
declare class PptxHandlerRuntime$C extends PptxHandlerRuntime$D {
|
|
@@ -8721,7 +8722,7 @@ declare class PptxHandlerRuntime$2 extends PptxHandlerRuntime$3 {
|
|
|
8721
8722
|
notesWidthEmu: number;
|
|
8722
8723
|
notesHeightEmu: number;
|
|
8723
8724
|
orderedSections: PptxSection[];
|
|
8724
|
-
}, slidesWithWarnings: PptxSlide[]): Promise<PptxData>;
|
|
8725
|
+
}, slidesWithWarnings: PptxSlide[], slideMasters: PptxSlideMaster[]): Promise<PptxData>;
|
|
8725
8726
|
/**
|
|
8726
8727
|
* Walk the raw XML of every slide to find the highest numeric `@_id`
|
|
8727
8728
|
* attribute on `p:cNvPr` / `p:cNvCxnSpPr` / `p:cNvPicPr` nodes.
|
package/dist/index.d.ts
CHANGED
|
@@ -2958,7 +2958,7 @@ declare function hasNonTrivialOverride(override: Record<string, string> | null |
|
|
|
2958
2958
|
* (which indicates an encrypted OOXML package) rather than a normal ZIP.
|
|
2959
2959
|
*
|
|
2960
2960
|
* Encrypted OOXML files are wrapped in OLE structured storage format.
|
|
2961
|
-
* The OLE magic bytes are: D0 CF 11 E0 A1
|
|
2961
|
+
* The OLE magic bytes are: D0 CF 11 E0 A1 B1 1A E1
|
|
2962
2962
|
* Normal PPTX files start with ZIP magic: 50 4B (PK)
|
|
2963
2963
|
*/
|
|
2964
2964
|
type FileFormatDetection = {
|
|
@@ -6571,7 +6571,7 @@ declare class PptxHandlerRuntime$10 extends PptxHandlerRuntime$11 {
|
|
|
6571
6571
|
}
|
|
6572
6572
|
|
|
6573
6573
|
declare class PptxHandlerRuntime$$ extends PptxHandlerRuntime$10 {
|
|
6574
|
-
protected extractTextRunStyle(runProperties: XmlObject | undefined, align: TextStyle['align'], relationshipMap?: Map<string, string
|
|
6574
|
+
protected extractTextRunStyle(runProperties: XmlObject | undefined, align: TextStyle['align'], relationshipMap?: Map<string, string>, includeDefaultAlignment?: boolean): TextStyle;
|
|
6575
6575
|
/**
|
|
6576
6576
|
* Copy `@panose` / `@pitchFamily` / `@charset` from a font child node
|
|
6577
6577
|
* (`a:latin`, `a:ea`, `a:cs`, `a:sym`) onto the matching `*Font*`
|
|
@@ -7570,6 +7570,7 @@ declare class PptxHandlerRuntime$D extends PptxHandlerRuntime$E {
|
|
|
7570
7570
|
* merges them so that layout values take priority over master values.
|
|
7571
7571
|
*/
|
|
7572
7572
|
protected lookupPlaceholderDefaults(slidePath: string, phInfo: PlaceholderInfo): PlaceholderDefaults | undefined;
|
|
7573
|
+
private mergePlaceholderLevelStyles;
|
|
7573
7574
|
}
|
|
7574
7575
|
|
|
7575
7576
|
declare class PptxHandlerRuntime$C extends PptxHandlerRuntime$D {
|
|
@@ -8721,7 +8722,7 @@ declare class PptxHandlerRuntime$2 extends PptxHandlerRuntime$3 {
|
|
|
8721
8722
|
notesWidthEmu: number;
|
|
8722
8723
|
notesHeightEmu: number;
|
|
8723
8724
|
orderedSections: PptxSection[];
|
|
8724
|
-
}, slidesWithWarnings: PptxSlide[]): Promise<PptxData>;
|
|
8725
|
+
}, slidesWithWarnings: PptxSlide[], slideMasters: PptxSlideMaster[]): Promise<PptxData>;
|
|
8725
8726
|
/**
|
|
8726
8727
|
* Walk the raw XML of every slide to find the highest numeric `@_id`
|
|
8727
8728
|
* attribute on `p:cNvPr` / `p:cNvCxnSpPr` / `p:cNvPicPr` nodes.
|
package/dist/index.js
CHANGED
|
@@ -12801,7 +12801,7 @@ function stripParentDirSegments(path) {
|
|
|
12801
12801
|
}
|
|
12802
12802
|
|
|
12803
12803
|
// src/core/utils/ole2-parser-types.ts
|
|
12804
|
-
var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161,
|
|
12804
|
+
var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
12805
12805
|
var ENDOFCHAIN = 4294967294;
|
|
12806
12806
|
var FREESECT = 4294967295;
|
|
12807
12807
|
var FATSECT = 4294967293;
|
|
@@ -19333,7 +19333,7 @@ function resolveLayoutCategory(layoutType) {
|
|
|
19333
19333
|
}
|
|
19334
19334
|
|
|
19335
19335
|
// src/core/utils/encryption-detection.ts
|
|
19336
|
-
var OLE_MAGIC2 = new Uint8Array([208, 207, 17, 224, 161,
|
|
19336
|
+
var OLE_MAGIC2 = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
19337
19337
|
var ZIP_MAGIC = new Uint8Array([80, 75]);
|
|
19338
19338
|
function detectFileFormat(data) {
|
|
19339
19339
|
if (data.byteLength < 8) {
|
|
@@ -20027,15 +20027,9 @@ async function verifyAgilePassword(info, password) {
|
|
|
20027
20027
|
pke.keyBits,
|
|
20028
20028
|
pke.hashSize
|
|
20029
20029
|
);
|
|
20030
|
-
const iv1 = generateIV(
|
|
20031
|
-
pke.hashAlgorithm,
|
|
20032
|
-
pke.saltValue,
|
|
20033
|
-
BLOCK_KEYS.verifierHashInput,
|
|
20034
|
-
pke.blockSize
|
|
20035
|
-
);
|
|
20036
20030
|
const verifierHashInput = await aesCbcDecryptRaw(
|
|
20037
20031
|
verifierInputKey,
|
|
20038
|
-
|
|
20032
|
+
pke.saltValue,
|
|
20039
20033
|
pke.encryptedVerifierHashInput
|
|
20040
20034
|
);
|
|
20041
20035
|
const verifierHashKey = await deriveAgileKey(
|
|
@@ -20047,15 +20041,9 @@ async function verifyAgilePassword(info, password) {
|
|
|
20047
20041
|
pke.keyBits,
|
|
20048
20042
|
pke.hashSize
|
|
20049
20043
|
);
|
|
20050
|
-
const iv2 = generateIV(
|
|
20051
|
-
pke.hashAlgorithm,
|
|
20052
|
-
pke.saltValue,
|
|
20053
|
-
BLOCK_KEYS.verifierHashValue,
|
|
20054
|
-
pke.blockSize
|
|
20055
|
-
);
|
|
20056
20044
|
const verifierHashValue = await aesCbcDecryptRaw(
|
|
20057
20045
|
verifierHashKey,
|
|
20058
|
-
|
|
20046
|
+
pke.saltValue,
|
|
20059
20047
|
pke.encryptedVerifierHashValue
|
|
20060
20048
|
);
|
|
20061
20049
|
const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
|
|
@@ -20080,13 +20068,7 @@ async function verifyAgilePassword(info, password) {
|
|
|
20080
20068
|
pke.keyBits,
|
|
20081
20069
|
pke.hashSize
|
|
20082
20070
|
);
|
|
20083
|
-
const
|
|
20084
|
-
pke.hashAlgorithm,
|
|
20085
|
-
pke.saltValue,
|
|
20086
|
-
BLOCK_KEYS.encryptedKeyValue,
|
|
20087
|
-
pke.blockSize
|
|
20088
|
-
);
|
|
20089
|
-
const decryptedKey = await aesCbcDecryptRaw(encKeyKey, iv3, pke.encryptedKeyValue);
|
|
20071
|
+
const decryptedKey = await aesCbcDecryptRaw(encKeyKey, pke.saltValue, pke.encryptedKeyValue);
|
|
20090
20072
|
return decryptedKey.subarray(0, info.keyData.keyBits / 8);
|
|
20091
20073
|
}
|
|
20092
20074
|
async function verifyStandardPassword(info, password) {
|
|
@@ -20139,8 +20121,7 @@ async function verifyAgileDataIntegrity(info, key, encryptedPackage) {
|
|
|
20139
20121
|
info.dataIntegrity.encryptedHmacValue
|
|
20140
20122
|
);
|
|
20141
20123
|
const expectedHmac = decryptedHmacValue.subarray(0, keyData.hashSize);
|
|
20142
|
-
const
|
|
20143
|
-
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedContent);
|
|
20124
|
+
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedPackage);
|
|
20144
20125
|
let match = true;
|
|
20145
20126
|
if (computedHmac.length < keyData.hashSize) {
|
|
20146
20127
|
match = false;
|
|
@@ -20294,14 +20275,13 @@ async function encryptPptx(pptxBuffer, password, options) {
|
|
|
20294
20275
|
keyBits,
|
|
20295
20276
|
hashSize
|
|
20296
20277
|
);
|
|
20297
|
-
const iv1 = await generateIV(hashAlgorithm, pkeSalt, BLOCK_KEYS.verifierHashInput, blockSize);
|
|
20298
20278
|
const paddedVerifierInput = new Uint8Array(
|
|
20299
20279
|
Math.ceil(verifierHashInput.length / blockSize) * blockSize
|
|
20300
20280
|
);
|
|
20301
20281
|
paddedVerifierInput.set(verifierHashInput);
|
|
20302
20282
|
const encryptedVerifierHashInput = await aesCbcEncryptNoPad(
|
|
20303
20283
|
verifierInputKey,
|
|
20304
|
-
|
|
20284
|
+
pkeSalt,
|
|
20305
20285
|
paddedVerifierInput
|
|
20306
20286
|
);
|
|
20307
20287
|
const verifierHashKey = await deriveAgileKey(
|
|
@@ -20313,12 +20293,11 @@ async function encryptPptx(pptxBuffer, password, options) {
|
|
|
20313
20293
|
keyBits,
|
|
20314
20294
|
hashSize
|
|
20315
20295
|
);
|
|
20316
|
-
const iv2 = await generateIV(hashAlgorithm, pkeSalt, BLOCK_KEYS.verifierHashValue, blockSize);
|
|
20317
20296
|
const paddedVerifierHash = new Uint8Array(Math.ceil(verifierHash.length / blockSize) * blockSize);
|
|
20318
20297
|
paddedVerifierHash.set(verifierHash);
|
|
20319
20298
|
const encryptedVerifierHashValue = await aesCbcEncryptNoPad(
|
|
20320
20299
|
verifierHashKey,
|
|
20321
|
-
|
|
20300
|
+
pkeSalt,
|
|
20322
20301
|
paddedVerifierHash
|
|
20323
20302
|
);
|
|
20324
20303
|
const encKeyKey = await deriveAgileKey(
|
|
@@ -20330,10 +20309,9 @@ async function encryptPptx(pptxBuffer, password, options) {
|
|
|
20330
20309
|
keyBits,
|
|
20331
20310
|
hashSize
|
|
20332
20311
|
);
|
|
20333
|
-
const iv3 = await generateIV(hashAlgorithm, pkeSalt, BLOCK_KEYS.encryptedKeyValue, blockSize);
|
|
20334
20312
|
const paddedDocumentKey = new Uint8Array(Math.ceil(documentKey.length / blockSize) * blockSize);
|
|
20335
20313
|
paddedDocumentKey.set(documentKey);
|
|
20336
|
-
const encryptedKeyValue = await aesCbcEncryptNoPad(encKeyKey,
|
|
20314
|
+
const encryptedKeyValue = await aesCbcEncryptNoPad(encKeyKey, pkeSalt, paddedDocumentKey);
|
|
20337
20315
|
const encInfo = {
|
|
20338
20316
|
keyData: {
|
|
20339
20317
|
saltSize: 16,
|
|
@@ -20369,7 +20347,7 @@ async function encryptPptx(pptxBuffer, password, options) {
|
|
|
20369
20347
|
const encryptedPackage = await encryptAgilePackage(packageData, documentKey, encInfo);
|
|
20370
20348
|
const hmacKeyRandom = new Uint8Array(hashSize);
|
|
20371
20349
|
crypto2.getRandomValues(hmacKeyRandom);
|
|
20372
|
-
const hmacValue = await hmac(hashAlgorithm, hmacKeyRandom, encryptedPackage
|
|
20350
|
+
const hmacValue = await hmac(hashAlgorithm, hmacKeyRandom, encryptedPackage);
|
|
20373
20351
|
const hmacKeyIV = await generateIV(
|
|
20374
20352
|
hashAlgorithm,
|
|
20375
20353
|
keyDataSalt,
|
|
@@ -21530,6 +21508,7 @@ var FONT_SUBSTITUTION_MAP = {
|
|
|
21530
21508
|
MoolBoran: ["Noto Sans Khmer", "sans-serif"],
|
|
21531
21509
|
// Decorative / Display
|
|
21532
21510
|
"Century Gothic": ["URW Gothic", "Futura", "sans-serif"],
|
|
21511
|
+
Oswald: ["Agency FB", "Arial Narrow", "sans-serif"],
|
|
21533
21512
|
"Franklin Gothic": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
21534
21513
|
"Franklin Gothic Medium": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
21535
21514
|
Garamond: ["EB Garamond", "Cormorant Garamond", "serif"],
|
|
@@ -31440,8 +31419,8 @@ var PptxHandlerRuntime18 = class extends PptxHandlerRuntime17 {
|
|
|
31440
31419
|
|
|
31441
31420
|
// src/core/core/runtime/PptxHandlerRuntimeTextRunStyleExtraction.ts
|
|
31442
31421
|
var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime18 {
|
|
31443
|
-
extractTextRunStyle(runProperties, align, relationshipMap) {
|
|
31444
|
-
const style = { align };
|
|
31422
|
+
extractTextRunStyle(runProperties, align, relationshipMap, includeDefaultAlignment = true) {
|
|
31423
|
+
const style = includeDefaultAlignment ? { align } : {};
|
|
31445
31424
|
if (!runProperties) {
|
|
31446
31425
|
return style;
|
|
31447
31426
|
}
|
|
@@ -38755,11 +38734,12 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
38755
38734
|
if (!source) {
|
|
38756
38735
|
return true;
|
|
38757
38736
|
}
|
|
38737
|
+
const typesMatch = source.type === target.type || source.type === "ctrtitle" && target.type === "title" || source.type === "subtitle" && target.type === "body";
|
|
38758
38738
|
if (source.idx !== void 0 && target.idx !== void 0) {
|
|
38759
38739
|
if (source.idx !== target.idx) {
|
|
38760
38740
|
return false;
|
|
38761
38741
|
}
|
|
38762
|
-
if (source.type && target.type &&
|
|
38742
|
+
if (source.type && target.type && !typesMatch) {
|
|
38763
38743
|
return false;
|
|
38764
38744
|
}
|
|
38765
38745
|
return true;
|
|
@@ -38767,11 +38747,11 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
38767
38747
|
if (source.idx !== void 0 && target.idx === void 0) {
|
|
38768
38748
|
const singletonTypes = /* @__PURE__ */ new Set(["title", "ctrtitle", "subtitle", "dt", "ftr", "sldnum"]);
|
|
38769
38749
|
if (source.type && singletonTypes.has(source.type)) {
|
|
38770
|
-
return
|
|
38750
|
+
return typesMatch;
|
|
38771
38751
|
}
|
|
38772
38752
|
return false;
|
|
38773
38753
|
}
|
|
38774
|
-
if (source.type && target.type &&
|
|
38754
|
+
if (source.type && target.type && !typesMatch) {
|
|
38775
38755
|
return false;
|
|
38776
38756
|
}
|
|
38777
38757
|
if (source.type && !target.type) {
|
|
@@ -38815,18 +38795,21 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38815
38795
|
xmlPath(layoutXmlObj, "p:sldLayout", "p:cSld", "p:spTree"),
|
|
38816
38796
|
expected
|
|
38817
38797
|
);
|
|
38818
|
-
if (layoutContext) {
|
|
38819
|
-
return layoutContext;
|
|
38820
|
-
}
|
|
38821
38798
|
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
38822
|
-
|
|
38823
|
-
|
|
38824
|
-
}
|
|
38825
|
-
const masterXmlObj = this.masterXmlMap.get(masterPath);
|
|
38826
|
-
return this.findPlaceholderInShapeTree(
|
|
38827
|
-
xmlPath(masterXmlObj, "p:sldMaster", "p:cSld", "p:spTree"),
|
|
38799
|
+
const masterContext = masterPath ? this.findPlaceholderInShapeTree(
|
|
38800
|
+
xmlPath(this.masterXmlMap.get(masterPath), "p:sldMaster", "p:cSld", "p:spTree"),
|
|
38828
38801
|
expected
|
|
38829
|
-
);
|
|
38802
|
+
) : void 0;
|
|
38803
|
+
if (!layoutContext) {
|
|
38804
|
+
return masterContext;
|
|
38805
|
+
}
|
|
38806
|
+
if (!masterContext) {
|
|
38807
|
+
return layoutContext;
|
|
38808
|
+
}
|
|
38809
|
+
return {
|
|
38810
|
+
shape: layoutContext.shape || masterContext.shape ? this.mergeXmlObjects(masterContext.shape, layoutContext.shape) : void 0,
|
|
38811
|
+
picture: layoutContext.picture || masterContext.picture ? this.mergeXmlObjects(masterContext.picture, layoutContext.picture) : void 0
|
|
38812
|
+
};
|
|
38830
38813
|
}
|
|
38831
38814
|
mergeXmlObjects(base, override, depth = 0) {
|
|
38832
38815
|
const MAX_MERGE_DEPTH = 64;
|
|
@@ -38879,10 +38862,11 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38879
38862
|
* otherwise falls back to `type`.
|
|
38880
38863
|
*/
|
|
38881
38864
|
buildPlaceholderDefaultsKey(phInfo) {
|
|
38865
|
+
const normalizedType = phInfo.type === "ctrtitle" ? "title" : phInfo.type === "subtitle" ? "body" : phInfo.type;
|
|
38882
38866
|
if (phInfo.idx !== void 0) {
|
|
38883
|
-
return
|
|
38867
|
+
return normalizedType ? `${normalizedType}_${phInfo.idx}` : `_${phInfo.idx}`;
|
|
38884
38868
|
}
|
|
38885
|
-
return
|
|
38869
|
+
return normalizedType ?? "body";
|
|
38886
38870
|
}
|
|
38887
38871
|
/**
|
|
38888
38872
|
* Look up merged {@link PlaceholderDefaults} for a shape's placeholder
|
|
@@ -38900,44 +38884,52 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38900
38884
|
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
38901
38885
|
const masterMap = masterPath ? this.masterPlaceholderDefaultsCache.get(masterPath) : void 0;
|
|
38902
38886
|
const masterDefaults = masterMap?.get(phKey);
|
|
38903
|
-
|
|
38887
|
+
const normalizedType = this.buildPlaceholderDefaultsKey(phInfo).split("_")[0];
|
|
38888
|
+
const masterTextStyleType = phInfo.type === "title" || phInfo.type === "ctrtitle" ? "title" : phInfo.type === "body" || phInfo.type === "obj" || phInfo.type === "subtitle" ? "body" : "other";
|
|
38889
|
+
const masterTextStyles = masterPath ? this.masterTxStylesCache.get(masterPath) : void 0;
|
|
38890
|
+
const masterTextLevels = masterTextStyleType === "title" ? masterTextStyles?.titleStyle : masterTextStyleType === "body" ? masterTextStyles?.bodyStyle : masterTextStyles?.otherStyle;
|
|
38891
|
+
const resolvedMasterDefaults = masterTextLevels ? {
|
|
38892
|
+
type: masterDefaults?.type ?? normalizedType,
|
|
38893
|
+
...masterDefaults,
|
|
38894
|
+
levelStyles: this.mergePlaceholderLevelStyles(
|
|
38895
|
+
masterTextLevels,
|
|
38896
|
+
masterDefaults?.levelStyles
|
|
38897
|
+
)
|
|
38898
|
+
} : masterDefaults;
|
|
38899
|
+
if (!layoutDefaults && !resolvedMasterDefaults) {
|
|
38904
38900
|
return void 0;
|
|
38905
38901
|
}
|
|
38906
|
-
if (!
|
|
38902
|
+
if (!resolvedMasterDefaults) {
|
|
38907
38903
|
return layoutDefaults;
|
|
38908
38904
|
}
|
|
38909
38905
|
if (!layoutDefaults) {
|
|
38910
|
-
return
|
|
38906
|
+
return resolvedMasterDefaults;
|
|
38911
38907
|
}
|
|
38912
38908
|
const merged = {
|
|
38913
38909
|
type: layoutDefaults.type,
|
|
38914
|
-
idx: layoutDefaults.idx ??
|
|
38915
|
-
bodyInsetLeft: layoutDefaults.bodyInsetLeft ??
|
|
38916
|
-
bodyInsetTop: layoutDefaults.bodyInsetTop ??
|
|
38917
|
-
bodyInsetRight: layoutDefaults.bodyInsetRight ??
|
|
38918
|
-
bodyInsetBottom: layoutDefaults.bodyInsetBottom ??
|
|
38919
|
-
textAnchor: layoutDefaults.textAnchor ??
|
|
38920
|
-
autoFit: layoutDefaults.autoFit ??
|
|
38921
|
-
textWrap: layoutDefaults.textWrap ??
|
|
38922
|
-
promptText: layoutDefaults.promptText ??
|
|
38910
|
+
idx: layoutDefaults.idx ?? resolvedMasterDefaults.idx,
|
|
38911
|
+
bodyInsetLeft: layoutDefaults.bodyInsetLeft ?? resolvedMasterDefaults.bodyInsetLeft,
|
|
38912
|
+
bodyInsetTop: layoutDefaults.bodyInsetTop ?? resolvedMasterDefaults.bodyInsetTop,
|
|
38913
|
+
bodyInsetRight: layoutDefaults.bodyInsetRight ?? resolvedMasterDefaults.bodyInsetRight,
|
|
38914
|
+
bodyInsetBottom: layoutDefaults.bodyInsetBottom ?? resolvedMasterDefaults.bodyInsetBottom,
|
|
38915
|
+
textAnchor: layoutDefaults.textAnchor ?? resolvedMasterDefaults.textAnchor,
|
|
38916
|
+
autoFit: layoutDefaults.autoFit ?? resolvedMasterDefaults.autoFit,
|
|
38917
|
+
textWrap: layoutDefaults.textWrap ?? resolvedMasterDefaults.textWrap,
|
|
38918
|
+
promptText: layoutDefaults.promptText ?? resolvedMasterDefaults.promptText
|
|
38923
38919
|
};
|
|
38924
|
-
if (layoutDefaults.levelStyles ||
|
|
38925
|
-
|
|
38926
|
-
|
|
38927
|
-
|
|
38928
|
-
|
|
38929
|
-
|
|
38930
|
-
|
|
38931
|
-
|
|
38932
|
-
|
|
38933
|
-
|
|
38934
|
-
|
|
38935
|
-
|
|
38936
|
-
|
|
38937
|
-
mergedLevels[key] = layoutLevel ?? masterLevel;
|
|
38938
|
-
}
|
|
38939
|
-
}
|
|
38940
|
-
merged.levelStyles = mergedLevels;
|
|
38920
|
+
if (layoutDefaults.levelStyles || resolvedMasterDefaults.levelStyles) {
|
|
38921
|
+
merged.levelStyles = this.mergePlaceholderLevelStyles(
|
|
38922
|
+
resolvedMasterDefaults.levelStyles,
|
|
38923
|
+
layoutDefaults.levelStyles
|
|
38924
|
+
);
|
|
38925
|
+
}
|
|
38926
|
+
return merged;
|
|
38927
|
+
}
|
|
38928
|
+
mergePlaceholderLevelStyles(base, override) {
|
|
38929
|
+
const merged = {};
|
|
38930
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(base ?? {}), ...Object.keys(override ?? {})])) {
|
|
38931
|
+
const level = Number.parseInt(key, 10);
|
|
38932
|
+
merged[level] = { ...base?.[level], ...override?.[level] };
|
|
38941
38933
|
}
|
|
38942
38934
|
return merged;
|
|
38943
38935
|
}
|
|
@@ -40235,7 +40227,11 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40235
40227
|
* for "first-wins" shape-level properties.
|
|
40236
40228
|
*/
|
|
40237
40229
|
resolveShapeParagraphStyle(p, textStyle, ctx) {
|
|
40238
|
-
const
|
|
40230
|
+
const inheritedParagraph = this.ensureArray(ctx.inheritedTxBody?.["a:p"])[0];
|
|
40231
|
+
const pPr = this.mergeXmlObjects(
|
|
40232
|
+
inheritedParagraph?.["a:pPr"],
|
|
40233
|
+
p["a:pPr"]
|
|
40234
|
+
);
|
|
40239
40235
|
const paragraphRtl = this.parseOptionalBooleanAttr(pPr?.["@_rtl"]);
|
|
40240
40236
|
if (paragraphRtl !== void 0 && textStyle.rtl === void 0) {
|
|
40241
40237
|
textStyle.rtl = paragraphRtl;
|
|
@@ -40351,24 +40347,28 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40351
40347
|
const defaultRunStyle = this.extractTextRunStyle(
|
|
40352
40348
|
pPr?.["a:defRPr"],
|
|
40353
40349
|
paraAlign,
|
|
40354
|
-
ctx.slideRelationshipMap
|
|
40350
|
+
ctx.slideRelationshipMap,
|
|
40351
|
+
false
|
|
40355
40352
|
);
|
|
40356
|
-
const level = Number.parseInt(String(pPr
|
|
40357
|
-
const levelKey = `a:lvl${Number.isFinite(level) ? Math.min(Math.max(level + 1, 1), 9) : 1}pPr`;
|
|
40353
|
+
const level = pPr?.["@_lvl"] === void 0 ? -1 : Number.parseInt(String(pPr["@_lvl"]), 10);
|
|
40354
|
+
const levelKey = level === -1 ? "a:defPPr" : `a:lvl${Number.isFinite(level) ? Math.min(Math.max(level + 1, 1), 9) : 1}pPr`;
|
|
40358
40355
|
const inheritedLevelStyle = this.extractTextRunStyle(
|
|
40359
40356
|
ctx.inheritedTxBody?.["a:lstStyle"]?.[levelKey]?.["a:defRPr"],
|
|
40360
40357
|
paraAlign,
|
|
40361
|
-
ctx.slideRelationshipMap
|
|
40358
|
+
ctx.slideRelationshipMap,
|
|
40359
|
+
false
|
|
40362
40360
|
);
|
|
40363
40361
|
const bodyLevelStyle = this.extractTextRunStyle(
|
|
40364
40362
|
ctx.txBody?.["a:lstStyle"]?.[levelKey]?.["a:defRPr"],
|
|
40365
40363
|
paraAlign,
|
|
40366
|
-
ctx.slideRelationshipMap
|
|
40364
|
+
ctx.slideRelationshipMap,
|
|
40365
|
+
false
|
|
40367
40366
|
);
|
|
40368
40367
|
const endParagraphStyle = this.extractTextRunStyle(
|
|
40369
40368
|
p?.["a:endParaRPr"],
|
|
40370
40369
|
paraAlign,
|
|
40371
|
-
ctx.slideRelationshipMap
|
|
40370
|
+
ctx.slideRelationshipMap,
|
|
40371
|
+
false
|
|
40372
40372
|
);
|
|
40373
40373
|
const mergedDefaultRunStyle = {
|
|
40374
40374
|
...ctx.bodyDefaultRunStyle,
|
|
@@ -40378,20 +40378,23 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40378
40378
|
...defaultRunStyle
|
|
40379
40379
|
};
|
|
40380
40380
|
if (ctx.effectiveLevelStyles) {
|
|
40381
|
-
const normalizedLevel = Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40382
|
-
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1];
|
|
40381
|
+
const normalizedLevel = level === -1 ? -1 : Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40382
|
+
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1] ?? (normalizedLevel === -1 ? ctx.effectiveLevelStyles[0] : void 0);
|
|
40383
40383
|
if (phLevel) {
|
|
40384
40384
|
this.applyPlaceholderLevelDefaults(mergedDefaultRunStyle, phLevel);
|
|
40385
40385
|
this.applyPlaceholderLevelDefaults(textStyle, phLevel);
|
|
40386
40386
|
}
|
|
40387
40387
|
}
|
|
40388
|
+
if (pPr?.["@_algn"] === void 0 && textStyle.align !== void 0) {
|
|
40389
|
+
paraAlign = textStyle.align;
|
|
40390
|
+
}
|
|
40388
40391
|
const parMarginLeft = pPr?.["@_marL"] !== void 0 ? Number.parseInt(String(pPr["@_marL"]), 10) / _PptxHandlerRuntime.EMU_PER_PX : void 0;
|
|
40389
40392
|
const parIndent = pPr?.["@_indent"] !== void 0 ? Number.parseInt(String(pPr["@_indent"]), 10) / _PptxHandlerRuntime.EMU_PER_PX : void 0;
|
|
40390
40393
|
let effectiveMarginLeft = parMarginLeft;
|
|
40391
40394
|
let effectiveIndent = parIndent;
|
|
40392
40395
|
if (ctx.effectiveLevelStyles) {
|
|
40393
|
-
const normalizedLevel = Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40394
|
-
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1];
|
|
40396
|
+
const normalizedLevel = level === -1 ? -1 : Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40397
|
+
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1] ?? (normalizedLevel === -1 ? ctx.effectiveLevelStyles[0] : void 0);
|
|
40395
40398
|
if (phLevel) {
|
|
40396
40399
|
if (effectiveMarginLeft === void 0 && phLevel.marginLeft !== void 0) {
|
|
40397
40400
|
effectiveMarginLeft = phLevel.marginLeft;
|
|
@@ -40557,11 +40560,23 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
40557
40560
|
continue;
|
|
40558
40561
|
}
|
|
40559
40562
|
const items = this.ensureArray(p[key]);
|
|
40560
|
-
|
|
40563
|
+
const rawBreaks = p["a:br"];
|
|
40564
|
+
const breakCount = Array.isArray(rawBreaks) ? rawBreaks.length : rawBreaks === void 0 ? 0 : 1;
|
|
40565
|
+
const insertCollapsedBreaks = key === "a:r" && items.length > 1 && breakCount > 0;
|
|
40566
|
+
for (const [itemIndex, item] of items.entries()) {
|
|
40561
40567
|
switch (key) {
|
|
40562
|
-
case "a:r":
|
|
40568
|
+
case "a:r": {
|
|
40563
40569
|
processRun(item);
|
|
40570
|
+
if (insertCollapsedBreaks && itemIndex < Math.min(items.length - 1, breakCount)) {
|
|
40571
|
+
parts.push("\n");
|
|
40572
|
+
segments.push({
|
|
40573
|
+
text: "\n",
|
|
40574
|
+
style: { ...mergedDefaultRunStyle },
|
|
40575
|
+
isLineBreak: true
|
|
40576
|
+
});
|
|
40577
|
+
}
|
|
40564
40578
|
break;
|
|
40579
|
+
}
|
|
40565
40580
|
case "a:fld":
|
|
40566
40581
|
processField(item);
|
|
40567
40582
|
break;
|
|
@@ -40579,6 +40594,9 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
40579
40594
|
processAlternateContent(item);
|
|
40580
40595
|
break;
|
|
40581
40596
|
case "a:br": {
|
|
40597
|
+
if (insertCollapsedBreaks) {
|
|
40598
|
+
break;
|
|
40599
|
+
}
|
|
40582
40600
|
const brNode = item ?? {};
|
|
40583
40601
|
const brRunProps = brNode["a:rPr"];
|
|
40584
40602
|
const brStyle = {
|
|
@@ -40741,7 +40759,13 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
40741
40759
|
);
|
|
40742
40760
|
const inheritedPlaceholder = slidePath && placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
40743
40761
|
const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
|
|
40744
|
-
const effectiveSpPr =
|
|
40762
|
+
const effectiveSpPr = spPr ? {
|
|
40763
|
+
...spPr,
|
|
40764
|
+
"a:xfrm": this.mergeXmlObjects(
|
|
40765
|
+
inheritedSpPr?.["a:xfrm"],
|
|
40766
|
+
spPr["a:xfrm"]
|
|
40767
|
+
)
|
|
40768
|
+
} : inheritedSpPr;
|
|
40745
40769
|
const xfrm = effectiveSpPr?.["a:xfrm"] || spPr?.["a:xfrm"] || inheritedSpPr?.["a:xfrm"];
|
|
40746
40770
|
if (!xfrm) {
|
|
40747
40771
|
return null;
|
|
@@ -40819,14 +40843,16 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
40819
40843
|
const inheritedBodyDefaultRunStyle = this.extractTextRunStyle(
|
|
40820
40844
|
xmlPath(inheritedTxBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
|
|
40821
40845
|
"left",
|
|
40822
|
-
slideRelationshipMap
|
|
40846
|
+
slideRelationshipMap,
|
|
40847
|
+
false
|
|
40823
40848
|
);
|
|
40824
40849
|
const bodyDefaultRunStyle = {
|
|
40825
40850
|
...inheritedBodyDefaultRunStyle,
|
|
40826
40851
|
...this.extractTextRunStyle(
|
|
40827
40852
|
xmlPath(txBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
|
|
40828
40853
|
"left",
|
|
40829
|
-
slideRelationshipMap
|
|
40854
|
+
slideRelationshipMap,
|
|
40855
|
+
false
|
|
40830
40856
|
)
|
|
40831
40857
|
};
|
|
40832
40858
|
Object.assign(textStyle, bodyDefaultRunStyle);
|
|
@@ -43213,6 +43239,21 @@ var PptxHandlerRuntime61 = class extends PptxHandlerRuntime60 {
|
|
|
43213
43239
|
element.id = `master-${element.id}`;
|
|
43214
43240
|
elements.push(element);
|
|
43215
43241
|
}
|
|
43242
|
+
} else if (entry.tag === "p:cxnSp") {
|
|
43243
|
+
const connectors = this.ensureArray(spTree["p:cxnSp"]);
|
|
43244
|
+
const connector = connectors[entry.indexInType];
|
|
43245
|
+
if (!connector) {
|
|
43246
|
+
continue;
|
|
43247
|
+
}
|
|
43248
|
+
const element = this.parseConnector(
|
|
43249
|
+
connector,
|
|
43250
|
+
`master-conn-${masterToken}-${entry.indexInType}`,
|
|
43251
|
+
masterPath
|
|
43252
|
+
);
|
|
43253
|
+
if (element) {
|
|
43254
|
+
element.id = `master-${element.id}`;
|
|
43255
|
+
elements.push(element);
|
|
43256
|
+
}
|
|
43216
43257
|
}
|
|
43217
43258
|
}
|
|
43218
43259
|
this.masterCache.set(masterPath, elements);
|
|
@@ -43351,6 +43392,21 @@ var PptxHandlerRuntime62 = class extends PptxHandlerRuntime61 {
|
|
|
43351
43392
|
element.id = `layout-${element.id}`;
|
|
43352
43393
|
elements.push(element);
|
|
43353
43394
|
}
|
|
43395
|
+
} else if (entry.tag === "p:cxnSp") {
|
|
43396
|
+
const connectors = this.ensureArray(spTree["p:cxnSp"]);
|
|
43397
|
+
const connector = connectors[entry.indexInType];
|
|
43398
|
+
if (!connector) {
|
|
43399
|
+
continue;
|
|
43400
|
+
}
|
|
43401
|
+
const element = this.parseConnector(
|
|
43402
|
+
connector,
|
|
43403
|
+
`layout-conn-${layoutToken}-${entry.indexInType}`,
|
|
43404
|
+
layoutPath
|
|
43405
|
+
);
|
|
43406
|
+
if (element) {
|
|
43407
|
+
element.id = `layout-${element.id}`;
|
|
43408
|
+
elements.push(element);
|
|
43409
|
+
}
|
|
43354
43410
|
}
|
|
43355
43411
|
}
|
|
43356
43412
|
const layoutShowMasterSp = xmlAttr(
|
|
@@ -47054,6 +47110,7 @@ var PptxHandlerRuntime79 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
|
|
|
47054
47110
|
this.masterCache.clear();
|
|
47055
47111
|
this.layoutXmlMap.clear();
|
|
47056
47112
|
this.masterXmlMap.clear();
|
|
47113
|
+
this.masterTxStylesCache.clear();
|
|
47057
47114
|
if (typeof globalThis.URL?.revokeObjectURL === "function" && this.blobUrlCache.size > 0) {
|
|
47058
47115
|
for (const url of this.blobUrlCache) {
|
|
47059
47116
|
URL.revokeObjectURL(url);
|
|
@@ -47338,7 +47395,7 @@ var PptxHandlerRuntime79 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
|
|
|
47338
47395
|
|
|
47339
47396
|
// src/core/core/runtime/PptxHandlerRuntimeLoadPipeline.ts
|
|
47340
47397
|
var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
47341
|
-
async buildLoadData(presentationState, slidesWithWarnings) {
|
|
47398
|
+
async buildLoadData(presentationState, slidesWithWarnings, slideMasters) {
|
|
47342
47399
|
const headerFooter = this.extractHeaderFooter();
|
|
47343
47400
|
const presentationProperties = await this.parsePresentationProperties();
|
|
47344
47401
|
const customShows = this.parseCustomShows();
|
|
@@ -47348,8 +47405,6 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47348
47405
|
const themeOptions = await this.parseThemeOptions();
|
|
47349
47406
|
const notesMaster = await this.parseNotesMaster();
|
|
47350
47407
|
const handoutMaster = await this.parseHandoutMaster();
|
|
47351
|
-
const slideMasters = await this.parseSlideMasters();
|
|
47352
|
-
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
47353
47408
|
const tags = await this.parseTags();
|
|
47354
47409
|
const customProperties = await this.parseCustomProperties();
|
|
47355
47410
|
const coreProperties = await this.parseCoreProperties();
|
|
@@ -47469,6 +47524,7 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47469
47524
|
this.masterCache.clear();
|
|
47470
47525
|
this.layoutXmlMap.clear();
|
|
47471
47526
|
this.masterXmlMap.clear();
|
|
47527
|
+
this.masterTxStylesCache.clear();
|
|
47472
47528
|
this.layoutPlaceholderDefaultsCache.clear();
|
|
47473
47529
|
this.masterPlaceholderDefaultsCache.clear();
|
|
47474
47530
|
this.themeOverrideCache.clear();
|
|
@@ -47489,10 +47545,12 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47489
47545
|
this.detectDigitalSignatureParts();
|
|
47490
47546
|
await this.parseCustomXmlParts();
|
|
47491
47547
|
const presentationState = await this.loadPresentationState();
|
|
47548
|
+
const slideMasters = await this.parseSlideMasters();
|
|
47549
|
+
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
47492
47550
|
const slides = await this.loadSlidesForPresentation(presentationState.sectionBySlideId);
|
|
47493
47551
|
const slidesWithWarnings = this.attachSlideWarnings(slides);
|
|
47494
47552
|
this.resetElementIdCounter(slides);
|
|
47495
|
-
return this.buildLoadData(presentationState, slidesWithWarnings);
|
|
47553
|
+
return this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
|
|
47496
47554
|
}
|
|
47497
47555
|
/**
|
|
47498
47556
|
* Retrieve the current background colour for a layout or master.
|
package/dist/index.mjs
CHANGED
|
@@ -12796,7 +12796,7 @@ function stripParentDirSegments(path) {
|
|
|
12796
12796
|
}
|
|
12797
12797
|
|
|
12798
12798
|
// src/core/utils/ole2-parser-types.ts
|
|
12799
|
-
var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161,
|
|
12799
|
+
var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
12800
12800
|
var ENDOFCHAIN = 4294967294;
|
|
12801
12801
|
var FREESECT = 4294967295;
|
|
12802
12802
|
var FATSECT = 4294967293;
|
|
@@ -19328,7 +19328,7 @@ function resolveLayoutCategory(layoutType) {
|
|
|
19328
19328
|
}
|
|
19329
19329
|
|
|
19330
19330
|
// src/core/utils/encryption-detection.ts
|
|
19331
|
-
var OLE_MAGIC2 = new Uint8Array([208, 207, 17, 224, 161,
|
|
19331
|
+
var OLE_MAGIC2 = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
19332
19332
|
var ZIP_MAGIC = new Uint8Array([80, 75]);
|
|
19333
19333
|
function detectFileFormat(data) {
|
|
19334
19334
|
if (data.byteLength < 8) {
|
|
@@ -20022,15 +20022,9 @@ async function verifyAgilePassword(info, password) {
|
|
|
20022
20022
|
pke.keyBits,
|
|
20023
20023
|
pke.hashSize
|
|
20024
20024
|
);
|
|
20025
|
-
const iv1 = generateIV(
|
|
20026
|
-
pke.hashAlgorithm,
|
|
20027
|
-
pke.saltValue,
|
|
20028
|
-
BLOCK_KEYS.verifierHashInput,
|
|
20029
|
-
pke.blockSize
|
|
20030
|
-
);
|
|
20031
20025
|
const verifierHashInput = await aesCbcDecryptRaw(
|
|
20032
20026
|
verifierInputKey,
|
|
20033
|
-
|
|
20027
|
+
pke.saltValue,
|
|
20034
20028
|
pke.encryptedVerifierHashInput
|
|
20035
20029
|
);
|
|
20036
20030
|
const verifierHashKey = await deriveAgileKey(
|
|
@@ -20042,15 +20036,9 @@ async function verifyAgilePassword(info, password) {
|
|
|
20042
20036
|
pke.keyBits,
|
|
20043
20037
|
pke.hashSize
|
|
20044
20038
|
);
|
|
20045
|
-
const iv2 = generateIV(
|
|
20046
|
-
pke.hashAlgorithm,
|
|
20047
|
-
pke.saltValue,
|
|
20048
|
-
BLOCK_KEYS.verifierHashValue,
|
|
20049
|
-
pke.blockSize
|
|
20050
|
-
);
|
|
20051
20039
|
const verifierHashValue = await aesCbcDecryptRaw(
|
|
20052
20040
|
verifierHashKey,
|
|
20053
|
-
|
|
20041
|
+
pke.saltValue,
|
|
20054
20042
|
pke.encryptedVerifierHashValue
|
|
20055
20043
|
);
|
|
20056
20044
|
const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
|
|
@@ -20075,13 +20063,7 @@ async function verifyAgilePassword(info, password) {
|
|
|
20075
20063
|
pke.keyBits,
|
|
20076
20064
|
pke.hashSize
|
|
20077
20065
|
);
|
|
20078
|
-
const
|
|
20079
|
-
pke.hashAlgorithm,
|
|
20080
|
-
pke.saltValue,
|
|
20081
|
-
BLOCK_KEYS.encryptedKeyValue,
|
|
20082
|
-
pke.blockSize
|
|
20083
|
-
);
|
|
20084
|
-
const decryptedKey = await aesCbcDecryptRaw(encKeyKey, iv3, pke.encryptedKeyValue);
|
|
20066
|
+
const decryptedKey = await aesCbcDecryptRaw(encKeyKey, pke.saltValue, pke.encryptedKeyValue);
|
|
20085
20067
|
return decryptedKey.subarray(0, info.keyData.keyBits / 8);
|
|
20086
20068
|
}
|
|
20087
20069
|
async function verifyStandardPassword(info, password) {
|
|
@@ -20134,8 +20116,7 @@ async function verifyAgileDataIntegrity(info, key, encryptedPackage) {
|
|
|
20134
20116
|
info.dataIntegrity.encryptedHmacValue
|
|
20135
20117
|
);
|
|
20136
20118
|
const expectedHmac = decryptedHmacValue.subarray(0, keyData.hashSize);
|
|
20137
|
-
const
|
|
20138
|
-
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedContent);
|
|
20119
|
+
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedPackage);
|
|
20139
20120
|
let match = true;
|
|
20140
20121
|
if (computedHmac.length < keyData.hashSize) {
|
|
20141
20122
|
match = false;
|
|
@@ -20289,14 +20270,13 @@ async function encryptPptx(pptxBuffer, password, options) {
|
|
|
20289
20270
|
keyBits,
|
|
20290
20271
|
hashSize
|
|
20291
20272
|
);
|
|
20292
|
-
const iv1 = await generateIV(hashAlgorithm, pkeSalt, BLOCK_KEYS.verifierHashInput, blockSize);
|
|
20293
20273
|
const paddedVerifierInput = new Uint8Array(
|
|
20294
20274
|
Math.ceil(verifierHashInput.length / blockSize) * blockSize
|
|
20295
20275
|
);
|
|
20296
20276
|
paddedVerifierInput.set(verifierHashInput);
|
|
20297
20277
|
const encryptedVerifierHashInput = await aesCbcEncryptNoPad(
|
|
20298
20278
|
verifierInputKey,
|
|
20299
|
-
|
|
20279
|
+
pkeSalt,
|
|
20300
20280
|
paddedVerifierInput
|
|
20301
20281
|
);
|
|
20302
20282
|
const verifierHashKey = await deriveAgileKey(
|
|
@@ -20308,12 +20288,11 @@ async function encryptPptx(pptxBuffer, password, options) {
|
|
|
20308
20288
|
keyBits,
|
|
20309
20289
|
hashSize
|
|
20310
20290
|
);
|
|
20311
|
-
const iv2 = await generateIV(hashAlgorithm, pkeSalt, BLOCK_KEYS.verifierHashValue, blockSize);
|
|
20312
20291
|
const paddedVerifierHash = new Uint8Array(Math.ceil(verifierHash.length / blockSize) * blockSize);
|
|
20313
20292
|
paddedVerifierHash.set(verifierHash);
|
|
20314
20293
|
const encryptedVerifierHashValue = await aesCbcEncryptNoPad(
|
|
20315
20294
|
verifierHashKey,
|
|
20316
|
-
|
|
20295
|
+
pkeSalt,
|
|
20317
20296
|
paddedVerifierHash
|
|
20318
20297
|
);
|
|
20319
20298
|
const encKeyKey = await deriveAgileKey(
|
|
@@ -20325,10 +20304,9 @@ async function encryptPptx(pptxBuffer, password, options) {
|
|
|
20325
20304
|
keyBits,
|
|
20326
20305
|
hashSize
|
|
20327
20306
|
);
|
|
20328
|
-
const iv3 = await generateIV(hashAlgorithm, pkeSalt, BLOCK_KEYS.encryptedKeyValue, blockSize);
|
|
20329
20307
|
const paddedDocumentKey = new Uint8Array(Math.ceil(documentKey.length / blockSize) * blockSize);
|
|
20330
20308
|
paddedDocumentKey.set(documentKey);
|
|
20331
|
-
const encryptedKeyValue = await aesCbcEncryptNoPad(encKeyKey,
|
|
20309
|
+
const encryptedKeyValue = await aesCbcEncryptNoPad(encKeyKey, pkeSalt, paddedDocumentKey);
|
|
20332
20310
|
const encInfo = {
|
|
20333
20311
|
keyData: {
|
|
20334
20312
|
saltSize: 16,
|
|
@@ -20364,7 +20342,7 @@ async function encryptPptx(pptxBuffer, password, options) {
|
|
|
20364
20342
|
const encryptedPackage = await encryptAgilePackage(packageData, documentKey, encInfo);
|
|
20365
20343
|
const hmacKeyRandom = new Uint8Array(hashSize);
|
|
20366
20344
|
crypto2.getRandomValues(hmacKeyRandom);
|
|
20367
|
-
const hmacValue = await hmac(hashAlgorithm, hmacKeyRandom, encryptedPackage
|
|
20345
|
+
const hmacValue = await hmac(hashAlgorithm, hmacKeyRandom, encryptedPackage);
|
|
20368
20346
|
const hmacKeyIV = await generateIV(
|
|
20369
20347
|
hashAlgorithm,
|
|
20370
20348
|
keyDataSalt,
|
|
@@ -21525,6 +21503,7 @@ var FONT_SUBSTITUTION_MAP = {
|
|
|
21525
21503
|
MoolBoran: ["Noto Sans Khmer", "sans-serif"],
|
|
21526
21504
|
// Decorative / Display
|
|
21527
21505
|
"Century Gothic": ["URW Gothic", "Futura", "sans-serif"],
|
|
21506
|
+
Oswald: ["Agency FB", "Arial Narrow", "sans-serif"],
|
|
21528
21507
|
"Franklin Gothic": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
21529
21508
|
"Franklin Gothic Medium": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
21530
21509
|
Garamond: ["EB Garamond", "Cormorant Garamond", "serif"],
|
|
@@ -31435,8 +31414,8 @@ var PptxHandlerRuntime18 = class extends PptxHandlerRuntime17 {
|
|
|
31435
31414
|
|
|
31436
31415
|
// src/core/core/runtime/PptxHandlerRuntimeTextRunStyleExtraction.ts
|
|
31437
31416
|
var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime18 {
|
|
31438
|
-
extractTextRunStyle(runProperties, align, relationshipMap) {
|
|
31439
|
-
const style = { align };
|
|
31417
|
+
extractTextRunStyle(runProperties, align, relationshipMap, includeDefaultAlignment = true) {
|
|
31418
|
+
const style = includeDefaultAlignment ? { align } : {};
|
|
31440
31419
|
if (!runProperties) {
|
|
31441
31420
|
return style;
|
|
31442
31421
|
}
|
|
@@ -38750,11 +38729,12 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
38750
38729
|
if (!source) {
|
|
38751
38730
|
return true;
|
|
38752
38731
|
}
|
|
38732
|
+
const typesMatch = source.type === target.type || source.type === "ctrtitle" && target.type === "title" || source.type === "subtitle" && target.type === "body";
|
|
38753
38733
|
if (source.idx !== void 0 && target.idx !== void 0) {
|
|
38754
38734
|
if (source.idx !== target.idx) {
|
|
38755
38735
|
return false;
|
|
38756
38736
|
}
|
|
38757
|
-
if (source.type && target.type &&
|
|
38737
|
+
if (source.type && target.type && !typesMatch) {
|
|
38758
38738
|
return false;
|
|
38759
38739
|
}
|
|
38760
38740
|
return true;
|
|
@@ -38762,11 +38742,11 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
38762
38742
|
if (source.idx !== void 0 && target.idx === void 0) {
|
|
38763
38743
|
const singletonTypes = /* @__PURE__ */ new Set(["title", "ctrtitle", "subtitle", "dt", "ftr", "sldnum"]);
|
|
38764
38744
|
if (source.type && singletonTypes.has(source.type)) {
|
|
38765
|
-
return
|
|
38745
|
+
return typesMatch;
|
|
38766
38746
|
}
|
|
38767
38747
|
return false;
|
|
38768
38748
|
}
|
|
38769
|
-
if (source.type && target.type &&
|
|
38749
|
+
if (source.type && target.type && !typesMatch) {
|
|
38770
38750
|
return false;
|
|
38771
38751
|
}
|
|
38772
38752
|
if (source.type && !target.type) {
|
|
@@ -38810,18 +38790,21 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38810
38790
|
xmlPath(layoutXmlObj, "p:sldLayout", "p:cSld", "p:spTree"),
|
|
38811
38791
|
expected
|
|
38812
38792
|
);
|
|
38813
|
-
if (layoutContext) {
|
|
38814
|
-
return layoutContext;
|
|
38815
|
-
}
|
|
38816
38793
|
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
38817
|
-
|
|
38818
|
-
|
|
38819
|
-
}
|
|
38820
|
-
const masterXmlObj = this.masterXmlMap.get(masterPath);
|
|
38821
|
-
return this.findPlaceholderInShapeTree(
|
|
38822
|
-
xmlPath(masterXmlObj, "p:sldMaster", "p:cSld", "p:spTree"),
|
|
38794
|
+
const masterContext = masterPath ? this.findPlaceholderInShapeTree(
|
|
38795
|
+
xmlPath(this.masterXmlMap.get(masterPath), "p:sldMaster", "p:cSld", "p:spTree"),
|
|
38823
38796
|
expected
|
|
38824
|
-
);
|
|
38797
|
+
) : void 0;
|
|
38798
|
+
if (!layoutContext) {
|
|
38799
|
+
return masterContext;
|
|
38800
|
+
}
|
|
38801
|
+
if (!masterContext) {
|
|
38802
|
+
return layoutContext;
|
|
38803
|
+
}
|
|
38804
|
+
return {
|
|
38805
|
+
shape: layoutContext.shape || masterContext.shape ? this.mergeXmlObjects(masterContext.shape, layoutContext.shape) : void 0,
|
|
38806
|
+
picture: layoutContext.picture || masterContext.picture ? this.mergeXmlObjects(masterContext.picture, layoutContext.picture) : void 0
|
|
38807
|
+
};
|
|
38825
38808
|
}
|
|
38826
38809
|
mergeXmlObjects(base, override, depth = 0) {
|
|
38827
38810
|
const MAX_MERGE_DEPTH = 64;
|
|
@@ -38874,10 +38857,11 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38874
38857
|
* otherwise falls back to `type`.
|
|
38875
38858
|
*/
|
|
38876
38859
|
buildPlaceholderDefaultsKey(phInfo) {
|
|
38860
|
+
const normalizedType = phInfo.type === "ctrtitle" ? "title" : phInfo.type === "subtitle" ? "body" : phInfo.type;
|
|
38877
38861
|
if (phInfo.idx !== void 0) {
|
|
38878
|
-
return
|
|
38862
|
+
return normalizedType ? `${normalizedType}_${phInfo.idx}` : `_${phInfo.idx}`;
|
|
38879
38863
|
}
|
|
38880
|
-
return
|
|
38864
|
+
return normalizedType ?? "body";
|
|
38881
38865
|
}
|
|
38882
38866
|
/**
|
|
38883
38867
|
* Look up merged {@link PlaceholderDefaults} for a shape's placeholder
|
|
@@ -38895,44 +38879,52 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38895
38879
|
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
38896
38880
|
const masterMap = masterPath ? this.masterPlaceholderDefaultsCache.get(masterPath) : void 0;
|
|
38897
38881
|
const masterDefaults = masterMap?.get(phKey);
|
|
38898
|
-
|
|
38882
|
+
const normalizedType = this.buildPlaceholderDefaultsKey(phInfo).split("_")[0];
|
|
38883
|
+
const masterTextStyleType = phInfo.type === "title" || phInfo.type === "ctrtitle" ? "title" : phInfo.type === "body" || phInfo.type === "obj" || phInfo.type === "subtitle" ? "body" : "other";
|
|
38884
|
+
const masterTextStyles = masterPath ? this.masterTxStylesCache.get(masterPath) : void 0;
|
|
38885
|
+
const masterTextLevels = masterTextStyleType === "title" ? masterTextStyles?.titleStyle : masterTextStyleType === "body" ? masterTextStyles?.bodyStyle : masterTextStyles?.otherStyle;
|
|
38886
|
+
const resolvedMasterDefaults = masterTextLevels ? {
|
|
38887
|
+
type: masterDefaults?.type ?? normalizedType,
|
|
38888
|
+
...masterDefaults,
|
|
38889
|
+
levelStyles: this.mergePlaceholderLevelStyles(
|
|
38890
|
+
masterTextLevels,
|
|
38891
|
+
masterDefaults?.levelStyles
|
|
38892
|
+
)
|
|
38893
|
+
} : masterDefaults;
|
|
38894
|
+
if (!layoutDefaults && !resolvedMasterDefaults) {
|
|
38899
38895
|
return void 0;
|
|
38900
38896
|
}
|
|
38901
|
-
if (!
|
|
38897
|
+
if (!resolvedMasterDefaults) {
|
|
38902
38898
|
return layoutDefaults;
|
|
38903
38899
|
}
|
|
38904
38900
|
if (!layoutDefaults) {
|
|
38905
|
-
return
|
|
38901
|
+
return resolvedMasterDefaults;
|
|
38906
38902
|
}
|
|
38907
38903
|
const merged = {
|
|
38908
38904
|
type: layoutDefaults.type,
|
|
38909
|
-
idx: layoutDefaults.idx ??
|
|
38910
|
-
bodyInsetLeft: layoutDefaults.bodyInsetLeft ??
|
|
38911
|
-
bodyInsetTop: layoutDefaults.bodyInsetTop ??
|
|
38912
|
-
bodyInsetRight: layoutDefaults.bodyInsetRight ??
|
|
38913
|
-
bodyInsetBottom: layoutDefaults.bodyInsetBottom ??
|
|
38914
|
-
textAnchor: layoutDefaults.textAnchor ??
|
|
38915
|
-
autoFit: layoutDefaults.autoFit ??
|
|
38916
|
-
textWrap: layoutDefaults.textWrap ??
|
|
38917
|
-
promptText: layoutDefaults.promptText ??
|
|
38905
|
+
idx: layoutDefaults.idx ?? resolvedMasterDefaults.idx,
|
|
38906
|
+
bodyInsetLeft: layoutDefaults.bodyInsetLeft ?? resolvedMasterDefaults.bodyInsetLeft,
|
|
38907
|
+
bodyInsetTop: layoutDefaults.bodyInsetTop ?? resolvedMasterDefaults.bodyInsetTop,
|
|
38908
|
+
bodyInsetRight: layoutDefaults.bodyInsetRight ?? resolvedMasterDefaults.bodyInsetRight,
|
|
38909
|
+
bodyInsetBottom: layoutDefaults.bodyInsetBottom ?? resolvedMasterDefaults.bodyInsetBottom,
|
|
38910
|
+
textAnchor: layoutDefaults.textAnchor ?? resolvedMasterDefaults.textAnchor,
|
|
38911
|
+
autoFit: layoutDefaults.autoFit ?? resolvedMasterDefaults.autoFit,
|
|
38912
|
+
textWrap: layoutDefaults.textWrap ?? resolvedMasterDefaults.textWrap,
|
|
38913
|
+
promptText: layoutDefaults.promptText ?? resolvedMasterDefaults.promptText
|
|
38918
38914
|
};
|
|
38919
|
-
if (layoutDefaults.levelStyles ||
|
|
38920
|
-
|
|
38921
|
-
|
|
38922
|
-
|
|
38923
|
-
|
|
38924
|
-
|
|
38925
|
-
|
|
38926
|
-
|
|
38927
|
-
|
|
38928
|
-
|
|
38929
|
-
|
|
38930
|
-
|
|
38931
|
-
|
|
38932
|
-
mergedLevels[key] = layoutLevel ?? masterLevel;
|
|
38933
|
-
}
|
|
38934
|
-
}
|
|
38935
|
-
merged.levelStyles = mergedLevels;
|
|
38915
|
+
if (layoutDefaults.levelStyles || resolvedMasterDefaults.levelStyles) {
|
|
38916
|
+
merged.levelStyles = this.mergePlaceholderLevelStyles(
|
|
38917
|
+
resolvedMasterDefaults.levelStyles,
|
|
38918
|
+
layoutDefaults.levelStyles
|
|
38919
|
+
);
|
|
38920
|
+
}
|
|
38921
|
+
return merged;
|
|
38922
|
+
}
|
|
38923
|
+
mergePlaceholderLevelStyles(base, override) {
|
|
38924
|
+
const merged = {};
|
|
38925
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(base ?? {}), ...Object.keys(override ?? {})])) {
|
|
38926
|
+
const level = Number.parseInt(key, 10);
|
|
38927
|
+
merged[level] = { ...base?.[level], ...override?.[level] };
|
|
38936
38928
|
}
|
|
38937
38929
|
return merged;
|
|
38938
38930
|
}
|
|
@@ -40230,7 +40222,11 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40230
40222
|
* for "first-wins" shape-level properties.
|
|
40231
40223
|
*/
|
|
40232
40224
|
resolveShapeParagraphStyle(p, textStyle, ctx) {
|
|
40233
|
-
const
|
|
40225
|
+
const inheritedParagraph = this.ensureArray(ctx.inheritedTxBody?.["a:p"])[0];
|
|
40226
|
+
const pPr = this.mergeXmlObjects(
|
|
40227
|
+
inheritedParagraph?.["a:pPr"],
|
|
40228
|
+
p["a:pPr"]
|
|
40229
|
+
);
|
|
40234
40230
|
const paragraphRtl = this.parseOptionalBooleanAttr(pPr?.["@_rtl"]);
|
|
40235
40231
|
if (paragraphRtl !== void 0 && textStyle.rtl === void 0) {
|
|
40236
40232
|
textStyle.rtl = paragraphRtl;
|
|
@@ -40346,24 +40342,28 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40346
40342
|
const defaultRunStyle = this.extractTextRunStyle(
|
|
40347
40343
|
pPr?.["a:defRPr"],
|
|
40348
40344
|
paraAlign,
|
|
40349
|
-
ctx.slideRelationshipMap
|
|
40345
|
+
ctx.slideRelationshipMap,
|
|
40346
|
+
false
|
|
40350
40347
|
);
|
|
40351
|
-
const level = Number.parseInt(String(pPr
|
|
40352
|
-
const levelKey = `a:lvl${Number.isFinite(level) ? Math.min(Math.max(level + 1, 1), 9) : 1}pPr`;
|
|
40348
|
+
const level = pPr?.["@_lvl"] === void 0 ? -1 : Number.parseInt(String(pPr["@_lvl"]), 10);
|
|
40349
|
+
const levelKey = level === -1 ? "a:defPPr" : `a:lvl${Number.isFinite(level) ? Math.min(Math.max(level + 1, 1), 9) : 1}pPr`;
|
|
40353
40350
|
const inheritedLevelStyle = this.extractTextRunStyle(
|
|
40354
40351
|
ctx.inheritedTxBody?.["a:lstStyle"]?.[levelKey]?.["a:defRPr"],
|
|
40355
40352
|
paraAlign,
|
|
40356
|
-
ctx.slideRelationshipMap
|
|
40353
|
+
ctx.slideRelationshipMap,
|
|
40354
|
+
false
|
|
40357
40355
|
);
|
|
40358
40356
|
const bodyLevelStyle = this.extractTextRunStyle(
|
|
40359
40357
|
ctx.txBody?.["a:lstStyle"]?.[levelKey]?.["a:defRPr"],
|
|
40360
40358
|
paraAlign,
|
|
40361
|
-
ctx.slideRelationshipMap
|
|
40359
|
+
ctx.slideRelationshipMap,
|
|
40360
|
+
false
|
|
40362
40361
|
);
|
|
40363
40362
|
const endParagraphStyle = this.extractTextRunStyle(
|
|
40364
40363
|
p?.["a:endParaRPr"],
|
|
40365
40364
|
paraAlign,
|
|
40366
|
-
ctx.slideRelationshipMap
|
|
40365
|
+
ctx.slideRelationshipMap,
|
|
40366
|
+
false
|
|
40367
40367
|
);
|
|
40368
40368
|
const mergedDefaultRunStyle = {
|
|
40369
40369
|
...ctx.bodyDefaultRunStyle,
|
|
@@ -40373,20 +40373,23 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40373
40373
|
...defaultRunStyle
|
|
40374
40374
|
};
|
|
40375
40375
|
if (ctx.effectiveLevelStyles) {
|
|
40376
|
-
const normalizedLevel = Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40377
|
-
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1];
|
|
40376
|
+
const normalizedLevel = level === -1 ? -1 : Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40377
|
+
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1] ?? (normalizedLevel === -1 ? ctx.effectiveLevelStyles[0] : void 0);
|
|
40378
40378
|
if (phLevel) {
|
|
40379
40379
|
this.applyPlaceholderLevelDefaults(mergedDefaultRunStyle, phLevel);
|
|
40380
40380
|
this.applyPlaceholderLevelDefaults(textStyle, phLevel);
|
|
40381
40381
|
}
|
|
40382
40382
|
}
|
|
40383
|
+
if (pPr?.["@_algn"] === void 0 && textStyle.align !== void 0) {
|
|
40384
|
+
paraAlign = textStyle.align;
|
|
40385
|
+
}
|
|
40383
40386
|
const parMarginLeft = pPr?.["@_marL"] !== void 0 ? Number.parseInt(String(pPr["@_marL"]), 10) / _PptxHandlerRuntime.EMU_PER_PX : void 0;
|
|
40384
40387
|
const parIndent = pPr?.["@_indent"] !== void 0 ? Number.parseInt(String(pPr["@_indent"]), 10) / _PptxHandlerRuntime.EMU_PER_PX : void 0;
|
|
40385
40388
|
let effectiveMarginLeft = parMarginLeft;
|
|
40386
40389
|
let effectiveIndent = parIndent;
|
|
40387
40390
|
if (ctx.effectiveLevelStyles) {
|
|
40388
|
-
const normalizedLevel = Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40389
|
-
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1];
|
|
40391
|
+
const normalizedLevel = level === -1 ? -1 : Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40392
|
+
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1] ?? (normalizedLevel === -1 ? ctx.effectiveLevelStyles[0] : void 0);
|
|
40390
40393
|
if (phLevel) {
|
|
40391
40394
|
if (effectiveMarginLeft === void 0 && phLevel.marginLeft !== void 0) {
|
|
40392
40395
|
effectiveMarginLeft = phLevel.marginLeft;
|
|
@@ -40552,11 +40555,23 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
40552
40555
|
continue;
|
|
40553
40556
|
}
|
|
40554
40557
|
const items = this.ensureArray(p[key]);
|
|
40555
|
-
|
|
40558
|
+
const rawBreaks = p["a:br"];
|
|
40559
|
+
const breakCount = Array.isArray(rawBreaks) ? rawBreaks.length : rawBreaks === void 0 ? 0 : 1;
|
|
40560
|
+
const insertCollapsedBreaks = key === "a:r" && items.length > 1 && breakCount > 0;
|
|
40561
|
+
for (const [itemIndex, item] of items.entries()) {
|
|
40556
40562
|
switch (key) {
|
|
40557
|
-
case "a:r":
|
|
40563
|
+
case "a:r": {
|
|
40558
40564
|
processRun(item);
|
|
40565
|
+
if (insertCollapsedBreaks && itemIndex < Math.min(items.length - 1, breakCount)) {
|
|
40566
|
+
parts.push("\n");
|
|
40567
|
+
segments.push({
|
|
40568
|
+
text: "\n",
|
|
40569
|
+
style: { ...mergedDefaultRunStyle },
|
|
40570
|
+
isLineBreak: true
|
|
40571
|
+
});
|
|
40572
|
+
}
|
|
40559
40573
|
break;
|
|
40574
|
+
}
|
|
40560
40575
|
case "a:fld":
|
|
40561
40576
|
processField(item);
|
|
40562
40577
|
break;
|
|
@@ -40574,6 +40589,9 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
40574
40589
|
processAlternateContent(item);
|
|
40575
40590
|
break;
|
|
40576
40591
|
case "a:br": {
|
|
40592
|
+
if (insertCollapsedBreaks) {
|
|
40593
|
+
break;
|
|
40594
|
+
}
|
|
40577
40595
|
const brNode = item ?? {};
|
|
40578
40596
|
const brRunProps = brNode["a:rPr"];
|
|
40579
40597
|
const brStyle = {
|
|
@@ -40736,7 +40754,13 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
40736
40754
|
);
|
|
40737
40755
|
const inheritedPlaceholder = slidePath && placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
40738
40756
|
const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
|
|
40739
|
-
const effectiveSpPr =
|
|
40757
|
+
const effectiveSpPr = spPr ? {
|
|
40758
|
+
...spPr,
|
|
40759
|
+
"a:xfrm": this.mergeXmlObjects(
|
|
40760
|
+
inheritedSpPr?.["a:xfrm"],
|
|
40761
|
+
spPr["a:xfrm"]
|
|
40762
|
+
)
|
|
40763
|
+
} : inheritedSpPr;
|
|
40740
40764
|
const xfrm = effectiveSpPr?.["a:xfrm"] || spPr?.["a:xfrm"] || inheritedSpPr?.["a:xfrm"];
|
|
40741
40765
|
if (!xfrm) {
|
|
40742
40766
|
return null;
|
|
@@ -40814,14 +40838,16 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
40814
40838
|
const inheritedBodyDefaultRunStyle = this.extractTextRunStyle(
|
|
40815
40839
|
xmlPath(inheritedTxBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
|
|
40816
40840
|
"left",
|
|
40817
|
-
slideRelationshipMap
|
|
40841
|
+
slideRelationshipMap,
|
|
40842
|
+
false
|
|
40818
40843
|
);
|
|
40819
40844
|
const bodyDefaultRunStyle = {
|
|
40820
40845
|
...inheritedBodyDefaultRunStyle,
|
|
40821
40846
|
...this.extractTextRunStyle(
|
|
40822
40847
|
xmlPath(txBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
|
|
40823
40848
|
"left",
|
|
40824
|
-
slideRelationshipMap
|
|
40849
|
+
slideRelationshipMap,
|
|
40850
|
+
false
|
|
40825
40851
|
)
|
|
40826
40852
|
};
|
|
40827
40853
|
Object.assign(textStyle, bodyDefaultRunStyle);
|
|
@@ -43208,6 +43234,21 @@ var PptxHandlerRuntime61 = class extends PptxHandlerRuntime60 {
|
|
|
43208
43234
|
element.id = `master-${element.id}`;
|
|
43209
43235
|
elements.push(element);
|
|
43210
43236
|
}
|
|
43237
|
+
} else if (entry.tag === "p:cxnSp") {
|
|
43238
|
+
const connectors = this.ensureArray(spTree["p:cxnSp"]);
|
|
43239
|
+
const connector = connectors[entry.indexInType];
|
|
43240
|
+
if (!connector) {
|
|
43241
|
+
continue;
|
|
43242
|
+
}
|
|
43243
|
+
const element = this.parseConnector(
|
|
43244
|
+
connector,
|
|
43245
|
+
`master-conn-${masterToken}-${entry.indexInType}`,
|
|
43246
|
+
masterPath
|
|
43247
|
+
);
|
|
43248
|
+
if (element) {
|
|
43249
|
+
element.id = `master-${element.id}`;
|
|
43250
|
+
elements.push(element);
|
|
43251
|
+
}
|
|
43211
43252
|
}
|
|
43212
43253
|
}
|
|
43213
43254
|
this.masterCache.set(masterPath, elements);
|
|
@@ -43346,6 +43387,21 @@ var PptxHandlerRuntime62 = class extends PptxHandlerRuntime61 {
|
|
|
43346
43387
|
element.id = `layout-${element.id}`;
|
|
43347
43388
|
elements.push(element);
|
|
43348
43389
|
}
|
|
43390
|
+
} else if (entry.tag === "p:cxnSp") {
|
|
43391
|
+
const connectors = this.ensureArray(spTree["p:cxnSp"]);
|
|
43392
|
+
const connector = connectors[entry.indexInType];
|
|
43393
|
+
if (!connector) {
|
|
43394
|
+
continue;
|
|
43395
|
+
}
|
|
43396
|
+
const element = this.parseConnector(
|
|
43397
|
+
connector,
|
|
43398
|
+
`layout-conn-${layoutToken}-${entry.indexInType}`,
|
|
43399
|
+
layoutPath
|
|
43400
|
+
);
|
|
43401
|
+
if (element) {
|
|
43402
|
+
element.id = `layout-${element.id}`;
|
|
43403
|
+
elements.push(element);
|
|
43404
|
+
}
|
|
43349
43405
|
}
|
|
43350
43406
|
}
|
|
43351
43407
|
const layoutShowMasterSp = xmlAttr(
|
|
@@ -47049,6 +47105,7 @@ var PptxHandlerRuntime79 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
|
|
|
47049
47105
|
this.masterCache.clear();
|
|
47050
47106
|
this.layoutXmlMap.clear();
|
|
47051
47107
|
this.masterXmlMap.clear();
|
|
47108
|
+
this.masterTxStylesCache.clear();
|
|
47052
47109
|
if (typeof globalThis.URL?.revokeObjectURL === "function" && this.blobUrlCache.size > 0) {
|
|
47053
47110
|
for (const url of this.blobUrlCache) {
|
|
47054
47111
|
URL.revokeObjectURL(url);
|
|
@@ -47333,7 +47390,7 @@ var PptxHandlerRuntime79 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
|
|
|
47333
47390
|
|
|
47334
47391
|
// src/core/core/runtime/PptxHandlerRuntimeLoadPipeline.ts
|
|
47335
47392
|
var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
47336
|
-
async buildLoadData(presentationState, slidesWithWarnings) {
|
|
47393
|
+
async buildLoadData(presentationState, slidesWithWarnings, slideMasters) {
|
|
47337
47394
|
const headerFooter = this.extractHeaderFooter();
|
|
47338
47395
|
const presentationProperties = await this.parsePresentationProperties();
|
|
47339
47396
|
const customShows = this.parseCustomShows();
|
|
@@ -47343,8 +47400,6 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47343
47400
|
const themeOptions = await this.parseThemeOptions();
|
|
47344
47401
|
const notesMaster = await this.parseNotesMaster();
|
|
47345
47402
|
const handoutMaster = await this.parseHandoutMaster();
|
|
47346
|
-
const slideMasters = await this.parseSlideMasters();
|
|
47347
|
-
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
47348
47403
|
const tags = await this.parseTags();
|
|
47349
47404
|
const customProperties = await this.parseCustomProperties();
|
|
47350
47405
|
const coreProperties = await this.parseCoreProperties();
|
|
@@ -47464,6 +47519,7 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47464
47519
|
this.masterCache.clear();
|
|
47465
47520
|
this.layoutXmlMap.clear();
|
|
47466
47521
|
this.masterXmlMap.clear();
|
|
47522
|
+
this.masterTxStylesCache.clear();
|
|
47467
47523
|
this.layoutPlaceholderDefaultsCache.clear();
|
|
47468
47524
|
this.masterPlaceholderDefaultsCache.clear();
|
|
47469
47525
|
this.themeOverrideCache.clear();
|
|
@@ -47484,10 +47540,12 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47484
47540
|
this.detectDigitalSignatureParts();
|
|
47485
47541
|
await this.parseCustomXmlParts();
|
|
47486
47542
|
const presentationState = await this.loadPresentationState();
|
|
47543
|
+
const slideMasters = await this.parseSlideMasters();
|
|
47544
|
+
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
47487
47545
|
const slides = await this.loadSlidesForPresentation(presentationState.sectionBySlideId);
|
|
47488
47546
|
const slidesWithWarnings = this.attachSlideWarnings(slides);
|
|
47489
47547
|
this.resetElementIdCounter(slides);
|
|
47490
|
-
return this.buildLoadData(presentationState, slidesWithWarnings);
|
|
47548
|
+
return this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
|
|
47491
47549
|
}
|
|
47492
47550
|
/**
|
|
47493
47551
|
* Retrieve the current background colour for a layout or master.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pptx-viewer-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "PowerPoint PPTX engine: parse, edit, serialize, and convert .pptx files. Framework-agnostic TypeScript SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"emf-converter": "^1.5.0",
|
|
80
|
-
"fast-xml-parser": "^5.
|
|
80
|
+
"fast-xml-parser": "^5.10.0",
|
|
81
81
|
"jszip": "^3.10.1",
|
|
82
82
|
"mtx-decompressor": "^1.4.2"
|
|
83
83
|
},
|