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
@@ -95463,7 +95463,10 @@ async function resolveBulletImage(imageRelId, slidePath, resolver) {
95463
95463
  if (!target) {
95464
95464
  return void 0;
95465
95465
  }
95466
- if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
95466
+ if (target.startsWith("http://") || target.startsWith("https://")) {
95467
+ return resolver.allowExternalImages ? target : void 0;
95468
+ }
95469
+ if (target.startsWith("data:")) {
95467
95470
  return target;
95468
95471
  }
95469
95472
  const imagePath = resolver.resolveImagePath(slidePath, target);
@@ -111434,6 +111437,157 @@ var init_pptx_view_props_helpers = __esm({
111434
111437
  }
111435
111438
  });
111436
111439
 
111440
+ // pptx/core/core/runtime/chart-part-registration.ts
111441
+ function asArray4(value) {
111442
+ if (value === void 0 || value === null) {
111443
+ return [];
111444
+ }
111445
+ return (Array.isArray(value) ? value : [value]).filter(
111446
+ (entry2) => Boolean(entry2) && typeof entry2 === "object"
111447
+ );
111448
+ }
111449
+ function nextFreeChartPartPath(zip, directory) {
111450
+ let n = 1;
111451
+ while (zip.file(`${directory}/chart${n}.xml`)) {
111452
+ n += 1;
111453
+ }
111454
+ return `${directory}/chart${n}.xml`;
111455
+ }
111456
+ function resolvePartTarget(fromPart, target) {
111457
+ if (target.startsWith("/")) {
111458
+ return target.slice(1);
111459
+ }
111460
+ const segments = fromPart.split("/").slice(0, -1);
111461
+ for (const segment of target.split("/")) {
111462
+ if (segment === "..") {
111463
+ segments.pop();
111464
+ } else if (segment !== "." && segment !== "") {
111465
+ segments.push(segment);
111466
+ }
111467
+ }
111468
+ return segments.join("/");
111469
+ }
111470
+ function relativePartTarget2(fromPart, toPart) {
111471
+ const from = fromPart.split("/").slice(0, -1);
111472
+ const to = toPart.split("/");
111473
+ let common = 0;
111474
+ while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
111475
+ common += 1;
111476
+ }
111477
+ return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
111478
+ }
111479
+ async function ensureContentTypeOverride2(deps, partPath, contentType) {
111480
+ const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
111481
+ if (!xml) {
111482
+ return;
111483
+ }
111484
+ const tree = deps.parser.parse(xml);
111485
+ const types = tree["Types"] ?? {};
111486
+ const overrides = asArray4(types["Override"]);
111487
+ const partName = `/${partPath}`;
111488
+ if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
111489
+ return;
111490
+ }
111491
+ overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
111492
+ types["Override"] = overrides;
111493
+ tree["Types"] = types;
111494
+ deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
111495
+ }
111496
+ async function rewriteChartRelationship(deps, slidePath, rewrite) {
111497
+ const slash = slidePath.lastIndexOf("/");
111498
+ const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
111499
+ const xml = await deps.zip.file(relsPath2)?.async("string");
111500
+ if (!xml) {
111501
+ return void 0;
111502
+ }
111503
+ const tree = deps.parser.parse(xml);
111504
+ const root = tree["Relationships"];
111505
+ const relationships3 = asArray4(root?.["Relationship"]);
111506
+ const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
111507
+ (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
111508
+ );
111509
+ if (!match || !root) {
111510
+ return void 0;
111511
+ }
111512
+ match["@_Type"] = rewrite.relationshipType;
111513
+ match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
111514
+ delete match["@_TargetMode"];
111515
+ root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
111516
+ deps.zip.file(relsPath2, deps.builder.build(tree));
111517
+ return String(match["@_Id"]);
111518
+ }
111519
+ function rebindGraphicData(node2, relationshipId2, extended2) {
111520
+ for (const key2 of Object.keys(node2)) {
111521
+ delete node2[key2];
111522
+ }
111523
+ node2["@_uri"] = extended2 ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
111524
+ if (extended2) {
111525
+ node2["cx:chart"] = {
111526
+ "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
111527
+ "@_xmlns:r": NS_R,
111528
+ "@_r:id": relationshipId2
111529
+ };
111530
+ } else {
111531
+ node2["c:chart"] = {
111532
+ "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
111533
+ "@_xmlns:r": NS_R,
111534
+ "@_r:id": relationshipId2
111535
+ };
111536
+ }
111537
+ }
111538
+ function visitGraphicData(node2, relationshipId2, extended2, getLocalName2) {
111539
+ if (!node2 || typeof node2 !== "object") {
111540
+ return 0;
111541
+ }
111542
+ if (Array.isArray(node2)) {
111543
+ return node2.reduce(
111544
+ (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended2, getLocalName2),
111545
+ 0
111546
+ );
111547
+ }
111548
+ const object2 = node2;
111549
+ let count = 0;
111550
+ for (const key2 of Object.keys(object2)) {
111551
+ if (key2.startsWith("@_")) {
111552
+ continue;
111553
+ }
111554
+ const value = object2[key2];
111555
+ if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
111556
+ for (const candidate of asArray4(value)) {
111557
+ const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
111558
+ const chart = chartKey ? candidate[chartKey] : void 0;
111559
+ if (chart && String(chart["@_r:id"]) === relationshipId2) {
111560
+ rebindGraphicData(candidate, relationshipId2, extended2);
111561
+ count += 1;
111562
+ }
111563
+ }
111564
+ continue;
111565
+ }
111566
+ count += visitGraphicData(value, relationshipId2, extended2, getLocalName2);
111567
+ }
111568
+ return count;
111569
+ }
111570
+ async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended2) {
111571
+ const xml = await deps.zip.file(slidePath)?.async("string");
111572
+ if (!xml) {
111573
+ return 0;
111574
+ }
111575
+ const tree = deps.parser.parse(xml);
111576
+ const count = visitGraphicData(tree, relationshipId2, extended2, deps.getLocalName);
111577
+ if (count > 0) {
111578
+ deps.zip.file(slidePath, deps.builder.build(tree));
111579
+ }
111580
+ return count;
111581
+ }
111582
+ var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R;
111583
+ var init_chart_part_registration = __esm({
111584
+ "pptx/core/core/runtime/chart-part-registration.ts"() {
111585
+ CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
111586
+ CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
111587
+ NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
111588
+ }
111589
+ });
111590
+
111437
111591
  // pptx/core/utils/chart-color-style-writer.ts
