ooxml-core 1.26.0 → 1.27.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.
Files changed (34) hide show
  1. package/dist/{PptxHandler-CVYP5PAN.cjs → PptxHandler-6ZGALYYM.cjs} +2 -2
  2. package/dist/{PptxHandler-5QBRBXRX.mjs → PptxHandler-HEPPGI32.mjs} +2 -2
  3. package/dist/{PptxHandler-TOAD6P7N.mjs → PptxHandler-NO7MNGOW.mjs} +1 -1
  4. package/dist/{PresentationBuilder-M5UXW4AF.mjs → PresentationBuilder-BCDRASRT.mjs} +2 -2
  5. package/dist/{PresentationBuilder-RVQZCTIO.cjs → PresentationBuilder-HFGK2BWN.cjs} +4 -4
  6. package/dist/{PresentationBuilder-EBVNYMLE.mjs → PresentationBuilder-OQOZE76H.mjs} +1 -1
  7. package/dist/{chunk-KONCS53X.mjs → chunk-4SGBL2H4.mjs} +4 -4
  8. package/dist/{chunk-ZXPPM63Y.mjs → chunk-63GRFYAN.mjs} +1 -1
  9. package/dist/{chunk-K6OFJ5GJ.mjs → chunk-7E45SAZJ.mjs} +201 -175
  10. package/dist/{chunk-EBJ724RB.mjs → chunk-ANIFYTKH.mjs} +1 -1
  11. package/dist/{chunk-EEHK52XB.cjs → chunk-HYCOBPCC.cjs} +201 -175
  12. package/dist/{chunk-4IIR2QEH.mjs → chunk-KE2FUFIU.mjs} +202 -176
  13. package/dist/{chunk-DNYZX6YG.mjs → chunk-VRJOOHWV.mjs} +1 -1
  14. package/dist/pptx/automation/index.cjs +209 -182
  15. package/dist/pptx/automation/index.d.ts +3 -3
  16. package/dist/pptx/automation/index.mjs +5 -5
  17. package/dist/pptx/chunks/{index-D3gKRIAi.d.ts → index-CbFowkp4.d.ts} +3 -3
  18. package/dist/pptx/chunks/{index-D3gKRIAi.d.ts.map → index-CbFowkp4.d.ts.map} +1 -1
  19. package/dist/pptx/chunks/{index-BOpULlxB.d.ts → index-D4FnOx6x.d.ts} +2 -2
  20. package/dist/pptx/chunks/{index-BOpULlxB.d.ts.map → index-D4FnOx6x.d.ts.map} +1 -1
  21. package/dist/pptx/chunks/{index-B94RKk84.d.ts → index-D8DNpc1X.d.ts} +14 -4
  22. package/dist/pptx/chunks/{index-B94RKk84.d.ts.map → index-D8DNpc1X.d.ts.map} +1 -1
  23. package/dist/pptx/cli/index.cjs +209 -182
  24. package/dist/pptx/cli/index.mjs +4 -4
  25. package/dist/pptx/converter/index.d.ts +1 -1
  26. package/dist/pptx/converter/index.mjs +2 -2
  27. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  28. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  29. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  30. package/dist/pptx/index.cjs +209 -182
  31. package/dist/pptx/index.d.ts +3 -3
  32. package/dist/pptx/index.mjs +5 -5
  33. package/dist/pptx/node/index.d.ts +1 -1
  34. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkEEHK52XB_cjs = require('./chunk-EEHK52XB.cjs');
3
+ var chunkHYCOBPCC_cjs = require('./chunk-HYCOBPCC.cjs');
4
4
  require('./chunk-MU3XSASV.cjs');
5
5
  require('./chunk-XZPZHXV4.cjs');
6
6
  require('./chunk-5W2QL4SB.cjs');
@@ -9,5 +9,5 @@ require('./chunk-5W2QL4SB.cjs');
9
9
 
10
10
  Object.defineProperty(exports, "PptxHandler", {
11
11
  enumerable: true,
12
- get: function () { return chunkEEHK52XB_cjs.PptxHandler; }
12
+ get: function () { return chunkHYCOBPCC_cjs.PptxHandler; }
13
13
  });
@@ -1,5 +1,5 @@
1
- export { PptxHandler } from './chunk-4IIR2QEH.mjs';
2
- import './chunk-DNYZX6YG.mjs';
1
+ export { PptxHandler } from './chunk-KE2FUFIU.mjs';
2
+ import './chunk-VRJOOHWV.mjs';
3
3
  import './chunk-JJ37PCNR.mjs';
4
4
  import './chunk-3GXV5MPC.mjs';
