ooxml-core 1.26.0 → 1.26.1

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-5QBRBXRX.mjs → PptxHandler-64BZOBWX.mjs} +2 -2
  2. package/dist/{PptxHandler-CVYP5PAN.cjs → PptxHandler-AILFLRH7.cjs} +2 -2
  3. package/dist/{PptxHandler-TOAD6P7N.mjs → PptxHandler-PMLQGMFQ.mjs} +1 -1
  4. package/dist/{PresentationBuilder-EBVNYMLE.mjs → PresentationBuilder-EJY2TYWL.mjs} +1 -1
  5. package/dist/{PresentationBuilder-M5UXW4AF.mjs → PresentationBuilder-HBCCO2CF.mjs} +2 -2
  6. package/dist/{PresentationBuilder-RVQZCTIO.cjs → PresentationBuilder-RBQP6A37.cjs} +4 -4
  7. package/dist/{chunk-EBJ724RB.mjs → chunk-DHAZSMC7.mjs} +1 -1
  8. package/dist/{chunk-4IIR2QEH.mjs → chunk-FZBAMWCJ.mjs} +181 -172
  9. package/dist/{chunk-EEHK52XB.cjs → chunk-NXTHB2M3.cjs} +180 -171
  10. package/dist/{chunk-KONCS53X.mjs → chunk-OQPT5IC3.mjs} +4 -4
  11. package/dist/{chunk-K6OFJ5GJ.mjs → chunk-OTXJVFMY.mjs} +180 -171
  12. package/dist/{chunk-DNYZX6YG.mjs → chunk-R7RL7W43.mjs} +1 -1
  13. package/dist/{chunk-ZXPPM63Y.mjs → chunk-WRFMS5CL.mjs} +1 -1
  14. package/dist/pptx/automation/index.cjs +188 -178
  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 +188 -178
  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 +188 -178
  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
@@ -125066,6 +125066,157 @@ var init_pptx_view_props_helpers = __esm({
125066
125066
  }
125067
125067
  });
125068
125068
 