111438
111592
  function localName22(key2) {
111439
111593
  return key2.replace(/^.*:/u, "");
@@ -111703,7 +111857,7 @@ function buildChartExSpaceXml(chartData) {
111703
111857
  const chartSpace = {
111704
111858
  "@_xmlns:cx": NS_CX,
111705
111859
  "@_xmlns:a": NS_A,
111706
- "@_xmlns:r": NS_R,
111860
+ "@_xmlns:r": NS_R2,
111707
111861
  "cx:chartData": {
111708
111862
  "cx:data": chartData.series.map(
111709
111863
  (series, index2) => buildChartExData(chartData, series, index2)
@@ -111717,7 +111871,7 @@ function buildChartExSpaceXml(chartData) {
111717
111871
  }
111718
111872
  return { "cx:chartSpace": chartSpace };
111719
111873
  }
111720
- var NS_CX, NS_A, NS_R, NS_C;
111874
+ var NS_CX, NS_A, NS_R2, NS_C;
111721
111875
  var init_chart_cx_generator = __esm({
111722
111876
  "pptx/core/utils/chart-cx-generator.ts"() {
111723
111877
  init_chart_cx_legend();
@@ -111725,7 +111879,7 @@ var init_chart_cx_generator = __esm({
111725
111879
  init_chart_cx_legend();
111726
111880
  NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
111727
111881
  NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
111728
- NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
111882
+ NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
111729
111883
  NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
111730
111884
  }
111731
111885
  });
@@ -113352,7 +113506,7 @@ function buildChartSpaceXml(chartData) {
113352
113506
  "c:chartSpace": {
113353
113507
  "@_xmlns:c": NS_C2,
113354
113508
  "@_xmlns:a": NS_A2,
113355
- "@_xmlns:r": NS_R2,
113509
+ "@_xmlns:r": NS_R3,
113356
113510
  "c:chart": chart
113357
113511
  }
113358
113512
  };
@@ -113360,7 +113514,7 @@ function buildChartSpaceXml(chartData) {
113360
113514
  applyGeneratedChartSpaceFormat(result, chartData);
113361
113515
  return result;
113362
113516
  }
113363
- var NS_C2, NS_A2, NS_R2, CAT_AX_ID, VAL_AX_ID, SER_AX_ID, SCATTER_LIKE;
113517
+ var NS_C2, NS_A2, NS_R3, CAT_AX_ID, VAL_AX_ID, SER_AX_ID, SCATTER_LIKE;
113364
113518
  var init_chart_xml_generator = __esm({
113365
113519
  "pptx/core/utils/chart-xml-generator.ts"() {
113366
113520
  init_chart_bubble_options();
@@ -113381,7 +113535,7 @@ var init_chart_xml_generator = __esm({
113381
113535
  init_chart_xml_series_fill();
113382
113536
  NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
113383
113537
  NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
113384
- NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
113538
+ NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
113385
113539
  CAT_AX_ID = 111111111;
113386
113540
  VAL_AX_ID = 222222222;
113387
113541
  SER_AX_ID = 333333333;
@@ -115533,7 +115687,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
115533
115687
  }
115534
115688
  return rPr;
115535
115689
  }
115536
- function asArray4(value) {
115690
+ function asArray5(value) {
115537
115691
  if (Array.isArray(value)) {
115538
115692
  return value;
115539
115693
  }
@@ -115552,7 +115706,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
115552
115706
  return txKey;
115553
115707
  }
115554
115708
  const pKey = findKey30(rich, "p", getLocalName2) ?? "a:p";
115555
- const paragraphs = asArray4(rich[pKey]).map((para) => {
115709
+ const paragraphs = asArray5(rich[pKey]).map((para) => {
115556
115710
  const next = { ...para };
115557
115711
  const pPrKey = findKey30(next, "pPr", getLocalName2) ?? "a:pPr";
115558
115712
  const pPr = { ...ensureXmlChildOrCreate(next, pPrKey, "first") };
@@ -115565,7 +115719,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
115565
115719
  next[pPrKey] = pPr;
115566
115720
  const rKey = findKey30(next, "r", getLocalName2);
115567
115721
  if (rKey) {
115568
- const runs = asArray4(next[rKey]).map((run2) => {
115722
+ const runs = asArray5(next[rKey]).map((run2) => {
115569
115723
  const rPrKey = findKey30(run2, "rPr", getLocalName2) ?? "a:rPr";
115570
115724
  const existingRPr = run2[rPrKey] ?? {};
115571
115725
  const nextRun = { ...run2 };
@@ -115959,7 +116113,7 @@ var init_chart_neutral_save = __esm({
115959
116113
  function findKey31(node2, localName28, getLocalName2) {
115960
116114
  return Object.keys(node2).find((key2) => getLocalName2(key2) === localName28);
115961
116115
  }
115962
- function asArray5(value) {
116116
+ function asArray6(value) {
115963
116117
  if (value === void 0 || value === null) {
115964
116118
  return [];
115965
116119
  }
@@ -115973,8 +116127,8 @@ function dimensionType(node2) {
115973
116127
  function replaceLevels(target, source, getLocalName2) {
115974
116128
  const targetKey = findKey31(target, "lvl", getLocalName2) ?? "cx:lvl";
115975
116129
  const sourceKey = findKey31(source, "lvl", getLocalName2);
115976
- const oldLevels = asArray5(target[targetKey]);
115977
- const newLevels = asArray5(sourceKey ? source[sourceKey] : void 0).map((level2, index2) => {
116130
+ const oldLevels = asArray6(target[targetKey]);
116131
+ const newLevels = asArray6(sourceKey ? source[sourceKey] : void 0).map((level2, index2) => {
115978
116132
  const old = oldLevels[index2];
115979
116133
  if (!old) {
115980
116134
  return level2;
@@ -115993,8 +116147,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
115993
116147
  for (const kind of ["strDim", "numDim"]) {
115994
116148
  const targetKey = findKey31(target, kind, getLocalName2) ?? `cx:${kind}`;
115995
116149
  const freshKey = findKey31(fresh, kind, getLocalName2);
115996
- const existing = asArray5(target[targetKey]);
115997
- const incoming = asArray5(freshKey ? fresh[freshKey] : void 0);
116150
+ const existing = asArray6(target[targetKey]);
116151
+ const incoming = asArray6(freshKey ? fresh[freshKey] : void 0);
115998
116152
  for (const dimension of incoming) {
115999
116153
  const wantedType = dimensionType(dimension);
116000
116154
  let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
@@ -116032,7 +116186,7 @@ function child28(node2, localName28, getLocalName2) {
116032
116186
  const value = key2 ? node2[key2] : void 0;
116033
116187
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
116034
116188
  }
116035
- function asArray6(value) {
116189
+ function asArray7(value) {
116036
116190
  if (value === void 0 || value === null) {
116037
116191
  return [];
116038
116192
  }
@@ -116221,7 +116375,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
116221
116375
  getLocalName2
116222
116376
  );
116223
116377
  const seriesKey = region ? findKey32(region, "series", getLocalName2) : void 0;
116224
- const first2 = region && seriesKey ? asArray6(region[seriesKey])[0] : void 0;
116378
+ const first2 = region && seriesKey ? asArray7(region[seriesKey])[0] : void 0;
116225
116379
  const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
116226
116380
  const series = chartData.series[0];
116227
116381
  if (!existing || !series) {
@@ -116239,9 +116393,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
116239
116393
  const chartDataKey = findKey32(chartSpace, "chartData", getLocalName2);
116240
116394
  const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
116241
116395
  const dataKey = findKey32(chartDataNode, "data", getLocalName2) ?? "cx:data";
116242
- const dataNodes = asArray6(chartDataNode[dataKey]);
116396
+ const dataNodes = asArray7(chartDataNode[dataKey]);
116243
116397
  const seriesKey = findKey32(region, "series", getLocalName2) ?? "cx:series";
116244
- const existing = asArray6(region[seriesKey]);
116398
+ const existing = asArray7(region[seriesKey]);
116245
116399
  const updated = [];
116246
116400
  chartData.series.forEach((series, index2) => {
116247
116401
  const node2 = existing[index2];
@@ -116323,157 +116477,6 @@ var init_chart_external_workbook_save = __esm({
116323
116477
  }
116324
116478
  });
116325
116479
 
116326
- // pptx/core/core/runtime/chart-part-registration.ts
116327
- function asArray7(value) {
116328
- if (value === void 0 || value === null) {
116329
- return [];
116330
- }
116331
- return (Array.isArray(value) ? value : [value]).filter(
116332
- (entry2) => Boolean(entry2) && typeof entry2 === "object"
116333
- );
116334
- }
116335
- function nextFreeChartPartPath(zip, directory) {
116336
- let n = 1;
116337
- while (zip.file(`${directory}/chart${n}.xml`)) {
116338
- n += 1;
116339
- }
116340
- return `${directory}/chart${n}.xml`;
116341
- }
116342
- function resolvePartTarget(fromPart, target) {
116343
- if (target.startsWith("/")) {
116344
- return target.slice(1);
116345
- }
116346
- const segments = fromPart.split("/").slice(0, -1);
116347
- for (const segment of target.split("/")) {
116348
- if (segment === "..") {
116349
- segments.pop();
116350
- } else if (segment !== "." && segment !== "") {
116351
- segments.push(segment);
116352
- }
116353
- }
116354
- return segments.join("/");
116355
- }
116356
- function relativePartTarget2(fromPart, toPart) {
116357
- const from = fromPart.split("/").slice(0, -1);
116358
- const to = toPart.split("/");
116359
- let common = 0;
116360
- while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
116361
- common += 1;
116362
- }
116363
- return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
116364
- }
116365
- async function ensureContentTypeOverride2(deps, partPath, contentType) {
116366
- const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
116367
- if (!xml) {
116368
- return;
116369
- }
116370
- const tree = deps.parser.parse(xml);
116371
- const types = tree["Types"] ?? {};
116372
- const overrides = asArray7(types["Override"]);
116373
- const partName = `/${partPath}`;
116374
- if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
116375
- return;
116376
- }
116377
- overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
116378
- types["Override"] = overrides;
116379
- tree["Types"] = types;
116380
- deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
116381
- }
116382
- async function rewriteChartRelationship(deps, slidePath, rewrite) {
116383
- const slash = slidePath.lastIndexOf("/");
116384
- const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
116385
- const xml = await deps.zip.file(relsPath2)?.async("string");
116386
- if (!xml) {
116387
- return void 0;
116388
- }
116389
- const tree = deps.parser.parse(xml);
116390
- const root = tree["Relationships"];
116391
- const relationships3 = asArray7(root?.["Relationship"]);
116392
- const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
116393
- (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
116394
- );
116395
- if (!match || !root) {
116396
- return void 0;
116397
- }
116398
- match["@_Type"] = rewrite.relationshipType;
116399
- match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
116400
- delete match["@_TargetMode"];
116401
- root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
116402
- deps.zip.file(relsPath2, deps.builder.build(tree));
116403
- return String(match["@_Id"]);
116404
- }
116405
- function rebindGraphicData(node2, relationshipId2, extended2) {
116406
- for (const key2 of Object.keys(node2)) {
116407
- delete node2[key2];
116408
- }
116409
- node2["@_uri"] = extended2 ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
116410
- if (extended2) {
116411
- node2["cx:chart"] = {
116412
- "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
116413
- "@_xmlns:r": NS_R3,
116414
- "@_r:id": relationshipId2
116415
- };
116416
- } else {
116417
- node2["c:chart"] = {
116418
- "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
116419
- "@_xmlns:r": NS_R3,
116420
- "@_r:id": relationshipId2
116421
- };
116422
- }
116423
- }
116424
- function visitGraphicData(node2, relationshipId2, extended2, getLocalName2) {
116425
- if (!node2 || typeof node2 !== "object") {
116426
- return 0;
116427
- }
116428
- if (Array.isArray(node2)) {
116429
- return node2.reduce(
116430
- (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended2, getLocalName2),
116431
- 0
116432
- );
116433
- }
116434
- const object2 = node2;
116435
- let count = 0;
116436
- for (const key2 of Object.keys(object2)) {
116437
- if (key2.startsWith("@_")) {
116438
- continue;
116439
- }
116440
- const value = object2[key2];
116441
- if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
116442
- for (const candidate of asArray7(value)) {
116443
- const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
116444
- const chart = chartKey ? candidate[chartKey] : void 0;
116445
- if (chart && String(chart["@_r:id"]) === relationshipId2) {
116446
- rebindGraphicData(candidate, relationshipId2, extended2);
116447
- count += 1;
116448
- }
116449
- }
116450
- continue;
116451
- }
116452
- count += visitGraphicData(value, relationshipId2, extended2, getLocalName2);
116453
- }
116454
- return count;
116455
- }
116456
- async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended2) {
116457
- const xml = await deps.zip.file(slidePath)?.async("string");
116458
- if (!xml) {
116459
- return 0;
116460
- }
116461
- const tree = deps.parser.parse(xml);
116462
- const count = visitGraphicData(tree, relationshipId2, extended2, deps.getLocalName);
116463
- if (count > 0) {
116464
- deps.zip.file(slidePath, deps.builder.build(tree));
116465
- }
116466
- return count;
116467
- }
116468
- var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R3;
116469
- var init_chart_part_registration = __esm({
116470
- "pptx/core/core/runtime/chart-part-registration.ts"() {
116471
- CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
116472
- CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
116473
- NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
116474
- }
116475
- });
116476
-
116477
116480
  // pptx/core/core/runtime/chart-part-family-switch.ts
116478
116481
  function detectChartPartFamily(chartSpace, getLocalName2) {
116479
116482
  const keys = Object.keys(chartSpace);
@@ -120520,18 +120523,22 @@ var init_PptxHandlerRuntimeElementActions = __esm({
120520
120523
  * Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
120521
120524
  * a `p:cNvPr` parent.
120522
120525
  */
120523
- serializeSingleAction(cNvPr, nodeName, action, resolveHyperlinkRelationshipId) {
120526
+ serializeSingleAction(cNvPr, nodeName, action, links) {
120524
120527
  if (!action) {
120525
120528
  delete cNvPr[nodeName];
120526
120529
  return;
120527
120530
  }
120528
120531
  const node2 = {};
120532
+ const url2 = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
120529
120533
  let rId = action.rId;
120530
- if (!rId && action.url) {
120534
+ if (rId && url2 && links.getSlideRelationshipMap().get(rId) !== url2) {
120535
+ rId = void 0;
120536
+ }
120537
+ if (!rId && url2) {
120531
120538
  const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
120532
120539
  action.action ?? ""
120533
120540
  );
120534
- rId = resolveHyperlinkRelationshipId(action.url, forceExternal) ?? void 0;
120541
+ rId = links.resolveHyperlinkRelationshipId(url2, forceExternal) ?? void 0;
120535
120542
  }
120536
120543
  node2["@_r:id"] = rId ?? "";
120537
120544
  if (action.action) {
@@ -120605,7 +120612,7 @@ var init_PptxHandlerRuntimeElementActions = __esm({
120605
120612
  * the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
120606
120613
  * non-visual properties.
120607
120614
  */
120608
- serializeElementActions(shape, el, resolveHyperlinkRelationshipId) {
120615
+ serializeElementActions(shape, el, links) {
120609
120616
  const key2 = this.getTreeBucketKeyForElementType(el.type);
120610
120617
  const cNvPr = this.getCnvPrNode(shape, key2);
120611
120618
  if (!cNvPr) {
@@ -120613,8 +120620,8 @@ var init_PptxHandlerRuntimeElementActions = __esm({
120613
120620
  }
120614
120621
  const actionClick = "actionClick" in el ? el.actionClick : void 0;
120615
120622
  const actionHover = "actionHover" in el ? el.actionHover : void 0;
120616
- this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, resolveHyperlinkRelationshipId);
120617
- this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, resolveHyperlinkRelationshipId);
120623
+ this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
120624
+ this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
120618
120625
  const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
120619
120626
  serializeDecorativeExtension(cNvPr, isDecorative);
120620
120627
  }
@@ -133903,7 +133910,7 @@ var init_PptxHandlerRuntimeSaveElementWriter = __esm({
133903
133910
  if (ctx.connectorShapeIds) {
133904
133911
  applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
133905
133912
  }
133906
- this.serializeElementActions(shape, el, ctx.resolveHyperlinkRelationshipId);
133913
+ this.serializeElementActions(shape, el, ctx);
133907
133914
  this.serializeShapeLocks(shape, el);
133908
133915
  this.applyHiddenToCnvPr(shape, el);
133909
133916
  this.applyNameToCnvPr(shape, el);
@@ -134881,6 +134888,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
134881
134888
  init_theme_override_utils();
134882
134889
  init_builders();
134883
134890
  init_authored_slide_background();
134891
+ init_chart_part_registration();
134884
134892
  init_PptxHandlerRuntimeSaveElementWriter();
134885
134893
  init_save_structural_id_gate();
134886
134894
  init_slide_fingerprint();
@@ -135016,7 +135024,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
135016
135024
  * Process a single slide during save: update slide XML, process elements,
135017
135025
  * rebuild shape tree, and persist relationships.
135018
135026
  */
135019
- async processSlideForSave(slide, saveSession, constants) {
135027
+ async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
135020
135028
  if (this.canSkipSlideSave(slide)) {
135021
135029
  return;
135022
135030
  }
@@ -135201,6 +135209,10 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
135201
135209
  slideRelationshipRegistry,
135202
135210
  resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
135203
135211
  getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
135212
+ slideTargetAt: (index2) => {
135213
+ const target = slidePaths[index2];
135214
+ return target ? relativePartTarget2(slide.id, target) : void 0;
135215
+ },
135204
135216
  resolvedMediaBytes,
135205
135217
  saveSession,
135206
135218
  slideImageRelationshipType: constants.slideImageRelationshipType,
@@ -137576,8 +137588,9 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
137576
137588
  await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
137577
137589
  await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
137578
137590
  this.templateElementBaselines.beginSave();
137591
+ const slidePaths = slides.map((slide) => slide.id);
137579
137592
  for (const slide of slides) {
137580
- await this.processSlideForSave(slide, saveSession, saveConstants);
137593
+ await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
137581
137594
  }
137582
137595
  this.templateElementBaselines.commitSave();
137583
137596
  const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");
@@ -138063,7 +138076,13 @@ var init_PptxHandlerRuntimeElementParsing = __esm({
138063
138076
  if (posterRId && relsMap) {
138064
138077
  const posterTarget = relsMap.get(posterRId);
138065
138078
  if (posterTarget) {
138066
- if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://") || posterTarget.startsWith("data:")) {
138079
+ if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://")) {
138080
+ if (this.allowExternalImages === true) {
138081
+ posterImage = posterTarget;
138082
+ imagePath = posterTarget;
138083
+ imageData = posterTarget;
138084
+ }
138085
+ } else if (posterTarget.startsWith("data:")) {
138067
138086
  posterImage = posterTarget;
138068
138087
  imagePath = posterTarget;
138069
138088
  imageData = posterTarget;
@@ -139249,7 +139268,12 @@ var init_PptxHandlerRuntimeShapeImageFill = __esm({
139249
139268
  const slideRels = this.slideRelsMap.get(slidePath);
139250
139269
  const target = slideRels?.get(relId);
139251
139270
  if (target) {
139252
- if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
139271
+ if (target.startsWith("http://") || target.startsWith("https://")) {
139272
+ if (this.allowExternalImages === true) {
139273
+ imagePath = target;
139274
+ imageData = target;
139275
+ }
139276
+ } else if (target.startsWith("data:")) {
139253
139277
  imagePath = target;
139254
139278
  imageData = target;
139255
139279
  } else {
@@ -139722,7 +139746,9 @@ var init_PptxHandlerRuntimeBulletParsing = __esm({
139722
139746
  const target = slideRels?.get(imageRelId);
139723
139747
  let imageDataUrl;
139724
139748
  if (target) {
139725
- if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
139749
+ if (target.startsWith("http://") || target.startsWith("https://")) {
139750
+ imageDataUrl = this.allowExternalImages === true ? target : void 0;
139751
+ } else if (target.startsWith("data:")) {
139726
139752
  imageDataUrl = target;
139727
139753
  } else {
139728
139754
  const imagePath = this.resolveImagePath(slidePath, target);
@@ -149452,6 +149478,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
149452
149478
  async enrichBulletPictureElementsWithEmbeddedData(elements3, slidePath) {
149453
149479
  await enrichBulletPictureImages(elements3, slidePath, {
149454
149480
  slideRelsMap: this.slideRelsMap,
149481
+ allowExternalImages: this.allowExternalImages === true,
149455
149482
  resolveImagePath: (path4, target) => this.resolveImagePath(path4, target),
149456
149483
  getImageData: (imagePath) => this.getImageData(imagePath)
149457
149484
  });
@@ -1,10 +1,10 @@
1
1
  import { r as TextSegment } from "../chunks/text-D49FKllA.js";
2
2
  import { t as PptxThemeColorRef } from "../chunks/color-ref-DT599vEx.js";
3
3
  import { $ as ParsedTableStyleFill, Jt as PptxChartMarkerSymbol, Lt as PptxChartErrBars, Z as ParsedTableStyleBorders, _ as PptxElementWithText, at as ParsedTableStyleText, m as PptxElement, or as ShapeStyle, pn as PptxChartUserShape, st as PptxTableCell3D, t as ChartPptxElement } from "../chunks/elements-DhW764aK.js";
4
- import { Yd as OleNestedDeckSlideDetail, Zi as TableStylePartName, cf as OleSheetGrid, ff as OlePayloadEditorKind } from "../chunks/index-D3gKRIAi.js";
4
+ import { Yd as OleNestedDeckSlideDetail, Zi as TableStylePartName, cf as OleSheetGrid, ff as OlePayloadEditorKind } from "../chunks/index-CbFowkp4.js";
5
5
  import { C as PptxSlide, Ct as PptxCoreProperties, ct as PptxThemeColorScheme, d as PptxData, ft as PptxThemeFontScheme, wt as PptxCustomProperty, x as PptxPresentationProperties, yt as PptxAppProperties } from "../chunks/text-operations-CNfUj45U.js";
6
- import { A as PresentationDiff, ft as ChartAxisEdit } from "../chunks/index-B94RKk84.js";
7
- import { C as PptxJsonAssetStats } from "../chunks/index-BOpULlxB.js";
6
+ import { A as PresentationDiff, ft as ChartAxisEdit } from "../chunks/index-D8DNpc1X.js";
7
+ import { C as PptxJsonAssetStats } from "../chunks/index-D4FnOx6x.js";
8
8
  import { d as ZodType, g as $ZodTypeInternals, h as $ZodShape, m as output, s as ZodObject } from "../chunks/schemas-fuDGetRe.js";
9
9
  import { Doc, Text } from "yjs";
10
10
  declare namespace types_d_exports {
@@ -1,9 +1,9 @@
1
- import { duplicateSlide, ThemePresets, getThemePreset, ChartBuilder, setChartDataPointStyle, setChartHelperLine, setChartColorMapOverride, listChartUserShapes, addChartUserShape, updateChartUserShape, removeChartUserShape, diffPresentations, findPlaceholders, applyTemplate, getSectionForSlide, moveSlidesToSection, reorderSections, removeSection, addSection, replaceWithCustomGeometry, replaceShapeGeometry, setElementLocked } from '../../chunk-KONCS53X.mjs';
1
+ import { duplicateSlide, ThemePresets, getThemePreset, ChartBuilder, setChartDataPointStyle, setChartHelperLine, setChartColorMapOverride, listChartUserShapes, addChartUserShape, updateChartUserShape, removeChartUserShape, diffPresentations, findPlaceholders, applyTemplate, getSectionForSlide, moveSlidesToSection, reorderSections, removeSection, addSection, replaceWithCustomGeometry, replaceShapeGeometry, setElementLocked } from '../../chunk-4SGBL2H4.mjs';
2
2
  import '../../chunk-6Q7TP72Y.mjs';
3
- import { mergePresentation } from '../../chunk-ZXPPM63Y.mjs';
4
- import { PptxMarkdownConverter } from '../../chunk-EBJ724RB.mjs';
5
- import { rebuildTableStructureInRawXml, TABLE_STYLE_PART_SEQUENCE, normalizeTableStyleGuid, createTableStyleEntry, addTableStyleToMap, deleteTableStyleFromMap, setChartType, setChartTitle, setChartGrouping, setChartLegend, setChartDataLabels, setChartAxis, setChartCategories, addChartSeries, removeChartSeries, updateChartSeriesValues, setChartDataPointExplosion, setChartDataPointMarker, setChartDataPointLabel, setChartSeriesMarker, setChartSeriesTrendline, setChartSeriesErrorBars, findLayoutByName, findLayoutByType, PptxHandler } from '../../chunk-4IIR2QEH.mjs';
6
- import { hasTextProperties, resolveDisplayedChartTypeName, isTemplateElementId, makeStoreAwareId, reassignDescendantIds, groupElements, ungroupElements, decomposeSmartArt, demoteSmartArtNode, promoteSmartArtNode, reorderSmartArtNode, updateSmartArtNodeText, removeSmartArtNode, addSmartArtNode, SvgExporter, buildPptxJsonDocument, deserializePptxFromJson, applyImportedPptxData, validatePptx, repairPptx, resolveOleEditorKindFromPayload, getOleNestedDeckDetail, getOleDocumentParagraphs, getOleSheetGrid, applyOleSheetCellEdit, applyOleDocumentParagraphEdit, applyOleNestedDeckElementTextEdit, setOleObjectName, parseDataUrlToBytes, replaceOleFile, ELEMENT_FIELD_KIND, SLIDE_FIELD_KIND } from '../../chunk-DNYZX6YG.mjs';
3
+ import { mergePresentation } from '../../chunk-63GRFYAN.mjs';
4
+ import { PptxMarkdownConverter } from '../../chunk-ANIFYTKH.mjs';
5
+ import { rebuildTableStructureInRawXml, TABLE_STYLE_PART_SEQUENCE, normalizeTableStyleGuid, createTableStyleEntry, addTableStyleToMap, deleteTableStyleFromMap, setChartType, setChartTitle, setChartGrouping, setChartLegend, setChartDataLabels, setChartAxis, setChartCategories, addChartSeries, removeChartSeries, updateChartSeriesValues, setChartDataPointExplosion, setChartDataPointMarker, setChartDataPointLabel, setChartSeriesMarker, setChartSeriesTrendline, setChartSeriesErrorBars, findLayoutByName, findLayoutByType, PptxHandler } from '../../chunk-KE2FUFIU.mjs';
6
+ import { hasTextProperties, resolveDisplayedChartTypeName, isTemplateElementId, makeStoreAwareId, reassignDescendantIds, groupElements, ungroupElements, decomposeSmartArt, demoteSmartArtNode, promoteSmartArtNode, reorderSmartArtNode, updateSmartArtNodeText, removeSmartArtNode, addSmartArtNode, SvgExporter, buildPptxJsonDocument, deserializePptxFromJson, applyImportedPptxData, validatePptx, repairPptx, resolveOleEditorKindFromPayload, getOleNestedDeckDetail, getOleDocumentParagraphs, getOleSheetGrid, applyOleSheetCellEdit, applyOleDocumentParagraphEdit, applyOleNestedDeckElementTextEdit, setOleObjectName, parseDataUrlToBytes, replaceOleFile, ELEMENT_FIELD_KIND, SLIDE_FIELD_KIND } from '../../chunk-VRJOOHWV.mjs';
7
7
  import '../../chunk-JJ37PCNR.mjs';
8
8
  import '../../chunk-3GXV5MPC.mjs';
9
9
  import { cloneElement } from '../../chunk-54S5A5PZ.mjs';