5
5
  import './chunk-54S5A5PZ.mjs';
@@ -1,4 +1,4 @@
1
- export { PptxHandler } from './chunk-K6OFJ5GJ.mjs';
1
+ export { PptxHandler } from './chunk-7E45SAZJ.mjs';
2
2
  import './chunk-2XMK5SXU.mjs';
3
3
  import './chunk-GXHKNSZX.mjs';
4
4
  import './chunk-CA7KCNL3.mjs';
@@ -1,5 +1,5 @@
1
- export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-4IIR2QEH.mjs';
2
- import './chunk-DNYZX6YG.mjs';
1
+ export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-KE2FUFIU.mjs';
2
+ import './chunk-VRJOOHWV.mjs';
3
3
  import './chunk-JJ37PCNR.mjs';
4
4
  import './chunk-3GXV5MPC.mjs';
5
5
  import './chunk-54S5A5PZ.mjs';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkEEHK52XB_cjs = require('./chunk-EEHK52XB.cjs');
3
+ var chunkHYCOBPCC_cjs = require('./chunk-HYCOBPCC.cjs');
4
4
  require('./chunk-MU3XSASV.cjs');
5
5
  require('./chunk-XZPZHXV4.cjs');
6
6
  require('./chunk-5W2QL4SB.cjs');
@@ -9,13 +9,13 @@ require('./chunk-5W2QL4SB.cjs');
9
9
 
10
10
  Object.defineProperty(exports, "PresentationBuilder", {
11
11
  enumerable: true,
12
- get: function () { return chunkEEHK52XB_cjs.PresentationBuilder; }
12
+ get: function () { return chunkHYCOBPCC_cjs.PresentationBuilder; }
13
13
  });
14
14
  Object.defineProperty(exports, "STANDARD_LAYOUTS", {
15
15
  enumerable: true,
16
- get: function () { return chunkEEHK52XB_cjs.STANDARD_LAYOUTS; }
16
+ get: function () { return chunkHYCOBPCC_cjs.STANDARD_LAYOUTS; }
17
17
  });
18
18
  Object.defineProperty(exports, "buildBlankPresentationArchive", {
19
19
  enumerable: true,
20
- get: function () { return chunkEEHK52XB_cjs.buildBlankPresentationArchive; }
20
+ get: function () { return chunkHYCOBPCC_cjs.buildBlankPresentationArchive; }
21
21
  });
@@ -1,4 +1,4 @@
1
- export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-K6OFJ5GJ.mjs';
1
+ export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-7E45SAZJ.mjs';
2
2
  import './chunk-2XMK5SXU.mjs';
3
3
  import './chunk-GXHKNSZX.mjs';
4
4
  import './chunk-CA7KCNL3.mjs';
@@ -1,6 +1,6 @@
1
- import { findText, replaceText, replaceTextInSlide, mergePresentation } from './chunk-ZXPPM63Y.mjs';
2
- import { PresentationBuilder, PptxHandler, SlideBuilder, validateSeriesIndex, removeEmptyDataPoint, ensureDataPoint, ensureChartData, assertChartGradientSupported, toChartGradientFill, isLineDrawnChartType, chartFormatTargetKey, applyChartGroupOptionsInput, countExistingLayouts, addLayoutToSlideMaster, addLayoutContentType, createLayout, STANDARD_LAYOUTS, generateLayoutXml, layoutRelsXml, createTextElement, createShapeElement, createImageElement, createTableElement, createChartElement, createConnectorElement, createMediaElement, createGroupElement, relationshipsPartFor, parseRelationships, resolvePartPath, clonePartGraph, buildRelationshipsXml, buildBlankPresentationArchive, nextRelationshipId, relativePartTarget, PptxXmlBuilder } from './chunk-4IIR2QEH.mjs';
3
- import { EMU_PER_PIXEL, EMU_PER_INCH, parseXml, first, elements, buildXml, bytesToBase64, base64ToBytes, hasTextProperties, escAttr } from './chunk-DNYZX6YG.mjs';
1
+ import { findText, replaceText, replaceTextInSlide, mergePresentation } from './chunk-63GRFYAN.mjs';
2
+ import { PresentationBuilder, PptxHandler, SlideBuilder, validateSeriesIndex, removeEmptyDataPoint, ensureDataPoint, ensureChartData, assertChartGradientSupported, toChartGradientFill, isLineDrawnChartType, chartFormatTargetKey, applyChartGroupOptionsInput, countExistingLayouts, addLayoutToSlideMaster, addLayoutContentType, createLayout, STANDARD_LAYOUTS, generateLayoutXml, layoutRelsXml, createTextElement, createShapeElement, createImageElement, createTableElement, createChartElement, createConnectorElement, createMediaElement, createGroupElement, relationshipsPartFor, parseRelationships, resolvePartPath, clonePartGraph, buildRelationshipsXml, buildBlankPresentationArchive, nextRelationshipId, relativePartTarget, PptxXmlBuilder } from './chunk-KE2FUFIU.mjs';
3
+ import { EMU_PER_PIXEL, EMU_PER_INCH, parseXml, first, elements, buildXml, bytesToBase64, base64ToBytes, hasTextProperties, escAttr } from './chunk-VRJOOHWV.mjs';
4
4
  import { openPptxZip } from './chunk-JJ37PCNR.mjs';