125069
+ // pptx/core/core/runtime/chart-part-registration.ts
125070
+ function asArray4(value) {
125071
+ if (value === void 0 || value === null) {
125072
+ return [];
125073
+ }
125074
+ return (Array.isArray(value) ? value : [value]).filter(
125075
+ (entry2) => Boolean(entry2) && typeof entry2 === "object"
125076
+ );
125077
+ }
125078
+ function nextFreeChartPartPath(zip, directory) {
125079
+ let n = 1;
125080
+ while (zip.file(`${directory}/chart${n}.xml`)) {
125081
+ n += 1;
125082
+ }
125083
+ return `${directory}/chart${n}.xml`;
125084
+ }
125085
+ function resolvePartTarget(fromPart, target) {
125086
+ if (target.startsWith("/")) {
125087
+ return target.slice(1);
125088
+ }
125089
+ const segments = fromPart.split("/").slice(0, -1);
125090
+ for (const segment of target.split("/")) {
125091
+ if (segment === "..") {
125092
+ segments.pop();
125093
+ } else if (segment !== "." && segment !== "") {
125094
+ segments.push(segment);
125095
+ }
125096
+ }
125097
+ return segments.join("/");
125098
+ }
125099
+ function relativePartTarget2(fromPart, toPart) {
125100
+ const from = fromPart.split("/").slice(0, -1);
125101
+ const to = toPart.split("/");
125102
+ let common = 0;
125103
+ while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
125104
+ common += 1;
125105
+ }
125106
+ return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
125107
+ }
125108
+ async function ensureContentTypeOverride2(deps, partPath, contentType) {
125109
+ const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
125110
+ if (!xml) {
125111
+ return;
125112
+ }
125113
+ const tree = deps.parser.parse(xml);
125114
+ const types = tree["Types"] ?? {};
125115
+ const overrides28 = asArray4(types["Override"]);
125116
+ const partName = `/${partPath}`;
125117
+ if (overrides28.some((entry2) => String(entry2["@_PartName"]) === partName)) {
125118
+ return;
125119
+ }
125120
+ overrides28.push({ "@_PartName": partName, "@_ContentType": contentType });
125121
+ types["Override"] = overrides28;
125122
+ tree["Types"] = types;
125123
+ deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
125124
+ }
125125
+ async function rewriteChartRelationship(deps, slidePath, rewrite) {
125126
+ const slash = slidePath.lastIndexOf("/");
125127
+ const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
125128
+ const xml = await deps.zip.file(relsPath2)?.async("string");
125129
+ if (!xml) {
125130
+ return void 0;
125131
+ }
125132
+ const tree = deps.parser.parse(xml);
125133
+ const root = tree["Relationships"];
125134
+ const relationships3 = asArray4(root?.["Relationship"]);
125135
+ const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
125136
+ (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
125137
+ );
125138
+ if (!match || !root) {
125139
+ return void 0;
125140
+ }
125141
+ match["@_Type"] = rewrite.relationshipType;
125142
+ match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
125143
+ delete match["@_TargetMode"];
125144
+ root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
125145
+ deps.zip.file(relsPath2, deps.builder.build(tree));
125146
+ return String(match["@_Id"]);
125147
+ }
125148
+ function rebindGraphicData(node, relationshipId2, extended) {
125149
+ for (const key2 of Object.keys(node)) {
125150
+ delete node[key2];
125151
+ }
125152
+ node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
125153
+ if (extended) {
125154
+ node["cx:chart"] = {
125155
+ "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
125156
+ "@_xmlns:r": NS_R,
125157
+ "@_r:id": relationshipId2
125158
+ };
125159
+ } else {
125160
+ node["c:chart"] = {
125161
+ "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
125162
+ "@_xmlns:r": NS_R,
125163
+ "@_r:id": relationshipId2
125164
+ };
125165
+ }
125166
+ }
125167
+ function visitGraphicData(node, relationshipId2, extended, getLocalName2) {
125168
+ if (!node || typeof node !== "object") {
125169
+ return 0;
125170
+ }
125171
+ if (Array.isArray(node)) {
125172
+ return node.reduce(
125173
+ (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended, getLocalName2),
125174
+ 0
125175
+ );
125176
+ }
125177
+ const object = node;
125178
+ let count = 0;
125179
+ for (const key2 of Object.keys(object)) {
125180
+ if (key2.startsWith("@_")) {
125181
+ continue;
125182
+ }
125183
+ const value = object[key2];
125184
+ if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
125185
+ for (const candidate of asArray4(value)) {
125186
+ const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
125187
+ const chart = chartKey ? candidate[chartKey] : void 0;
125188
+ if (chart && String(chart["@_r:id"]) === relationshipId2) {
125189
+ rebindGraphicData(candidate, relationshipId2, extended);
125190
+ count += 1;
125191
+ }
125192
+ }
125193
+ continue;
125194
+ }
125195
+ count += visitGraphicData(value, relationshipId2, extended, getLocalName2);
125196
+ }
125197
+ return count;
125198
+ }
125199
+ async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended) {
125200
+ const xml = await deps.zip.file(slidePath)?.async("string");
125201
+ if (!xml) {
125202
+ return 0;
125203
+ }
125204
+ const tree = deps.parser.parse(xml);
125205
+ const count = visitGraphicData(tree, relationshipId2, extended, deps.getLocalName);
125206
+ if (count > 0) {
125207
+ deps.zip.file(slidePath, deps.builder.build(tree));
125208
+ }
125209
+ return count;
125210
+ }
125211
+ var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R;
125212
+ var init_chart_part_registration = __esm({
125213
+ "pptx/core/core/runtime/chart-part-registration.ts"() {
125214
+ CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
125215
+ CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
125216
+ NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
125217
+ }
125218
+ });
125219
+
125069
125220
  // pptx/core/utils/chart-color-style-writer.ts
