pptx-react-viewer 1.1.1 → 1.1.3
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/{PowerPointViewer-DtLlYf0r.d.mts → PowerPointViewer-CX0a7wz_.d.mts} +2 -0
- package/dist/{PowerPointViewer-DtLlYf0r.d.ts → PowerPointViewer-CX0a7wz_.d.ts} +2 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +373 -64
- package/dist/index.mjs +373 -64
- package/dist/pptx-viewer.css +1 -1
- package/dist/viewer/index.d.mts +11 -3
- package/dist/viewer/index.d.ts +11 -3
- package/dist/viewer/index.js +373 -64
- package/dist/viewer/index.mjs +373 -64
- package/node_modules/emf-converter/package.json +1 -1
- package/node_modules/mtx-decompressor/dist/index.d.mts +2 -1
- package/node_modules/mtx-decompressor/dist/index.d.ts +2 -1
- package/node_modules/mtx-decompressor/dist/index.js +85 -93
- package/node_modules/mtx-decompressor/dist/index.mjs +85 -93
- package/node_modules/mtx-decompressor/package.json +1 -1
- package/node_modules/pptx-viewer-core/dist/{SvgExporter-CPr1npgo.d.ts → SvgExporter-BMjoxMDV.d.ts} +1 -1
- package/node_modules/pptx-viewer-core/dist/{SvgExporter-B4-1_Hjp.d.mts → SvgExporter-z6AbXRQg.d.mts} +1 -1
- package/node_modules/pptx-viewer-core/dist/cli/index.d.mts +2 -2
- package/node_modules/pptx-viewer-core/dist/cli/index.d.ts +2 -2
- package/node_modules/pptx-viewer-core/dist/cli/index.js +504 -253
- package/node_modules/pptx-viewer-core/dist/cli/index.mjs +504 -253
- package/node_modules/pptx-viewer-core/dist/converter/index.d.mts +3 -3
- package/node_modules/pptx-viewer-core/dist/converter/index.d.ts +3 -3
- package/node_modules/pptx-viewer-core/dist/index.d.mts +318 -6
- package/node_modules/pptx-viewer-core/dist/index.d.ts +318 -6
- package/node_modules/pptx-viewer-core/dist/index.js +1474 -253
- package/node_modules/pptx-viewer-core/dist/index.mjs +1450 -254
- package/node_modules/pptx-viewer-core/dist/{presentation-DgkIYhXo.d.mts → presentation-CchuDGfU.d.mts} +17 -1
- package/node_modules/pptx-viewer-core/dist/{presentation-DgkIYhXo.d.ts → presentation-CchuDGfU.d.ts} +17 -1
- package/node_modules/pptx-viewer-core/dist/{text-operations-dYKZp3zE.d.mts → text-operations-CeukUztU.d.mts} +1 -1
- package/node_modules/pptx-viewer-core/dist/{text-operations-B6U6XxWt.d.ts → text-operations-e7JxgI5l.d.ts} +1 -1
- package/node_modules/pptx-viewer-core/package.json +1 -1
- package/package.json +4 -4
|
@@ -5162,7 +5162,11 @@ function isoNow() {
|
|
|
5162
5162
|
return (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z");
|
|
5163
5163
|
}
|
|
5164
5164
|
var STANDARD_LAYOUTS = [
|
|
5165
|
-
|
|
5165
|
+
// `type` is ST_SlideLayoutType per ECMA-376 §19.7.15. The Title Slide
|
|
5166
|
+
// layout uses `title`; `ctrTitle` is a placeholder type (ST_PlaceholderType)
|
|
5167
|
+
// and is not valid here — PowerPoint's OPC loader rejects the package
|
|
5168
|
+
// with ERROR_FILE_CORRUPT (0x80070570) when it sees it.
|
|
5169
|
+
{ name: "Title Slide", type: "title" },
|
|
5166
5170
|
{ name: "Title and Content", type: "obj" },
|
|
5167
5171
|
{ name: "Section Header", type: "secHead" },
|
|
5168
5172
|
{ name: "Two Content", type: "twoObj" },
|
|
@@ -5196,7 +5200,7 @@ ${slideOverrides}
|
|
|
5196
5200
|
<Override PartName="/ppt/viewProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"/>
|
|
5197
5201
|
<Override PartName="/ppt/tableStyles.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"/>
|
|
5198
5202
|
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
|
|
5199
|
-
<Override PartName="/docProps/app.xml" ContentType="application/vnd.
|
|
5203
|
+
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
|
|
5200
5204
|
</Types>`;
|
|
5201
5205
|
}
|
|
5202
5206
|
function rootRelsXml() {
|
|
@@ -6255,33 +6259,10 @@ var PptxPresentationSaveBuilder = class {
|
|
|
6255
6259
|
init.presentationData["p:presentation"] = presentation;
|
|
6256
6260
|
return init.presentationData;
|
|
6257
6261
|
}
|
|
6258
|
-
applyHeaderFooter(presentation,
|
|
6259
|
-
if (
|
|
6260
|
-
|
|
6261
|
-
}
|
|
6262
|
-
const hf = presentation["p:hf"] || {};
|
|
6263
|
-
if (headerFooter.hasHeader !== void 0) {
|
|
6264
|
-
hf["@_hdr"] = headerFooter.hasHeader ? "1" : "0";
|
|
6265
|
-
}
|
|
6266
|
-
if (headerFooter.hasFooter !== void 0) {
|
|
6267
|
-
hf["@_ftr"] = headerFooter.hasFooter ? "1" : "0";
|
|
6268
|
-
}
|
|
6269
|
-
if (headerFooter.hasDateTime !== void 0) {
|
|
6270
|
-
hf["@_dt"] = headerFooter.hasDateTime ? "1" : "0";
|
|
6271
|
-
}
|
|
6272
|
-
if (headerFooter.hasSlideNumber !== void 0) {
|
|
6273
|
-
hf["@_sldNum"] = headerFooter.hasSlideNumber ? "1" : "0";
|
|
6274
|
-
}
|
|
6275
|
-
if (headerFooter.footerText !== void 0) {
|
|
6276
|
-
hf["@_ftrText"] = headerFooter.footerText;
|
|
6277
|
-
}
|
|
6278
|
-
if (headerFooter.dateTimeText !== void 0) {
|
|
6279
|
-
hf["@_dtText"] = headerFooter.dateTimeText;
|
|
6280
|
-
}
|
|
6281
|
-
if (headerFooter.dateFormat !== void 0) {
|
|
6282
|
-
hf["@_dtFmt"] = headerFooter.dateFormat;
|
|
6262
|
+
applyHeaderFooter(presentation, _headerFooter) {
|
|
6263
|
+
if (presentation["p:hf"] !== void 0) {
|
|
6264
|
+
delete presentation["p:hf"];
|
|
6283
6265
|
}
|
|
6284
|
-
presentation["p:hf"] = hf;
|
|
6285
6266
|
}
|
|
6286
6267
|
applySlideDimensions(presentation, rawSlideWidthEmu, rawSlideHeightEmu, rawSlideSizeType) {
|
|
6287
6268
|
const slideSize = presentation["p:sldSz"];
|
|
@@ -6545,9 +6526,40 @@ var PptxPresentationSlidesReconciler = class {
|
|
|
6545
6526
|
"@_r:id": slide.rId
|
|
6546
6527
|
};
|
|
6547
6528
|
});
|
|
6548
|
-
|
|
6549
|
-
|
|
6529
|
+
input.presentationData["p:presentation"] = this.insertSlideIdListInOrder(
|
|
6530
|
+
presentation,
|
|
6531
|
+
slideIdList
|
|
6532
|
+
);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
/**
|
|
6536
|
+
* Return a new presentation XML object whose `p:sldIdLst` child sits in the
|
|
6537
|
+
* schema-mandated position (after `sldMasterIdLst` / `notesMasterIdLst` /
|
|
6538
|
+
* `handoutMasterIdLst`, before `sldSz`). Non-sldIdLst keys keep their
|
|
6539
|
+
* relative order; attribute keys (`@_...`) stay at the front.
|
|
6540
|
+
*/
|
|
6541
|
+
insertSlideIdListInOrder(presentation, slideIdList) {
|
|
6542
|
+
const before = /* @__PURE__ */ new Set([
|
|
6543
|
+
"p:sldMasterIdLst",
|
|
6544
|
+
"p:notesMasterIdLst",
|
|
6545
|
+
"p:handoutMasterIdLst"
|
|
6546
|
+
]);
|
|
6547
|
+
const rebuilt = {};
|
|
6548
|
+
let inserted = false;
|
|
6549
|
+
for (const key of Object.keys(presentation)) {
|
|
6550
|
+
if (key === "p:sldIdLst") {
|
|
6551
|
+
continue;
|
|
6552
|
+
}
|
|
6553
|
+
if (!inserted && !key.startsWith("@_") && !before.has(key)) {
|
|
6554
|
+
rebuilt["p:sldIdLst"] = slideIdList;
|
|
6555
|
+
inserted = true;
|
|
6556
|
+
}
|
|
6557
|
+
rebuilt[key] = presentation[key];
|
|
6550
6558
|
}
|
|
6559
|
+
if (!inserted) {
|
|
6560
|
+
rebuilt["p:sldIdLst"] = slideIdList;
|
|
6561
|
+
}
|
|
6562
|
+
return rebuilt;
|
|
6551
6563
|
}
|
|
6552
6564
|
async attachNewSlide(init) {
|
|
6553
6565
|
const sourceSlidePath = init.input.findSourceSlidePath(init.slide.sourceSlideId);
|
|
@@ -6957,7 +6969,9 @@ var PptxSlideNotesPartUpdater = class {
|
|
|
6957
6969
|
var PptxSlideBackgroundBuilder = class {
|
|
6958
6970
|
applyBackground(init) {
|
|
6959
6971
|
const hasBackgroundColor = typeof init.slide.backgroundColor === "string" && init.slide.backgroundColor.length > 0 && init.slide.backgroundColor !== "transparent";
|
|
6960
|
-
const
|
|
6972
|
+
const rawBackgroundImage = typeof init.slide.backgroundImage === "string" ? init.slide.backgroundImage : "";
|
|
6973
|
+
const hasBackgroundImage = rawBackgroundImage.length > 0;
|
|
6974
|
+
const hasDataUrlBackgroundImage = hasBackgroundImage && rawBackgroundImage.startsWith("data:");
|
|
6961
6975
|
const hasBackgroundGradient = typeof init.slide.backgroundGradient === "string" && init.slide.backgroundGradient.length > 0;
|
|
6962
6976
|
const cSld = init.slideNode["p:cSld"] || {};
|
|
6963
6977
|
if (!(hasBackgroundColor || hasBackgroundImage || hasBackgroundGradient)) {
|
|
@@ -6965,9 +6979,17 @@ var PptxSlideBackgroundBuilder = class {
|
|
|
6965
6979
|
init.slideNode["p:cSld"] = cSld;
|
|
6966
6980
|
return;
|
|
6967
6981
|
}
|
|
6982
|
+
const existingBg = cSld["p:bg"];
|
|
6983
|
+
const existingBgPr = existingBg?.["p:bgPr"];
|
|
6984
|
+
const existingHasBlipFill = existingBgPr?.["a:blipFill"] !== void 0;
|
|
6985
|
+
if (!hasDataUrlBackgroundImage && existingHasBlipFill) {
|
|
6986
|
+
this.reorderCSldBgFirst(cSld, existingBg);
|
|
6987
|
+
init.slideNode["p:cSld"] = cSld;
|
|
6988
|
+
return;
|
|
6989
|
+
}
|
|
6968
6990
|
const backgroundProperties = {};
|
|
6969
|
-
if (
|
|
6970
|
-
const parsedBackgroundImage = init.parseDataUrlToBytes(
|
|
6991
|
+
if (hasDataUrlBackgroundImage) {
|
|
6992
|
+
const parsedBackgroundImage = init.parseDataUrlToBytes(rawBackgroundImage);
|
|
6971
6993
|
if (parsedBackgroundImage) {
|
|
6972
6994
|
const backgroundImagePath = init.saveState.nextMediaPath(parsedBackgroundImage.extension);
|
|
6973
6995
|
init.zip.file(backgroundImagePath, parsedBackgroundImage.bytes);
|
|
@@ -6990,9 +7012,42 @@ var PptxSlideBackgroundBuilder = class {
|
|
|
6990
7012
|
}
|
|
6991
7013
|
};
|
|
6992
7014
|
}
|
|
6993
|
-
backgroundProperties["a:
|
|
6994
|
-
|
|
6995
|
-
|
|
7015
|
+
const hasFillChild = backgroundProperties["a:blipFill"] !== void 0 || backgroundProperties["a:solidFill"] !== void 0 || backgroundProperties["a:gradFill"] !== void 0 || backgroundProperties["a:pattFill"] !== void 0 || backgroundProperties["a:noFill"] !== void 0 || backgroundProperties["a:grpFill"] !== void 0;
|
|
7016
|
+
if (hasFillChild) {
|
|
7017
|
+
backgroundProperties["a:effectLst"] = {};
|
|
7018
|
+
}
|
|
7019
|
+
if (!hasFillChild) {
|
|
7020
|
+
delete cSld["p:bg"];
|
|
7021
|
+
init.slideNode["p:cSld"] = cSld;
|
|
7022
|
+
return;
|
|
7023
|
+
}
|
|
7024
|
+
const rebuiltCSld = { "p:bg": { "p:bgPr": backgroundProperties } };
|
|
7025
|
+
for (const key of Object.keys(cSld)) {
|
|
7026
|
+
if (key === "p:bg") {
|
|
7027
|
+
continue;
|
|
7028
|
+
}
|
|
7029
|
+
rebuiltCSld[key] = cSld[key];
|
|
7030
|
+
}
|
|
7031
|
+
init.slideNode["p:cSld"] = rebuiltCSld;
|
|
7032
|
+
}
|
|
7033
|
+
reorderCSldBgFirst(cSld, bg) {
|
|
7034
|
+
const keys = Object.keys(cSld);
|
|
7035
|
+
if (keys.length > 0 && keys[0] === "p:bg") {
|
|
7036
|
+
return;
|
|
7037
|
+
}
|
|
7038
|
+
const reordered = { "p:bg": bg };
|
|
7039
|
+
for (const key of keys) {
|
|
7040
|
+
if (key === "p:bg") {
|
|
7041
|
+
continue;
|
|
7042
|
+
}
|
|
7043
|
+
reordered[key] = cSld[key];
|
|
7044
|
+
}
|
|
7045
|
+
for (const key of Object.keys(cSld)) {
|
|
7046
|
+
delete cSld[key];
|
|
7047
|
+
}
|
|
7048
|
+
for (const key of Object.keys(reordered)) {
|
|
7049
|
+
cSld[key] = reordered[key];
|
|
7050
|
+
}
|
|
6996
7051
|
}
|
|
6997
7052
|
};
|
|
6998
7053
|
|
|
@@ -9869,6 +9924,7 @@ var PptxConnectorParser = class {
|
|
|
9869
9924
|
slideRelationships,
|
|
9870
9925
|
this.context.getOrderedSlidePaths()
|
|
9871
9926
|
);
|
|
9927
|
+
const connElementName = cNvPr?.["@_name"] ? String(cNvPr["@_name"]).trim() : void 0;
|
|
9872
9928
|
const locks = this.context.parseShapeLocks(
|
|
9873
9929
|
cNvConnectionShapeProperties?.["a:cxnSpLocks"] ?? cNvConnectionShapeProperties?.["a:spLocks"]
|
|
9874
9930
|
);
|
|
@@ -9876,6 +9932,7 @@ var PptxConnectorParser = class {
|
|
|
9876
9932
|
const textResult = this.context.parseConnectorTextBody?.(txBody, slidePath);
|
|
9877
9933
|
return {
|
|
9878
9934
|
id,
|
|
9935
|
+
name: connElementName || void 0,
|
|
9879
9936
|
type: "connector",
|
|
9880
9937
|
x: Math.round(parseInt(String(offset["@_x"] || "0"), 10) / this.context.emuPerPx),
|
|
9881
9938
|
y: Math.round(parseInt(String(offset["@_y"] || "0"), 10) / this.context.emuPerPx),
|
|
@@ -13405,7 +13462,16 @@ var PptxRuntimeDependencyFactory = class {
|
|
|
13405
13462
|
return new XMLParser({
|
|
13406
13463
|
ignoreAttributes: false,
|
|
13407
13464
|
attributeNamePrefix: "@_",
|
|
13408
|
-
parseAttributeValue: false
|
|
13465
|
+
parseAttributeValue: false,
|
|
13466
|
+
// Keep element text as strings. When true (the fast-xml-parser
|
|
13467
|
+
// default), `<AppVersion>16.0000</AppVersion>` is coerced to the
|
|
13468
|
+
// JS number 16, losing the trailing zeros. On save we write back
|
|
13469
|
+
// "16", which fails PowerPoint's strict `[0-9]+\.[0-9]{4}` match
|
|
13470
|
+
// on AppVersion — the loader rejects the package with HRESULT
|
|
13471
|
+
// 0x80070570 (ERROR_FILE_CORRUPT) and shows the repair dialog.
|
|
13472
|
+
// More generally, OOXML element text is always an untyped string;
|
|
13473
|
+
// downstream callers coerce where needed.
|
|
13474
|
+
parseTagValue: false
|
|
13409
13475
|
});
|
|
13410
13476
|
}
|
|
13411
13477
|
createBuilder() {
|
|
@@ -14081,7 +14147,7 @@ var TRIPLET_ENCODINGS = [
|
|
|
14081
14147
|
{ byteCount: 2, xBits: 4, yBits: 4, deltaX: 49, deltaY: 49, xSign: 1, ySign: -1 },
|
|
14082
14148
|
{ byteCount: 2, xBits: 4, yBits: 4, deltaX: 49, deltaY: 49, xSign: -1, ySign: 1 },
|
|
14083
14149
|
{ byteCount: 2, xBits: 4, yBits: 4, deltaX: 49, deltaY: 49, xSign: 1, ySign: 1 },
|
|
14084
|
-
// Indices 84-
|
|
14150
|
+
// Indices 84-119: 8-bit X + 8-bit Y (3 bytes total)
|
|
14085
14151
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 1, deltaY: 1, xSign: -1, ySign: -1 },
|
|
14086
14152
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 1, deltaY: 1, xSign: 1, ySign: -1 },
|
|
14087
14153
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 1, deltaY: 1, xSign: -1, ySign: 1 },
|
|
@@ -14118,12 +14184,12 @@ var TRIPLET_ENCODINGS = [
|
|
|
14118
14184
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 513, deltaY: 513, xSign: 1, ySign: -1 },
|
|
14119
14185
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 513, deltaY: 513, xSign: -1, ySign: 1 },
|
|
14120
14186
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 513, deltaY: 513, xSign: 1, ySign: 1 },
|
|
14121
|
-
// Indices
|
|
14187
|
+
// Indices 120-123: 12-bit X + 12-bit Y (4 bytes total)
|
|
14122
14188
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: -1, ySign: -1 },
|
|
14123
14189
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: 1, ySign: -1 },
|
|
14124
14190
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: -1, ySign: 1 },
|
|
14125
14191
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: 1, ySign: 1 },
|
|
14126
|
-
// Indices
|
|
14192
|
+
// Indices 124-127: 16-bit X + 16-bit Y (5 bytes total)
|
|
14127
14193
|
{ byteCount: 5, xBits: 16, yBits: 16, deltaX: 0, deltaY: 0, xSign: -1, ySign: -1 },
|
|
14128
14194
|
{ byteCount: 5, xBits: 16, yBits: 16, deltaX: 0, deltaY: 0, xSign: 1, ySign: -1 },
|
|
14129
14195
|
{ byteCount: 5, xBits: 16, yBits: 16, deltaX: 0, deltaY: 0, xSign: -1, ySign: 1 },
|
|
@@ -14212,14 +14278,15 @@ function decodePushInstructions(sIn, sOut, pushCount) {
|
|
|
14212
14278
|
if (pushCount === 0) {
|
|
14213
14279
|
return;
|
|
14214
14280
|
}
|
|
14215
|
-
const
|
|
14216
|
-
let isShort = false;
|
|
14281
|
+
const data = [];
|
|
14217
14282
|
let remaining = pushCount;
|
|
14283
|
+
let isShort = false;
|
|
14284
|
+
const runValues = [];
|
|
14218
14285
|
function flush() {
|
|
14219
|
-
if (
|
|
14286
|
+
if (runValues.length === 0) {
|
|
14220
14287
|
return;
|
|
14221
14288
|
}
|
|
14222
|
-
const count =
|
|
14289
|
+
const count = runValues.length;
|
|
14223
14290
|
if (isShort) {
|
|
14224
14291
|
if (count < 8) {
|
|
14225
14292
|
sOut.writeU8(PUSHW + (count - 1));
|
|
@@ -14227,7 +14294,7 @@ function decodePushInstructions(sIn, sOut, pushCount) {
|
|
|
14227
14294
|
sOut.writeU8(NPUSHW);
|
|
14228
14295
|
sOut.writeU8(count);
|
|
14229
14296
|
}
|
|
14230
|
-
for (const v of
|
|
14297
|
+
for (const v of runValues) {
|
|
14231
14298
|
sOut.writeS16(v);
|
|
14232
14299
|
}
|
|
14233
14300
|
} else {
|
|
@@ -14237,54 +14304,50 @@ function decodePushInstructions(sIn, sOut, pushCount) {
|
|
|
14237
14304
|
sOut.writeU8(NPUSHB);
|
|
14238
14305
|
sOut.writeU8(count);
|
|
14239
14306
|
}
|
|
14240
|
-
for (const v of
|
|
14307
|
+
for (const v of runValues) {
|
|
14241
14308
|
sOut.writeU8(v & 255);
|
|
14242
14309
|
}
|
|
14243
14310
|
}
|
|
14244
|
-
|
|
14311
|
+
runValues.length = 0;
|
|
14245
14312
|
}
|
|
14246
|
-
function
|
|
14313
|
+
function put(v) {
|
|
14314
|
+
data.push(v);
|
|
14247
14315
|
const needsShort = v < 0 || v > 255;
|
|
14248
|
-
if (
|
|
14316
|
+
if (runValues.length > 0 && needsShort !== isShort) {
|
|
14249
14317
|
flush();
|
|
14250
14318
|
}
|
|
14251
|
-
if (
|
|
14319
|
+
if (runValues.length === 0) {
|
|
14252
14320
|
isShort = needsShort;
|
|
14253
14321
|
}
|
|
14254
|
-
|
|
14255
|
-
if (
|
|
14322
|
+
runValues.push(v);
|
|
14323
|
+
if (runValues.length >= 255) {
|
|
14256
14324
|
flush();
|
|
14257
14325
|
}
|
|
14258
14326
|
}
|
|
14259
14327
|
while (remaining > 0) {
|
|
14260
|
-
const code = sIn.
|
|
14261
|
-
if (code === 251 && remaining >=
|
|
14262
|
-
|
|
14263
|
-
const
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
const b = read255Short(sIn);
|
|
14328
|
+
const code = sIn.peekU8();
|
|
14329
|
+
if (code === 251 && remaining >= 3 && data.length >= 2) {
|
|
14330
|
+
sIn.readU8();
|
|
14331
|
+
const prev = data[data.length - 2];
|
|
14332
|
+
put(prev);
|
|
14333
|
+
const val = read255Short(sIn);
|
|
14334
|
+
put(val);
|
|
14335
|
+
put(prev);
|
|
14336
|
+
remaining -= 3;
|
|
14337
|
+
} else if (code === 252 && remaining >= 5 && data.length >= 2) {
|
|
14338
|
+
sIn.readU8();
|
|
14339
|
+
const prev = data[data.length - 2];
|
|
14340
|
+
put(prev);
|
|
14274
14341
|
const c = read255Short(sIn);
|
|
14342
|
+
put(c);
|
|
14343
|
+
put(prev);
|
|
14275
14344
|
const d = read255Short(sIn);
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
addValue(c);
|
|
14280
|
-
addValue(a);
|
|
14281
|
-
addValue(d);
|
|
14282
|
-
addValue(a);
|
|
14283
|
-
remaining -= 7;
|
|
14345
|
+
put(d);
|
|
14346
|
+
put(prev);
|
|
14347
|
+
remaining -= 5;
|
|
14284
14348
|
} else {
|
|
14285
|
-
sIn.seekRelative(-1);
|
|
14286
14349
|
const v = read255Short(sIn);
|
|
14287
|
-
|
|
14350
|
+
put(v);
|
|
14288
14351
|
remaining -= 1;
|
|
14289
14352
|
}
|
|
14290
14353
|
}
|
|
@@ -14312,6 +14375,9 @@ function makeGlyphFlags(x, y, onCurve, firstTime) {
|
|
|
14312
14375
|
return flags;
|
|
14313
14376
|
}
|
|
14314
14377
|
function decodeSimpleGlyph(numContours, streams, out, calcBBox, minX, minY, maxX, maxY) {
|
|
14378
|
+
if (numContours === 0) {
|
|
14379
|
+
return;
|
|
14380
|
+
}
|
|
14315
14381
|
const sGlyph = streams[0];
|
|
14316
14382
|
out.writeS16(numContours);
|
|
14317
14383
|
const bboxPos = out.pos;
|
|
@@ -14332,13 +14398,12 @@ function decodeSimpleGlyph(numContours, streams, out, calcBBox, minX, minY, maxX
|
|
|
14332
14398
|
}
|
|
14333
14399
|
let totalPoints = 0;
|
|
14334
14400
|
for (let c = 0; c < numContours; c++) {
|
|
14335
|
-
const pointsInContour = read255UShort(sGlyph);
|
|
14336
|
-
totalPoints += pointsInContour;
|
|
14337
14401
|
if (c === 0) {
|
|
14338
|
-
|
|
14339
|
-
} else {
|
|
14340
|
-
out.writeU16(totalPoints - 1);
|
|
14402
|
+
totalPoints = 1;
|
|
14341
14403
|
}
|
|
14404
|
+
const pointsInContour = read255UShort(sGlyph);
|
|
14405
|
+
totalPoints += pointsInContour;
|
|
14406
|
+
out.writeU16(totalPoints - 1);
|
|
14342
14407
|
}
|
|
14343
14408
|
const flagBytes = new Uint8Array(totalPoints);
|
|
14344
14409
|
for (let i = 0; i < totalPoints; i++) {
|
|
@@ -14351,7 +14416,7 @@ function decodeSimpleGlyph(numContours, streams, out, calcBBox, minX, minY, maxX
|
|
|
14351
14416
|
let cumulativeY = 0;
|
|
14352
14417
|
for (let i = 0; i < totalPoints; i++) {
|
|
14353
14418
|
const flag = flagBytes[i];
|
|
14354
|
-
onCurve[i] = flag
|
|
14419
|
+
onCurve[i] = flag & 128 ? 0 : 1;
|
|
14355
14420
|
const enc = TRIPLET_ENCODINGS[flag & 127];
|
|
14356
14421
|
const extraBytes = enc.byteCount - 1;
|
|
14357
14422
|
const subBuf = new Uint8Array(extraBytes);
|
|
@@ -14690,7 +14755,10 @@ var AHuff = class _AHuff {
|
|
|
14690
14755
|
this.bio = bio;
|
|
14691
14756
|
this.range = range;
|
|
14692
14757
|
this.bitCount = bitsUsed(range - 1);
|
|
14693
|
-
this.bitCount2 =
|
|
14758
|
+
this.bitCount2 = 0;
|
|
14759
|
+
if (range > 256 && range < 512) {
|
|
14760
|
+
this.bitCount2 = bitsUsed(range - 256 - 1) + 1;
|
|
14761
|
+
}
|
|
14694
14762
|
const treeSize = 2 * range;
|
|
14695
14763
|
this.tree = Array.from({ length: treeSize });
|
|
14696
14764
|
for (let i = 0; i < treeSize; i++) {
|
|
@@ -14698,6 +14766,7 @@ var AHuff = class _AHuff {
|
|
|
14698
14766
|
}
|
|
14699
14767
|
for (let i = 2; i < treeSize; i++) {
|
|
14700
14768
|
this.tree[i].up = i >> 1;
|
|
14769
|
+
this.tree[i].weight = 1;
|
|
14701
14770
|
}
|
|
14702
14771
|
for (let i = 1; i < range; i++) {
|
|
14703
14772
|
this.tree[i].left = 2 * i;
|
|
@@ -14707,7 +14776,8 @@ var AHuff = class _AHuff {
|
|
|
14707
14776
|
for (let i = 0; i < range; i++) {
|
|
14708
14777
|
const leafIdx = range + i;
|
|
14709
14778
|
this.tree[leafIdx].code = i;
|
|
14710
|
-
this.tree[leafIdx].
|
|
14779
|
+
this.tree[leafIdx].left = -1;
|
|
14780
|
+
this.tree[leafIdx].right = -1;
|
|
14711
14781
|
}
|
|
14712
14782
|
this.symbolIndex = Array.from({ length: range });
|
|
14713
14783
|
for (let i = 0; i < range; i++) {
|
|
@@ -14747,15 +14817,13 @@ var AHuff = class _AHuff {
|
|
|
14747
14817
|
*/
|
|
14748
14818
|
readSymbol() {
|
|
14749
14819
|
let a = _AHuff.ROOT;
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
}
|
|
14756
|
-
}
|
|
14820
|
+
let symbol;
|
|
14821
|
+
do {
|
|
14822
|
+
a = this.bio.inputBit() ? this.tree[a].right : this.tree[a].left;
|
|
14823
|
+
symbol = this.tree[a].code;
|
|
14824
|
+
} while (symbol < 0);
|
|
14757
14825
|
this.updateWeight(a);
|
|
14758
|
-
return
|
|
14826
|
+
return symbol;
|
|
14759
14827
|
}
|
|
14760
14828
|
// --------------------------------------------------------------------
|
|
14761
14829
|
// Private helpers
|
|
@@ -14779,17 +14847,19 @@ var AHuff = class _AHuff {
|
|
|
14779
14847
|
updateWeight(a) {
|
|
14780
14848
|
const tree = this.tree;
|
|
14781
14849
|
for (; a !== _AHuff.ROOT; a = tree[a].up) {
|
|
14850
|
+
const weightA = tree[a].weight;
|
|
14782
14851
|
let b = a - 1;
|
|
14783
|
-
if (
|
|
14784
|
-
|
|
14852
|
+
if (tree[b].weight === weightA) {
|
|
14853
|
+
do {
|
|
14785
14854
|
b--;
|
|
14786
|
-
}
|
|
14787
|
-
|
|
14855
|
+
} while (tree[b].weight === weightA);
|
|
14856
|
+
b++;
|
|
14857
|
+
if (b > _AHuff.ROOT) {
|
|
14788
14858
|
this.swapNodes(a, b);
|
|
14789
14859
|
a = b;
|
|
14790
14860
|
}
|
|
14791
14861
|
}
|
|
14792
|
-
tree[a].weight
|
|
14862
|
+
tree[a].weight = weightA + 1;
|
|
14793
14863
|
}
|
|
14794
14864
|
tree[_AHuff.ROOT].weight++;
|
|
14795
14865
|
}
|
|
@@ -14809,38 +14879,26 @@ var AHuff = class _AHuff {
|
|
|
14809
14879
|
*/
|
|
14810
14880
|
swapNodes(a, b) {
|
|
14811
14881
|
const tree = this.tree;
|
|
14812
|
-
const
|
|
14813
|
-
const
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
na.weight = nb.weight;
|
|
14826
|
-
nb.weight = tmp;
|
|
14827
|
-
if (na.left) {
|
|
14828
|
-
tree[na.left].up = a;
|
|
14829
|
-
}
|
|
14830
|
-
if (na.right) {
|
|
14831
|
-
tree[na.right].up = a;
|
|
14832
|
-
}
|
|
14833
|
-
if (nb.left) {
|
|
14834
|
-
tree[nb.left].up = b;
|
|
14835
|
-
}
|
|
14836
|
-
if (nb.right) {
|
|
14837
|
-
tree[nb.right].up = b;
|
|
14838
|
-
}
|
|
14839
|
-
if (na.code >= 0) {
|
|
14840
|
-
this.symbolIndex[na.code] = a;
|
|
14882
|
+
const upa = tree[a].up;
|
|
14883
|
+
const upb = tree[b].up;
|
|
14884
|
+
const tmp = tree[a];
|
|
14885
|
+
tree[a] = tree[b];
|
|
14886
|
+
tree[b] = tmp;
|
|
14887
|
+
tree[a].up = upa;
|
|
14888
|
+
tree[b].up = upb;
|
|
14889
|
+
let code = tree[a].code;
|
|
14890
|
+
if (code < 0) {
|
|
14891
|
+
tree[tree[a].left].up = a;
|
|
14892
|
+
tree[tree[a].right].up = a;
|
|
14893
|
+
} else {
|
|
14894
|
+
this.symbolIndex[code] = a;
|
|
14841
14895
|
}
|
|
14842
|
-
|
|
14843
|
-
|
|
14896
|
+
code = tree[b].code;
|
|
14897
|
+
if (code < 0) {
|
|
14898
|
+
tree[tree[b].left].up = b;
|
|
14899
|
+
tree[tree[b].right].up = b;
|
|
14900
|
+
} else {
|
|
14901
|
+
this.symbolIndex[code] = b;
|
|
14844
14902
|
}
|
|
14845
14903
|
}
|
|
14846
14904
|
/**
|
|
@@ -15219,12 +15277,12 @@ function unpackMtx(data, size) {
|
|
|
15219
15277
|
const offset2 = data[4] << 16 | data[5] << 8 | data[6];
|
|
15220
15278
|
const offset3 = data[7] << 16 | data[8] << 8 | data[9];
|
|
15221
15279
|
const offsets = [10, offset2, offset3];
|
|
15222
|
-
const
|
|
15280
|
+
const blockSizes = [offset2 - 10, offset3 - offset2, size - offset3];
|
|
15223
15281
|
const streams = [];
|
|
15224
15282
|
const decompressedSizes = [];
|
|
15225
15283
|
for (let i = 0; i < 3; i++) {
|
|
15226
15284
|
const block = data.subarray(offsets[i]);
|
|
15227
|
-
const decompressed = lzcompDecompress(block,
|
|
15285
|
+
const decompressed = lzcompDecompress(block, blockSizes[i], versionMagic);
|
|
15228
15286
|
streams.push(decompressed);
|
|
15229
15287
|
decompressedSizes.push(decompressed.length);
|
|
15230
15288
|
}
|
|
@@ -15316,6 +15374,15 @@ function parseEotHeader(data) {
|
|
|
15316
15374
|
const fullName = readNameString();
|
|
15317
15375
|
if (version >= 131074) {
|
|
15318
15376
|
readNameString();
|
|
15377
|
+
offset += 8;
|
|
15378
|
+
if (offset + 4 <= data.length) {
|
|
15379
|
+
const signatureSize = readUint16LE(data, offset + 2);
|
|
15380
|
+
offset += 4 + signatureSize;
|
|
15381
|
+
}
|
|
15382
|
+
if (offset + 8 <= data.length) {
|
|
15383
|
+
const eudcFontSize = readUint32LE(data, offset + 4);
|
|
15384
|
+
offset += 8 + eudcFontSize;
|
|
15385
|
+
}
|
|
15319
15386
|
}
|
|
15320
15387
|
return {
|
|
15321
15388
|
eotSize,
|
|
@@ -23414,12 +23481,6 @@ function buildParagraphPropertiesXml(textStyle, paragraphAlign, bulletInfo, spac
|
|
|
23414
23481
|
if (textStyle?.rtl !== void 0) {
|
|
23415
23482
|
paragraphProps["@_rtl"] = textStyle.rtl ? "1" : "0";
|
|
23416
23483
|
}
|
|
23417
|
-
if (spacing.spacingBefore) {
|
|
23418
|
-
paragraphProps["a:spcBef"] = spacing.spacingBefore;
|
|
23419
|
-
}
|
|
23420
|
-
if (spacing.spacingAfter) {
|
|
23421
|
-
paragraphProps["a:spcAft"] = spacing.spacingAfter;
|
|
23422
|
-
}
|
|
23423
23484
|
if (spacing.lineSpacing) {
|
|
23424
23485
|
paragraphProps["a:lnSpc"] = spacing.lineSpacing;
|
|
23425
23486
|
} else if (typeof spacing.lineSpacingExactPt === "number" && Number.isFinite(spacing.lineSpacingExactPt)) {
|
|
@@ -23429,6 +23490,12 @@ function buildParagraphPropertiesXml(textStyle, paragraphAlign, bulletInfo, spac
|
|
|
23429
23490
|
}
|
|
23430
23491
|
};
|
|
23431
23492
|
}
|
|
23493
|
+
if (spacing.spacingBefore) {
|
|
23494
|
+
paragraphProps["a:spcBef"] = spacing.spacingBefore;
|
|
23495
|
+
}
|
|
23496
|
+
if (spacing.spacingAfter) {
|
|
23497
|
+
paragraphProps["a:spcAft"] = spacing.spacingAfter;
|
|
23498
|
+
}
|
|
23432
23499
|
if (typeof textStyle?.paragraphMarginLeft === "number" && Number.isFinite(textStyle.paragraphMarginLeft)) {
|
|
23433
23500
|
paragraphProps["@_marL"] = String(Math.round(textStyle.paragraphMarginLeft * EMU_PER_PX4));
|
|
23434
23501
|
}
|
|
@@ -23479,9 +23546,10 @@ function applyBulletProperties(paragraphProps, bulletInfo) {
|
|
|
23479
23546
|
paragraphProps["a:buNone"] = {};
|
|
23480
23547
|
return;
|
|
23481
23548
|
}
|
|
23482
|
-
if (bulletInfo.
|
|
23483
|
-
|
|
23484
|
-
|
|
23549
|
+
if (bulletInfo.color) {
|
|
23550
|
+
const colorHex = bulletInfo.color.replace("#", "");
|
|
23551
|
+
paragraphProps["a:buClr"] = {
|
|
23552
|
+
"a:srgbClr": { "@_val": colorHex }
|
|
23485
23553
|
};
|
|
23486
23554
|
}
|
|
23487
23555
|
if (bulletInfo.sizePercent !== void 0) {
|
|
@@ -23494,10 +23562,9 @@ function applyBulletProperties(paragraphProps, bulletInfo) {
|
|
|
23494
23562
|
"@_val": String(Math.round(bulletInfo.sizePts * 100))
|
|
23495
23563
|
};
|
|
23496
23564
|
}
|
|
23497
|
-
if (bulletInfo.
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
"a:srgbClr": { "@_val": colorHex }
|
|
23565
|
+
if (bulletInfo.fontFamily) {
|
|
23566
|
+
paragraphProps["a:buFont"] = {
|
|
23567
|
+
"@_typeface": bulletInfo.fontFamily
|
|
23501
23568
|
};
|
|
23502
23569
|
}
|
|
23503
23570
|
if (bulletInfo.char) {
|
|
@@ -23520,9 +23587,8 @@ function applyBulletProperties(paragraphProps, bulletInfo) {
|
|
|
23520
23587
|
}
|
|
23521
23588
|
function assembleParagraphXml(runs, paragraphProps) {
|
|
23522
23589
|
const paragraph = {
|
|
23523
|
-
"a:
|
|
23590
|
+
"a:pPr": paragraphProps
|
|
23524
23591
|
};
|
|
23525
|
-
paragraph["a:pPr"] = paragraphProps;
|
|
23526
23592
|
const regularRuns = runs.filter((r) => !r.__isField);
|
|
23527
23593
|
const fieldRuns = runs.filter((r) => r.__isField).map((r) => {
|
|
23528
23594
|
const { __isField, ...rest } = r;
|
|
@@ -23541,6 +23607,7 @@ function assembleParagraphXml(runs, paragraphProps) {
|
|
|
23541
23607
|
if (cleanRegularRuns.length === 0 && fieldRuns.length === 0) {
|
|
23542
23608
|
paragraph["a:r"] = runs.length > 1 ? runs : runs[0];
|
|
23543
23609
|
}
|
|
23610
|
+
paragraph["a:endParaRPr"] = { "@_lang": "en-US" };
|
|
23544
23611
|
return paragraph;
|
|
23545
23612
|
}
|
|
23546
23613
|
function computeUniformSegmentOverrides(textStyle, textSegments) {
|
|
@@ -26379,9 +26446,6 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26379
26446
|
if (style.textCaps && style.textCaps !== "none") {
|
|
26380
26447
|
runProps["@_cap"] = style.textCaps;
|
|
26381
26448
|
}
|
|
26382
|
-
if (style.rtl !== void 0) {
|
|
26383
|
-
runProps["@_rtl"] = style.rtl ? "1" : "0";
|
|
26384
|
-
}
|
|
26385
26449
|
if (style.kumimoji !== void 0) {
|
|
26386
26450
|
runProps["@_kumimoji"] = style.kumimoji ? "1" : "0";
|
|
26387
26451
|
}
|
|
@@ -26403,17 +26467,19 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26403
26467
|
if (style.bookmark) {
|
|
26404
26468
|
runProps["@_bmk"] = style.bookmark;
|
|
26405
26469
|
}
|
|
26406
|
-
if (style.
|
|
26407
|
-
|
|
26408
|
-
|
|
26409
|
-
"@
|
|
26410
|
-
}
|
|
26411
|
-
|
|
26412
|
-
"
|
|
26413
|
-
|
|
26414
|
-
|
|
26415
|
-
|
|
26416
|
-
|
|
26470
|
+
if (style.textOutlineWidth || style.textOutlineColor) {
|
|
26471
|
+
const lnObj = {};
|
|
26472
|
+
if (typeof style.textOutlineWidth === "number" && style.textOutlineWidth > 0) {
|
|
26473
|
+
lnObj["@_w"] = String(Math.round(style.textOutlineWidth * _PptxHandlerRuntime.EMU_PER_PX));
|
|
26474
|
+
}
|
|
26475
|
+
if (style.textOutlineColor) {
|
|
26476
|
+
lnObj["a:solidFill"] = {
|
|
26477
|
+
"a:srgbClr": {
|
|
26478
|
+
"@_val": style.textOutlineColor.replace("#", "")
|
|
26479
|
+
}
|
|
26480
|
+
};
|
|
26481
|
+
}
|
|
26482
|
+
runProps["a:ln"] = lnObj;
|
|
26417
26483
|
}
|
|
26418
26484
|
if (style.color) {
|
|
26419
26485
|
runProps["a:solidFill"] = {
|
|
@@ -26421,15 +26487,7 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26421
26487
|
"@_val": style.color.replace("#", "")
|
|
26422
26488
|
}
|
|
26423
26489
|
};
|
|
26424
|
-
}
|
|
26425
|
-
if (style.highlightColor) {
|
|
26426
|
-
runProps["a:highlight"] = {
|
|
26427
|
-
"a:srgbClr": {
|
|
26428
|
-
"@_val": style.highlightColor.replace("#", "")
|
|
26429
|
-
}
|
|
26430
|
-
};
|
|
26431
|
-
}
|
|
26432
|
-
if (style.textFillGradientStops && style.textFillGradientStops.length > 0) {
|
|
26490
|
+
} else if (style.textFillGradientStops && style.textFillGradientStops.length > 0) {
|
|
26433
26491
|
const gradStops = style.textFillGradientStops.filter((stop) => Boolean(stop?.color)).map((stop) => {
|
|
26434
26492
|
const rawPos = (stop.position ?? 0) / 100;
|
|
26435
26493
|
const posVal = Math.round(Math.max(0, Math.min(1, rawPos)) * 1e5);
|
|
@@ -26462,8 +26520,7 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26462
26520
|
}
|
|
26463
26521
|
runProps["a:gradFill"] = gradFillXml;
|
|
26464
26522
|
}
|
|
26465
|
-
}
|
|
26466
|
-
if (style.textFillPattern) {
|
|
26523
|
+
} else if (style.textFillPattern) {
|
|
26467
26524
|
const pattFill = { "@_prst": style.textFillPattern };
|
|
26468
26525
|
if (style.textFillPatternForeground) {
|
|
26469
26526
|
pattFill["a:fgClr"] = {
|
|
@@ -26481,6 +26538,17 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26481
26538
|
}
|
|
26482
26539
|
runProps["a:pattFill"] = pattFill;
|
|
26483
26540
|
}
|
|
26541
|
+
const textEffectLst = buildTextRunEffectListXml(style);
|
|
26542
|
+
if (textEffectLst) {
|
|
26543
|
+
runProps["a:effectLst"] = textEffectLst;
|
|
26544
|
+
}
|
|
26545
|
+
if (style.highlightColor) {
|
|
26546
|
+
runProps["a:highlight"] = {
|
|
26547
|
+
"a:srgbClr": {
|
|
26548
|
+
"@_val": style.highlightColor.replace("#", "")
|
|
26549
|
+
}
|
|
26550
|
+
};
|
|
26551
|
+
}
|
|
26484
26552
|
if (style.underline && style.underlineColor) {
|
|
26485
26553
|
runProps["a:uFill"] = {
|
|
26486
26554
|
"a:solidFill": {
|
|
@@ -26490,23 +26558,17 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26490
26558
|
}
|
|
26491
26559
|
};
|
|
26492
26560
|
}
|
|
26493
|
-
if (style.
|
|
26494
|
-
|
|
26495
|
-
|
|
26496
|
-
|
|
26497
|
-
}
|
|
26498
|
-
|
|
26499
|
-
|
|
26500
|
-
|
|
26501
|
-
"@_val": style.textOutlineColor.replace("#", "")
|
|
26502
|
-
}
|
|
26503
|
-
};
|
|
26504
|
-
}
|
|
26505
|
-
runProps["a:ln"] = lnObj;
|
|
26561
|
+
if (style.fontFamily) {
|
|
26562
|
+
runProps["a:latin"] = { "@_typeface": style.fontFamily };
|
|
26563
|
+
runProps["a:ea"] = {
|
|
26564
|
+
"@_typeface": style.eastAsiaFont || style.fontFamily
|
|
26565
|
+
};
|
|
26566
|
+
runProps["a:cs"] = {
|
|
26567
|
+
"@_typeface": style.complexScriptFont || style.fontFamily
|
|
26568
|
+
};
|
|
26506
26569
|
}
|
|
26507
|
-
|
|
26508
|
-
|
|
26509
|
-
runProps["a:effectLst"] = textEffectLst;
|
|
26570
|
+
if (style.symbolFont) {
|
|
26571
|
+
runProps["a:sym"] = { "@_typeface": style.symbolFont };
|
|
26510
26572
|
}
|
|
26511
26573
|
if (style.hyperlink && resolveHyperlinkRelationshipId) {
|
|
26512
26574
|
const hyperlinkTarget = String(style.hyperlink).trim();
|
|
@@ -26754,6 +26816,55 @@ var PptxHandlerRuntime14 = class extends PptxHandlerRuntime13 {
|
|
|
26754
26816
|
|
|
26755
26817
|
// src/core/core/runtime/PptxHandlerRuntimeSaveShapeXml.ts
|
|
26756
26818
|
var PptxHandlerRuntime15 = class _PptxHandlerRuntime extends PptxHandlerRuntime14 {
|
|
26819
|
+
/**
|
|
26820
|
+
* Build a `p:graphicFrame` XML skeleton for an SDK-created table.
|
|
26821
|
+
*
|
|
26822
|
+
* Tables round-trip as `<p:graphicFrame>/<a:graphic>/<a:graphicData
|
|
26823
|
+
* uri=".../drawingml/2006/table">/<a:tbl>` inside `p:spTree`. When the
|
|
26824
|
+
* element was loaded from an existing file, `el.rawXml` already contains
|
|
26825
|
+
* this envelope and the downstream `serializeTableDataToXml` path
|
|
26826
|
+
* populates cells in place. When the element was created via the SDK
|
|
26827
|
+
* (`SlideBuilder.addTable`), there is no `rawXml`, so this method
|
|
26828
|
+
* fabricates a minimal envelope with an empty `a:tbl`. The element
|
|
26829
|
+
* writer then calls `serializeTableDataToXml`, which triggers
|
|
26830
|
+
* `rebuildTableXmlFromData` and fills in `a:tblGrid` / `a:tr` children.
|
|
26831
|
+
*/
|
|
26832
|
+
createTableGraphicFrameXml(el) {
|
|
26833
|
+
const EMU = _PptxHandlerRuntime.EMU_PER_PX;
|
|
26834
|
+
const offX = String(Math.round(el.x * EMU));
|
|
26835
|
+
const offY = String(Math.round(el.y * EMU));
|
|
26836
|
+
const extCx = String(Math.round(Math.max(el.width, 1) * EMU));
|
|
26837
|
+
const extCy = String(Math.round(Math.max(el.height, 1) * EMU));
|
|
26838
|
+
const tblPr = {
|
|
26839
|
+
"@_firstRow": el.tableData?.firstRowHeader ? "1" : "0",
|
|
26840
|
+
"@_bandRow": el.tableData?.bandedRows ? "1" : "0"
|
|
26841
|
+
};
|
|
26842
|
+
if (el.tableData?.tableStyleId) {
|
|
26843
|
+
tblPr["a:tableStyleId"] = el.tableData.tableStyleId;
|
|
26844
|
+
}
|
|
26845
|
+
return {
|
|
26846
|
+
"p:nvGraphicFramePr": {
|
|
26847
|
+
"p:cNvPr": { "@_id": "0", "@_name": el.name || "Table" },
|
|
26848
|
+
"p:cNvGraphicFramePr": {
|
|
26849
|
+
"a:graphicFrameLocks": { "@_noGrp": "1" }
|
|
26850
|
+
},
|
|
26851
|
+
"p:nvPr": {}
|
|
26852
|
+
},
|
|
26853
|
+
"p:xfrm": {
|
|
26854
|
+
"a:off": { "@_x": offX, "@_y": offY },
|
|
26855
|
+
"a:ext": { "@_cx": extCx, "@_cy": extCy }
|
|
26856
|
+
},
|
|
26857
|
+
"a:graphic": {
|
|
26858
|
+
"a:graphicData": {
|
|
26859
|
+
"@_uri": "http://schemas.openxmlformats.org/drawingml/2006/table",
|
|
26860
|
+
"a:tbl": {
|
|
26861
|
+
"a:tblPr": tblPr,
|
|
26862
|
+
"a:tblGrid": {}
|
|
26863
|
+
}
|
|
26864
|
+
}
|
|
26865
|
+
}
|
|
26866
|
+
};
|
|
26867
|
+
}
|
|
26757
26868
|
/**
|
|
26758
26869
|
* Build a p:sp XML object for an ink annotation element.
|
|
26759
26870
|
* Each ink path becomes a separate a:path within a:pathLst,
|
|
@@ -28235,14 +28346,15 @@ function writeCellTextFormatting(xmlCell, style, ensureArray6) {
|
|
|
28235
28346
|
const paragraphs = ensureArray6(xmlCell["a:txBody"]?.["a:p"]);
|
|
28236
28347
|
for (const paragraph of paragraphs) {
|
|
28237
28348
|
const runs = ensureArray6(paragraph?.["a:r"]);
|
|
28349
|
+
const rebuiltRuns = [];
|
|
28350
|
+
let runsChanged = false;
|
|
28238
28351
|
for (const run of runs) {
|
|
28239
28352
|
if (!run) {
|
|
28353
|
+
rebuiltRuns.push(run);
|
|
28240
28354
|
continue;
|
|
28241
28355
|
}
|
|
28242
|
-
|
|
28243
|
-
|
|
28244
|
-
}
|
|
28245
|
-
const rPr = run["a:rPr"];
|
|
28356
|
+
const existingRPr = run["a:rPr"] ?? {};
|
|
28357
|
+
const rPr = { ...existingRPr };
|
|
28246
28358
|
if (style.bold !== void 0) {
|
|
28247
28359
|
rPr["@_b"] = style.bold ? "1" : "0";
|
|
28248
28360
|
}
|
|
@@ -28262,6 +28374,18 @@ function writeCellTextFormatting(xmlCell, style, ensureArray6) {
|
|
|
28262
28374
|
}
|
|
28263
28375
|
};
|
|
28264
28376
|
}
|
|
28377
|
+
const rebuilt = { "a:rPr": rPr };
|
|
28378
|
+
for (const key of Object.keys(run)) {
|
|
28379
|
+
if (key === "a:rPr") {
|
|
28380
|
+
continue;
|
|
28381
|
+
}
|
|
28382
|
+
rebuilt[key] = run[key];
|
|
28383
|
+
}
|
|
28384
|
+
rebuiltRuns.push(rebuilt);
|
|
28385
|
+
runsChanged = true;
|
|
28386
|
+
}
|
|
28387
|
+
if (runsChanged && rebuiltRuns.length > 0) {
|
|
28388
|
+
paragraph["a:r"] = rebuiltRuns.length === 1 ? rebuiltRuns[0] : rebuiltRuns;
|
|
28265
28389
|
}
|
|
28266
28390
|
}
|
|
28267
28391
|
}
|
|
@@ -28283,6 +28407,9 @@ var PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
28283
28407
|
const existingParagraphs = this.ensureArray(txBody["a:p"]);
|
|
28284
28408
|
const firstRPr = this.ensureArray(existingParagraphs[0]?.["a:r"])[0]?.["a:rPr"];
|
|
28285
28409
|
const firstPPr = existingParagraphs[0]?.["a:pPr"];
|
|
28410
|
+
const firstEndParaRPr = existingParagraphs[0]?.["a:endParaRPr"];
|
|
28411
|
+
const rPrForRun = firstRPr ? { ...firstRPr } : { "@_lang": "en-US", "@_dirty": "0" };
|
|
28412
|
+
const endParaRPr = firstEndParaRPr ? { ...firstEndParaRPr } : { "@_lang": "en-US", "@_dirty": "0" };
|
|
28286
28413
|
const lines = text.split("\n");
|
|
28287
28414
|
const paragraphs = lines.map((line) => {
|
|
28288
28415
|
const paragraph = {};
|
|
@@ -28290,9 +28417,10 @@ var PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
28290
28417
|
paragraph["a:pPr"] = firstPPr;
|
|
28291
28418
|
}
|
|
28292
28419
|
paragraph["a:r"] = {
|
|
28293
|
-
|
|
28420
|
+
"a:rPr": rPrForRun,
|
|
28294
28421
|
"a:t": line
|
|
28295
28422
|
};
|
|
28423
|
+
paragraph["a:endParaRPr"] = endParaRPr;
|
|
28296
28424
|
return paragraph;
|
|
28297
28425
|
});
|
|
28298
28426
|
txBody["a:p"] = paragraphs.length === 1 ? paragraphs[0] : paragraphs;
|
|
@@ -28442,14 +28570,27 @@ function serializeCellMergeAttributes(xmlCell, cell) {
|
|
|
28442
28570
|
delete xmlCell["@_vMerge"];
|
|
28443
28571
|
}
|
|
28444
28572
|
}
|
|
28573
|
+
var DEFAULT_POWERPOINT_TABLE_STYLE_ID = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
|
|
28445
28574
|
function serializeTablePropertyFlags(tbl, tableData) {
|
|
28446
28575
|
const tblPr = tbl["a:tblPr"] ?? {};
|
|
28447
|
-
|
|
28448
|
-
|
|
28449
|
-
|
|
28450
|
-
|
|
28451
|
-
|
|
28452
|
-
|
|
28576
|
+
const setOrDelete = (key, truthy) => {
|
|
28577
|
+
if (truthy) {
|
|
28578
|
+
tblPr[key] = "1";
|
|
28579
|
+
} else {
|
|
28580
|
+
delete tblPr[key];
|
|
28581
|
+
}
|
|
28582
|
+
};
|
|
28583
|
+
setOrDelete("@_bandRow", tableData.bandedRows);
|
|
28584
|
+
setOrDelete("@_bandCol", tableData.bandedColumns);
|
|
28585
|
+
setOrDelete("@_firstRow", tableData.firstRowHeader);
|
|
28586
|
+
setOrDelete("@_lastRow", tableData.lastRow);
|
|
28587
|
+
setOrDelete("@_firstCol", tableData.firstCol);
|
|
28588
|
+
setOrDelete("@_lastCol", tableData.lastCol);
|
|
28589
|
+
if (tableData.tableStyleId) {
|
|
28590
|
+
tblPr["a:tableStyleId"] = tableData.tableStyleId;
|
|
28591
|
+
} else if (!tblPr["a:tableStyleId"]) {
|
|
28592
|
+
tblPr["a:tableStyleId"] = DEFAULT_POWERPOINT_TABLE_STYLE_ID;
|
|
28593
|
+
}
|
|
28453
28594
|
tbl["a:tblPr"] = tblPr;
|
|
28454
28595
|
}
|
|
28455
28596
|
function replaceFirstTextValueInTree(node, localName, newValue, getXmlLocalName) {
|
|
@@ -28494,7 +28635,9 @@ function createDefaultXmlCell() {
|
|
|
28494
28635
|
"a:bodyPr": {},
|
|
28495
28636
|
"a:lstStyle": {},
|
|
28496
28637
|
"a:p": {
|
|
28497
|
-
|
|
28638
|
+
// Match PowerPoint's "Insert Table" default: every paragraph-end
|
|
28639
|
+
// run carries `lang="en-US" dirty="0"`.
|
|
28640
|
+
"a:endParaRPr": { "@_lang": "en-US", "@_dirty": "0" }
|
|
28498
28641
|
}
|
|
28499
28642
|
},
|
|
28500
28643
|
"a:tcPr": {}
|
|
@@ -28502,6 +28645,11 @@ function createDefaultXmlCell() {
|
|
|
28502
28645
|
}
|
|
28503
28646
|
|
|
28504
28647
|
// src/core/core/runtime/table-xml-rebuild.ts
|
|
28648
|
+
var GRID_COL_ID_EXT_URI = "{9D8B030D-6E8A-4147-A177-3AD203B41FA5}";
|
|
28649
|
+
var A16_NAMESPACE = "http://schemas.microsoft.com/office/drawing/2014/main";
|
|
28650
|
+
function randomColumnId() {
|
|
28651
|
+
return String(Math.floor(Math.random() * 4294967295));
|
|
28652
|
+
}
|
|
28505
28653
|
function rebuildTableXmlFromData(tbl, tableData, emuPerPx, ensureArrayFn) {
|
|
28506
28654
|
const existingXmlRows = ensureArrayFn(tbl["a:tr"]);
|
|
28507
28655
|
const existingGridCols = ensureArrayFn(
|
|
@@ -28510,8 +28658,31 @@ function rebuildTableXmlFromData(tbl, tableData, emuPerPx, ensureArrayFn) {
|
|
|
28510
28658
|
const totalWidthEmu = existingGridCols.reduce((sum, col) => {
|
|
28511
28659
|
return sum + (parseInt(String(col?.["@_w"] || "0"), 10) || 0);
|
|
28512
28660
|
}, 0) || 9144e3;
|
|
28513
|
-
const
|
|
28514
|
-
|
|
28661
|
+
const existingColIds = existingGridCols.map((col) => {
|
|
28662
|
+
const extList = col?.["a:extLst"];
|
|
28663
|
+
const exts = Array.isArray(extList?.["a:ext"]) ? extList["a:ext"] : extList?.["a:ext"] ? [extList["a:ext"]] : [];
|
|
28664
|
+
for (const ext of exts) {
|
|
28665
|
+
if (ext?.["@_uri"] === GRID_COL_ID_EXT_URI) {
|
|
28666
|
+
const colId = ext["a16:colId"];
|
|
28667
|
+
const val = colId?.["@_val"];
|
|
28668
|
+
if (typeof val === "string" && val.length > 0) {
|
|
28669
|
+
return val;
|
|
28670
|
+
}
|
|
28671
|
+
}
|
|
28672
|
+
}
|
|
28673
|
+
return "";
|
|
28674
|
+
});
|
|
28675
|
+
const newGridCols = tableData.columnWidths.map((w, i) => ({
|
|
28676
|
+
"@_w": String(Math.round(w * totalWidthEmu)),
|
|
28677
|
+
"a:extLst": {
|
|
28678
|
+
"a:ext": {
|
|
28679
|
+
"@_uri": GRID_COL_ID_EXT_URI,
|
|
28680
|
+
"a16:colId": {
|
|
28681
|
+
"@_xmlns:a16": A16_NAMESPACE,
|
|
28682
|
+
"@_val": existingColIds[i] || randomColumnId()
|
|
28683
|
+
}
|
|
28684
|
+
}
|
|
28685
|
+
}
|
|
28515
28686
|
}));
|
|
28516
28687
|
if (!tbl["a:tblGrid"]) {
|
|
28517
28688
|
tbl["a:tblGrid"] = {};
|
|
@@ -29427,32 +29598,58 @@ var PptxHandlerRuntime24 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
29427
29598
|
};
|
|
29428
29599
|
for (const variant of variants) {
|
|
29429
29600
|
const fontData = variant.rawFontData;
|
|
29430
|
-
const
|
|
29431
|
-
const
|
|
29432
|
-
const
|
|
29433
|
-
|
|
29434
|
-
|
|
29435
|
-
|
|
29601
|
+
const hasOriginal = Boolean(variant.originalRId && variant.partPath);
|
|
29602
|
+
const reuseObfuscation = hasOriginal && Boolean(variant.fontGuid);
|
|
29603
|
+
const reuseVerbatim = hasOriginal && !variant.fontGuid && Boolean(variant.originalPartBytes);
|
|
29604
|
+
let guid;
|
|
29605
|
+
let fontPartPath;
|
|
29606
|
+
let relativeTarget;
|
|
29436
29607
|
let rId;
|
|
29437
|
-
|
|
29438
|
-
|
|
29439
|
-
)
|
|
29440
|
-
|
|
29441
|
-
|
|
29608
|
+
let bytesToWrite;
|
|
29609
|
+
let fontKeyForXml;
|
|
29610
|
+
if (reuseObfuscation) {
|
|
29611
|
+
guid = variant.fontGuid;
|
|
29612
|
+
fontPartPath = variant.partPath;
|
|
29613
|
+
relativeTarget = fontPartPath.startsWith("ppt/") ? fontPartPath.substring(4) : fontPartPath;
|
|
29614
|
+
rId = variant.originalRId;
|
|
29615
|
+
bytesToWrite = obfuscateFont(fontData, guid);
|
|
29616
|
+
fontKeyForXml = `{${guid}}`;
|
|
29617
|
+
} else if (reuseVerbatim) {
|
|
29618
|
+
guid = "";
|
|
29619
|
+
fontPartPath = variant.partPath;
|
|
29620
|
+
relativeTarget = fontPartPath.startsWith("ppt/") ? fontPartPath.substring(4) : fontPartPath;
|
|
29621
|
+
rId = variant.originalRId;
|
|
29622
|
+
bytesToWrite = variant.originalPartBytes;
|
|
29623
|
+
fontKeyForXml = void 0;
|
|
29442
29624
|
} else {
|
|
29443
|
-
|
|
29444
|
-
|
|
29445
|
-
|
|
29446
|
-
|
|
29447
|
-
|
|
29448
|
-
|
|
29449
|
-
|
|
29625
|
+
guid = variant.fontGuid ?? generateFontGuid();
|
|
29626
|
+
const fileName = `{${guid}}.fntdata`;
|
|
29627
|
+
fontPartPath = `ppt/fonts/${fileName}`;
|
|
29628
|
+
relativeTarget = `fonts/${fileName}`;
|
|
29629
|
+
bytesToWrite = obfuscateFont(fontData, guid);
|
|
29630
|
+
fontKeyForXml = `{${guid}}`;
|
|
29631
|
+
const existingRel = relationships.find(
|
|
29632
|
+
(r) => String(r?.["@_Target"] || "") === relativeTarget
|
|
29633
|
+
);
|
|
29634
|
+
if (existingRel) {
|
|
29635
|
+
rId = String(existingRel["@_Id"]);
|
|
29636
|
+
} else {
|
|
29637
|
+
maxId++;
|
|
29638
|
+
rId = `rId${maxId}`;
|
|
29639
|
+
relationships.push({
|
|
29640
|
+
"@_Id": rId,
|
|
29641
|
+
"@_Type": _PptxHandlerRuntime.FONT_REL_TYPE,
|
|
29642
|
+
"@_Target": relativeTarget
|
|
29643
|
+
});
|
|
29644
|
+
}
|
|
29450
29645
|
}
|
|
29646
|
+
this.zip.file(fontPartPath, bytesToWrite);
|
|
29451
29647
|
const variantKey = variant.bold && variant.italic ? "p:boldItalic" : variant.bold ? "p:bold" : variant.italic ? "p:italic" : "p:regular";
|
|
29452
|
-
|
|
29453
|
-
|
|
29454
|
-
"@_fontKey"
|
|
29455
|
-
}
|
|
29648
|
+
const variantEntry = { "@_r:id": rId };
|
|
29649
|
+
if (fontKeyForXml) {
|
|
29650
|
+
variantEntry["@_fontKey"] = fontKeyForXml;
|
|
29651
|
+
}
|
|
29652
|
+
entry[variantKey] = variantEntry;
|
|
29456
29653
|
}
|
|
29457
29654
|
embeddedFontEntries.push(entry);
|
|
29458
29655
|
}
|
|
@@ -29596,54 +29793,59 @@ var PptxHandlerRuntime25 = class extends PptxHandlerRuntime24 {
|
|
|
29596
29793
|
}
|
|
29597
29794
|
};
|
|
29598
29795
|
const root = propsData["p:presentationPr"] || {};
|
|
29599
|
-
const
|
|
29600
|
-
|
|
29601
|
-
|
|
29602
|
-
|
|
29603
|
-
|
|
29604
|
-
showPr["p:browse"] = {};
|
|
29605
|
-
} else if (properties.showType === "kiosk") {
|
|
29606
|
-
const kioskNode = {};
|
|
29607
|
-
if (properties.kioskRestartTime !== void 0 && properties.kioskRestartTime > 0) {
|
|
29608
|
-
kioskNode["@_restart"] = String(properties.kioskRestartTime);
|
|
29796
|
+
const existingShowPr = root["p:showPr"] || {};
|
|
29797
|
+
const rebuiltShowPr = {};
|
|
29798
|
+
for (const key of Object.keys(existingShowPr)) {
|
|
29799
|
+
if (key.startsWith("@_")) {
|
|
29800
|
+
rebuiltShowPr[key] = existingShowPr[key];
|
|
29609
29801
|
}
|
|
29610
|
-
showPr["p:kiosk"] = kioskNode;
|
|
29611
|
-
} else {
|
|
29612
|
-
showPr["p:present"] = {};
|
|
29613
29802
|
}
|
|
29614
29803
|
if (properties.loopContinuously !== void 0) {
|
|
29615
|
-
|
|
29804
|
+
rebuiltShowPr["@_loop"] = properties.loopContinuously ? "1" : "0";
|
|
29616
29805
|
}
|
|
29617
29806
|
if (properties.showWithNarration !== void 0) {
|
|
29618
|
-
|
|
29807
|
+
rebuiltShowPr["@_showNarration"] = properties.showWithNarration ? "1" : "0";
|
|
29619
29808
|
}
|
|
29620
29809
|
if (properties.showWithAnimation !== void 0) {
|
|
29621
|
-
|
|
29810
|
+
rebuiltShowPr["@_showAnimation"] = properties.showWithAnimation ? "1" : "0";
|
|
29622
29811
|
}
|
|
29623
29812
|
if (properties.advanceMode !== void 0) {
|
|
29624
|
-
|
|
29813
|
+
rebuiltShowPr["@_useTimings"] = properties.advanceMode === "useTimings" ? "1" : "0";
|
|
29625
29814
|
}
|
|
29626
|
-
if (properties.
|
|
29627
|
-
|
|
29628
|
-
|
|
29629
|
-
};
|
|
29815
|
+
if (properties.showType === "browsed") {
|
|
29816
|
+
rebuiltShowPr["p:browse"] = {};
|
|
29817
|
+
} else if (properties.showType === "kiosk") {
|
|
29818
|
+
const kioskNode = {};
|
|
29819
|
+
if (properties.kioskRestartTime !== void 0 && properties.kioskRestartTime > 0) {
|
|
29820
|
+
kioskNode["@_restart"] = String(properties.kioskRestartTime);
|
|
29821
|
+
}
|
|
29822
|
+
rebuiltShowPr["p:kiosk"] = kioskNode;
|
|
29823
|
+
} else {
|
|
29824
|
+
rebuiltShowPr["p:present"] = {};
|
|
29630
29825
|
}
|
|
29631
|
-
delete showPr["p:sldAll"];
|
|
29632
|
-
delete showPr["p:sldRg"];
|
|
29633
|
-
delete showPr["p:custShow"];
|
|
29634
29826
|
if (properties.showSlidesMode === "range") {
|
|
29635
|
-
|
|
29827
|
+
rebuiltShowPr["p:sldRg"] = {
|
|
29636
29828
|
"@_st": String(properties.showSlidesFrom ?? 1),
|
|
29637
29829
|
"@_end": String(properties.showSlidesTo ?? 1)
|
|
29638
29830
|
};
|
|
29639
29831
|
} else if (properties.showSlidesMode === "customShow" && properties.showSlidesCustomShowId) {
|
|
29640
|
-
|
|
29832
|
+
rebuiltShowPr["p:custShow"] = {
|
|
29641
29833
|
"@_id": properties.showSlidesCustomShowId
|
|
29642
29834
|
};
|
|
29643
29835
|
} else {
|
|
29644
|
-
|
|
29836
|
+
rebuiltShowPr["p:sldAll"] = {};
|
|
29837
|
+
}
|
|
29838
|
+
if (properties.penColor) {
|
|
29839
|
+
rebuiltShowPr["p:penClr"] = {
|
|
29840
|
+
"a:srgbClr": { "@_val": properties.penColor.replace("#", "") }
|
|
29841
|
+
};
|
|
29842
|
+
} else if (existingShowPr["p:penClr"] !== void 0) {
|
|
29843
|
+
rebuiltShowPr["p:penClr"] = existingShowPr["p:penClr"];
|
|
29645
29844
|
}
|
|
29646
|
-
|
|
29845
|
+
if (existingShowPr["p:extLst"] !== void 0) {
|
|
29846
|
+
rebuiltShowPr["p:extLst"] = existingShowPr["p:extLst"];
|
|
29847
|
+
}
|
|
29848
|
+
root["p:showPr"] = rebuiltShowPr;
|
|
29647
29849
|
if (properties.printFrameSlides !== void 0 || properties.printSlidesPerPage !== void 0 || properties.printColorMode !== void 0) {
|
|
29648
29850
|
const prnPr = root["p:prnPr"] || {};
|
|
29649
29851
|
if (properties.printFrameSlides !== void 0) {
|
|
@@ -30774,7 +30976,12 @@ var PptxHandlerRuntime31 = class extends PptxHandlerRuntime30 {
|
|
|
30774
30976
|
shape = this.createPictureXml(el, relationshipId);
|
|
30775
30977
|
}
|
|
30776
30978
|
if (targetImagePath) {
|
|
30777
|
-
|
|
30979
|
+
const targetExt = targetImagePath.toLowerCase().match(/\.([^./\\]+)$/)?.[1];
|
|
30980
|
+
const parsedExt = parsedImage.extension.toLowerCase();
|
|
30981
|
+
const extensionMismatch = targetExt !== void 0 && targetExt !== parsedExt && !(targetExt === "jpg" && parsedExt === "jpeg") && !(targetExt === "jpeg" && parsedExt === "jpg");
|
|
30982
|
+
if (!extensionMismatch) {
|
|
30983
|
+
this.zip.file(targetImagePath, parsedImage.bytes);
|
|
30984
|
+
}
|
|
30778
30985
|
}
|
|
30779
30986
|
} else {
|
|
30780
30987
|
this.compatibilityService.reportWarning({
|
|
@@ -30885,6 +31092,9 @@ var PptxHandlerRuntime32 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
30885
31092
|
if (!shape && el.type === "ink") {
|
|
30886
31093
|
shape = this.createInkShapeXml(el);
|
|
30887
31094
|
}
|
|
31095
|
+
if (!shape && el.type === "table") {
|
|
31096
|
+
shape = this.createTableGraphicFrameXml(el);
|
|
31097
|
+
}
|
|
30888
31098
|
if (!shape) {
|
|
30889
31099
|
this.compatibilityService.reportWarning({
|
|
30890
31100
|
code: "SAVE_ELEMENT_SKIPPED",
|
|
@@ -31179,6 +31389,7 @@ var PptxHandlerRuntime34 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
31179
31389
|
);
|
|
31180
31390
|
} else {
|
|
31181
31391
|
this.zip.remove("ppt/commentAuthors.xml");
|
|
31392
|
+
await this.stripPresentationCommentAuthorsRelationship();
|
|
31182
31393
|
}
|
|
31183
31394
|
const contentTypesXmlAfterComments = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
31184
31395
|
if (contentTypesXmlAfterComments) {
|
|
@@ -31252,8 +31463,39 @@ var PptxHandlerRuntime34 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
31252
31463
|
if (effectiveConformance === "strict") {
|
|
31253
31464
|
await this.convertZipToStrictConformance();
|
|
31254
31465
|
}
|
|
31466
|
+
for (const name of Object.keys(this.zip.files)) {
|
|
31467
|
+
if (this.zip.files[name].dir) {
|
|
31468
|
+
delete this.zip.files[name];
|
|
31469
|
+
}
|
|
31470
|
+
}
|
|
31255
31471
|
return await this.zip.generateAsync({ type: "uint8array" });
|
|
31256
31472
|
}
|
|
31473
|
+
/**
|
|
31474
|
+
* Remove any Relationship in presentation.xml.rels whose Type matches either
|
|
31475
|
+
* the Transitional or Strict commentAuthors relationship URI.
|
|
31476
|
+
*/
|
|
31477
|
+
async stripPresentationCommentAuthorsRelationship() {
|
|
31478
|
+
const relsPath = "ppt/_rels/presentation.xml.rels";
|
|
31479
|
+
const relsXml = await this.zip.file(relsPath)?.async("string");
|
|
31480
|
+
if (!relsXml) {
|
|
31481
|
+
return;
|
|
31482
|
+
}
|
|
31483
|
+
const relsData = this.parser.parse(relsXml);
|
|
31484
|
+
const root = relsData["Relationships"];
|
|
31485
|
+
if (!root) {
|
|
31486
|
+
return;
|
|
31487
|
+
}
|
|
31488
|
+
const relationships = this.ensureArray(root["Relationship"]);
|
|
31489
|
+
const filtered = relationships.filter((relationship) => {
|
|
31490
|
+
const type = String(relationship?.["@_Type"] ?? "");
|
|
31491
|
+
return type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors" && type !== "http://purl.oclc.org/ooxml/officeDocument/relationships/commentAuthors";
|
|
31492
|
+
});
|
|
31493
|
+
if (filtered.length === relationships.length) {
|
|
31494
|
+
return;
|
|
31495
|
+
}
|
|
31496
|
+
root["Relationship"] = filtered;
|
|
31497
|
+
this.zip.file(relsPath, this.builder.build(relsData));
|
|
31498
|
+
}
|
|
31257
31499
|
};
|
|
31258
31500
|
|
|
31259
31501
|
// src/core/core/runtime/PptxHandlerRuntimeElementParsing.ts
|
|
@@ -33238,7 +33480,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33238
33480
|
}
|
|
33239
33481
|
const shapeStyle = this.extractShapeStyle(effectiveSpPr, styleNode);
|
|
33240
33482
|
const hasText = text.trim().length > 0;
|
|
33241
|
-
const isPlainRect = !prstGeom || prstGeom === "rect";
|
|
33483
|
+
const isPlainRect = (!prstGeom || prstGeom === "rect") && !custGeom;
|
|
33242
33484
|
const hasVisibleStyle = shapeStyle.fillColor && shapeStyle.fillColor !== "transparent" || (shapeStyle.strokeWidth || 0) > 0;
|
|
33243
33485
|
let type = "shape";
|
|
33244
33486
|
if (hasText && isPlainRect && !hasVisibleStyle) {
|
|
@@ -33250,6 +33492,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33250
33492
|
slideRelationshipMap,
|
|
33251
33493
|
this.orderedSlidePaths
|
|
33252
33494
|
);
|
|
33495
|
+
const elementName = cNvPrForActions?.["@_name"] ? String(cNvPrForActions["@_name"]).trim() : void 0;
|
|
33253
33496
|
const cNvSpPr = shape?.["p:nvSpPr"]?.["p:cNvSpPr"];
|
|
33254
33497
|
const spLocksNode = cNvSpPr?.["a:spLocks"];
|
|
33255
33498
|
const slideLocks = this.parseShapeLocks(spLocksNode);
|
|
@@ -33260,6 +33503,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33260
33503
|
const promptText = !hasText && phDefaults?.promptText ? phDefaults.promptText : void 0;
|
|
33261
33504
|
const commonProps = {
|
|
33262
33505
|
id,
|
|
33506
|
+
name: elementName || void 0,
|
|
33263
33507
|
x,
|
|
33264
33508
|
y,
|
|
33265
33509
|
width,
|
|
@@ -33496,12 +33740,14 @@ var PptxHandlerRuntime45 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33496
33740
|
picSlideRels,
|
|
33497
33741
|
this.orderedSlidePaths
|
|
33498
33742
|
);
|
|
33743
|
+
const picElementName = picCNvPr?.["@_name"] ? String(picCNvPr["@_name"]).trim() : void 0;
|
|
33499
33744
|
const picCNvPicPr = pic?.["p:nvPicPr"]?.["p:cNvPicPr"];
|
|
33500
33745
|
const picLocks = this.parseShapeLocks(
|
|
33501
33746
|
picCNvPicPr?.["a:picLocks"] ?? picCNvPicPr?.["a:spLocks"]
|
|
33502
33747
|
);
|
|
33503
33748
|
return {
|
|
33504
33749
|
id,
|
|
33750
|
+
name: picElementName || void 0,
|
|
33505
33751
|
type: "picture",
|
|
33506
33752
|
x,
|
|
33507
33753
|
y,
|
|
@@ -34048,9 +34294,11 @@ var PptxHandlerRuntime47 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
34048
34294
|
grpSlideRels,
|
|
34049
34295
|
this.orderedSlidePaths
|
|
34050
34296
|
);
|
|
34297
|
+
const grpElementName = grpCNvPr?.["@_name"] ? String(grpCNvPr["@_name"]).trim() : void 0;
|
|
34051
34298
|
const groupElement = {
|
|
34052
34299
|
type: "group",
|
|
34053
34300
|
id: baseId,
|
|
34301
|
+
name: grpElementName || void 0,
|
|
34054
34302
|
x: parentX,
|
|
34055
34303
|
y: parentY,
|
|
34056
34304
|
width: parentW || Math.max(...children.map((c) => c.x + c.width)),
|
|
@@ -37930,6 +38178,7 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
|
|
|
37930
38178
|
if (!fontBinary || fontBinary.length === 0) {
|
|
37931
38179
|
return null;
|
|
37932
38180
|
}
|
|
38181
|
+
const originalPartBytes = new Uint8Array(fontBinary);
|
|
37933
38182
|
let fontData;
|
|
37934
38183
|
let resolvedGuid;
|
|
37935
38184
|
if (isEotFormat(fontBinary)) {
|
|
@@ -37983,7 +38232,9 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
|
|
|
37983
38232
|
format,
|
|
37984
38233
|
rawFontData: fontData,
|
|
37985
38234
|
partPath: fontPath,
|
|
37986
|
-
fontGuid: resolvedGuid
|
|
38235
|
+
fontGuid: resolvedGuid,
|
|
38236
|
+
originalRId: rId,
|
|
38237
|
+
originalPartBytes
|
|
37987
38238
|
};
|
|
37988
38239
|
} catch {
|
|
37989
38240
|
return null;
|