5
5
  import { cloneSlide, cloneElement } from './chunk-54S5A5PZ.mjs';
6
6
 
@@ -14771,7 +14771,7 @@ async function setPresentationRunText(bytes, slideIndex, elementId, runIndex, te
14771
14771
  async function createPresentationFromOutline(slides, options = {}) {
14772
14772
  if (!(slides instanceof Array) || !slides.length || slides.length > 200)
14773
14773
  throw new Error("A presentation outline has 1 to 200 slides");
14774
- const { PresentationBuilder: PresentationBuilder2 } = await import('./PresentationBuilder-M5UXW4AF.mjs');
14774
+ const { PresentationBuilder: PresentationBuilder2 } = await import('./PresentationBuilder-BCDRASRT.mjs');
14775
14775
  const { handler, data, createSlide } = await PresentationBuilder2.create({
14776
14776
  ...options.title ? { title: options.title } : {}
14777
14777
  });
@@ -1,4 +1,4 @@
1
- import { hasTextProperties } from './chunk-DNYZX6YG.mjs';
1
+ import { hasTextProperties } from './chunk-VRJOOHWV.mjs';
2
2
  import { cloneSlide } from './chunk-54S5A5PZ.mjs';
3
3
 
4
4
  // pptx/core/builders/sdk/merge-operations.ts
@@ -36379,7 +36379,10 @@ async function resolveBulletImage(imageRelId, slidePath, resolver) {
36379
36379
  if (!target) {
36380
36380
  return void 0;
36381
36381
  }
36382
- if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
36382
+ if (target.startsWith("http://") || target.startsWith("https://")) {
36383
+ return resolver.allowExternalImages ? target : void 0;
36384
+ }
36385
+ if (target.startsWith("data:")) {
36383
36386
  return target;
36384
36387
  }
36385
36388
  const imagePath = resolver.resolveImagePath(slidePath, target);
@@ -50512,6 +50515,152 @@ function applyCommonViewContainer(root, name, props) {
50512
50515
  root[key2] = container;
50513
50516
  }
50514
50517
 
50518
+ // pptx/core/core/runtime/chart-part-registration.ts
50519
+ var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
50520
+ var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
50521
+ var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
50522
+ function asArray3(value) {
50523
+ if (value === void 0 || value === null) {
50524
+ return [];
50525
+ }
50526
+ return (Array.isArray(value) ? value : [value]).filter(
50527
+ (entry2) => Boolean(entry2) && typeof entry2 === "object"
50528
+ );
50529
+ }
50530
+ function nextFreeChartPartPath(zip, directory) {
50531
+ let n = 1;
50532
+ while (zip.file(`${directory}/chart${n}.xml`)) {
50533
+ n += 1;
50534
+ }
50535
+ return `${directory}/chart${n}.xml`;
50536
+ }
50537
+ function resolvePartTarget(fromPart, target) {
50538
+ if (target.startsWith("/")) {
50539
+ return target.slice(1);
50540
+ }
50541
+ const segments = fromPart.split("/").slice(0, -1);
50542
+ for (const segment of target.split("/")) {
50543
+ if (segment === "..") {
50544
+ segments.pop();
50545
+ } else if (segment !== "." && segment !== "") {
50546
+ segments.push(segment);
50547
+ }
50548
+ }
50549
+ return segments.join("/");
50550
+ }
50551
+ function relativePartTarget2(fromPart, toPart) {
50552
+ const from = fromPart.split("/").slice(0, -1);
50553
+ const to = toPart.split("/");
50554
+ let common = 0;
50555
+ while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
50556
+ common += 1;
50557
+ }
50558
+ return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
50559
+ }
50560
+ async function ensureContentTypeOverride2(deps, partPath, contentType) {
50561
+ const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
50562
+ if (!xml) {
50563
+ return;
50564
+ }
50565
+ const tree = deps.parser.parse(xml);
50566
+ const types = tree["Types"] ?? {};
50567
+ const overrides = asArray3(types["Override"]);
50568
+ const partName = `/${partPath}`;
50569
+ if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
50570
+ return;
50571
+ }
50572
+ overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
50573
+ types["Override"] = overrides;
50574
+ tree["Types"] = types;
50575
+ deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
50576
+ }
50577
+ async function rewriteChartRelationship(deps, slidePath, rewrite) {
50578
+ const slash = slidePath.lastIndexOf("/");
50579
+ const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
50580
+ const xml = await deps.zip.file(relsPath2)?.async("string");
50581
+ if (!xml) {
50582
+ return void 0;
50583
+ }
50584
+ const tree = deps.parser.parse(xml);
50585
+ const root = tree["Relationships"];
50586
+ const relationships2 = asArray3(root?.["Relationship"]);
50587
+ const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
50588
+ (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
50589
+ );
50590
+ if (!match || !root) {
50591
+ return void 0;
50592
+ }
50593
+ match["@_Type"] = rewrite.relationshipType;
50594
+ match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
50595
+ delete match["@_TargetMode"];
50596
+ root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
50597
+ deps.zip.file(relsPath2, deps.builder.build(tree));
50598
+ return String(match["@_Id"]);
50599
+ }
50600
+ function rebindGraphicData(node, relationshipId, extended) {
50601
+ for (const key2 of Object.keys(node)) {
50602
+ delete node[key2];
50603
+ }
50604
+ node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
50605
+ if (extended) {
50606
+ node["cx:chart"] = {
50607
+ "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
50608
+ "@_xmlns:r": NS_R,
50609
+ "@_r:id": relationshipId
50610
+ };
50611
+ } else {
50612
+ node["c:chart"] = {
50613
+ "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
50614
+ "@_xmlns:r": NS_R,
50615
+ "@_r:id": relationshipId
50616
+ };
50617
+ }
50618
+ }
50619
+ function visitGraphicData(node, relationshipId, extended, getLocalName2) {
50620
+ if (!node || typeof node !== "object") {
50621
+ return 0;
50622
+ }
50623
+ if (Array.isArray(node)) {
50624
+ return node.reduce(
50625
+ (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
50626
+ 0
50627
+ );
50628
+ }
50629
+ const object = node;
50630
+ let count = 0;
50631
+ for (const key2 of Object.keys(object)) {
50632
+ if (key2.startsWith("@_")) {
50633
+ continue;
50634
+ }
50635
+ const value = object[key2];
50636
+ if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
50637
+ for (const candidate of asArray3(value)) {
50638
+ const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
50639
+ const chart = chartKey ? candidate[chartKey] : void 0;
50640
+ if (chart && String(chart["@_r:id"]) === relationshipId) {
50641
+ rebindGraphicData(candidate, relationshipId, extended);
50642
+ count += 1;
50643
+ }
50644
+ }
50645
+ continue;
50646
+ }
50647
+ count += visitGraphicData(value, relationshipId, extended, getLocalName2);
50648
+ }
50649
+ return count;
50650
+ }
50651
+ async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
50652
+ const xml = await deps.zip.file(slidePath)?.async("string");
50653
+ if (!xml) {
50654
+ return 0;
50655
+ }
50656
+ const tree = deps.parser.parse(xml);
50657
+ const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
50658
+ if (count > 0) {
50659
+ deps.zip.file(slidePath, deps.builder.build(tree));
50660
+ }
50661
+ return count;
50662
+ }
50663
+
50515
50664
  // pptx/core/utils/chart-color-style-writer.ts