125070
125221
  function localName23(key2) {
125071
125222
  return key2.replace(/^.*:/u, "");
@@ -125335,7 +125486,7 @@ function buildChartExSpaceXml(chartData) {
125335
125486
  const chartSpace = {
125336
125487
  "@_xmlns:cx": NS_CX,
125337
125488
  "@_xmlns:a": NS_A,
125338
- "@_xmlns:r": NS_R,
125489
+ "@_xmlns:r": NS_R2,
125339
125490
  "cx:chartData": {
125340
125491
  "cx:data": chartData.series.map(
125341
125492
  (series, index) => buildChartExData(chartData, series, index)
@@ -125349,7 +125500,7 @@ function buildChartExSpaceXml(chartData) {
125349
125500
  }
125350
125501
  return { "cx:chartSpace": chartSpace };
125351
125502
  }
125352
- var NS_CX, NS_A, NS_R, NS_C;
125503
+ var NS_CX, NS_A, NS_R2, NS_C;
125353
125504
  var init_chart_cx_generator = __esm({
125354
125505
  "pptx/core/utils/chart-cx-generator.ts"() {
125355
125506
  init_chart_cx_legend();
@@ -125357,7 +125508,7 @@ var init_chart_cx_generator = __esm({
125357
125508
  init_chart_cx_legend();
125358
125509
  NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
125359
125510
  NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
125360
- NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
125511
+ NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
125361
125512
  NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
125362
125513
  }
125363
125514
  });
@@ -126984,7 +127135,7 @@ function buildChartSpaceXml(chartData) {
126984
127135
  "c:chartSpace": {
126985
127136
  "@_xmlns:c": NS_C2,
126986
127137
  "@_xmlns:a": NS_A2,
126987
- "@_xmlns:r": NS_R2,
127138
+ "@_xmlns:r": NS_R3,
126988
127139
  "c:chart": chart
126989
127140
  }
126990
127141
  };
@@ -126992,7 +127143,7 @@ function buildChartSpaceXml(chartData) {
126992
127143
  applyGeneratedChartSpaceFormat(result, chartData);
126993
127144
  return result;
126994
127145
  }
126995
- var NS_C2, NS_A2, NS_R2, CAT_AX_ID, VAL_AX_ID, SER_AX_ID, SCATTER_LIKE;
127146
+ var NS_C2, NS_A2, NS_R3, CAT_AX_ID, VAL_AX_ID, SER_AX_ID, SCATTER_LIKE;
126996
127147
  var init_chart_xml_generator = __esm({
126997
127148
  "pptx/core/utils/chart-xml-generator.ts"() {
126998
127149
  init_chart_bubble_options();
@@ -127013,7 +127164,7 @@ var init_chart_xml_generator = __esm({
127013
127164
  init_chart_xml_series_fill();
127014
127165
  NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
127015
127166
  NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
127016
- NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
127167
+ NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
127017
127168
  CAT_AX_ID = 111111111;
127018
127169
  VAL_AX_ID = 222222222;
127019
127170
  SER_AX_ID = 333333333;
@@ -129165,7 +129316,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
129165
129316
  }
129166
129317
  return rPr;
129167
129318
  }
129168
- function asArray4(value) {
129319
+ function asArray5(value) {
129169
129320
  if (Array.isArray(value)) {
129170
129321
  return value;
129171
129322
  }
@@ -129184,7 +129335,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
129184
129335
  return txKey;
129185
129336
  }
129186
129337
  const pKey = findKey30(rich, "p", getLocalName2) ?? "a:p";
129187
- const paragraphs = asArray4(rich[pKey]).map((para) => {
129338
+ const paragraphs = asArray5(rich[pKey]).map((para) => {
129188
129339
  const next = { ...para };
129189
129340
  const pPrKey = findKey30(next, "pPr", getLocalName2) ?? "a:pPr";
129190
129341
  const pPr = { ...ensureXmlChildOrCreate(next, pPrKey, "first") };
@@ -129197,7 +129348,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
129197
129348
  next[pPrKey] = pPr;
129198
129349
  const rKey = findKey30(next, "r", getLocalName2);
129199
129350
  if (rKey) {
129200
- const runs = asArray4(next[rKey]).map((run2) => {
129351
+ const runs = asArray5(next[rKey]).map((run2) => {
129201
129352
  const rPrKey = findKey30(run2, "rPr", getLocalName2) ?? "a:rPr";
129202
129353
  const existingRPr = run2[rPrKey] ?? {};
129203
129354
  const nextRun = { ...run2 };
@@ -129591,7 +129742,7 @@ var init_chart_neutral_save = __esm({
129591
129742
  function findKey31(node, localName29, getLocalName2) {
129592
129743
  return Object.keys(node).find((key2) => getLocalName2(key2) === localName29);
129593
129744
  }
129594
- function asArray5(value) {
129745
+ function asArray6(value) {
129595
129746
  if (value === void 0 || value === null) {
129596
129747
  return [];
129597
129748
  }
@@ -129605,8 +129756,8 @@ function dimensionType(node) {
129605
129756
  function replaceLevels(target, source, getLocalName2) {
129606
129757
  const targetKey = findKey31(target, "lvl", getLocalName2) ?? "cx:lvl";
129607
129758
  const sourceKey = findKey31(source, "lvl", getLocalName2);
129608
- const oldLevels = asArray5(target[targetKey]);
129609
- const newLevels = asArray5(sourceKey ? source[sourceKey] : void 0).map((level2, index) => {
129759
+ const oldLevels = asArray6(target[targetKey]);
129760
+ const newLevels = asArray6(sourceKey ? source[sourceKey] : void 0).map((level2, index) => {
129610
129761
  const old = oldLevels[index];
129611
129762
  if (!old) {
129612
129763
  return level2;
@@ -129625,8 +129776,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
129625
129776
  for (const kind of ["strDim", "numDim"]) {
129626
129777
  const targetKey = findKey31(target, kind, getLocalName2) ?? `cx:${kind}`;
129627
129778
  const freshKey = findKey31(fresh, kind, getLocalName2);
129628
- const existing = asArray5(target[targetKey]);
129629
- const incoming = asArray5(freshKey ? fresh[freshKey] : void 0);
129779
+ const existing = asArray6(target[targetKey]);
129780
+ const incoming = asArray6(freshKey ? fresh[freshKey] : void 0);
129630
129781
  for (const dimension of incoming) {
129631
129782
  const wantedType = dimensionType(dimension);
129632
129783
  let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
@@ -129664,7 +129815,7 @@ function child29(node, localName29, getLocalName2) {
129664
129815
  const value = key2 ? node[key2] : void 0;
129665
129816
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
129666
129817
  }
129667
- function asArray6(value) {
129818
+ function asArray7(value) {
129668
129819
  if (value === void 0 || value === null) {
129669
129820
  return [];
129670
129821
  }
@@ -129853,7 +130004,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
129853
130004
  getLocalName2
129854
130005
  );
129855
130006
  const seriesKey = region ? findKey32(region, "series", getLocalName2) : void 0;
129856
- const first2 = region && seriesKey ? asArray6(region[seriesKey])[0] : void 0;
130007
+ const first2 = region && seriesKey ? asArray7(region[seriesKey])[0] : void 0;
129857
130008
  const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
129858
130009
  const series = chartData.series[0];
129859
130010
  if (!existing || !series) {
@@ -129871,9 +130022,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
129871
130022
  const chartDataKey = findKey32(chartSpace, "chartData", getLocalName2);
129872
130023
  const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
129873
130024
  const dataKey = findKey32(chartDataNode, "data", getLocalName2) ?? "cx:data";
129874
- const dataNodes = asArray6(chartDataNode[dataKey]);
130025
+ const dataNodes = asArray7(chartDataNode[dataKey]);
129875
130026
  const seriesKey = findKey32(region, "series", getLocalName2) ?? "cx:series";
129876
- const existing = asArray6(region[seriesKey]);
130027
+ const existing = asArray7(region[seriesKey]);
129877
130028
  const updated = [];
129878
130029
  chartData.series.forEach((series, index) => {
129879
130030
  const node = existing[index];
@@ -129955,157 +130106,6 @@ var init_chart_external_workbook_save = __esm({
129955
130106
  }
129956
130107
  });
129957
130108
 
129958
- // pptx/core/core/runtime/chart-part-registration.ts
129959
- function asArray7(value) {
129960
- if (value === void 0 || value === null) {
129961
- return [];
129962
- }
129963
- return (Array.isArray(value) ? value : [value]).filter(
129964
- (entry2) => Boolean(entry2) && typeof entry2 === "object"
129965
- );
129966
- }
129967
- function nextFreeChartPartPath(zip, directory) {
129968
- let n = 1;
129969
- while (zip.file(`${directory}/chart${n}.xml`)) {
129970
- n += 1;
129971
- }
129972
- return `${directory}/chart${n}.xml`;
129973
- }
129974
- function resolvePartTarget(fromPart, target) {
129975
- if (target.startsWith("/")) {
129976
- return target.slice(1);
129977
- }
129978
- const segments = fromPart.split("/").slice(0, -1);
129979
- for (const segment of target.split("/")) {
129980
- if (segment === "..") {
129981
- segments.pop();
129982
- } else if (segment !== "." && segment !== "") {
129983
- segments.push(segment);
129984
- }
129985
- }
129986
- return segments.join("/");
129987
- }
129988
- function relativePartTarget2(fromPart, toPart) {
129989
- const from = fromPart.split("/").slice(0, -1);
129990
- const to = toPart.split("/");
129991
- let common = 0;
129992
- while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
129993
- common += 1;
129994
- }
129995
- return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
129996
- }
129997
- async function ensureContentTypeOverride2(deps, partPath, contentType) {
129998
- const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
129999
- if (!xml) {
130000
- return;
130001
- }
130002
- const tree = deps.parser.parse(xml);
130003
- const types = tree["Types"] ?? {};
130004
- const overrides28 = asArray7(types["Override"]);
130005
- const partName = `/${partPath}`;
130006
- if (overrides28.some((entry2) => String(entry2["@_PartName"]) === partName)) {
130007
- return;
130008
- }
130009
- overrides28.push({ "@_PartName": partName, "@_ContentType": contentType });
130010
- types["Override"] = overrides28;
130011
- tree["Types"] = types;
130012
- deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
130013
- }
130014
- async function rewriteChartRelationship(deps, slidePath, rewrite) {
130015
- const slash = slidePath.lastIndexOf("/");
130016
- const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
130017
- const xml = await deps.zip.file(relsPath2)?.async("string");
130018
- if (!xml) {
130019
- return void 0;
130020
- }
130021
- const tree = deps.parser.parse(xml);
130022
- const root = tree["Relationships"];
130023
- const relationships3 = asArray7(root?.["Relationship"]);
130024
- const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
130025
- (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
130026
- );
130027
- if (!match || !root) {
130028
- return void 0;
130029
- }
130030
- match["@_Type"] = rewrite.relationshipType;
130031
- match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
130032
- delete match["@_TargetMode"];
130033
- root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
130034
- deps.zip.file(relsPath2, deps.builder.build(tree));
130035
- return String(match["@_Id"]);
130036
- }
130037
- function rebindGraphicData(node, relationshipId2, extended) {
130038
- for (const key2 of Object.keys(node)) {
130039
- delete node[key2];
130040
- }
130041
- node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
130042
- if (extended) {
130043
- node["cx:chart"] = {
130044
- "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
130045
- "@_xmlns:r": NS_R3,
130046
- "@_r:id": relationshipId2
130047
- };
130048
- } else {
130049
- node["c:chart"] = {
130050
- "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
130051
- "@_xmlns:r": NS_R3,
130052
- "@_r:id": relationshipId2
130053
- };
130054
- }
130055
- }
130056
- function visitGraphicData(node, relationshipId2, extended, getLocalName2) {
130057
- if (!node || typeof node !== "object") {
130058
- return 0;
130059
- }
130060
- if (Array.isArray(node)) {
130061
- return node.reduce(
130062
- (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended, getLocalName2),
130063
- 0
130064
- );
130065
- }
130066
- const object = node;
130067
- let count = 0;
130068
- for (const key2 of Object.keys(object)) {
130069
- if (key2.startsWith("@_")) {
130070
- continue;
130071
- }
130072
- const value = object[key2];
130073
- if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
130074
- for (const candidate of asArray7(value)) {
130075
- const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
130076
- const chart = chartKey ? candidate[chartKey] : void 0;
130077
- if (chart && String(chart["@_r:id"]) === relationshipId2) {
130078
- rebindGraphicData(candidate, relationshipId2, extended);
130079
- count += 1;
130080
- }
130081
- }
130082
- continue;
130083
- }
130084
- count += visitGraphicData(value, relationshipId2, extended, getLocalName2);
130085
- }
130086
- return count;
130087
- }
130088
- async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended) {
130089
- const xml = await deps.zip.file(slidePath)?.async("string");
130090
- if (!xml) {
130091
- return 0;
130092
- }
130093
- const tree = deps.parser.parse(xml);
130094
- const count = visitGraphicData(tree, relationshipId2, extended, deps.getLocalName);
130095
- if (count > 0) {
130096
- deps.zip.file(slidePath, deps.builder.build(tree));
130097
- }
130098
- return count;
130099
- }
130100
- var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R3;
130101
- var init_chart_part_registration = __esm({
130102
- "pptx/core/core/runtime/chart-part-registration.ts"() {
130103
- CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
130104
- CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
130105
- NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
130106
- }
130107
- });
130108
-
130109
130109
  // pptx/core/core/runtime/chart-part-family-switch.ts
130110
130110
  function detectChartPartFamily(chartSpace, getLocalName2) {
130111
130111
  const keys = Object.keys(chartSpace);
@@ -134152,18 +134152,22 @@ var init_PptxHandlerRuntimeElementActions = __esm({
134152
134152
  * Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
134153
134153
  * a `p:cNvPr` parent.
134154
134154
  */
134155
- serializeSingleAction(cNvPr, nodeName, action, resolveHyperlinkRelationshipId) {
134155
+ serializeSingleAction(cNvPr, nodeName, action, links) {
134156
134156
  if (!action) {
134157
134157
  delete cNvPr[nodeName];
134158
134158
  return;
134159
134159
  }
134160
134160
  const node = {};
134161
+ const url = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
134161
134162
  let rId = action.rId;
134162
- if (!rId && action.url) {
134163
+ if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
134164
+ rId = void 0;
134165
+ }
134166
+ if (!rId && url) {
134163
134167
  const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
134164
134168
  action.action ?? ""
134165
134169
  );
134166
- rId = resolveHyperlinkRelationshipId(action.url, forceExternal) ?? void 0;
134170
+ rId = links.resolveHyperlinkRelationshipId(url, forceExternal) ?? void 0;
134167
134171
  }
134168
134172
  node["@_r:id"] = rId ?? "";
134169
134173
  if (action.action) {
@@ -134237,7 +134241,7 @@ var init_PptxHandlerRuntimeElementActions = __esm({
134237
134241
  * the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
134238
134242
  * non-visual properties.
134239
134243
  */
134240
- serializeElementActions(shape, el, resolveHyperlinkRelationshipId) {
134244
+ serializeElementActions(shape, el, links) {
134241
134245
  const key2 = this.getTreeBucketKeyForElementType(el.type);
134242
134246
  const cNvPr = this.getCnvPrNode(shape, key2);
134243
134247
  if (!cNvPr) {
@@ -134245,8 +134249,8 @@ var init_PptxHandlerRuntimeElementActions = __esm({
134245
134249
  }
134246
134250
  const actionClick = "actionClick" in el ? el.actionClick : void 0;
134247
134251
  const actionHover = "actionHover" in el ? el.actionHover : void 0;
134248
- this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, resolveHyperlinkRelationshipId);
134249
- this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, resolveHyperlinkRelationshipId);
134252
+ this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
134253
+ this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
134250
134254
  const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
134251
134255
  serializeDecorativeExtension(cNvPr, isDecorative);
134252
134256
  }
@@ -147874,7 +147878,7 @@ var init_PptxHandlerRuntimeSaveElementWriter = __esm({
147874
147878
  if (ctx.connectorShapeIds) {
147875
147879
  applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
147876
147880
  }
147877
- this.serializeElementActions(shape, el, ctx.resolveHyperlinkRelationshipId);
147881
+ this.serializeElementActions(shape, el, ctx);
147878
147882
  this.serializeShapeLocks(shape, el);
147879
147883
  this.applyHiddenToCnvPr(shape, el);
147880
147884
  this.applyNameToCnvPr(shape, el);
@@ -148852,6 +148856,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
148852
148856
  init_theme_override_utils();
148853
148857
  init_builders();
148854
148858
  init_authored_slide_background();
148859
+ init_chart_part_registration();
148855
148860
  init_PptxHandlerRuntimeSaveElementWriter();
148856
148861
  init_save_structural_id_gate();
148857
148862
  init_slide_fingerprint();
@@ -148987,7 +148992,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
148987
148992
  * Process a single slide during save: update slide XML, process elements,
148988
148993
  * rebuild shape tree, and persist relationships.
148989
148994
  */
148990
- async processSlideForSave(slide, saveSession, constants) {
148995
+ async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
148991
148996
  if (this.canSkipSlideSave(slide)) {
148992
148997
  return;
148993
148998
  }
@@ -149172,6 +149177,10 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
149172
149177
  slideRelationshipRegistry,
149173
149178
  resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
149174
149179
  getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
149180
+ slideTargetAt: (index) => {
149181
+ const target = slidePaths[index];
149182
+ return target ? relativePartTarget2(slide.id, target) : void 0;
149183
+ },
149175
149184
  resolvedMediaBytes,
149176
149185
  saveSession,
149177
149186
  slideImageRelationshipType: constants.slideImageRelationshipType,
@@ -151547,8 +151556,9 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
151547
151556
  await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
151548
151557
  await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
151549
151558
  this.templateElementBaselines.beginSave();
151559
+ const slidePaths = slides.map((slide) => slide.id);
151550
151560
  for (const slide of slides) {
151551
- await this.processSlideForSave(slide, saveSession, saveConstants);
151561
+ await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
151552
151562
  }
151553
151563
  this.templateElementBaselines.commitSave();
151554
151564
  const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");