ooxml-core 1.46.0 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PptxHandler-6UQWMUVU.cjs +14 -0
- package/dist/{PptxHandler-HWEOIHEA.mjs → PptxHandler-PLSH2BAS.mjs} +2 -2
- package/dist/PptxHandler-QLKZVYCG.mjs +5 -0
- package/dist/{PresentationBuilder-66RV4F45.mjs → PresentationBuilder-3QXOJNRO.mjs} +2 -2
- package/dist/{PresentationBuilder-2BCCMZW7.cjs → PresentationBuilder-CRBFFHNW.cjs} +6 -6
- package/dist/{PresentationBuilder-AFD72LIG.mjs → PresentationBuilder-DQ3XFU4R.mjs} +3 -3
- package/dist/{chunk-G6LEU3Y5.mjs → chunk-32K7JG2Z.mjs} +1 -1
- package/dist/{chunk-5TOVSCVT.cjs → chunk-7RCBSNXT.cjs} +3 -3
- package/dist/{chunk-EI6555OK.mjs → chunk-CXIDPUT6.mjs} +1 -1
- package/dist/{chunk-E2TTMUKU.mjs → chunk-EKEE6BTU.mjs} +745 -65
- package/dist/{chunk-QUAFASFC.cjs → chunk-HBQBS7PO.cjs} +65 -0
- package/dist/{chunk-LXVE2VKR.mjs → chunk-I5REMIZR.mjs} +65 -1
- package/dist/{chunk-L6MJGE3Q.mjs → chunk-IKFTITJ7.mjs} +5 -5
- package/dist/{chunk-X2DC7XRL.mjs → chunk-K5G6MV37.mjs} +66 -2
- package/dist/{chunk-IBRV3AK3.cjs → chunk-RRA262A6.cjs} +2032 -1340
- package/dist/{chunk-H43QQVJU.mjs → chunk-WAYEYX4G.mjs} +1 -1
- package/dist/{chunk-HH3AYM63.mjs → chunk-WLKOLTBH.mjs} +760 -68
- package/dist/pptx/automation/index.cjs +45721 -44894
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-B4Z6N-Gz.d.ts → elements-CValElsy.d.ts} +3 -428
- package/dist/pptx/chunks/elements-CValElsy.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-DtFoPmk7.d.ts → index-BaBgJR8i.d.ts} +203 -15
- package/dist/pptx/chunks/index-BaBgJR8i.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BPGaFlm5.d.ts → index-ClHCBGOf.d.ts} +10 -8
- package/dist/pptx/chunks/{index-BPGaFlm5.d.ts.map → index-ClHCBGOf.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-D4-WJQ1r.d.ts → index-DqkBjVqR.d.ts} +4 -4
- package/dist/pptx/chunks/{index-D4-WJQ1r.d.ts.map → index-DqkBjVqR.d.ts.map} +1 -1
- package/dist/pptx/chunks/{table-BfgZfw5R.d.ts → table-DUO1H9-r.d.ts} +441 -2
- package/dist/pptx/chunks/table-DUO1H9-r.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-CVHXOSit.d.ts → text-operations-B3lZjvs_.d.ts} +3 -3
- package/dist/pptx/chunks/{text-operations-CVHXOSit.d.ts.map → text-operations-B3lZjvs_.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +1047 -220
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +15 -15
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +9 -9
- package/dist/pptx/editor/render/slide-operations.mjs +3 -3
- package/dist/pptx/editor/render/table-layout.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +51837 -51026
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/PptxHandler-FZ43IJFP.mjs +0 -5
- package/dist/PptxHandler-XAUKKK36.cjs +0 -14
- package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +0 -1
- package/dist/pptx/chunks/index-DtFoPmk7.d.ts.map +0 -1
- package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +0 -1
package/dist/pptx/cli/index.cjs
CHANGED
|
@@ -35289,13 +35289,13 @@ function resolveDrawingColor(color3, theme, options2) {
|
|
|
35289
35289
|
}
|
|
35290
35290
|
let { r, g: g3, b } = rgb;
|
|
35291
35291
|
const find = (name) => color3.transforms.find((entry2) => entry2.name === name)?.value;
|
|
35292
|
-
const
|
|
35293
|
-
if (
|
|
35292
|
+
const has3 = (name) => color3.transforms.some((entry2) => entry2.name === name);
|
|
35293
|
+
if (has3("comp")) {
|
|
35294
35294
|
const hsl = rgbToHsl(r, g3, b);
|
|
35295
35295
|
({ r, g: g3, b } = hslToRgb((hsl.h + 180) % 360, hsl.s, hsl.l));
|
|
35296
35296
|
}
|
|
35297
|
-
if (
|
|
35298
|
-
if (
|
|
35297
|
+
if (has3("inv")) [r, g3, b] = [255 - r, 255 - g3, 255 - b];
|
|
35298
|
+
if (has3("gray")) r = g3 = b = Math.round(0.299 * r + 0.587 * g3 + 0.114 * b);
|
|
35299
35299
|
const shade = parseDrawingPercent(find("shade"));
|
|
35300
35300
|
if (shade !== void 0) {
|
|
35301
35301
|
r = linearToSrgb255(srgb255ToLinear(r) * shade);
|
|
@@ -35308,7 +35308,7 @@ function resolveDrawingColor(color3, theme, options2) {
|
|
|
35308
35308
|
g3 = linearToSrgb255(1 - (1 - srgb255ToLinear(g3)) * tint);
|
|
35309
35309
|
b = linearToSrgb255(1 - (1 - srgb255ToLinear(b)) * tint);
|
|
35310
35310
|
}
|
|
35311
|
-
if (["hue", "hueMod", "hueOff", "sat", "satMod", "satOff", "lum", "lumMod", "lumOff"].some(
|
|
35311
|
+
if (["hue", "hueMod", "hueOff", "sat", "satMod", "satOff", "lum", "lumMod", "lumOff"].some(has3)) {
|
|
35312
35312
|
const hsl = rgbToHsl(r, g3, b);
|
|
35313
35313
|
const wrap2 = (degrees) => (degrees % 360 + 360) % 360;
|
|
35314
35314
|
const hueAbs = parseDrawingHueDegrees(find("hue"));
|
|
@@ -35869,6 +35869,70 @@ function applyPictureEffects(blip, effects2) {
|
|
|
35869
35869
|
for (const node of elements(blip)) blip.removeChild(node);
|
|
35870
35870
|
for (const node of nodes) blip.appendChild(node);
|
|
35871
35871
|
}
|
|
35872
|
+
function patchPictureEffects(source2, patch) {
|
|
35873
|
+
const result = structuredClone(source2);
|
|
35874
|
+
const upsert2 = (kind, update) => {
|
|
35875
|
+
const matches = result.flatMap((effect, index2) => effect.kind === kind ? [index2] : []);
|
|
35876
|
+
if (matches.length > 1) throw new Error(`Ambiguous duplicate picture effect: ${kind}`);
|
|
35877
|
+
const index = matches[0];
|
|
35878
|
+
const value = update(index === void 0 ? void 0 : result[index]);
|
|
35879
|
+
if (index !== void 0) {
|
|
35880
|
+
if (value) result[index] = value;
|
|
35881
|
+
else result.splice(index, 1);
|
|
35882
|
+
} else if (value) {
|
|
35883
|
+
const ext = result.findIndex(
|
|
35884
|
+
(effect) => effect.kind === "unsupported" && effect.name === "extLst"
|
|
35885
|
+
);
|
|
35886
|
+
result.splice(ext < 0 ? result.length : ext, 0, value);
|
|
35887
|
+
}
|
|
35888
|
+
};
|
|
35889
|
+
for (const key2 of ["brightness", "contrast", "alpha"])
|
|
35890
|
+
if (patch[key2] !== void 0 && !Number.isFinite(patch[key2]))
|
|
35891
|
+
throw new RangeError("Picture effect must be finite");
|
|
35892
|
+
if ([patch.brightness, patch.contrast].some((value) => value !== void 0 && Math.abs(value) > 1))
|
|
35893
|
+
throw new RangeError("Picture luminance must be between -1 and 1");
|
|
35894
|
+
if (patch.alpha !== void 0 && patch.alpha < 0)
|
|
35895
|
+
throw new RangeError("Picture alpha must be nonnegative");
|
|
35896
|
+
if (patch.grayscale !== void 0)
|
|
35897
|
+
upsert2(
|
|
35898
|
+
"grayscale",
|
|
35899
|
+
(effect) => patch.grayscale ? effect ?? { kind: "grayscale" } : void 0
|
|
35900
|
+
);
|
|
35901
|
+
if (patch.brightness !== void 0 || patch.contrast !== void 0)
|
|
35902
|
+
upsert2("luminance", (effect) => ({
|
|
35903
|
+
...effect?.kind === "luminance" ? effect : { kind: "luminance" },
|
|
35904
|
+
...patch.brightness !== void 0 ? { brightness: patch.brightness } : {},
|
|
35905
|
+
...patch.contrast !== void 0 ? { contrast: patch.contrast } : {}
|
|
35906
|
+
}));
|
|
35907
|
+
if (patch.alpha !== void 0)
|
|
35908
|
+
upsert2("alphaModFix", (effect) => ({
|
|
35909
|
+
...effect?.kind === "alphaModFix" ? effect : { kind: "alphaModFix" },
|
|
35910
|
+
amount: patch.alpha
|
|
35911
|
+
}));
|
|
35912
|
+
if (patch.standard) {
|
|
35913
|
+
const target = patch.standard;
|
|
35914
|
+
const matches = result.flatMap(
|
|
35915
|
+
(effect, index2) => effect.kind === "standard" && effect.name === target.name || effect.kind === "unsupported" && effect.name === target.name ? [index2] : []
|
|
35916
|
+
);
|
|
35917
|
+
if (matches.length > 1 || matches.some((index2) => result[index2]?.kind === "unsupported"))
|
|
35918
|
+
throw new Error(`Ambiguous or unreadable picture effect: ${target.name}`);
|
|
35919
|
+
const index = matches[0], before = index === void 0 ? void 0 : result[index];
|
|
35920
|
+
const next = {
|
|
35921
|
+
...before?.kind === "standard" ? before : {},
|
|
35922
|
+
...target,
|
|
35923
|
+
kind: "standard"
|
|
35924
|
+
};
|
|
35925
|
+
const doc = parseXml(next.sourceXml ?? `<a:${next.name} xmlns:a="${NS.a}"/>`);
|
|
35926
|
+
applyStandardPictureEffect(doc.documentElement, next);
|
|
35927
|
+
if (index === void 0) {
|
|
35928
|
+
const ext = result.findIndex(
|
|
35929
|
+
(effect) => effect.kind === "artistic" || effect.kind === "unsupported" && effect.name === "extLst"
|
|
35930
|
+
);
|
|
35931
|
+
result.splice(ext < 0 ? result.length : ext, 0, next);
|
|
35932
|
+
} else result[index] = next;
|
|
35933
|
+
}
|
|
35934
|
+
return result;
|
|
35935
|
+
}
|
|
35872
35936
|
var init_picture_effects = __esm({
|
|
35873
35937
|
"drawingml/picture-effects.ts"() {
|
|
35874
35938
|
init_picture_artistic();
|
|
@@ -45715,6 +45779,22 @@ var init_ole2_parser = __esm({
|
|
|
45715
45779
|
}
|
|
45716
45780
|
});
|
|
45717
45781
|
|
|
45782
|
+
// pptx/core/utils/modify-verifier-codec.ts
|
|
45783
|
+
function base64Encode2(bytes) {
|
|
45784
|
+
if (typeof Buffer !== "undefined") {
|
|
45785
|
+
return Buffer.from(bytes).toString("base64");
|
|
45786
|
+
}
|
|
45787
|
+
let binary = "";
|
|
45788
|
+
for (let i2 = 0; i2 < bytes.length; i2++) {
|
|
45789
|
+
binary += String.fromCharCode(bytes[i2]);
|
|
45790
|
+
}
|
|
45791
|
+
return btoa(binary);
|
|
45792
|
+
}
|
|
45793
|
+
var init_modify_verifier_codec = __esm({
|
|
45794
|
+
"pptx/core/utils/modify-verifier-codec.ts"() {
|
|
45795
|
+
}
|
|
45796
|
+
});
|
|
45797
|
+
|
|
45718
45798
|
// pptx/core/utils/signature-detection.ts
|
|
45719
45799
|
var init_signature_detection = __esm({
|
|
45720
45800
|
"pptx/core/utils/signature-detection.ts"() {
|
|
@@ -61268,6 +61348,263 @@ var init_chart_layout_operations = __esm({
|
|
|
61268
61348
|
}
|
|
61269
61349
|
});
|
|
61270
61350
|
|
|
61351
|
+
// pptx/core/builders/sdk/picture-layout-input.ts
|
|
61352
|
+
function finite4(where, name, value) {
|
|
61353
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
61354
|
+
throw new RangeError(`${where}.${name} must be a finite number, got ${String(value)}`);
|
|
61355
|
+
}
|
|
61356
|
+
return value;
|
|
61357
|
+
}
|
|
61358
|
+
function tileLayout(where, tile) {
|
|
61359
|
+
const scale = (name) => {
|
|
61360
|
+
const value = finite4(where, `tile.${name}`, tile[name] ?? 1);
|
|
61361
|
+
if (value <= 0) {
|
|
61362
|
+
throw new RangeError(`${where}.tile.${name} must be above 0, got ${value}`);
|
|
61363
|
+
}
|
|
61364
|
+
return value;
|
|
61365
|
+
};
|
|
61366
|
+
const flip = tile.flip ?? "none";
|
|
61367
|
+
if (!FLIPS.has(flip)) {
|
|
61368
|
+
throw new RangeError(`${where}.tile.flip must be none, x, y or xy, got ${String(flip)}`);
|
|
61369
|
+
}
|
|
61370
|
+
const alignment = tile.alignment ?? "tl";
|
|
61371
|
+
if (!ALIGNMENTS.has(alignment)) {
|
|
61372
|
+
throw new RangeError(
|
|
61373
|
+
`${where}.tile.alignment must be one of ${[...ALIGNMENTS].join(", ")}, got ${String(alignment)}`
|
|
61374
|
+
);
|
|
61375
|
+
}
|
|
61376
|
+
return {
|
|
61377
|
+
tileOffsetX: finite4(where, "tile.offsetX", tile.offsetX ?? 0),
|
|
61378
|
+
tileOffsetY: finite4(where, "tile.offsetY", tile.offsetY ?? 0),
|
|
61379
|
+
tileScaleX: scale("scaleX"),
|
|
61380
|
+
tileScaleY: scale("scaleY"),
|
|
61381
|
+
tileFlip: flip,
|
|
61382
|
+
tileAlignment: alignment
|
|
61383
|
+
};
|
|
61384
|
+
}
|
|
61385
|
+
function fillRectLayout(where, rect2) {
|
|
61386
|
+
const inset = (name) => {
|
|
61387
|
+
const value = finite4(where, `fillRect.${name}`, rect2[name]);
|
|
61388
|
+
if (Math.abs(value) > MAX_INSET) {
|
|
61389
|
+
throw new RangeError(
|
|
61390
|
+
`${where}.fillRect.${name} must be between -${MAX_INSET} and ${MAX_INSET}, got ${value}`
|
|
61391
|
+
);
|
|
61392
|
+
}
|
|
61393
|
+
return value;
|
|
61394
|
+
};
|
|
61395
|
+
const layout = {
|
|
61396
|
+
fillRectLeft: inset("l"),
|
|
61397
|
+
fillRectTop: inset("t"),
|
|
61398
|
+
fillRectRight: inset("r"),
|
|
61399
|
+
fillRectBottom: inset("b")
|
|
61400
|
+
};
|
|
61401
|
+
if (layout.fillRectLeft + layout.fillRectRight >= 1) {
|
|
61402
|
+
throw new RangeError(`${where}.fillRect.l + r must be below 1, which leaves no picture`);
|
|
61403
|
+
}
|
|
61404
|
+
if (layout.fillRectTop + layout.fillRectBottom >= 1) {
|
|
61405
|
+
throw new RangeError(`${where}.fillRect.t + b must be below 1, which leaves no picture`);
|
|
61406
|
+
}
|
|
61407
|
+
return layout;
|
|
61408
|
+
}
|
|
61409
|
+
function mapPictureLayoutInput(where, input) {
|
|
61410
|
+
const { mode, tile, fillRect } = input;
|
|
61411
|
+
if (mode !== void 0 && mode !== "stretch" && mode !== "tile") {
|
|
61412
|
+
throw new RangeError(`${where}.mode must be 'stretch' or 'tile', got ${String(mode)}`);
|
|
61413
|
+
}
|
|
61414
|
+
if (tile && fillRect) {
|
|
61415
|
+
throw new RangeError(`${where} takes a tile or a fillRect, not both`);
|
|
61416
|
+
}
|
|
61417
|
+
if (tile && mode === "stretch") {
|
|
61418
|
+
throw new RangeError(`${where}.tile needs mode 'tile', got 'stretch'`);
|
|
61419
|
+
}
|
|
61420
|
+
if (fillRect && mode === "tile") {
|
|
61421
|
+
throw new RangeError(`${where}.fillRect needs mode 'stretch', got 'tile'`);
|
|
61422
|
+
}
|
|
61423
|
+
if (tile || mode === "tile") {
|
|
61424
|
+
return tileLayout(where, tile ?? {});
|
|
61425
|
+
}
|
|
61426
|
+
return fillRect ? fillRectLayout(where, fillRect) : void 0;
|
|
61427
|
+
}
|
|
61428
|
+
var FLIPS, ALIGNMENTS, MAX_INSET;
|
|
61429
|
+
var init_picture_layout_input = __esm({
|
|
61430
|
+
"pptx/core/builders/sdk/picture-layout-input.ts"() {
|
|
61431
|
+
FLIPS = /* @__PURE__ */ new Set(["none", "x", "y", "xy"]);
|
|
61432
|
+
ALIGNMENTS = /* @__PURE__ */ new Set([
|
|
61433
|
+
"tl",
|
|
61434
|
+
"t",
|
|
61435
|
+
"tr",
|
|
61436
|
+
"l",
|
|
61437
|
+
"ctr",
|
|
61438
|
+
"r",
|
|
61439
|
+
"bl",
|
|
61440
|
+
"b",
|
|
61441
|
+
"br"
|
|
61442
|
+
]);
|
|
61443
|
+
MAX_INSET = 10;
|
|
61444
|
+
}
|
|
61445
|
+
});
|
|
61446
|
+
|
|
61447
|
+
// pptx/core/builders/sdk/link-input.ts
|
|
61448
|
+
function mapLinkToAction(link) {
|
|
61449
|
+
if (!link) {
|
|
61450
|
+
return void 0;
|
|
61451
|
+
}
|
|
61452
|
+
const tooltip = link.tooltip !== void 0 ? { tooltip: link.tooltip } : {};
|
|
61453
|
+
if ("url" in link) {
|
|
61454
|
+
return { url: assertUrl(link.url), ...tooltip };
|
|
61455
|
+
}
|
|
61456
|
+
assertSlideIndex(link.slideIndex);
|
|
61457
|
+
return { action: SLIDE_JUMP_ACTION, targetSlideIndex: link.slideIndex, ...tooltip };
|
|
61458
|
+
}
|
|
61459
|
+
function mapLinkToRunStyle(link) {
|
|
61460
|
+
if (!link) {
|
|
61461
|
+
return {};
|
|
61462
|
+
}
|
|
61463
|
+
const tooltip = link.tooltip !== void 0 ? { hyperlinkTooltip: link.tooltip } : {};
|
|
61464
|
+
if ("url" in link) {
|
|
61465
|
+
return { hyperlink: assertUrl(link.url), ...tooltip };
|
|
61466
|
+
}
|
|
61467
|
+
assertSlideIndex(link.slideIndex);
|
|
61468
|
+
return {
|
|
61469
|
+
hyperlink: SLIDE_JUMP_ACTION,
|
|
61470
|
+
hyperlinkAction: SLIDE_JUMP_ACTION,
|
|
61471
|
+
hyperlinkTargetSlideIndex: link.slideIndex,
|
|
61472
|
+
...tooltip
|
|
61473
|
+
};
|
|
61474
|
+
}
|
|
61475
|
+
function assertUrl(url) {
|
|
61476
|
+
if (typeof url !== "string" || url.trim() === "") {
|
|
61477
|
+
throw new RangeError("LinkInput.url must be a non-empty address");
|
|
61478
|
+
}
|
|
61479
|
+
return url;
|
|
61480
|
+
}
|
|
61481
|
+
function assertSlideIndex(index) {
|
|
61482
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
61483
|
+
throw new RangeError(`LinkInput.slideIndex must be a 0-based slide position, got ${index}`);
|
|
61484
|
+
}
|
|
61485
|
+
}
|
|
61486
|
+
var SLIDE_JUMP_ACTION;
|
|
61487
|
+
var init_link_input = __esm({
|
|
61488
|
+
"pptx/core/builders/sdk/link-input.ts"() {
|
|
61489
|
+
SLIDE_JUMP_ACTION = "ppaction://hlinksldjump";
|
|
61490
|
+
}
|
|
61491
|
+
});
|
|
61492
|
+
|
|
61493
|
+
// pptx/core/core/runtime/picture-svg-blip.ts
|
|
61494
|
+
function addSvgBlipExtension(picture, relationshipId2) {
|
|
61495
|
+
const blipFill = picture["p:blipFill"];
|
|
61496
|
+
const blip = blipFill?.["a:blip"];
|
|
61497
|
+
if (!blip || typeof blip !== "object") {
|
|
61498
|
+
return;
|
|
61499
|
+
}
|
|
61500
|
+
const ext = {
|
|
61501
|
+
"@_uri": SVG_BLIP_EXT_URI,
|
|
61502
|
+
"asvg:svgBlip": { "@_xmlns:asvg": SVG_NS2, "@_r:embed": relationshipId2 }
|
|
61503
|
+
};
|
|
61504
|
+
const extLst = blip["a:extLst"] ?? {};
|
|
61505
|
+
const existing = extLst["a:ext"];
|
|
61506
|
+
const list3 = existing === void 0 ? [] : Array.isArray(existing) ? existing : [existing];
|
|
61507
|
+
extLst["a:ext"] = list3.length === 0 ? ext : [...list3, ext];
|
|
61508
|
+
blip["a:extLst"] = extLst;
|
|
61509
|
+
}
|
|
61510
|
+
var SVG_BLIP_EXT_URI, SVG_NS2, TRANSPARENT_PNG_DATA_URL;
|
|
61511
|
+
var init_picture_svg_blip = __esm({
|
|
61512
|
+
"pptx/core/core/runtime/picture-svg-blip.ts"() {
|
|
61513
|
+
SVG_BLIP_EXT_URI = "{96DAC541-7B7A-43D3-8B79-37D633B846F1}";
|
|
61514
|
+
SVG_NS2 = "http://schemas.microsoft.com/office/drawing/2016/SVG/main";
|
|
61515
|
+
TRANSPARENT_PNG_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNgAAIAAAUAAen63NgAAAAASUVORK5CYII=";
|
|
61516
|
+
}
|
|
61517
|
+
});
|
|
61518
|
+
|
|
61519
|
+
// pptx/core/builders/sdk/svg-picture-input.ts
|
|
61520
|
+
function svgPictureSource(source2, svgFallback) {
|
|
61521
|
+
if (svgFallback !== void 0 && SVG_DATA_URL.test(svgFallback)) {
|
|
61522
|
+
throw new RangeError("ImageOptions.svgFallback must be a raster image, not SVG");
|
|
61523
|
+
}
|
|
61524
|
+
const match = SVG_DATA_URL.exec(source2);
|
|
61525
|
+
if (!match?.groups) {
|
|
61526
|
+
if (svgFallback !== void 0) {
|
|
61527
|
+
throw new RangeError("ImageOptions.svgFallback applies only to an SVG data URL source");
|
|
61528
|
+
}
|
|
61529
|
+
return void 0;
|
|
61530
|
+
}
|
|
61531
|
+
const params = match.groups["params"] ?? "";
|
|
61532
|
+
const payload = match.groups["payload"] ?? "";
|
|
61533
|
+
const base64 = /;base64$/iu.test(params);
|
|
61534
|
+
const text2 = base64 ? decodeBase64Text(payload) : decodeURIComponent(payload);
|
|
61535
|
+
if (!/<svg[\s>]/iu.test(text2)) {
|
|
61536
|
+
throw new RangeError("An SVG picture source must hold an <svg> element");
|
|
61537
|
+
}
|
|
61538
|
+
return {
|
|
61539
|
+
svgData: base64 ? `data:image/svg+xml;base64,${payload.replace(/\s+/gu, "")}` : `data:image/svg+xml;base64,${base64Encode2(new TextEncoder().encode(text2))}`,
|
|
61540
|
+
raster: svgFallback ?? TRANSPARENT_PNG_DATA_URL
|
|
61541
|
+
};
|
|
61542
|
+
}
|
|
61543
|
+
function decodeBase64Text(payload) {
|
|
61544
|
+
try {
|
|
61545
|
+
const binary = atob(payload.replace(/\s+/gu, ""));
|
|
61546
|
+
const bytes = Uint8Array.from(binary, (ch) => ch.charCodeAt(0));
|
|
61547
|
+
return new TextDecoder().decode(bytes);
|
|
61548
|
+
} catch {
|
|
61549
|
+
throw new RangeError("An SVG picture source has base64 data that cannot be read");
|
|
61550
|
+
}
|
|
61551
|
+
}
|
|
61552
|
+
var SVG_DATA_URL;
|
|
61553
|
+
var init_svg_picture_input = __esm({
|
|
61554
|
+
"pptx/core/builders/sdk/svg-picture-input.ts"() {
|
|
61555
|
+
init_picture_svg_blip();
|
|
61556
|
+
init_modify_verifier_codec();
|
|
61557
|
+
SVG_DATA_URL = /^data:image\/svg\+xml(?<params>[^,]*),(?<payload>[\s\S]*)$/iu;
|
|
61558
|
+
}
|
|
61559
|
+
});
|
|
61560
|
+
|
|
61561
|
+
// pptx/core/builders/sdk/picture-effects-input.ts
|
|
61562
|
+
function pictureEffectsFromInput(options2) {
|
|
61563
|
+
const { opacity: opacity2, brightness, contrast } = options2 ?? {};
|
|
61564
|
+
if (opacity2 !== void 0 && !(opacity2 >= 0 && opacity2 <= 1)) {
|
|
61565
|
+
throw new RangeError(`ImageOptions.opacity must be between 0 and 1, got ${opacity2}`);
|
|
61566
|
+
}
|
|
61567
|
+
const patch = {};
|
|
61568
|
+
if (opacity2 !== void 0 && opacity2 < 1) {
|
|
61569
|
+
patch.alpha = opacity2;
|
|
61570
|
+
}
|
|
61571
|
+
if (brightness !== void 0) {
|
|
61572
|
+
patch.brightness = brightness / 100;
|
|
61573
|
+
}
|
|
61574
|
+
if (contrast !== void 0) {
|
|
61575
|
+
patch.contrast = contrast / 100;
|
|
61576
|
+
}
|
|
61577
|
+
if (Object.keys(patch).length === 0) {
|
|
61578
|
+
return void 0;
|
|
61579
|
+
}
|
|
61580
|
+
let patched;
|
|
61581
|
+
try {
|
|
61582
|
+
patched = patchPictureEffects([], patch);
|
|
61583
|
+
} catch (error) {
|
|
61584
|
+
throw new RangeError(
|
|
61585
|
+
`ImageOptions.brightness and contrast must be finite percentages from -100 to 100 (${String(error)})`
|
|
61586
|
+
);
|
|
61587
|
+
}
|
|
61588
|
+
let effects2;
|
|
61589
|
+
for (const effect of patched) {
|
|
61590
|
+
effects2 ??= {};
|
|
61591
|
+
if (effect.kind === "alphaModFix") {
|
|
61592
|
+
effects2.alphaModFix = effect.amount * 100;
|
|
61593
|
+
} else if (effect.kind === "luminance") {
|
|
61594
|
+
effects2.lum = {
|
|
61595
|
+
...effect.brightness !== void 0 ? { bright: effect.brightness * 100 } : {},
|
|
61596
|
+
...effect.contrast !== void 0 ? { contrast: effect.contrast * 100 } : {}
|
|
61597
|
+
};
|
|
61598
|
+
}
|
|
61599
|
+
}
|
|
61600
|
+
return effects2;
|
|
61601
|
+
}
|
|
61602
|
+
var init_picture_effects_input = __esm({
|
|
61603
|
+
"pptx/core/builders/sdk/picture-effects-input.ts"() {
|
|
61604
|
+
init_picture_effects();
|
|
61605
|
+
}
|
|
61606
|
+
});
|
|
61607
|
+
|
|
61271
61608
|
// pptx/core/builders/sdk/shape-style-input.ts
|
|
61272
61609
|
function mapFillToShapeStyle(fill3) {
|
|
61273
61610
|
if (!fill3) {
|
|
@@ -61304,12 +61641,18 @@ function mapFillToShapeStyle(fill3) {
|
|
|
61304
61641
|
...fill3.foreground !== void 0 ? { fillColor: fill3.foreground } : {},
|
|
61305
61642
|
fillPatternBackgroundColor: fill3.background
|
|
61306
61643
|
};
|
|
61307
|
-
case "image":
|
|
61644
|
+
case "image": {
|
|
61645
|
+
if (typeof fill3.url !== "string" || !fill3.url.startsWith("data:")) {
|
|
61646
|
+
throw new RangeError("FillInput.url of an image fill must be a data: URL");
|
|
61647
|
+
}
|
|
61648
|
+
const layout = mapPictureLayoutInput("FillInput", fill3);
|
|
61308
61649
|
return {
|
|
61309
61650
|
fillMode: "image",
|
|
61310
61651
|
fillImageUrl: fill3.url,
|
|
61311
|
-
fillImageMode:
|
|
61652
|
+
fillImageMode: layout?.tileScaleX !== void 0 ? "tile" : "stretch",
|
|
61653
|
+
...layout ? { fillImageLayout: layout } : {}
|
|
61312
61654
|
};
|
|
61655
|
+
}
|
|
61313
61656
|
case "none":
|
|
61314
61657
|
return { fillMode: "none" };
|
|
61315
61658
|
default:
|
|
@@ -61438,6 +61781,7 @@ function buildShapeStyle(opts) {
|
|
|
61438
61781
|
var DASH_UNITS_PER_WIDTH, MITER_UNITS_PER_RATIO;
|
|
61439
61782
|
var init_shape_style_input = __esm({
|
|
61440
61783
|
"pptx/core/builders/sdk/shape-style-input.ts"() {
|
|
61784
|
+
init_picture_layout_input();
|
|
61441
61785
|
DASH_UNITS_PER_WIDTH = 1e5;
|
|
61442
61786
|
MITER_UNITS_PER_RATIO = 1e5;
|
|
61443
61787
|
}
|
|
@@ -61674,6 +62018,67 @@ var init_table_merge_input = __esm({
|
|
|
61674
62018
|
}
|
|
61675
62019
|
});
|
|
61676
62020
|
|
|
62021
|
+
// pptx/core/builders/sdk/text-body-input.ts
|
|
62022
|
+
function mapTextBodyInput(input) {
|
|
62023
|
+
const style = {};
|
|
62024
|
+
if (!input) {
|
|
62025
|
+
return style;
|
|
62026
|
+
}
|
|
62027
|
+
const { insets, autoFit, wrap: wrap2 } = input;
|
|
62028
|
+
for (const side of Object.keys(INSET_FIELDS)) {
|
|
62029
|
+
const value = insets?.[side];
|
|
62030
|
+
if (value === void 0) {
|
|
62031
|
+
continue;
|
|
62032
|
+
}
|
|
62033
|
+
if (!Number.isFinite(value) || Math.abs(value * EMU_PER_PX8) > MAX_INSET_EMU) {
|
|
62034
|
+
throw new RangeError(`insets.${side} must be a finite px length, got ${value}`);
|
|
62035
|
+
}
|
|
62036
|
+
style[INSET_FIELDS[side]] = value;
|
|
62037
|
+
}
|
|
62038
|
+
if (autoFit !== void 0) {
|
|
62039
|
+
const mapped = AUTO_FIT[autoFit];
|
|
62040
|
+
if (!mapped) {
|
|
62041
|
+
throw new RangeError(
|
|
62042
|
+
`autoFit must be 'none', 'shrinkText' or 'resizeShape', got ${String(autoFit)}`
|
|
62043
|
+
);
|
|
62044
|
+
}
|
|
62045
|
+
Object.assign(style, mapped);
|
|
62046
|
+
}
|
|
62047
|
+
if (wrap2 !== void 0) {
|
|
62048
|
+
style.textWrap = wrap2 ? "square" : "none";
|
|
62049
|
+
}
|
|
62050
|
+
return style;
|
|
62051
|
+
}
|
|
62052
|
+
function characterSpacingToSpc(px2) {
|
|
62053
|
+
const spc = Math.round(px2 * 75);
|
|
62054
|
+
if (!Number.isFinite(px2) || Math.abs(spc) > MAX_SPC) {
|
|
62055
|
+
throw new RangeError(`characterSpacing must be a finite px length, got ${px2}`);
|
|
62056
|
+
}
|
|
62057
|
+
return spc;
|
|
62058
|
+
}
|
|
62059
|
+
var EMU_PER_PX8, MAX_INSET_EMU, MAX_SPC, INSET_FIELDS, AUTO_FIT;
|
|
62060
|
+
var init_text_body_input = __esm({
|
|
62061
|
+
"pptx/core/builders/sdk/text-body-input.ts"() {
|
|
62062
|
+
EMU_PER_PX8 = 9525;
|
|
62063
|
+
MAX_INSET_EMU = 51206400;
|
|
62064
|
+
MAX_SPC = 4e5;
|
|
62065
|
+
INSET_FIELDS = {
|
|
62066
|
+
left: "bodyInsetLeft",
|
|
62067
|
+
top: "bodyInsetTop",
|
|
62068
|
+
right: "bodyInsetRight",
|
|
62069
|
+
bottom: "bodyInsetBottom"
|
|
62070
|
+
};
|
|
62071
|
+
AUTO_FIT = {
|
|
62072
|
+
// The model's `autoFitMode` names read the other way round: `'normal'` is
|
|
62073
|
+
// `a:normAutofit` (PowerPoint shrinks the text on overflow) and `'shrink'`
|
|
62074
|
+
// is `a:spAutoFit` (the shape grows to fit the text).
|
|
62075
|
+
shrinkText: { autoFit: true, autoFitMode: "normal" },
|
|
62076
|
+
resizeShape: { autoFit: true, autoFitMode: "shrink" },
|
|
62077
|
+
none: { autoFit: false, autoFitMode: "none" }
|
|
62078
|
+
};
|
|
62079
|
+
}
|
|
62080
|
+
});
|
|
62081
|
+
|
|
61677
62082
|
// pptx/core/builders/sdk/text-segment-style.ts
|
|
61678
62083
|
function elementStyleForSegments(textStyle, segments) {
|
|
61679
62084
|
const styled = segments.filter((segment) => !segment.isParagraphBreak);
|
|
@@ -61786,6 +62191,12 @@ function mapTextStyleInput(opts) {
|
|
|
61786
62191
|
if (opts.spaceAfter !== void 0) {
|
|
61787
62192
|
ts.paragraphSpacingAfter = opts.spaceAfter;
|
|
61788
62193
|
}
|
|
62194
|
+
if (opts.characterSpacing !== void 0) {
|
|
62195
|
+
ts.characterSpacing = characterSpacingToSpc(opts.characterSpacing);
|
|
62196
|
+
}
|
|
62197
|
+
if (opts.link !== void 0) {
|
|
62198
|
+
Object.assign(ts, mapLinkToRunStyle(opts.link));
|
|
62199
|
+
}
|
|
61789
62200
|
return ts;
|
|
61790
62201
|
}
|
|
61791
62202
|
function buildTextSegments(input, baseStyle) {
|
|
@@ -61810,6 +62221,34 @@ function buildTextSegments(input, baseStyle) {
|
|
|
61810
62221
|
style: { ...base, ...mapTextStyleInput(seg.style) }
|
|
61811
62222
|
}));
|
|
61812
62223
|
}
|
|
62224
|
+
function flipsOf(options2) {
|
|
62225
|
+
return {
|
|
62226
|
+
...options2?.flipHorizontal ? { flipHorizontal: true } : {},
|
|
62227
|
+
...options2?.flipVertical ? { flipVertical: true } : {}
|
|
62228
|
+
};
|
|
62229
|
+
}
|
|
62230
|
+
function applyShapeText(el, options2) {
|
|
62231
|
+
const text2 = options2?.text;
|
|
62232
|
+
if (!text2 || text2.length === 0) {
|
|
62233
|
+
const body = mapTextBodyInput(options2);
|
|
62234
|
+
if (Object.keys(body).length > 0) {
|
|
62235
|
+
el.text = "";
|
|
62236
|
+
el.textStyle = body;
|
|
62237
|
+
}
|
|
62238
|
+
return;
|
|
62239
|
+
}
|
|
62240
|
+
const textSegments = buildTextSegments(text2, options2.textStyle);
|
|
62241
|
+
el.text = typeof text2 === "string" ? text2 : text2.map((s) => s.text).join("");
|
|
62242
|
+
el.textStyle = {
|
|
62243
|
+
...elementStyleForSegments(mapTextStyleInput(options2.textStyle), textSegments),
|
|
62244
|
+
...mapTextBodyInput(options2)
|
|
62245
|
+
};
|
|
62246
|
+
el.textSegments = textSegments;
|
|
62247
|
+
}
|
|
62248
|
+
function withAction(link) {
|
|
62249
|
+
const actionClick = mapLinkToAction(link);
|
|
62250
|
+
return actionClick ? { actionClick } : {};
|
|
62251
|
+
}
|
|
61813
62252
|
function pos(type, opts) {
|
|
61814
62253
|
const d = DEFAULTS[type];
|
|
61815
62254
|
return {
|
|
@@ -61840,32 +62279,35 @@ function createTextElement(text2, options2) {
|
|
|
61840
62279
|
id: generateId("txt"),
|
|
61841
62280
|
...p2,
|
|
61842
62281
|
rotation: options2?.rotation,
|
|
62282
|
+
...flipsOf(options2),
|
|
61843
62283
|
opacity: options2?.opacity,
|
|
61844
62284
|
text: plainText,
|
|
61845
|
-
textStyle:
|
|
62285
|
+
textStyle: {
|
|
62286
|
+
...elementStyleForSegments(mapTextStyleInput(textStyleBase), textSegments),
|
|
62287
|
+
...mapTextBodyInput(options2)
|
|
62288
|
+
},
|
|
61846
62289
|
textSegments,
|
|
61847
|
-
shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill))
|
|
62290
|
+
shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill)),
|
|
62291
|
+
...withAction(options2?.link)
|
|
61848
62292
|
};
|
|
61849
62293
|
}
|
|
61850
|
-
function createShapeElement(shapeType, options2) {
|
|
62294
|
+
function createShapeElement(shapeType, options2, defaults) {
|
|
61851
62295
|
const p2 = pos("shape", options2);
|
|
61852
62296
|
const el = {
|
|
61853
62297
|
type: "shape",
|
|
61854
62298
|
id: generateId("shp"),
|
|
61855
62299
|
...p2,
|
|
61856
62300
|
rotation: options2?.rotation,
|
|
62301
|
+
...flipsOf(options2),
|
|
61857
62302
|
opacity: options2?.opacity,
|
|
61858
62303
|
shapeType,
|
|
61859
62304
|
shapeAdjustments: options2?.adjustments,
|
|
61860
62305
|
shapeStyle: buildShapeStyle(
|
|
61861
|
-
effectInputs(options2, options2?.fill ??
|
|
61862
|
-
)
|
|
62306
|
+
effectInputs(options2, options2?.fill ?? defaults?.fill ?? DEFAULT_SHAPE_FILL)
|
|
62307
|
+
),
|
|
62308
|
+
...withAction(options2?.link)
|
|
61863
62309
|
};
|
|
61864
|
-
|
|
61865
|
-
el.text = options2.text;
|
|
61866
|
-
el.textStyle = mapTextStyleInput(options2.textStyle);
|
|
61867
|
-
el.textSegments = buildTextSegments(options2.text, options2.textStyle);
|
|
61868
|
-
}
|
|
62310
|
+
applyShapeText(el, options2);
|
|
61869
62311
|
return el;
|
|
61870
62312
|
}
|
|
61871
62313
|
function createConnectorElement(options2) {
|
|
@@ -61901,26 +62343,41 @@ function createConnectorElement(options2) {
|
|
|
61901
62343
|
id: generateId("cxn"),
|
|
61902
62344
|
...p2,
|
|
61903
62345
|
rotation: options2?.rotation,
|
|
62346
|
+
...flipsOf(options2),
|
|
61904
62347
|
shapeType: connType,
|
|
61905
62348
|
shapeStyle: style
|
|
61906
62349
|
};
|
|
61907
62350
|
}
|
|
61908
62351
|
function createImageElement(source2, options2) {
|
|
61909
62352
|
const p2 = pos("image", options2);
|
|
62353
|
+
const svg = svgPictureSource(source2, options2?.svgFallback);
|
|
62354
|
+
if (svg) {
|
|
62355
|
+
const { svgFallback: _raster, ...rest } = options2 ?? {};
|
|
62356
|
+
const svgPicture = createImageElement(svg.raster, rest);
|
|
62357
|
+
svgPicture.svgData = svg.svgData;
|
|
62358
|
+
return svgPicture;
|
|
62359
|
+
}
|
|
61910
62360
|
const isDataUrl = source2.startsWith("data:");
|
|
62361
|
+
const imageEffects = pictureEffectsFromInput(options2);
|
|
61911
62362
|
return {
|
|
61912
62363
|
type: "image",
|
|
61913
62364
|
id: generateId("img"),
|
|
61914
62365
|
...p2,
|
|
61915
62366
|
rotation: options2?.rotation,
|
|
61916
|
-
|
|
62367
|
+
...flipsOf(options2),
|
|
62368
|
+
...imageEffects ? { imageEffects } : {},
|
|
61917
62369
|
imagePath: isDataUrl ? void 0 : source2,
|
|
61918
62370
|
imageData: isDataUrl ? source2 : void 0,
|
|
61919
62371
|
altText: options2?.altText,
|
|
61920
62372
|
cropLeft: options2?.cropLeft,
|
|
61921
62373
|
cropTop: options2?.cropTop,
|
|
61922
62374
|
cropRight: options2?.cropRight,
|
|
61923
|
-
cropBottom: options2?.cropBottom
|
|
62375
|
+
cropBottom: options2?.cropBottom,
|
|
62376
|
+
...mapPictureLayoutInput("ImageOptions", {
|
|
62377
|
+
tile: options2?.tile,
|
|
62378
|
+
fillRect: options2?.fillRect
|
|
62379
|
+
}),
|
|
62380
|
+
...withAction(options2?.link)
|
|
61924
62381
|
};
|
|
61925
62382
|
}
|
|
61926
62383
|
function createTableCell(cellInput) {
|
|
@@ -62025,6 +62482,7 @@ function createMediaElement(mediaType, source2, options2) {
|
|
|
62025
62482
|
id: generateId("med"),
|
|
62026
62483
|
...p2,
|
|
62027
62484
|
rotation: options2?.rotation,
|
|
62485
|
+
...flipsOf(options2),
|
|
62028
62486
|
mediaType,
|
|
62029
62487
|
mediaPath: isDataUrl ? void 0 : source2,
|
|
62030
62488
|
mediaData: isDataUrl ? source2 : void 0,
|
|
@@ -62043,6 +62501,7 @@ function createGroupElement(children16, options2) {
|
|
|
62043
62501
|
id: generateId("grp"),
|
|
62044
62502
|
...p2,
|
|
62045
62503
|
rotation: options2?.rotation,
|
|
62504
|
+
...flipsOf(options2),
|
|
62046
62505
|
children: children16
|
|
62047
62506
|
};
|
|
62048
62507
|
}
|
|
@@ -62056,6 +62515,7 @@ function createFreeformElement(pathData, options2) {
|
|
|
62056
62515
|
id: generateId("frm"),
|
|
62057
62516
|
...p2,
|
|
62058
62517
|
rotation: options2?.rotation,
|
|
62518
|
+
...flipsOf(options2),
|
|
62059
62519
|
opacity: options2?.opacity,
|
|
62060
62520
|
shapeType: "custom",
|
|
62061
62521
|
pathData,
|
|
@@ -62065,24 +62525,26 @@ function createFreeformElement(pathData, options2) {
|
|
|
62065
62525
|
shapeStyle: buildShapeStyle({
|
|
62066
62526
|
...effectInputs(options2, options2?.fill ?? { type: "none" }),
|
|
62067
62527
|
stroke: options2?.stroke ?? { color: "#000000", width: 2 }
|
|
62068
|
-
})
|
|
62528
|
+
}),
|
|
62529
|
+
...withAction(options2?.link)
|
|
62069
62530
|
};
|
|
62070
|
-
|
|
62071
|
-
el.text = options2.text;
|
|
62072
|
-
el.textStyle = mapTextStyleInput(options2.textStyle);
|
|
62073
|
-
el.textSegments = buildTextSegments(options2.text, options2.textStyle);
|
|
62074
|
-
}
|
|
62531
|
+
applyShapeText(el, options2);
|
|
62075
62532
|
return el;
|
|
62076
62533
|
}
|
|
62077
|
-
var idCounter, DEFAULTS;
|
|
62534
|
+
var idCounter, DEFAULTS, DEFAULT_SHAPE_FILL;
|
|
62078
62535
|
var init_ElementFactory = __esm({
|
|
62079
62536
|
"pptx/core/builders/sdk/ElementFactory.ts"() {
|
|
62080
62537
|
init_table_style_defaults();
|
|
62081
62538
|
init_custom_geometry();
|
|
62082
62539
|
init_chart_gradient_input();
|
|
62083
62540
|
init_chart_layout_operations();
|
|
62541
|
+
init_picture_layout_input();
|
|
62542
|
+
init_link_input();
|
|
62543
|
+
init_svg_picture_input();
|
|
62544
|
+
init_picture_effects_input();
|
|
62084
62545
|
init_table_cell_input();
|
|
62085
62546
|
init_table_merge_input();
|
|
62547
|
+
init_text_body_input();
|
|
62086
62548
|
init_text_segment_style();
|
|
62087
62549
|
init_shape_style_input();
|
|
62088
62550
|
idCounter = 0;
|
|
@@ -62096,6 +62558,7 @@ var init_ElementFactory = __esm({
|
|
|
62096
62558
|
media: { x: 100, y: 100, width: 480, height: 270 },
|
|
62097
62559
|
group: { x: 0, y: 0, width: 600, height: 400 }
|
|
62098
62560
|
};
|
|
62561
|
+
DEFAULT_SHAPE_FILL = { type: "solid", color: "#4472C4" };
|
|
62099
62562
|
}
|
|
62100
62563
|
});
|
|
62101
62564
|
|
|
@@ -62111,9 +62574,12 @@ var init_SlideBuilder = __esm({
|
|
|
62111
62574
|
* @param layoutPath - Optional layout archive path.
|
|
62112
62575
|
* @param layoutName - Optional layout display name.
|
|
62113
62576
|
* @param handler - Loaded deck context for placeholder geometry and text styles.
|
|
62577
|
+
* @param shapeDefaults - What `addShape` uses for an omitted option
|
|
62578
|
+
* (`PresentationOptions.shapeDefaults`).
|
|
62114
62579
|
*/
|
|
62115
|
-
constructor(slideNumber, layoutPath, layoutName, handler) {
|
|
62580
|
+
constructor(slideNumber, layoutPath, layoutName, handler, shapeDefaults) {
|
|
62116
62581
|
this.handler = handler;
|
|
62582
|
+
this.shapeDefaults = shapeDefaults;
|
|
62117
62583
|
this.slide = {
|
|
62118
62584
|
id: `slide${slideNumber}`,
|
|
62119
62585
|
rId: `rId${slideNumber + 1}`,
|
|
@@ -62124,6 +62590,7 @@ var init_SlideBuilder = __esm({
|
|
|
62124
62590
|
};
|
|
62125
62591
|
}
|
|
62126
62592
|
handler;
|
|
62593
|
+
shapeDefaults;
|
|
62127
62594
|
slide;
|
|
62128
62595
|
/** Add a text box to the slide. */
|
|
62129
62596
|
addText(text2, options2) {
|
|
@@ -62171,7 +62638,7 @@ var init_SlideBuilder = __esm({
|
|
|
62171
62638
|
}
|
|
62172
62639
|
/** Add a shape to the slide. */
|
|
62173
62640
|
addShape(shapeType, options2) {
|
|
62174
|
-
this.slide.elements.push(createShapeElement(shapeType, options2));
|
|
62641
|
+
this.slide.elements.push(createShapeElement(shapeType, options2, this.shapeDefaults));
|
|
62175
62642
|
return this;
|
|
62176
62643
|
}
|
|
62177
62644
|
/** Add a connector (line) to the slide. */
|
|
@@ -62482,6 +62949,174 @@ var init_layout_operations = __esm({
|
|
|
62482
62949
|
}
|
|
62483
62950
|
});
|
|
62484
62951
|
|
|
62952
|
+
// pptx/core/utils/document-properties-model.ts
|
|
62953
|
+
function toPptxCoreProperties(core) {
|
|
62954
|
+
const result = {};
|
|
62955
|
+
for (const field of CORE_FIELDS) result[field] = trimmed(core[field]);
|
|
62956
|
+
return anyDefined(result) ? result : void 0;
|
|
62957
|
+
}
|
|
62958
|
+
function toPptxAppProperties(app) {
|
|
62959
|
+
const result = {
|
|
62960
|
+
application: trimmed(app.application),
|
|
62961
|
+
appVersion: trimmed(app.appVersion),
|
|
62962
|
+
presentationFormat: trimmed(app.presentationFormat),
|
|
62963
|
+
slides: app.slides,
|
|
62964
|
+
hiddenSlides: app.hiddenSlides,
|
|
62965
|
+
notes: app.notes,
|
|
62966
|
+
totalTime: app.totalTime,
|
|
62967
|
+
words: app.words,
|
|
62968
|
+
paragraphs: app.paragraphs,
|
|
62969
|
+
company: trimmed(app.company),
|
|
62970
|
+
manager: trimmed(app.manager),
|
|
62971
|
+
template: trimmed(app.template),
|
|
62972
|
+
hyperlinkBase: trimmed(app.hyperlinkBase),
|
|
62973
|
+
docSecurity: app.docSecurity,
|
|
62974
|
+
mmClips: app.mmClips,
|
|
62975
|
+
scaleCrop: app.scaleCrop,
|
|
62976
|
+
linksUpToDate: app.linksUpToDate,
|
|
62977
|
+
sharedDoc: app.sharedDoc,
|
|
62978
|
+
hyperlinksChanged: app.hyperlinksChanged
|
|
62979
|
+
};
|
|
62980
|
+
return anyDefined(result) ? result : void 0;
|
|
62981
|
+
}
|
|
62982
|
+
function toPptxCustomProperties(texts) {
|
|
62983
|
+
return texts.flatMap((entry2) => {
|
|
62984
|
+
const name = entry2.name.trim();
|
|
62985
|
+
if (!name) return [];
|
|
62986
|
+
const known = CUSTOM_TYPES.has(entry2.type);
|
|
62987
|
+
return [{ name, value: known ? entry2.text : "", type: known ? entry2.type : "unknown" }];
|
|
62988
|
+
});
|
|
62989
|
+
}
|
|
62990
|
+
function applyCoreOverrides(core, overrides) {
|
|
62991
|
+
const next = { ...core };
|
|
62992
|
+
for (const field of CORE_FIELDS) {
|
|
62993
|
+
const value = overrides?.[field];
|
|
62994
|
+
if (value === void 0) continue;
|
|
62995
|
+
const text2 = String(value).trim();
|
|
62996
|
+
if (text2) next[field] = text2;
|
|
62997
|
+
else delete next[field];
|
|
62998
|
+
}
|
|
62999
|
+
return next;
|
|
63000
|
+
}
|
|
63001
|
+
function applyAppOverrides(app, overrides) {
|
|
63002
|
+
const next = { ...app };
|
|
63003
|
+
for (const field of APP_TEXT_OVERRIDES) {
|
|
63004
|
+
const value = overrides?.[field];
|
|
63005
|
+
if (value === void 0) continue;
|
|
63006
|
+
const text2 = String(value).trim();
|
|
63007
|
+
if (text2) next[field] = text2;
|
|
63008
|
+
else delete next[field];
|
|
63009
|
+
}
|
|
63010
|
+
for (const field of APP_NUMBER_OVERRIDES) {
|
|
63011
|
+
const value = Number(overrides?.[field]);
|
|
63012
|
+
if (overrides?.[field] !== void 0 && Number.isFinite(value)) next[field] = Math.trunc(value);
|
|
63013
|
+
}
|
|
63014
|
+
return next;
|
|
63015
|
+
}
|
|
63016
|
+
function toCustomProperty(entry2) {
|
|
63017
|
+
const type = String(entry2.type || "lpwstr").trim().toLowerCase();
|
|
63018
|
+
return customPropertyFromText(
|
|
63019
|
+
entry2.name,
|
|
63020
|
+
CUSTOM_TYPES.has(type) ? type : "lpwstr",
|
|
63021
|
+
String(entry2.value ?? "")
|
|
63022
|
+
);
|
|
63023
|
+
}
|
|
63024
|
+
var CORE_FIELDS, APP_TEXT_OVERRIDES, APP_NUMBER_OVERRIDES, trimmed, anyDefined, CUSTOM_TYPES;
|
|
63025
|
+
var init_document_properties_model = __esm({
|
|
63026
|
+
"pptx/core/utils/document-properties-model.ts"() {
|
|
63027
|
+
init_properties();
|
|
63028
|
+
CORE_FIELDS = [
|
|
63029
|
+
"title",
|
|
63030
|
+
"subject",
|
|
63031
|
+
"creator",
|
|
63032
|
+
"keywords",
|
|
63033
|
+
"description",
|
|
63034
|
+
"lastModifiedBy",
|
|
63035
|
+
"revision",
|
|
63036
|
+
"created",
|
|
63037
|
+
"modified",
|
|
63038
|
+
"category",
|
|
63039
|
+
"contentStatus"
|
|
63040
|
+
];
|
|
63041
|
+
APP_TEXT_OVERRIDES = [
|
|
63042
|
+
"application",
|
|
63043
|
+
"appVersion",
|
|
63044
|
+
"presentationFormat",
|
|
63045
|
+
"company",
|
|
63046
|
+
"manager",
|
|
63047
|
+
"template"
|
|
63048
|
+
];
|
|
63049
|
+
APP_NUMBER_OVERRIDES = [
|
|
63050
|
+
"slides",
|
|
63051
|
+
"hiddenSlides",
|
|
63052
|
+
"notes",
|
|
63053
|
+
"totalTime",
|
|
63054
|
+
"words",
|
|
63055
|
+
"paragraphs"
|
|
63056
|
+
];
|
|
63057
|
+
trimmed = (value) => value?.trim() || void 0;
|
|
63058
|
+
anyDefined = (record2) => Object.values(record2).some((value) => value !== void 0);
|
|
63059
|
+
CUSTOM_TYPES = /* @__PURE__ */ new Set(["lpwstr", "i4", "bool", "filetime", "r8", "i2", "ui4", "lpstr"]);
|
|
63060
|
+
}
|
|
63061
|
+
});
|
|
63062
|
+
|
|
63063
|
+
// pptx/core/builders/sdk/presentation-app-properties.ts
|
|
63064
|
+
function blankAppXml(slideCount) {
|
|
63065
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
63066
|
+
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
|
63067
|
+
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
|
|
63068
|
+
<Application>pptx-viewer-sdk</Application>
|
|
63069
|
+
<Slides>${slideCount}</Slides>
|
|
63070
|
+
<ScaleCrop>false</ScaleCrop>
|
|
63071
|
+
<LinksUpToDate>false</LinksUpToDate>
|
|
63072
|
+
<SharedDoc>false</SharedDoc>
|
|
63073
|
+
<HyperlinksChanged>false</HyperlinksChanged>
|
|
63074
|
+
<AppVersion>1.0000</AppVersion>
|
|
63075
|
+
</Properties>`;
|
|
63076
|
+
}
|
|
63077
|
+
function validate(input) {
|
|
63078
|
+
for (const [field, value] of Object.entries(input)) {
|
|
63079
|
+
if (!INPUT_FIELDS.has(field)) {
|
|
63080
|
+
throw new RangeError(
|
|
63081
|
+
`appProperties.${field} cannot be set when a presentation is created; it takes ${[...INPUT_FIELDS].join(", ")} (counts are computed on save)`
|
|
63082
|
+
);
|
|
63083
|
+
}
|
|
63084
|
+
if (value !== void 0 && typeof value !== "string") {
|
|
63085
|
+
throw new RangeError(`appProperties.${field} must be a string`);
|
|
63086
|
+
}
|
|
63087
|
+
}
|
|
63088
|
+
const version = input.appVersion?.trim();
|
|
63089
|
+
if (version && !APP_VERSION.test(version)) {
|
|
63090
|
+
throw new RangeError(
|
|
63091
|
+
`appProperties.appVersion must be digits, a dot and four digits (e.g. "16.0000"), got "${input.appVersion}"`
|
|
63092
|
+
);
|
|
63093
|
+
}
|
|
63094
|
+
}
|
|
63095
|
+
function newPresentationAppXml(slideCount, input) {
|
|
63096
|
+
const xml = blankAppXml(slideCount);
|
|
63097
|
+
if (input === void 0) {
|
|
63098
|
+
return xml;
|
|
63099
|
+
}
|
|
63100
|
+
validate(input);
|
|
63101
|
+
return writeAppProperties(applyAppOverrides(parseAppProperties(xml), input), xml);
|
|
63102
|
+
}
|
|
63103
|
+
var INPUT_FIELDS, APP_VERSION;
|
|
63104
|
+
var init_presentation_app_properties = __esm({
|
|
63105
|
+
"pptx/core/builders/sdk/presentation-app-properties.ts"() {
|
|
63106
|
+
init_properties();
|
|
63107
|
+
init_document_properties_model();
|
|
63108
|
+
INPUT_FIELDS = /* @__PURE__ */ new Set([
|
|
63109
|
+
"application",
|
|
63110
|
+
"appVersion",
|
|
63111
|
+
"presentationFormat",
|
|
63112
|
+
"company",
|
|
63113
|
+
"manager",
|
|
63114
|
+
"template"
|
|
63115
|
+
]);
|
|
63116
|
+
APP_VERSION = /^\d+\.\d{4}$/u;
|
|
63117
|
+
}
|
|
63118
|
+
});
|
|
63119
|
+
|
|
62485
63120
|
// pptx/core/builders/sdk/standard-layout-placeholders.ts
|
|
62486
63121
|
function standardLayoutPlaceholders(type, width, height) {
|
|
62487
63122
|
if (type === "blank") return [];
|
|
@@ -62806,19 +63441,6 @@ function corePropsXml(title, creator) {
|
|
|
62806
63441
|
<dcterms:modified xsi:type="dcterms:W3CDTF">${now}</dcterms:modified>
|
|
62807
63442
|
</cp:coreProperties>`;
|
|
62808
63443
|
}
|
|
62809
|
-
function appPropsXml(slideCount) {
|
|
62810
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
62811
|
-
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
|
62812
|
-
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
|
|
62813
|
-
<Application>pptx-viewer-sdk</Application>
|
|
62814
|
-
<Slides>${slideCount}</Slides>
|
|
62815
|
-
<ScaleCrop>false</ScaleCrop>
|
|
62816
|
-
<LinksUpToDate>false</LinksUpToDate>
|
|
62817
|
-
<SharedDoc>false</SharedDoc>
|
|
62818
|
-
<HyperlinksChanged>false</HyperlinksChanged>
|
|
62819
|
-
<AppVersion>1.0000</AppVersion>
|
|
62820
|
-
</Properties>`;
|
|
62821
|
-
}
|
|
62822
63444
|
async function buildBlankPresentationArchive(options2) {
|
|
62823
63445
|
const width = options2?.width ?? DEFAULT_WIDTH;
|
|
62824
63446
|
const height = options2?.height ?? DEFAULT_HEIGHT;
|
|
@@ -62860,7 +63482,7 @@ async function buildBlankPresentationArchive(options2) {
|
|
|
62860
63482
|
zip.file("ppt/viewProps.xml", viewPropsXml());
|
|
62861
63483
|
zip.file("ppt/tableStyles.xml", tableStylesXml());
|
|
62862
63484
|
zip.file("docProps/core.xml", corePropsXml(options2?.title, options2?.creator));
|
|
62863
|
-
zip.file("docProps/app.xml",
|
|
63485
|
+
zip.file("docProps/app.xml", newPresentationAppXml(initialSlideCount, options2?.appProperties));
|
|
62864
63486
|
return zip.generateAsync({ type: "arraybuffer" });
|
|
62865
63487
|
}
|
|
62866
63488
|
var DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_COLORS2, DEFAULT_MAJOR_FONT, DEFAULT_MINOR_FONT, STANDARD_LAYOUTS, PresentationBuilder;
|
|
@@ -62870,6 +63492,7 @@ var init_PresentationBuilder = __esm({
|
|
|
62870
63492
|
init_PptxHandler();
|
|
62871
63493
|
init_SlideBuilder();
|
|
62872
63494
|
init_layout_operations();
|
|
63495
|
+
init_presentation_app_properties();
|
|
62873
63496
|
init_standard_layout_placeholders();
|
|
62874
63497
|
DEFAULT_WIDTH = 12192e3;
|
|
62875
63498
|
DEFAULT_HEIGHT = 6858e3;
|
|
@@ -62928,7 +63551,7 @@ var init_PresentationBuilder = __esm({
|
|
|
62928
63551
|
const layoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.name === layoutName) + 1 || 7;
|
|
62929
63552
|
const layoutPath = `ppt/slideLayouts/slideLayout${layoutIdx}.xml`;
|
|
62930
63553
|
const resolvedName = layoutName ?? STANDARD_LAYOUTS[layoutIdx - 1]?.name ?? "Blank";
|
|
62931
|
-
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler);
|
|
63554
|
+
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler, options2?.shapeDefaults);
|
|
62932
63555
|
};
|
|
62933
63556
|
return { handler, data, createSlide };
|
|
62934
63557
|
}
|
|
@@ -63954,19 +64577,19 @@ function serializePlaceholderLevelStyle(style, existing) {
|
|
|
63954
64577
|
attrEdits.algn = ALIGN_TO_XML[style.alignment] ?? style.alignment;
|
|
63955
64578
|
}
|
|
63956
64579
|
if (style.marginLeft !== void 0) {
|
|
63957
|
-
attrEdits.marL = String(Math.round(style.marginLeft *
|
|
64580
|
+
attrEdits.marL = String(Math.round(style.marginLeft * EMU_PER_PX9));
|
|
63958
64581
|
}
|
|
63959
64582
|
if (style.marginRight !== void 0) {
|
|
63960
|
-
attrEdits.marR = String(Math.round(style.marginRight *
|
|
64583
|
+
attrEdits.marR = String(Math.round(style.marginRight * EMU_PER_PX9));
|
|
63961
64584
|
}
|
|
63962
64585
|
if (style.indent !== void 0) {
|
|
63963
|
-
attrEdits.indent = String(Math.round(style.indent *
|
|
64586
|
+
attrEdits.indent = String(Math.round(style.indent * EMU_PER_PX9));
|
|
63964
64587
|
}
|
|
63965
64588
|
if (style.rtl !== void 0) {
|
|
63966
64589
|
attrEdits.rtl = style.rtl ? "1" : "0";
|
|
63967
64590
|
}
|
|
63968
64591
|
if (style.defaultTabSize !== void 0) {
|
|
63969
|
-
attrEdits.defTabSz = String(Math.round(style.defaultTabSize *
|
|
64592
|
+
attrEdits.defTabSz = String(Math.round(style.defaultTabSize * EMU_PER_PX9));
|
|
63970
64593
|
}
|
|
63971
64594
|
if (style.eaLineBreak !== void 0) {
|
|
63972
64595
|
attrEdits.eaLnBrk = style.eaLineBreak ? "1" : "0";
|
|
@@ -64105,13 +64728,13 @@ function preservedIfStillCurrent(preserved, hex3) {
|
|
|
64105
64728
|
}
|
|
64106
64729
|
return preserved;
|
|
64107
64730
|
}
|
|
64108
|
-
var
|
|
64731
|
+
var EMU_PER_PX9, PT_HUNDREDTHS_PER_PX, ALIGN_TO_XML, LEVEL_PPR_CHILD_ORDER, DEF_RPR_CHILD_ORDER, FILL_VARIANTS;
|
|
64109
64732
|
var init_placeholder_level_style_serializer = __esm({
|
|
64110
64733
|
"pptx/core/utils/placeholder-level-style-serializer.ts"() {
|
|
64111
64734
|
init_color_xml_preservation();
|
|
64112
64735
|
init_ordered_xml_merge();
|
|
64113
64736
|
init_tab_stops();
|
|
64114
|
-
|
|
64737
|
+
EMU_PER_PX9 = 9525;
|
|
64115
64738
|
PT_HUNDREDTHS_PER_PX = 75;
|
|
64116
64739
|
ALIGN_TO_XML = {
|
|
64117
64740
|
left: "l",
|
|
@@ -68728,41 +69351,41 @@ function parseBorderSide(side) {
|
|
|
68728
69351
|
}
|
|
68729
69352
|
const ln = typeof side["a:ln"] === "object" ? side["a:ln"] : {};
|
|
68730
69353
|
const border = {};
|
|
68731
|
-
let
|
|
69354
|
+
let has3 = false;
|
|
68732
69355
|
if (ln["a:noFill"] !== void 0) {
|
|
68733
69356
|
border.noFill = true;
|
|
68734
|
-
|
|
69357
|
+
has3 = true;
|
|
68735
69358
|
}
|
|
68736
69359
|
const widthEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
68737
69360
|
if (widthEmu > 0) {
|
|
68738
69361
|
border.width = Math.max(1, Math.round(widthEmu / EMU_PER_PIXEL3));
|
|
68739
|
-
|
|
69362
|
+
has3 = true;
|
|
68740
69363
|
}
|
|
68741
69364
|
const prstDash = ln["a:prstDash"];
|
|
68742
69365
|
const dashVal = prstDash ? String(prstDash["@_val"] || "").trim() : "";
|
|
68743
69366
|
if (dashVal) {
|
|
68744
69367
|
border.dash = dashVal;
|
|
68745
|
-
|
|
69368
|
+
has3 = true;
|
|
68746
69369
|
}
|
|
68747
69370
|
const cmpd = String(ln["@_cmpd"] || "").trim();
|
|
68748
69371
|
if (cmpd && cmpd !== "sng") {
|
|
68749
69372
|
border.compound = cmpd;
|
|
68750
|
-
|
|
69373
|
+
has3 = true;
|
|
68751
69374
|
}
|
|
68752
69375
|
const solidFill3 = ln["a:solidFill"];
|
|
68753
69376
|
const fill3 = parseSolidFillStyle(solidFill3);
|
|
68754
69377
|
if (fill3) {
|
|
68755
69378
|
border.fill = fill3;
|
|
68756
|
-
|
|
69379
|
+
has3 = true;
|
|
68757
69380
|
} else {
|
|
68758
69381
|
const srgb2 = solidFill3?.["a:srgbClr"];
|
|
68759
69382
|
const hex3 = srgb2 ? String(srgb2["@_val"] || "").trim() : "";
|
|
68760
69383
|
if (hex3) {
|
|
68761
69384
|
border.color = hex3.startsWith("#") ? hex3 : `#${hex3}`;
|
|
68762
|
-
|
|
69385
|
+
has3 = true;
|
|
68763
69386
|
}
|
|
68764
69387
|
}
|
|
68765
|
-
return
|
|
69388
|
+
return has3 ? border : void 0;
|
|
68766
69389
|
}
|
|
68767
69390
|
function parseTableStyleBorders(tcStyle) {
|
|
68768
69391
|
const tcBdr = tcStyle?.["a:tcBdr"];
|
|
@@ -68770,16 +69393,16 @@ function parseTableStyleBorders(tcStyle) {
|
|
|
68770
69393
|
return void 0;
|
|
68771
69394
|
}
|
|
68772
69395
|
const result = {};
|
|
68773
|
-
let
|
|
69396
|
+
let has3 = false;
|
|
68774
69397
|
for (const name of BORDER_SIDES) {
|
|
68775
69398
|
const node = tcBdr[`a:${name}`] ?? (name === "tr2bl" ? tcBdr["a:bl2tr"] : void 0);
|
|
68776
69399
|
const border = parseBorderSide(node);
|
|
68777
69400
|
if (border) {
|
|
68778
69401
|
result[name] = border;
|
|
68779
|
-
|
|
69402
|
+
has3 = true;
|
|
68780
69403
|
}
|
|
68781
69404
|
}
|
|
68782
|
-
return
|
|
69405
|
+
return has3 ? result : void 0;
|
|
68783
69406
|
}
|
|
68784
69407
|
function parseTableStyleSectionCell3D(tcStyle) {
|
|
68785
69408
|
const cell3DNode = tcStyle?.["a:cell3D"];
|
|
@@ -71727,6 +72350,25 @@ var init_PptxLoadDataBuilder = __esm({
|
|
|
71727
72350
|
});
|
|
71728
72351
|
|
|
71729
72352
|
// pptx/core/core/builders/PptxSaveSessionBuilder.ts
|
|
72353
|
+
function fnv1a(bytes) {
|
|
72354
|
+
let hash2 = 2166136261;
|
|
72355
|
+
for (const byte of bytes) {
|
|
72356
|
+
hash2 ^= byte;
|
|
72357
|
+
hash2 = Math.imul(hash2, 16777619) >>> 0;
|
|
72358
|
+
}
|
|
72359
|
+
return hash2;
|
|
72360
|
+
}
|
|
72361
|
+
function sameBytes(a, b) {
|
|
72362
|
+
if (a.length !== b.length) {
|
|
72363
|
+
return false;
|
|
72364
|
+
}
|
|
72365
|
+
for (let i2 = 0; i2 < a.length; i2++) {
|
|
72366
|
+
if (a[i2] !== b[i2]) {
|
|
72367
|
+
return false;
|
|
72368
|
+
}
|
|
72369
|
+
}
|
|
72370
|
+
return true;
|
|
72371
|
+
}
|
|
71730
72372
|
var PptxSaveState, PptxSaveStateBuilder;
|
|
71731
72373
|
var init_PptxSaveSessionBuilder = __esm({
|
|
71732
72374
|
"pptx/core/core/builders/PptxSaveSessionBuilder.ts"() {
|
|
@@ -71738,6 +72380,8 @@ var init_PptxSaveSessionBuilder = __esm({
|
|
|
71738
72380
|
emuPerPx;
|
|
71739
72381
|
usedSlideNumbers = /* @__PURE__ */ new Set();
|
|
71740
72382
|
usedMediaPaths = /* @__PURE__ */ new Set();
|
|
72383
|
+
/** New pictures' media parts in this save, by content (see `mediaPathForContent`). */
|
|
72384
|
+
newMediaByContent = /* @__PURE__ */ new Map();
|
|
71741
72385
|
usedInkPaths = /* @__PURE__ */ new Set();
|
|
71742
72386
|
maxInkPartIndex = 0;
|
|
71743
72387
|
existingCommentPaths = /* @__PURE__ */ new Set();
|
|
@@ -71778,6 +72422,23 @@ var init_PptxSaveSessionBuilder = __esm({
|
|
|
71778
72422
|
this.usedMediaPaths.add(filePath);
|
|
71779
72423
|
return filePath;
|
|
71780
72424
|
}
|
|
72425
|
+
/**
|
|
72426
|
+
* The media part for a NEW picture's bytes: the part an identical picture
|
|
72427
|
+
* already got in this save, or a fresh one. Pictures loaded from the deck
|
|
72428
|
+
* keep their own parts and never come through here.
|
|
72429
|
+
*/
|
|
72430
|
+
mediaPathForContent(bytes, extension) {
|
|
72431
|
+
const key2 = `${extension.toLowerCase()}:${bytes.length}:${fnv1a(bytes)}`;
|
|
72432
|
+
const candidates = this.newMediaByContent.get(key2) ?? [];
|
|
72433
|
+
const same8 = candidates.find((candidate) => sameBytes(candidate.bytes, bytes));
|
|
72434
|
+
if (same8) {
|
|
72435
|
+
return { path: same8.path, reused: true };
|
|
72436
|
+
}
|
|
72437
|
+
const path4 = this.nextMediaPath(extension);
|
|
72438
|
+
candidates.push({ bytes, path: path4 });
|
|
72439
|
+
this.newMediaByContent.set(key2, candidates);
|
|
72440
|
+
return { path: path4, reused: false };
|
|
72441
|
+
}
|
|
71781
72442
|
getUsedMediaPaths() {
|
|
71782
72443
|
return this.usedMediaPaths;
|
|
71783
72444
|
}
|
|
@@ -73033,117 +73694,6 @@ var init_app_properties_text_stats = __esm({
|
|
|
73033
73694
|
}
|
|
73034
73695
|
});
|
|
73035
73696
|
|
|
73036
|
-
// pptx/core/utils/document-properties-model.ts
|
|
73037
|
-
function toPptxCoreProperties(core) {
|
|
73038
|
-
const result = {};
|
|
73039
|
-
for (const field of CORE_FIELDS) result[field] = trimmed(core[field]);
|
|
73040
|
-
return anyDefined(result) ? result : void 0;
|
|
73041
|
-
}
|
|
73042
|
-
function toPptxAppProperties(app) {
|
|
73043
|
-
const result = {
|
|
73044
|
-
application: trimmed(app.application),
|
|
73045
|
-
appVersion: trimmed(app.appVersion),
|
|
73046
|
-
presentationFormat: trimmed(app.presentationFormat),
|
|
73047
|
-
slides: app.slides,
|
|
73048
|
-
hiddenSlides: app.hiddenSlides,
|
|
73049
|
-
notes: app.notes,
|
|
73050
|
-
totalTime: app.totalTime,
|
|
73051
|
-
words: app.words,
|
|
73052
|
-
paragraphs: app.paragraphs,
|
|
73053
|
-
company: trimmed(app.company),
|
|
73054
|
-
manager: trimmed(app.manager),
|
|
73055
|
-
template: trimmed(app.template),
|
|
73056
|
-
hyperlinkBase: trimmed(app.hyperlinkBase),
|
|
73057
|
-
docSecurity: app.docSecurity,
|
|
73058
|
-
mmClips: app.mmClips,
|
|
73059
|
-
scaleCrop: app.scaleCrop,
|
|
73060
|
-
linksUpToDate: app.linksUpToDate,
|
|
73061
|
-
sharedDoc: app.sharedDoc,
|
|
73062
|
-
hyperlinksChanged: app.hyperlinksChanged
|
|
73063
|
-
};
|
|
73064
|
-
return anyDefined(result) ? result : void 0;
|
|
73065
|
-
}
|
|
73066
|
-
function toPptxCustomProperties(texts) {
|
|
73067
|
-
return texts.flatMap((entry2) => {
|
|
73068
|
-
const name = entry2.name.trim();
|
|
73069
|
-
if (!name) return [];
|
|
73070
|
-
const known = CUSTOM_TYPES.has(entry2.type);
|
|
73071
|
-
return [{ name, value: known ? entry2.text : "", type: known ? entry2.type : "unknown" }];
|
|
73072
|
-
});
|
|
73073
|
-
}
|
|
73074
|
-
function applyCoreOverrides(core, overrides) {
|
|
73075
|
-
const next = { ...core };
|
|
73076
|
-
for (const field of CORE_FIELDS) {
|
|
73077
|
-
const value = overrides?.[field];
|
|
73078
|
-
if (value === void 0) continue;
|
|
73079
|
-
const text2 = String(value).trim();
|
|
73080
|
-
if (text2) next[field] = text2;
|
|
73081
|
-
else delete next[field];
|
|
73082
|
-
}
|
|
73083
|
-
return next;
|
|
73084
|
-
}
|
|
73085
|
-
function applyAppOverrides(app, overrides) {
|
|
73086
|
-
const next = { ...app };
|
|
73087
|
-
for (const field of APP_TEXT_OVERRIDES) {
|
|
73088
|
-
const value = overrides?.[field];
|
|
73089
|
-
if (value === void 0) continue;
|
|
73090
|
-
const text2 = String(value).trim();
|
|
73091
|
-
if (text2) next[field] = text2;
|
|
73092
|
-
else delete next[field];
|
|
73093
|
-
}
|
|
73094
|
-
for (const field of APP_NUMBER_OVERRIDES) {
|
|
73095
|
-
const value = Number(overrides?.[field]);
|
|
73096
|
-
if (overrides?.[field] !== void 0 && Number.isFinite(value)) next[field] = Math.trunc(value);
|
|
73097
|
-
}
|
|
73098
|
-
return next;
|
|
73099
|
-
}
|
|
73100
|
-
function toCustomProperty(entry2) {
|
|
73101
|
-
const type = String(entry2.type || "lpwstr").trim().toLowerCase();
|
|
73102
|
-
return customPropertyFromText(
|
|
73103
|
-
entry2.name,
|
|
73104
|
-
CUSTOM_TYPES.has(type) ? type : "lpwstr",
|
|
73105
|
-
String(entry2.value ?? "")
|
|
73106
|
-
);
|
|
73107
|
-
}
|
|
73108
|
-
var CORE_FIELDS, APP_TEXT_OVERRIDES, APP_NUMBER_OVERRIDES, trimmed, anyDefined, CUSTOM_TYPES;
|
|
73109
|
-
var init_document_properties_model = __esm({
|
|
73110
|
-
"pptx/core/utils/document-properties-model.ts"() {
|
|
73111
|
-
init_properties();
|
|
73112
|
-
CORE_FIELDS = [
|
|
73113
|
-
"title",
|
|
73114
|
-
"subject",
|
|
73115
|
-
"creator",
|
|
73116
|
-
"keywords",
|
|
73117
|
-
"description",
|
|
73118
|
-
"lastModifiedBy",
|
|
73119
|
-
"revision",
|
|
73120
|
-
"created",
|
|
73121
|
-
"modified",
|
|
73122
|
-
"category",
|
|
73123
|
-
"contentStatus"
|
|
73124
|
-
];
|
|
73125
|
-
APP_TEXT_OVERRIDES = [
|
|
73126
|
-
"application",
|
|
73127
|
-
"appVersion",
|
|
73128
|
-
"presentationFormat",
|
|
73129
|
-
"company",
|
|
73130
|
-
"manager",
|
|
73131
|
-
"template"
|
|
73132
|
-
];
|
|
73133
|
-
APP_NUMBER_OVERRIDES = [
|
|
73134
|
-
"slides",
|
|
73135
|
-
"hiddenSlides",
|
|
73136
|
-
"notes",
|
|
73137
|
-
"totalTime",
|
|
73138
|
-
"words",
|
|
73139
|
-
"paragraphs"
|
|
73140
|
-
];
|
|
73141
|
-
trimmed = (value) => value?.trim() || void 0;
|
|
73142
|
-
anyDefined = (record2) => Object.values(record2).some((value) => value !== void 0);
|
|
73143
|
-
CUSTOM_TYPES = /* @__PURE__ */ new Set(["lpwstr", "i4", "bool", "filetime", "r8", "i2", "ui4", "lpstr"]);
|
|
73144
|
-
}
|
|
73145
|
-
});
|
|
73146
|
-
|
|
73147
73697
|
// pptx/core/services/custom-properties-package.ts
|
|
73148
73698
|
async function ensureCustomPropertiesPackagingArtifacts(context) {
|
|
73149
73699
|
const ctFile = context.zip.file("[Content_Types].xml");
|
|
@@ -107489,8 +108039,8 @@ function titleText(title) {
|
|
|
107489
108039
|
}
|
|
107490
108040
|
function scalingFromNeutral(axis, out) {
|
|
107491
108041
|
const { scaling } = axis;
|
|
107492
|
-
setOrRemove(out, "min",
|
|
107493
|
-
setOrRemove(out, "max",
|
|
108042
|
+
setOrRemove(out, "min", finite5(scaling.min));
|
|
108043
|
+
setOrRemove(out, "max", finite5(scaling.max));
|
|
107494
108044
|
const logBase = scaling.logBase !== void 0 && scaling.logBase > 0 ? scaling.logBase : void 0;
|
|
107495
108045
|
setOrRemove(out, "logBase", logBase);
|
|
107496
108046
|
setOrRemove(out, "logScale", logBase !== void 0 ? true : void 0);
|
|
@@ -107502,7 +108052,7 @@ function labelsFromNeutral(axis, out) {
|
|
|
107502
108052
|
setOrRemove(out, "minorTickMark", oneOf(TICK_MARKS2, axis.minorTickMark));
|
|
107503
108053
|
setOrRemove(out, "tickLblPos", oneOf(["high", "low", "nextTo", "none"], axis.tickLabelPosition));
|
|
107504
108054
|
setOrRemove(out, "crosses", oneOf(["autoZero", "min", "max"], axis.crosses));
|
|
107505
|
-
setOrRemove(out, "crossesAt",
|
|
108055
|
+
setOrRemove(out, "crossesAt", finite5(axis.crossesAt));
|
|
107506
108056
|
const valueAxis = type === "valAx";
|
|
107507
108057
|
const categoryOrDate = type === "catAx" || type === "dateAx";
|
|
107508
108058
|
const skips = type === "catAx" || type === "serAx";
|
|
@@ -107556,8 +108106,8 @@ function axisFromNeutral(axis, out) {
|
|
|
107556
108106
|
setOrRemove(out, "displayUnits", custom ? "custom" : builtIn);
|
|
107557
108107
|
setOrRemove(out, "displayUnitsValue", custom || void 0);
|
|
107558
108108
|
}
|
|
107559
|
-
setOrRemove(out, "majorUnit",
|
|
107560
|
-
setOrRemove(out, "minorUnit",
|
|
108109
|
+
setOrRemove(out, "majorUnit", finite5(axis.majorUnit));
|
|
108110
|
+
setOrRemove(out, "minorUnit", finite5(axis.minorUnit));
|
|
107561
108111
|
setOrRemove(
|
|
107562
108112
|
out,
|
|
107563
108113
|
"baseTimeUnit",
|
|
@@ -107578,12 +108128,12 @@ function axesFromNeutral(axes, styled) {
|
|
|
107578
108128
|
);
|
|
107579
108129
|
});
|
|
107580
108130
|
}
|
|
107581
|
-
var oneOf,
|
|
108131
|
+
var oneOf, finite5, positiveInteger, TICK_MARKS2, TIME_UNITS2, BUILT_IN_UNITS2;
|
|
107582
108132
|
var init_chart_from_neutral_axes = __esm({
|
|
107583
108133
|
"pptx/core/utils/chart-from-neutral-axes.ts"() {
|
|
107584
108134
|
init_chart_from_neutral_labels();
|
|
107585
108135
|
oneOf = (values, value) => value !== void 0 && values.includes(value) ? value : void 0;
|
|
107586
|
-
|
|
108136
|
+
finite5 = (value) => value !== void 0 && Number.isFinite(value) ? value : void 0;
|
|
107587
108137
|
positiveInteger = (value) => value !== void 0 && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
107588
108138
|
TICK_MARKS2 = ["cross", "in", "none", "out"];
|
|
107589
108139
|
TIME_UNITS2 = ["days", "months", "years"];
|
|
@@ -126827,26 +127377,26 @@ function buildImgEffects(effects2) {
|
|
|
126827
127377
|
if (effects2.backgroundRemoval) {
|
|
126828
127378
|
out.push({ "a14:backgroundRemoval": buildBackgroundRemovalNode(effects2.backgroundRemoval) });
|
|
126829
127379
|
}
|
|
126830
|
-
if (
|
|
127380
|
+
if (finite6(effects2.sharpenSoften?.amount)) {
|
|
126831
127381
|
out.push({ "a14:sharpenSoften": { "@_amount": round4(effects2.sharpenSoften.amount) } });
|
|
126832
127382
|
}
|
|
126833
127383
|
const bc = effects2.brightnessContrast;
|
|
126834
|
-
if (bc && (
|
|
127384
|
+
if (bc && (finite6(bc.bright) || finite6(bc.contrast))) {
|
|
126835
127385
|
const node = {};
|
|
126836
|
-
if (
|
|
127386
|
+
if (finite6(bc.bright)) {
|
|
126837
127387
|
node["@_bright"] = round4(bc.bright);
|
|
126838
127388
|
}
|
|
126839
|
-
if (
|
|
127389
|
+
if (finite6(bc.contrast)) {
|
|
126840
127390
|
node["@_contrast"] = round4(bc.contrast);
|
|
126841
127391
|
}
|
|
126842
127392
|
out.push({ "a14:brightnessContrast": node });
|
|
126843
127393
|
}
|
|
126844
|
-
if (
|
|
127394
|
+
if (finite6(effects2.colorTemperature?.colorTemp)) {
|
|
126845
127395
|
out.push({
|
|
126846
127396
|
"a14:colorTemperature": { "@_colorTemp": round4(effects2.colorTemperature.colorTemp) }
|
|
126847
127397
|
});
|
|
126848
127398
|
}
|
|
126849
|
-
if (
|
|
127399
|
+
if (finite6(effects2.colorSaturation?.sat)) {
|
|
126850
127400
|
out.push({ "a14:saturation": { "@_sat": round4(effects2.colorSaturation.sat) } });
|
|
126851
127401
|
}
|
|
126852
127402
|
const artistic = a14ArtisticElementName(effects2.artisticEffect);
|
|
@@ -126896,7 +127446,7 @@ function applyA14ImageExtension(blip, effects2) {
|
|
|
126896
127446
|
extLst[extKey] = entries.length === 1 ? entries[0] : entries;
|
|
126897
127447
|
blip[extLstKey] = extLst;
|
|
126898
127448
|
}
|
|
126899
|
-
var GALLERY_TO_A14, round4,
|
|
127449
|
+
var GALLERY_TO_A14, round4, finite6;
|
|
126900
127450
|
var init_image_a14_effects_writer = __esm({
|
|
126901
127451
|
"pptx/core/core/runtime/image-a14-effects-writer.ts"() {
|
|
126902
127452
|
init_image_a14_effects();
|
|
@@ -126929,7 +127479,7 @@ var init_image_a14_effects_writer = __esm({
|
|
|
126929
127479
|
watercolorSponge: "artisticWatercolorSponge"
|
|
126930
127480
|
};
|
|
126931
127481
|
round4 = (value) => String(Math.round(value));
|
|
126932
|
-
|
|
127482
|
+
finite6 = (value) => typeof value === "number" && Number.isFinite(value);
|
|
126933
127483
|
}
|
|
126934
127484
|
});
|
|
126935
127485
|
|
|
@@ -127109,6 +127659,21 @@ var init_image_alpha_effects = __esm({
|
|
|
127109
127659
|
}
|
|
127110
127660
|
});
|
|
127111
127661
|
|
|
127662
|
+
// pptx/core/core/runtime/blip-extension-order.ts
|
|
127663
|
+
function keepExtensionListLast(blip) {
|
|
127664
|
+
const key2 = Object.keys(blip).find((candidate) => candidate.split(":").at(-1) === "extLst");
|
|
127665
|
+
if (key2 === void 0) {
|
|
127666
|
+
return;
|
|
127667
|
+
}
|
|
127668
|
+
const value = blip[key2];
|
|
127669
|
+
delete blip[key2];
|
|
127670
|
+
blip[key2] = value;
|
|
127671
|
+
}
|
|
127672
|
+
var init_blip_extension_order = __esm({
|
|
127673
|
+
"pptx/core/core/runtime/blip-extension-order.ts"() {
|
|
127674
|
+
}
|
|
127675
|
+
});
|
|
127676
|
+
|
|
127112
127677
|
// pptx/core/core/runtime/image-color-effects.ts
|
|
127113
127678
|
function child32(parent, name) {
|
|
127114
127679
|
if (!parent) {
|
|
@@ -127636,16 +128201,16 @@ function buildParagraphPropertiesXml(textStyle, paragraphAlign, bulletInfo, spac
|
|
|
127636
128201
|
paragraphProps["@_rtl"] = textStyle.rtl ? "1" : "0";
|
|
127637
128202
|
}
|
|
127638
128203
|
if (typeof textStyle?.paragraphMarginLeft === "number" && Number.isFinite(textStyle.paragraphMarginLeft) && owns("paragraphMarginLeft")) {
|
|
127639
|
-
paragraphProps["@_marL"] = String(Math.round(textStyle.paragraphMarginLeft *
|
|
128204
|
+
paragraphProps["@_marL"] = String(Math.round(textStyle.paragraphMarginLeft * EMU_PER_PX10));
|
|
127640
128205
|
}
|
|
127641
128206
|
if (typeof textStyle?.paragraphMarginRight === "number" && Number.isFinite(textStyle.paragraphMarginRight) && owns("paragraphMarginRight")) {
|
|
127642
|
-
paragraphProps["@_marR"] = String(Math.round(textStyle.paragraphMarginRight *
|
|
128207
|
+
paragraphProps["@_marR"] = String(Math.round(textStyle.paragraphMarginRight * EMU_PER_PX10));
|
|
127643
128208
|
}
|
|
127644
128209
|
if (typeof textStyle?.paragraphIndent === "number" && Number.isFinite(textStyle.paragraphIndent) && owns("paragraphIndent")) {
|
|
127645
|
-
paragraphProps["@_indent"] = String(Math.round(textStyle.paragraphIndent *
|
|
128210
|
+
paragraphProps["@_indent"] = String(Math.round(textStyle.paragraphIndent * EMU_PER_PX10));
|
|
127646
128211
|
}
|
|
127647
128212
|
if (typeof textStyle?.defaultTabSize === "number" && Number.isFinite(textStyle.defaultTabSize) && owns("defaultTabSize")) {
|
|
127648
|
-
paragraphProps["@_defTabSz"] = String(Math.round(textStyle.defaultTabSize *
|
|
128213
|
+
paragraphProps["@_defTabSz"] = String(Math.round(textStyle.defaultTabSize * EMU_PER_PX10));
|
|
127649
128214
|
}
|
|
127650
128215
|
if (textStyle?.eaLineBreak !== void 0 && owns("eaLineBreak")) {
|
|
127651
128216
|
paragraphProps["@_eaLnBrk"] = textStyle.eaLineBreak ? "1" : "0";
|
|
@@ -127775,7 +128340,7 @@ function assembleParagraphXml(runs, paragraphProps, endParaRunProperties, markup
|
|
|
127775
128340
|
}
|
|
127776
128341
|
return paragraph2;
|
|
127777
128342
|
}
|
|
127778
|
-
var
|
|
128343
|
+
var EMU_PER_PX10;
|
|
127779
128344
|
var init_PptxHandlerRuntimeSaveParagraphHelpers = __esm({
|
|
127780
128345
|
"pptx/core/core/runtime/PptxHandlerRuntimeSaveParagraphHelpers.ts"() {
|
|
127781
128346
|
init_units2();
|
|
@@ -127784,7 +128349,7 @@ var init_PptxHandlerRuntimeSaveParagraphHelpers = __esm({
|
|
|
127784
128349
|
init_tab_stops();
|
|
127785
128350
|
init_paragraph_child_assembly();
|
|
127786
128351
|
init_uniform_segment_overrides();
|
|
127787
|
-
|
|
128352
|
+
EMU_PER_PX10 = EMU_PER_PIXEL;
|
|
127788
128353
|
}
|
|
127789
128354
|
});
|
|
127790
128355
|
|
|
@@ -129209,17 +129774,37 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
129209
129774
|
init_PptxHandlerRuntimeTableStyles();
|
|
129210
129775
|
init_shape_lock_containers();
|
|
129211
129776
|
PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
129777
|
+
/**
|
|
129778
|
+
* Report a slide jump whose index names no slide of the deck being saved.
|
|
129779
|
+
* It is not written: PowerPoint does not open a file with a slide jump that
|
|
129780
|
+
* has no slide relationship.
|
|
129781
|
+
*/
|
|
129782
|
+
reportMissingSlideJumpTarget(elementId, index) {
|
|
129783
|
+
this.compatibilityService?.reportWarning({
|
|
129784
|
+
code: "SAVE_SLIDE_JUMP_TARGET_MISSING",
|
|
129785
|
+
message: `A slide jump to slide index ${index} has no such slide in the saved deck; the link was not written.`,
|
|
129786
|
+
severity: "warning",
|
|
129787
|
+
scope: "element",
|
|
129788
|
+
...elementId ? { elementId } : {}
|
|
129789
|
+
});
|
|
129790
|
+
}
|
|
129212
129791
|
/**
|
|
129213
129792
|
* Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
|
|
129214
129793
|
* a `p:cNvPr` parent.
|
|
129215
129794
|
*/
|
|
129216
|
-
serializeSingleAction(cNvPr, nodeName, action, links) {
|
|
129795
|
+
serializeSingleAction(cNvPr, nodeName, action, links, elementId) {
|
|
129217
129796
|
if (!action) {
|
|
129218
129797
|
delete cNvPr[nodeName];
|
|
129219
129798
|
return;
|
|
129220
129799
|
}
|
|
129221
129800
|
const node = {};
|
|
129222
|
-
const
|
|
129801
|
+
const slideJumpIndex = /^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? action.targetSlideIndex : void 0;
|
|
129802
|
+
const url = action.url?.trim() || (slideJumpIndex !== void 0 ? links.slideTargetAt?.(slideJumpIndex) : void 0);
|
|
129803
|
+
if (!url && slideJumpIndex !== void 0 && links.slideTargetAt) {
|
|
129804
|
+
this.reportMissingSlideJumpTarget(elementId, slideJumpIndex);
|
|
129805
|
+
delete cNvPr[nodeName];
|
|
129806
|
+
return;
|
|
129807
|
+
}
|
|
129223
129808
|
let rId = action.rId;
|
|
129224
129809
|
if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
|
|
129225
129810
|
rId = void 0;
|
|
@@ -129310,8 +129895,8 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
129310
129895
|
}
|
|
129311
129896
|
const actionClick = "actionClick" in el ? el.actionClick : void 0;
|
|
129312
129897
|
const actionHover = "actionHover" in el ? el.actionHover : void 0;
|
|
129313
|
-
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
|
|
129314
|
-
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
|
|
129898
|
+
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links, el.id);
|
|
129899
|
+
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links, el.id);
|
|
129315
129900
|
const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
|
|
129316
129901
|
serializeDecorativeExtension(cNvPr, isDecorative);
|
|
129317
129902
|
}
|
|
@@ -131347,12 +131932,12 @@ function buildTextRunEffectListXml(style, parseColor) {
|
|
|
131347
131932
|
}
|
|
131348
131933
|
if (hasTextBlur) {
|
|
131349
131934
|
effectLst["a:blur"] = {
|
|
131350
|
-
"@_rad": String(Math.round((style.textBlurRadius ?? 0) *
|
|
131935
|
+
"@_rad": String(Math.round((style.textBlurRadius ?? 0) * EMU_PER_PX11))
|
|
131351
131936
|
};
|
|
131352
131937
|
}
|
|
131353
131938
|
if (hasTextSoftEdge) {
|
|
131354
131939
|
effectLst["a:softEdge"] = {
|
|
131355
|
-
"@_rad": String(Math.round((style.textSoftEdgeRadius ?? 0) *
|
|
131940
|
+
"@_rad": String(Math.round((style.textSoftEdgeRadius ?? 0) * EMU_PER_PX11))
|
|
131356
131941
|
};
|
|
131357
131942
|
}
|
|
131358
131943
|
if (hasTextAlphaModFix) {
|
|
@@ -131394,8 +131979,8 @@ function buildOuterShadowNode(style) {
|
|
|
131394
131979
|
const oy = style.textShadowOffsetY ?? 0;
|
|
131395
131980
|
const { distance, directionDegrees } = shadowOffsetToDistanceAndDirection(ox, oy);
|
|
131396
131981
|
return {
|
|
131397
|
-
"@_blurRad": String(Math.round((style.textShadowBlur ?? 4) *
|
|
131398
|
-
"@_dist": String(Math.round(distance *
|
|
131982
|
+
"@_blurRad": String(Math.round((style.textShadowBlur ?? 4) * EMU_PER_PX11)),
|
|
131983
|
+
"@_dist": String(Math.round(distance * EMU_PER_PX11)),
|
|
131399
131984
|
"@_dir": positiveFixedAngleAttribute(directionDegrees),
|
|
131400
131985
|
"a:srgbClr": buildShadowColorNode(style.textShadowColor || "#000000", style.textShadowOpacity)
|
|
131401
131986
|
};
|
|
@@ -131407,8 +131992,8 @@ function buildInnerShadowNode(style, parseColor) {
|
|
|
131407
131992
|
const fallbackHex = style.textInnerShadowColor || "#000000";
|
|
131408
131993
|
const resolvedOriginal = style.textInnerShadowColorXml ? parseColor?.(style.textInnerShadowColorXml) : void 0;
|
|
131409
131994
|
return {
|
|
131410
|
-
"@_blurRad": String(Math.round((style.textInnerShadowBlur ?? 3) *
|
|
131411
|
-
"@_dist": String(Math.round(distance *
|
|
131995
|
+
"@_blurRad": String(Math.round((style.textInnerShadowBlur ?? 3) * EMU_PER_PX11)),
|
|
131996
|
+
"@_dist": String(Math.round(distance * EMU_PER_PX11)),
|
|
131412
131997
|
"@_dir": positiveFixedAngleAttribute(directionDegrees),
|
|
131413
131998
|
...serializeColorChoiceWithRef(
|
|
131414
131999
|
style.textInnerShadowColorRef,
|
|
@@ -131424,7 +132009,7 @@ function buildPresetShadowNode(style) {
|
|
|
131424
132009
|
"@_prst": style.textPresetShadowName
|
|
131425
132010
|
};
|
|
131426
132011
|
if (typeof style.textPresetShadowDistance === "number") {
|
|
131427
|
-
node["@_dist"] = String(Math.round(style.textPresetShadowDistance *
|
|
132012
|
+
node["@_dist"] = String(Math.round(style.textPresetShadowDistance * EMU_PER_PX11));
|
|
131428
132013
|
}
|
|
131429
132014
|
if (typeof style.textPresetShadowDirection === "number") {
|
|
131430
132015
|
node["@_dir"] = positiveFixedAngleAttribute(style.textPresetShadowDirection);
|
|
@@ -131441,7 +132026,7 @@ function buildGlowNode(style, parseColor) {
|
|
|
131441
132026
|
const fallbackHex = style.textGlowColor || "#ffff00";
|
|
131442
132027
|
const resolvedOriginal = style.textGlowColorXml ? parseColor?.(style.textGlowColorXml) : void 0;
|
|
131443
132028
|
return {
|
|
131444
|
-
"@_rad": String(Math.round((style.textGlowRadius ?? 6) *
|
|
132029
|
+
"@_rad": String(Math.round((style.textGlowRadius ?? 6) * EMU_PER_PX11)),
|
|
131445
132030
|
...serializeColorChoiceWithRef(
|
|
131446
132031
|
style.textGlowColorRef,
|
|
131447
132032
|
style.textGlowColorXml,
|
|
@@ -131454,7 +132039,7 @@ function buildGlowNode(style, parseColor) {
|
|
|
131454
132039
|
function buildReflectionNode(style) {
|
|
131455
132040
|
const refl = {};
|
|
131456
132041
|
if (typeof style.textReflectionBlur === "number") {
|
|
131457
|
-
refl["@_blurRad"] = String(Math.round(style.textReflectionBlur *
|
|
132042
|
+
refl["@_blurRad"] = String(Math.round(style.textReflectionBlur * EMU_PER_PX11));
|
|
131458
132043
|
}
|
|
131459
132044
|
if (typeof style.textReflectionStartOpacity === "number") {
|
|
131460
132045
|
refl["@_stA"] = String(Math.round(style.textReflectionStartOpacity * 1e5));
|
|
@@ -131466,7 +132051,7 @@ function buildReflectionNode(style) {
|
|
|
131466
132051
|
refl["@_endPos"] = String(Math.round(style.textReflectionEndPosition * 1e5));
|
|
131467
132052
|
}
|
|
131468
132053
|
if (typeof style.textReflectionOffset === "number") {
|
|
131469
|
-
refl["@_dist"] = String(Math.round(style.textReflectionOffset *
|
|
132054
|
+
refl["@_dist"] = String(Math.round(style.textReflectionOffset * EMU_PER_PX11));
|
|
131470
132055
|
}
|
|
131471
132056
|
if (typeof style.textReflectionDirection === "number") {
|
|
131472
132057
|
refl["@_dir"] = positiveFixedAngleAttribute(style.textReflectionDirection);
|
|
@@ -131521,12 +132106,12 @@ function buildClrChangeNode(style) {
|
|
|
131521
132106
|
}
|
|
131522
132107
|
};
|
|
131523
132108
|
}
|
|
131524
|
-
var
|
|
132109
|
+
var EMU_PER_PX11;
|
|
131525
132110
|
var init_text_run_effect_xml_builder = __esm({
|
|
131526
132111
|
"pptx/core/core/runtime/text-run-effect-xml-builder.ts"() {
|
|
131527
132112
|
init_color_xml_preservation();
|
|
131528
132113
|
init_positive_fixed_angle();
|
|
131529
|
-
|
|
132114
|
+
EMU_PER_PX11 = 9525;
|
|
131530
132115
|
}
|
|
131531
132116
|
});
|
|
131532
132117
|
|
|
@@ -133148,6 +133733,7 @@ var init_PptxHandlerRuntimeSaveImageEffects = __esm({
|
|
|
133148
133733
|
init_crop_shape_geometry();
|
|
133149
133734
|
init_image_a14_effects_writer();
|
|
133150
133735
|
init_image_alpha_effects();
|
|
133736
|
+
init_blip_extension_order();
|
|
133151
133737
|
init_image_color_effects();
|
|
133152
133738
|
init_image_crop_save();
|
|
133153
133739
|
init_PptxHandlerRuntimeSaveShapeXml();
|
|
@@ -133265,6 +133851,7 @@ var init_PptxHandlerRuntimeSaveImageEffects = __esm({
|
|
|
133265
133851
|
delete blip["a:blur"];
|
|
133266
133852
|
}
|
|
133267
133853
|
applyA14ImageExtension(blip, nextEffects);
|
|
133854
|
+
keepExtensionListLast(blip);
|
|
133268
133855
|
}
|
|
133269
133856
|
normalizePresetGeometry(shapeType) {
|
|
133270
133857
|
return this.elementXmlBuilder.normalizePresetGeometry(shapeType);
|
|
@@ -140240,6 +140827,58 @@ var init_PptxHandlerRuntimeSaveEffectsWriter = __esm({
|
|
|
140240
140827
|
}
|
|
140241
140828
|
});
|
|
140242
140829
|
|
|
140830
|
+
// pptx/core/core/runtime/run-slide-jump-targets.ts
|
|
140831
|
+
function withRunSlideJumpTarget(style, slideTargetAt, onMissing) {
|
|
140832
|
+
if (!style || !slideTargetAt) {
|
|
140833
|
+
return style;
|
|
140834
|
+
}
|
|
140835
|
+
const index = style.hyperlinkTargetSlideIndex;
|
|
140836
|
+
if (typeof index !== "number" || style.hyperlinkRId) {
|
|
140837
|
+
return style;
|
|
140838
|
+
}
|
|
140839
|
+
const hyperlink = style.hyperlink?.trim();
|
|
140840
|
+
if (hyperlink && !hyperlink.startsWith("ppaction://")) {
|
|
140841
|
+
return style;
|
|
140842
|
+
}
|
|
140843
|
+
if (style.hyperlinkAction && style.hyperlinkAction !== SLIDE_JUMP_ACTION2) {
|
|
140844
|
+
return style;
|
|
140845
|
+
}
|
|
140846
|
+
const target = slideTargetAt(index);
|
|
140847
|
+
if (!target) {
|
|
140848
|
+
onMissing?.(index);
|
|
140849
|
+
const {
|
|
140850
|
+
hyperlink: _hyperlink,
|
|
140851
|
+
hyperlinkAction: _action,
|
|
140852
|
+
hyperlinkTargetSlideIndex: _index,
|
|
140853
|
+
hyperlinkTooltip: _tooltip,
|
|
140854
|
+
...rest
|
|
140855
|
+
} = style;
|
|
140856
|
+
return rest;
|
|
140857
|
+
}
|
|
140858
|
+
return { ...style, hyperlink: target, hyperlinkAction: SLIDE_JUMP_ACTION2 };
|
|
140859
|
+
}
|
|
140860
|
+
function withSegmentSlideJumpTargets(segments, slideTargetAt, onMissing) {
|
|
140861
|
+
if (!segments || !slideTargetAt) {
|
|
140862
|
+
return segments;
|
|
140863
|
+
}
|
|
140864
|
+
let changed = false;
|
|
140865
|
+
const next = segments.map((segment) => {
|
|
140866
|
+
const style = withRunSlideJumpTarget(segment.style, slideTargetAt, onMissing);
|
|
140867
|
+
if (style === segment.style) {
|
|
140868
|
+
return segment;
|
|
140869
|
+
}
|
|
140870
|
+
changed = true;
|
|
140871
|
+
return { ...segment, style };
|
|
140872
|
+
});
|
|
140873
|
+
return changed ? next : segments;
|
|
140874
|
+
}
|
|
140875
|
+
var SLIDE_JUMP_ACTION2;
|
|
140876
|
+
var init_run_slide_jump_targets = __esm({
|
|
140877
|
+
"pptx/core/core/runtime/run-slide-jump-targets.ts"() {
|
|
140878
|
+
SLIDE_JUMP_ACTION2 = "ppaction://hlinksldjump";
|
|
140879
|
+
}
|
|
140880
|
+
});
|
|
140881
|
+
|
|
140243
140882
|
// pptx/core/core/runtime/PptxHandlerRuntimeSaveTextWriter.ts
|
|
140244
140883
|
function firstWarpGuideName(preset) {
|
|
140245
140884
|
return preset !== void 0 && ADJ1_WARP_PRESETS.has(preset) ? "adj1" : "adj";
|
|
@@ -140254,6 +140893,7 @@ var init_PptxHandlerRuntimeSaveTextWriter = __esm({
|
|
|
140254
140893
|
init_element_paragraph_geometry();
|
|
140255
140894
|
init_paragraph_scoped_segment_state();
|
|
140256
140895
|
init_PptxHandlerRuntimeSaveEffectsWriter();
|
|
140896
|
+
init_run_slide_jump_targets();
|
|
140257
140897
|
init_PptxHandlerRuntimeSaveParagraphHelpers();
|
|
140258
140898
|
ADJ1_WARP_PRESETS = /* @__PURE__ */ new Set([
|
|
140259
140899
|
"textWave1",
|
|
@@ -140275,7 +140915,7 @@ var init_PptxHandlerRuntimeSaveTextWriter = __esm({
|
|
|
140275
140915
|
* text chains), and delegates paragraph creation to
|
|
140276
140916
|
* `createParagraphsFromTextContent`.
|
|
140277
140917
|
*/
|
|
140278
|
-
applyTextBodyContent(shape2, el, resolveHyperlinkRelationshipId, getSlideRelationshipMap) {
|
|
140918
|
+
applyTextBodyContent(shape2, el, resolveHyperlinkRelationshipId, getSlideRelationshipMap, slideTargetAt) {
|
|
140279
140919
|
const hasEditableTextContent = typeof el.text === "string" || (el.textSegments?.length ?? 0) > 0;
|
|
140280
140920
|
if (!hasEditableTextContent) {
|
|
140281
140921
|
return;
|
|
@@ -140398,10 +141038,15 @@ var init_PptxHandlerRuntimeSaveTextWriter = __esm({
|
|
|
140398
141038
|
);
|
|
140399
141039
|
}
|
|
140400
141040
|
txBody["a:bodyPr"] = bodyPr;
|
|
141041
|
+
const onMissing = (index) => this.reportMissingSlideJumpTarget(el.id, index);
|
|
140401
141042
|
txBody["a:p"] = this.createParagraphsFromTextContent(
|
|
140402
141043
|
textValueForSave,
|
|
140403
|
-
|
|
140404
|
-
|
|
141044
|
+
withRunSlideJumpTarget(
|
|
141045
|
+
this.routeElementParagraphGeometry(txBody, el.textStyle),
|
|
141046
|
+
slideTargetAt,
|
|
141047
|
+
onMissing
|
|
141048
|
+
),
|
|
141049
|
+
withSegmentSlideJumpTargets(textSegmentsForSave, slideTargetAt, onMissing),
|
|
140405
141050
|
resolveHyperlinkRelationshipId
|
|
140406
141051
|
);
|
|
140407
141052
|
}
|
|
@@ -140518,6 +141163,101 @@ var init_save_picture_geometry_gate = __esm({
|
|
|
140518
141163
|
}
|
|
140519
141164
|
});
|
|
140520
141165
|
|
|
141166
|
+
// pptx/core/core/runtime/save-picture-fill.ts
|
|
141167
|
+
function drawingPictureLayout(layout, emuPerPx) {
|
|
141168
|
+
const offset = (px2) => px2 === void 0 ? void 0 : Math.round(px2 * emuPerPx);
|
|
141169
|
+
if ([
|
|
141170
|
+
layout.tileOffsetX,
|
|
141171
|
+
layout.tileOffsetY,
|
|
141172
|
+
layout.tileScaleX,
|
|
141173
|
+
layout.tileScaleY,
|
|
141174
|
+
layout.tileFlip,
|
|
141175
|
+
layout.tileAlignment
|
|
141176
|
+
].some(has2)) {
|
|
141177
|
+
const tile = {};
|
|
141178
|
+
const offsetX = offset(layout.tileOffsetX);
|
|
141179
|
+
const offsetY = offset(layout.tileOffsetY);
|
|
141180
|
+
if (offsetX !== void 0) tile.offsetXEmu = offsetX;
|
|
141181
|
+
if (offsetY !== void 0) tile.offsetYEmu = offsetY;
|
|
141182
|
+
if (layout.tileScaleX !== void 0) tile.scaleX = layout.tileScaleX;
|
|
141183
|
+
if (layout.tileScaleY !== void 0) tile.scaleY = layout.tileScaleY;
|
|
141184
|
+
if (layout.tileFlip !== void 0) tile.flip = layout.tileFlip;
|
|
141185
|
+
if (layout.tileAlignment !== void 0) tile.alignment = layout.tileAlignment;
|
|
141186
|
+
return { tile };
|
|
141187
|
+
}
|
|
141188
|
+
if ([layout.fillRectLeft, layout.fillRectTop, layout.fillRectRight, layout.fillRectBottom].some(has2)) {
|
|
141189
|
+
return {
|
|
141190
|
+
fillRect: {
|
|
141191
|
+
l: layout.fillRectLeft ?? 0,
|
|
141192
|
+
t: layout.fillRectTop ?? 0,
|
|
141193
|
+
r: layout.fillRectRight ?? 0,
|
|
141194
|
+
b: layout.fillRectBottom ?? 0
|
|
141195
|
+
}
|
|
141196
|
+
};
|
|
141197
|
+
}
|
|
141198
|
+
return void 0;
|
|
141199
|
+
}
|
|
141200
|
+
function blipFillXml(relId, layout, parse) {
|
|
141201
|
+
const xml = drawingFillXml({ kind: "picture", relId, layout }) ?? "";
|
|
141202
|
+
const node = parse(xml)["a:blipFill"];
|
|
141203
|
+
delete node["@_xmlns:a"];
|
|
141204
|
+
delete node["@_xmlns:r"];
|
|
141205
|
+
return node;
|
|
141206
|
+
}
|
|
141207
|
+
function checkedBlipFill(relId, layout, ctx) {
|
|
141208
|
+
try {
|
|
141209
|
+
return blipFillXml(relId, layout, ctx.parse);
|
|
141210
|
+
} catch (error) {
|
|
141211
|
+
if (!(error instanceof RangeError)) {
|
|
141212
|
+
throw error;
|
|
141213
|
+
}
|
|
141214
|
+
ctx.warn(
|
|
141215
|
+
"SAVE_PICTURE_LAYOUT_INVALID",
|
|
141216
|
+
`Picture tile or fill rectangle could not be written (${error.message}); the picture is stretched over its frame instead.`
|
|
141217
|
+
);
|
|
141218
|
+
const { rotWithShape } = layout;
|
|
141219
|
+
return blipFillXml(relId, rotWithShape === void 0 ? {} : { rotWithShape }, ctx.parse);
|
|
141220
|
+
}
|
|
141221
|
+
}
|
|
141222
|
+
function writeNewShapePictureFill(spPr, style, ctx) {
|
|
141223
|
+
const relId = style.fillImageUrl ? ctx.embed(style.fillImageUrl) : void 0;
|
|
141224
|
+
if (!relId) {
|
|
141225
|
+
ctx.warn(
|
|
141226
|
+
"SAVE_SHAPE_PICTURE_FILL_UNSUPPORTED",
|
|
141227
|
+
"Shape picture fill could not be embedded (it needs a data: URL); the shape was saved without a fill."
|
|
141228
|
+
);
|
|
141229
|
+
return;
|
|
141230
|
+
}
|
|
141231
|
+
const layout = {
|
|
141232
|
+
...drawingPictureLayout(style.fillImageLayout ?? {}, ctx.emuPerPx),
|
|
141233
|
+
rotWithShape: style.fillImageRotWithShape ?? true
|
|
141234
|
+
};
|
|
141235
|
+
setFillChoice(spPr, "a:blipFill", checkedBlipFill(relId, layout, ctx));
|
|
141236
|
+
}
|
|
141237
|
+
function applyNewPictureLayout(blipFill, layout, ctx) {
|
|
141238
|
+
const drawingLayout = drawingPictureLayout(layout, ctx.emuPerPx);
|
|
141239
|
+
const relId = blipFill["a:blip"]?.["@_r:embed"];
|
|
141240
|
+
if (!drawingLayout || typeof relId !== "string") {
|
|
141241
|
+
return;
|
|
141242
|
+
}
|
|
141243
|
+
const built = checkedBlipFill(relId, drawingLayout, ctx);
|
|
141244
|
+
delete blipFill["a:stretch"];
|
|
141245
|
+
delete blipFill["a:tile"];
|
|
141246
|
+
for (const key2 of ["a:tile", "a:stretch"]) {
|
|
141247
|
+
if (built[key2] !== void 0) {
|
|
141248
|
+
blipFill[key2] = built[key2];
|
|
141249
|
+
}
|
|
141250
|
+
}
|
|
141251
|
+
}
|
|
141252
|
+
var has2;
|
|
141253
|
+
var init_save_picture_fill = __esm({
|
|
141254
|
+
"pptx/core/core/runtime/save-picture-fill.ts"() {
|
|
141255
|
+
init_write_fill();
|
|
141256
|
+
init_fill_choice_group();
|
|
141257
|
+
has2 = (value) => value !== void 0;
|
|
141258
|
+
}
|
|
141259
|
+
});
|
|
141260
|
+
|
|
140521
141261
|
// pptx/core/core/runtime/PptxHandlerRuntimeSaveElementEmbedding.ts
|
|
140522
141262
|
function getMediaReferenceContainer(shape2) {
|
|
140523
141263
|
if (!shape2) {
|
|
@@ -140539,9 +141279,11 @@ var init_PptxHandlerRuntimeSaveElementEmbedding = __esm({
|
|
|
140539
141279
|
init_diagram_relationship_ids();
|
|
140540
141280
|
init_drawing_media_reference();
|
|
140541
141281
|
init_xml_access();
|
|
141282
|
+
init_picture_svg_blip();
|
|
140542
141283
|
init_PptxHandlerRuntimeSaveTextWriter();
|
|
140543
141284
|
init_save_picture_geometry_gate();
|
|
140544
|
-
|
|
141285
|
+
init_save_picture_fill();
|
|
141286
|
+
PptxHandlerRuntime32 = class _PptxHandlerRuntime extends PptxHandlerRuntime31 {
|
|
140545
141287
|
/** Serialize table, chart, and SmartArt data when applicable. */
|
|
140546
141288
|
applyDataSerialization(shape2, el, slideId) {
|
|
140547
141289
|
if (el.type === "table" && "tableData" in el && el.tableData) {
|
|
@@ -140628,15 +141370,29 @@ var init_PptxHandlerRuntimeSaveElementEmbedding = __esm({
|
|
|
140628
141370
|
if (parsedImage) {
|
|
140629
141371
|
let targetImagePath = el.imagePath;
|
|
140630
141372
|
if (!targetImagePath) {
|
|
140631
|
-
|
|
140632
|
-
|
|
141373
|
+
const media = ctx.saveSession.mediaPathForContent(parsedImage.bytes, parsedImage.extension);
|
|
141374
|
+
targetImagePath = media.path;
|
|
140633
141375
|
const relativeMediaPath = targetImagePath.replace(/^ppt\//u, "../");
|
|
140634
|
-
ctx.slideRelationships.
|
|
140635
|
-
"@
|
|
140636
|
-
|
|
140637
|
-
|
|
140638
|
-
|
|
141376
|
+
const existingRelationshipId = media.reused ? ctx.slideRelationships.find(
|
|
141377
|
+
(rel) => rel["@_Type"] === ctx.slideImageRelationshipType && rel["@_Target"] === relativeMediaPath
|
|
141378
|
+
)?.["@_Id"] : void 0;
|
|
141379
|
+
const relationshipId2 = typeof existingRelationshipId === "string" ? existingRelationshipId : ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
141380
|
+
if (relationshipId2 !== existingRelationshipId) {
|
|
141381
|
+
ctx.slideRelationships.push({
|
|
141382
|
+
"@_Id": relationshipId2,
|
|
141383
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
141384
|
+
"@_Target": relativeMediaPath
|
|
141385
|
+
});
|
|
141386
|
+
}
|
|
140639
141387
|
shape2 = this.createPictureXml(el, relationshipId2);
|
|
141388
|
+
this.embedNewSvgVariant(el, shape2, ctx);
|
|
141389
|
+
const blipFill = shape2["p:blipFill"];
|
|
141390
|
+
if (blipFill) {
|
|
141391
|
+
applyNewPictureLayout(blipFill, el, this.pictureFillSaveContext(el, ctx));
|
|
141392
|
+
}
|
|
141393
|
+
if (media.reused) {
|
|
141394
|
+
return shape2;
|
|
141395
|
+
}
|
|
140640
141396
|
}
|
|
140641
141397
|
if (targetImagePath) {
|
|
140642
141398
|
const targetExt = targetImagePath.toLowerCase().match(/\.(?<ext>[^./\\]+)$/u)?.groups?.["ext"];
|
|
@@ -140657,6 +141413,71 @@ var init_PptxHandlerRuntimeSaveElementEmbedding = __esm({
|
|
|
140657
141413
|
}
|
|
140658
141414
|
return shape2;
|
|
140659
141415
|
}
|
|
141416
|
+
/** Add an image relationship from the slide to `mediaPath`; its id. */
|
|
141417
|
+
addSlideImageRelationship(mediaPath, ctx) {
|
|
141418
|
+
const relationshipId2 = ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
141419
|
+
ctx.slideRelationships.push({
|
|
141420
|
+
"@_Id": relationshipId2,
|
|
141421
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
141422
|
+
"@_Target": mediaPath.replace(/^ppt\//u, "../")
|
|
141423
|
+
});
|
|
141424
|
+
return relationshipId2;
|
|
141425
|
+
}
|
|
141426
|
+
/** What the picture-fill writers need, bound to `el` on the slide being saved. */
|
|
141427
|
+
pictureFillSaveContext(el, ctx) {
|
|
141428
|
+
return {
|
|
141429
|
+
emuPerPx: _PptxHandlerRuntime.EMU_PER_PX,
|
|
141430
|
+
parse: (xml) => this.parser.parse(xml),
|
|
141431
|
+
embed: (dataUrl) => {
|
|
141432
|
+
const parsed = this.parseDataUrlToBytes(dataUrl);
|
|
141433
|
+
if (!parsed) {
|
|
141434
|
+
return void 0;
|
|
141435
|
+
}
|
|
141436
|
+
const mediaPath = ctx.saveSession.nextMediaPath(parsed.extension);
|
|
141437
|
+
this.zip.file(mediaPath, parsed.bytes);
|
|
141438
|
+
return this.addSlideImageRelationship(mediaPath, ctx);
|
|
141439
|
+
},
|
|
141440
|
+
warn: (code, message) => this.compatibilityService.reportWarning({
|
|
141441
|
+
code,
|
|
141442
|
+
message,
|
|
141443
|
+
scope: "element",
|
|
141444
|
+
slideId: ctx.slide.id,
|
|
141445
|
+
elementId: el.id
|
|
141446
|
+
})
|
|
141447
|
+
};
|
|
141448
|
+
}
|
|
141449
|
+
/**
|
|
141450
|
+
* For a new SVG picture (`svgData` without a part yet), write the SVG part
|
|
141451
|
+
* and point the blip's `asvg:svgBlip` extension at it; the blip itself
|
|
141452
|
+
* embeds the raster (`imageData`).
|
|
141453
|
+
*/
|
|
141454
|
+
embedNewSvgVariant(el, picture, ctx) {
|
|
141455
|
+
const svgData = el.svgData;
|
|
141456
|
+
if (!svgData || el.svgPath) {
|
|
141457
|
+
return;
|
|
141458
|
+
}
|
|
141459
|
+
const parsed = this.parseDataUrlToBytes(svgData);
|
|
141460
|
+
if (!parsed || parsed.extension.toLowerCase() !== "svg") {
|
|
141461
|
+
return;
|
|
141462
|
+
}
|
|
141463
|
+
const media = ctx.saveSession.mediaPathForContent(parsed.bytes, "svg");
|
|
141464
|
+
const target = media.path.replace(/^ppt\//u, "../");
|
|
141465
|
+
const existing = media.reused ? ctx.slideRelationships.find(
|
|
141466
|
+
(rel) => rel["@_Type"] === ctx.slideImageRelationshipType && rel["@_Target"] === target
|
|
141467
|
+
)?.["@_Id"] : void 0;
|
|
141468
|
+
const relationshipId2 = typeof existing === "string" ? existing : ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
141469
|
+
if (relationshipId2 !== existing) {
|
|
141470
|
+
ctx.slideRelationships.push({
|
|
141471
|
+
"@_Id": relationshipId2,
|
|
141472
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
141473
|
+
"@_Target": target
|
|
141474
|
+
});
|
|
141475
|
+
}
|
|
141476
|
+
if (!media.reused) {
|
|
141477
|
+
this.zip.file(media.path, parsed.bytes);
|
|
141478
|
+
}
|
|
141479
|
+
addSvgBlipExtension(picture, relationshipId2);
|
|
141480
|
+
}
|
|
140660
141481
|
/** Embed media data and manage relationships for media elements. */
|
|
140661
141482
|
processMediaEmbedding(mediaElement, shape2, ctx) {
|
|
140662
141483
|
const mediaType = mediaElement.mediaType === "audio" ? "audio" : "video";
|
|
@@ -142024,6 +142845,7 @@ var init_PptxHandlerRuntimeSaveElementWriter = __esm({
|
|
|
142024
142845
|
init_xml_access();
|
|
142025
142846
|
init_xml_reorder();
|
|
142026
142847
|
init_PptxHandlerRuntimeSaveContentPartInk();
|
|
142848
|
+
init_save_picture_fill();
|
|
142027
142849
|
init_PptxHandlerRuntimeSaveShapeXml();
|
|
142028
142850
|
init_template_group_node();
|
|
142029
142851
|
PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime40 {
|
|
@@ -142435,6 +143257,10 @@ var init_PptxHandlerRuntimeSaveElementWriter = __esm({
|
|
|
142435
143257
|
}
|
|
142436
143258
|
if (!shape2 && (el.type === "text" || el.type === "shape")) {
|
|
142437
143259
|
shape2 = this.createElementXml(el);
|
|
143260
|
+
const spPr = ensureXmlChild(shape2, "p:spPr");
|
|
143261
|
+
if (spPr && el.shapeStyle?.fillMode === "image") {
|
|
143262
|
+
writeNewShapePictureFill(spPr, el.shapeStyle, this.pictureFillSaveContext(el, ctx));
|
|
143263
|
+
}
|
|
142438
143264
|
}
|
|
142439
143265
|
if (!shape2 && el.type === "connector") {
|
|
142440
143266
|
shape2 = this.createConnectorXml(el);
|
|
@@ -142547,7 +143373,8 @@ var init_PptxHandlerRuntimeSaveElementWriter = __esm({
|
|
|
142547
143373
|
shape2,
|
|
142548
143374
|
el,
|
|
142549
143375
|
ctx.resolveHyperlinkRelationshipId,
|
|
142550
|
-
ctx.getSlideRelationshipMap
|
|
143376
|
+
ctx.getSlideRelationshipMap,
|
|
143377
|
+
ctx.slideTargetAt
|
|
142551
143378
|
);
|
|
142552
143379
|
}
|
|
142553
143380
|
this.applyDataSerialization(shape2, el, ctx.slide.id);
|