50516
50665
  var METHODS = /* @__PURE__ */ new Set(["cycle", "withinLinear", "acrossLinear"]);
50517
50666
  var COLOR_NAMES = /* @__PURE__ */ new Set(["scrgbClr", "srgbClr", "hslClr", "sysClr", "schemeClr", "prstClr"]);
@@ -50581,7 +50730,7 @@ function buildChartExLegend(legendPosition) {
50581
50730
  // pptx/core/utils/chart-cx-generator.ts
50582
50731
  var NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
50583
50732
  var NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
50584
- var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
50733
+ var NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
50585
50734
  var NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
50586
50735
  function points4(values) {
50587
50736
  return values.map((value, index) => ({ "@_idx": String(index), "#text": String(value) }));
@@ -50776,7 +50925,7 @@ function buildChartExSpaceXml(chartData) {
50776
50925
  const chartSpace = {
50777
50926
  "@_xmlns:cx": NS_CX,
50778
50927
  "@_xmlns:a": NS_A,
50779
- "@_xmlns:r": NS_R,
50928
+ "@_xmlns:r": NS_R2,
50780
50929
  "cx:chartData": {
50781
50930
  "cx:data": chartData.series.map(
50782
50931
  (series, index) => buildChartExData(chartData, series, index)
@@ -52339,7 +52488,7 @@ function buildGeneratedSeriesSpPr(series, family) {
52339
52488
  // pptx/core/utils/chart-xml-generator.ts
52340
52489
  var NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
52341
52490
  var NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
52342
- var NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
52491
+ var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
52343
52492
  var CAT_AX_ID = 111111111;
52344
52493
  var VAL_AX_ID = 222222222;
52345
52494
  var SER_AX_ID = 333333333;
@@ -52545,7 +52694,7 @@ function buildChartSpaceXml(chartData) {
52545
52694
  "c:chartSpace": {
52546
52695
  "@_xmlns:c": NS_C2,
52547
52696
  "@_xmlns:a": NS_A2,
52548
- "@_xmlns:r": NS_R2,
52697
+ "@_xmlns:r": NS_R3,
52549
52698
  "c:chart": chart
52550
52699
  }
52551
52700
  };
@@ -54594,7 +54743,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
54594
54743
  }
54595
54744
  return rPr;
54596
54745
  }
54597
- function asArray3(value) {
54746
+ function asArray4(value) {
54598
54747
  if (Array.isArray(value)) {
54599
54748
  return value;
54600
54749
  }
@@ -54613,7 +54762,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
54613
54762
  return txKey;
54614
54763
  }
54615
54764
  const pKey = findKey19(rich, "p", getLocalName2) ?? "a:p";
54616
- const paragraphs = asArray3(rich[pKey]).map((para) => {
54765
+ const paragraphs = asArray4(rich[pKey]).map((para) => {
54617
54766
  const next = { ...para };
54618
54767
  const pPrKey = findKey19(next, "pPr", getLocalName2) ?? "a:pPr";
54619
54768
  const pPr = { ...ensureXmlChildOrCreate(next, pPrKey, "first") };
@@ -54626,7 +54775,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
54626
54775
  next[pPrKey] = pPr;
54627
54776
  const rKey = findKey19(next, "r", getLocalName2);
54628
54777
  if (rKey) {
54629
- const runs = asArray3(next[rKey]).map((run2) => {
54778
+ const runs = asArray4(next[rKey]).map((run2) => {
54630
54779
  const rPrKey = findKey19(run2, "rPr", getLocalName2) ?? "a:rPr";
54631
54780
  const existingRPr = run2[rPrKey] ?? {};
54632
54781
  const nextRun = { ...run2 };
@@ -54990,7 +55139,7 @@ function saveChartPartThroughNeutral(xml, before, after) {
54990
55139
  function findKey20(node, localName15, getLocalName2) {
54991
55140
  return Object.keys(node).find((key2) => getLocalName2(key2) === localName15);
54992
55141
  }
54993
- function asArray4(value) {
55142
+ function asArray5(value) {
54994
55143
  if (value === void 0 || value === null) {
54995
55144
  return [];
54996
55145
  }
@@ -55004,8 +55153,8 @@ function dimensionType(node) {
55004
55153
  function replaceLevels(target, source, getLocalName2) {
55005
55154
  const targetKey = findKey20(target, "lvl", getLocalName2) ?? "cx:lvl";
55006
55155
  const sourceKey = findKey20(source, "lvl", getLocalName2);
55007
- const oldLevels = asArray4(target[targetKey]);
55008
- const newLevels = asArray4(sourceKey ? source[sourceKey] : void 0).map((level, index) => {
55156
+ const oldLevels = asArray5(target[targetKey]);
55157
+ const newLevels = asArray5(sourceKey ? source[sourceKey] : void 0).map((level, index) => {
55009
55158
  const old = oldLevels[index];
55010
55159
  if (!old) {
55011
55160
  return level;
@@ -55024,8 +55173,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
55024
55173
  for (const kind of ["strDim", "numDim"]) {
55025
55174
  const targetKey = findKey20(target, kind, getLocalName2) ?? `cx:${kind}`;
55026
55175
  const freshKey = findKey20(fresh, kind, getLocalName2);
55027
- const existing = asArray4(target[targetKey]);
55028
- const incoming = asArray4(freshKey ? fresh[freshKey] : void 0);
55176
+ const existing = asArray5(target[targetKey]);
55177
+ const incoming = asArray5(freshKey ? fresh[freshKey] : void 0);
55029
55178
  for (const dimension of incoming) {
55030
55179
  const wantedType = dimensionType(dimension);
55031
55180
  let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
@@ -55059,7 +55208,7 @@ function child13(node, localName15, getLocalName2) {
55059
55208
  const value = key2 ? node[key2] : void 0;
55060
55209
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
55061
55210
  }
55062
- function asArray5(value) {
55211
+ function asArray6(value) {
55063
55212
  if (value === void 0 || value === null) {
55064
55213
  return [];
55065
55214
  }
@@ -55241,7 +55390,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
55241
55390
  getLocalName2
55242
55391
  );
55243
55392
  const seriesKey = region ? findKey21(region, "series", getLocalName2) : void 0;
55244
- const first2 = region && seriesKey ? asArray5(region[seriesKey])[0] : void 0;
55393
+ const first2 = region && seriesKey ? asArray6(region[seriesKey])[0] : void 0;
55245
55394
  const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
55246
55395
  const series = chartData.series[0];
55247
55396
  if (!existing || !series) {
@@ -55259,9 +55408,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
55259
55408
  const chartDataKey = findKey21(chartSpace, "chartData", getLocalName2);
55260
55409
  const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
55261
55410
  const dataKey = findKey21(chartDataNode, "data", getLocalName2) ?? "cx:data";
55262
- const dataNodes = asArray5(chartDataNode[dataKey]);
55411
+ const dataNodes = asArray6(chartDataNode[dataKey]);
55263
55412
  const seriesKey = findKey21(region, "series", getLocalName2) ?? "cx:series";
55264
- const existing = asArray5(region[seriesKey]);
55413
+ const existing = asArray6(region[seriesKey]);
55265
55414
  const updated = [];
55266
55415
  chartData.series.forEach((series, index) => {
55267
55416
  const node = existing[index];
@@ -55331,152 +55480,6 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
55331
55480
  );
55332
55481
  }
55333
55482
 
55334
- // pptx/core/core/runtime/chart-part-registration.ts
55335
- var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
55336
- var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
55337
- var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
55338
- function asArray6(value) {
55339
- if (value === void 0 || value === null) {
55340
- return [];
55341
- }
55342
- return (Array.isArray(value) ? value : [value]).filter(
55343
- (entry2) => Boolean(entry2) && typeof entry2 === "object"
55344
- );
55345
- }
55346
- function nextFreeChartPartPath(zip, directory) {
55347
- let n = 1;
55348
- while (zip.file(`${directory}/chart${n}.xml`)) {
55349
- n += 1;
55350
- }
55351
- return `${directory}/chart${n}.xml`;
55352
- }
55353
- function resolvePartTarget(fromPart, target) {
55354
- if (target.startsWith("/")) {
55355
- return target.slice(1);
55356
- }
55357
- const segments = fromPart.split("/").slice(0, -1);
55358
- for (const segment of target.split("/")) {
55359
- if (segment === "..") {
55360
- segments.pop();
55361
- } else if (segment !== "." && segment !== "") {
55362
- segments.push(segment);
55363
- }
55364
- }
55365
- return segments.join("/");
55366
- }
55367
- function relativePartTarget2(fromPart, toPart) {
55368
- const from = fromPart.split("/").slice(0, -1);
55369
- const to = toPart.split("/");
55370
- let common = 0;
55371
- while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
55372
- common += 1;
55373
- }
55374
- return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
55375
- }
55376
- async function ensureContentTypeOverride2(deps, partPath, contentType) {
55377
- const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
55378
- if (!xml) {
55379
- return;
55380
- }
55381
- const tree = deps.parser.parse(xml);
55382
- const types = tree["Types"] ?? {};
55383
- const overrides = asArray6(types["Override"]);
55384
- const partName = `/${partPath}`;
55385
- if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
55386
- return;
55387
- }
55388
- overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
55389
- types["Override"] = overrides;
55390
- tree["Types"] = types;
55391
- deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
55392
- }
55393
- async function rewriteChartRelationship(deps, slidePath, rewrite) {
55394
- const slash = slidePath.lastIndexOf("/");
55395
- const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
55396
- const xml = await deps.zip.file(relsPath2)?.async("string");
55397
- if (!xml) {
55398
- return void 0;
55399
- }
55400
- const tree = deps.parser.parse(xml);
55401
- const root = tree["Relationships"];
55402
- const relationships2 = asArray6(root?.["Relationship"]);
55403
- const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
55404
- (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
55405
- );
55406
- if (!match || !root) {
55407
- return void 0;
55408
- }
55409
- match["@_Type"] = rewrite.relationshipType;
55410
- match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
55411
- delete match["@_TargetMode"];
55412
- root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
55413
- deps.zip.file(relsPath2, deps.builder.build(tree));
55414
- return String(match["@_Id"]);
55415
- }
55416
- function rebindGraphicData(node, relationshipId, extended) {
55417
- for (const key2 of Object.keys(node)) {
55418
- delete node[key2];
55419
- }
55420
- node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
55421
- if (extended) {
55422
- node["cx:chart"] = {
55423
- "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
55424
- "@_xmlns:r": NS_R3,
55425
- "@_r:id": relationshipId
55426
- };
55427
- } else {
55428
- node["c:chart"] = {
55429
- "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
55430
- "@_xmlns:r": NS_R3,
55431
- "@_r:id": relationshipId
55432
- };
55433
- }
55434
- }
55435
- function visitGraphicData(node, relationshipId, extended, getLocalName2) {
55436
- if (!node || typeof node !== "object") {
55437
- return 0;
55438
- }
55439
- if (Array.isArray(node)) {
55440
- return node.reduce(
55441
- (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
55442
- 0
55443
- );
55444
- }
55445
- const object = node;
55446
- let count = 0;
55447
- for (const key2 of Object.keys(object)) {
55448
- if (key2.startsWith("@_")) {
55449
- continue;
55450
- }
55451
- const value = object[key2];
55452
- if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
55453
- for (const candidate of asArray6(value)) {
55454
- const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
55455
- const chart = chartKey ? candidate[chartKey] : void 0;
55456
- if (chart && String(chart["@_r:id"]) === relationshipId) {
55457
- rebindGraphicData(candidate, relationshipId, extended);
55458
- count += 1;
55459
- }
55460
- }
55461
- continue;
55462
- }
55463
- count += visitGraphicData(value, relationshipId, extended, getLocalName2);
55464
- }
55465
- return count;
55466
- }
55467
- async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
55468
- const xml = await deps.zip.file(slidePath)?.async("string");
55469
- if (!xml) {
55470
- return 0;
55471
- }
55472
- const tree = deps.parser.parse(xml);
55473
- const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
55474
- if (count > 0) {
55475
- deps.zip.file(slidePath, deps.builder.build(tree));
55476
- }
55477
- return count;
55478
- }
55479
-
55480
55483
  // pptx/core/core/runtime/chart-part-family-switch.ts
55481
55484
  var CHART_EX_CONTENT_TYPE = "application/vnd.ms-office.chartex+xml";
55482
55485
  var CHART_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
@@ -59307,18 +59310,22 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
59307
59310
  * Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
59308
59311
  * a `p:cNvPr` parent.
59309
59312
  */
59310
- serializeSingleAction(cNvPr, nodeName, action, resolveHyperlinkRelationshipId) {
59313
+ serializeSingleAction(cNvPr, nodeName, action, links) {
59311
59314
  if (!action) {
59312
59315
  delete cNvPr[nodeName];
59313
59316
  return;
59314
59317
  }
59315
59318
  const node = {};
59319
+ const url = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
59316
59320
  let rId = action.rId;
59317
- if (!rId && action.url) {
59321
+ if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
59322
+ rId = void 0;
59323
+ }
59324
+ if (!rId && url) {
59318
59325
  const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
59319
59326
  action.action ?? ""
59320
59327
  );
59321
- rId = resolveHyperlinkRelationshipId(action.url, forceExternal) ?? void 0;
59328
+ rId = links.resolveHyperlinkRelationshipId(url, forceExternal) ?? void 0;
59322
59329
  }
59323
59330
  node["@_r:id"] = rId ?? "";
59324
59331
  if (action.action) {
@@ -59392,7 +59399,7 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
59392
59399
  * the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
59393
59400
  * non-visual properties.
59394
59401
  */
59395
- serializeElementActions(shape, el, resolveHyperlinkRelationshipId) {
59402
+ serializeElementActions(shape, el, links) {
59396
59403
  const key2 = this.getTreeBucketKeyForElementType(el.type);
59397
59404
  const cNvPr = this.getCnvPrNode(shape, key2);
59398
59405
  if (!cNvPr) {
@@ -59400,8 +59407,8 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
59400
59407
  }
59401
59408
  const actionClick = "actionClick" in el ? el.actionClick : void 0;
59402
59409
  const actionHover = "actionHover" in el ? el.actionHover : void 0;
59403
- this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, resolveHyperlinkRelationshipId);
59404
- this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, resolveHyperlinkRelationshipId);
59410
+ this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
59411
+ this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
59405
59412
  const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
59406
59413
  serializeDecorativeExtension(cNvPr, isDecorative);
59407
59414
  }
@@ -71795,7 +71802,7 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
71795
71802
  if (ctx.connectorShapeIds) {
71796
71803
  applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
71797
71804
  }
71798
- this.serializeElementActions(shape, el, ctx.resolveHyperlinkRelationshipId);
71805
+ this.serializeElementActions(shape, el, ctx);
71799
71806
  this.serializeShapeLocks(shape, el);
71800
71807
  this.applyHiddenToCnvPr(shape, el);
71801
71808
  this.applyNameToCnvPr(shape, el);
@@ -72836,7 +72843,7 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
72836
72843
  * Process a single slide during save: update slide XML, process elements,
72837
72844
  * rebuild shape tree, and persist relationships.
72838
72845
  */
72839
- async processSlideForSave(slide, saveSession, constants) {
72846
+ async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
72840
72847
  if (this.canSkipSlideSave(slide)) {
72841
72848
  return;
72842
72849
  }
@@ -73021,6 +73028,10 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
73021
73028
  slideRelationshipRegistry,
73022
73029
  resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
73023
73030
  getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
73031
+ slideTargetAt: (index) => {
73032
+ const target = slidePaths[index];
73033
+ return target ? relativePartTarget2(slide.id, target) : void 0;
73034
+ },
73024
73035
  resolvedMediaBytes,
73025
73036
  saveSession,
73026
73037
  slideImageRelationshipType: constants.slideImageRelationshipType,
@@ -75245,8 +75256,9 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
75245
75256
  await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
75246
75257
  await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
75247
75258
  this.templateElementBaselines.beginSave();
75259
+ const slidePaths = slides.map((slide) => slide.id);
75248
75260
  for (const slide of slides) {
75249
- await this.processSlideForSave(slide, saveSession, saveConstants);
75261
+ await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
75250
75262
  }
75251
75263
  this.templateElementBaselines.commitSave();
75252
75264
  const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");
@@ -75724,7 +75736,13 @@ var PptxHandlerRuntime55 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
75724
75736
  if (posterRId && relsMap) {
75725
75737
  const posterTarget = relsMap.get(posterRId);
75726
75738
  if (posterTarget) {
75727
- if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://") || posterTarget.startsWith("data:")) {
75739
+ if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://")) {
75740
+ if (this.allowExternalImages === true) {
75741
+ posterImage = posterTarget;
75742
+ imagePath = posterTarget;
75743
+ imageData = posterTarget;
75744
+ }
75745
+ } else if (posterTarget.startsWith("data:")) {
75728
75746
  posterImage = posterTarget;
75729
75747
  imagePath = posterTarget;
75730
75748
  imageData = posterTarget;
@@ -76854,7 +76872,12 @@ var PptxHandlerRuntime61 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
76854
76872
  const slideRels = this.slideRelsMap.get(slidePath);
76855
76873
  const target = slideRels?.get(relId);
76856
76874
  if (target) {
76857
- if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
76875
+ if (target.startsWith("http://") || target.startsWith("https://")) {
76876
+ if (this.allowExternalImages === true) {
76877
+ imagePath = target;
76878
+ imageData = target;
76879
+ }
76880
+ } else if (target.startsWith("data:")) {
76858
76881
  imagePath = target;
76859
76882
  imageData = target;
76860
76883
  } else {
@@ -77308,7 +77331,9 @@ var PptxHandlerRuntime63 = class extends PptxHandlerRuntime62 {
77308
77331
  const target = slideRels?.get(imageRelId);
77309
77332
  let imageDataUrl;
77310
77333
  if (target) {
77311
- if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
77334
+ if (target.startsWith("http://") || target.startsWith("https://")) {
77335
+ imageDataUrl = this.allowExternalImages === true ? target : void 0;
77336
+ } else if (target.startsWith("data:")) {
77312
77337
  imageDataUrl = target;
77313
77338
  } else {
77314
77339
  const imagePath = this.resolveImagePath(slidePath, target);
@@ -86619,6 +86644,7 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
86619
86644
  async enrichBulletPictureElementsWithEmbeddedData(elements2, slidePath) {
86620
86645
  await enrichBulletPictureImages(elements2, slidePath, {
86621
86646
  slideRelsMap: this.slideRelsMap,
86647
+ allowExternalImages: this.allowExternalImages === true,
86622
86648
  resolveImagePath: (path3, target) => this.resolveImagePath(path3, target),
86623
86649
  getImageData: (imagePath) => this.getImageData(imagePath)
86624
86650
  });