ooxml-core 1.9.0 → 1.10.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 (126) hide show
  1. package/dist/PptxHandler-5UURGJEV.mjs +2 -0
  2. package/dist/{PptxHandler-EX4WBIQQ.mjs → PptxHandler-ADEFY476.mjs} +2 -2
  3. package/dist/PptxHandler-U5XB2HUE.cjs +11 -0
  4. package/dist/automation/index.cjs +744 -192
  5. package/dist/automation/index.mjs +744 -192
  6. package/dist/{chunk-SWF7KVL5.cjs → chunk-3N6XMMTT.cjs} +1365 -1062
  7. package/dist/{chunk-FIELY5PI.mjs → chunk-5NVJN4E6.mjs} +30 -2
  8. package/dist/{chunk-IGOA57LE.mjs → chunk-A6P7G3UK.mjs} +1 -1
  9. package/dist/{chunk-CPKNMQLX.cjs → chunk-AWIDASUW.cjs} +25 -2
  10. package/dist/{chunk-SVQZXP3F.mjs → chunk-CBNKBVX5.mjs} +25 -2
  11. package/dist/{chunk-OXHMZS7B.mjs → chunk-CCHYFCPD.mjs} +649 -172
  12. package/dist/{chunk-OB277ZGE.mjs → chunk-R6KSBNKX.mjs} +27 -1
  13. package/dist/{chunk-AT66SA5M.cjs → chunk-S6DOCMQC.cjs} +28 -0
  14. package/dist/{chunk-WSO4T2LJ.mjs → chunk-WUE5ZHU3.mjs} +26 -3
  15. package/dist/{chunk-LCS3J3QI.mjs → chunk-ZE53K7DH.mjs} +474 -171
  16. package/dist/{chunk-M76PHYRR.mjs → chunk-ZOUGMAZG.mjs} +1 -1
  17. package/dist/docx/layout/adapt-table.d.ts +2 -2
  18. package/dist/docx/layout/adapt-table.d.ts.map +1 -1
  19. package/dist/docx/layout/flow-table.d.ts.map +1 -1
  20. package/dist/docx/layout/index.cjs +477 -75
  21. package/dist/docx/layout/index.mjs +477 -76
  22. package/dist/docx/layout/nested-frame-profile.d.ts +9 -0
  23. package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -0
  24. package/dist/docx/layout/page-cursor.d.ts +2 -0
  25. package/dist/docx/layout/page-cursor.d.ts.map +1 -1
  26. package/dist/docx/layout/result.d.ts +13 -0
  27. package/dist/docx/layout/result.d.ts.map +1 -1
  28. package/dist/docx/layout/table-border-layout.d.ts +16 -0
  29. package/dist/docx/layout/table-border-layout.d.ts.map +1 -0
  30. package/dist/docx/layout/table-cell-layout.d.ts +2 -1
  31. package/dist/docx/layout/table-cell-layout.d.ts.map +1 -1
  32. package/dist/docx/layout/table-content.d.ts +4 -0
  33. package/dist/docx/layout/table-content.d.ts.map +1 -0
  34. package/dist/docx/layout/table-footnotes.d.ts +5 -0
  35. package/dist/docx/layout/table-footnotes.d.ts.map +1 -1
  36. package/dist/docx/layout/table-frames.d.ts +4 -0
  37. package/dist/docx/layout/table-frames.d.ts.map +1 -0
  38. package/dist/docx/layout/table-layout.d.ts +8 -3
  39. package/dist/docx/layout/table-layout.d.ts.map +1 -1
  40. package/dist/docx/layout/table-note-completion.d.ts +5 -0
  41. package/dist/docx/layout/table-note-completion.d.ts.map +1 -0
  42. package/dist/docx/layout/table-note-stories.d.ts +6 -0
  43. package/dist/docx/layout/table-note-stories.d.ts.map +1 -0
  44. package/dist/pptx/automation/index.cjs +535 -182
  45. package/dist/pptx/automation/index.d.ts +4 -4
  46. package/dist/pptx/automation/index.mjs +5 -5
  47. package/dist/pptx/chunks/{index-BZh-IMkN.d.ts → index-Cuxtr76Y.d.ts} +17 -3
  48. package/dist/pptx/chunks/index-Cuxtr76Y.d.ts.map +1 -0
  49. package/dist/pptx/chunks/{index-B4cnSPNz.d.ts → index-DUCGeZh7.d.ts} +65 -5
  50. package/dist/pptx/chunks/index-DUCGeZh7.d.ts.map +1 -0
  51. package/dist/pptx/chunks/{smart-art-Q2kZQtHh.d.ts → smart-art-D-sXa_Nb.d.ts} +11 -1
  52. package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts.map +1 -0
  53. package/dist/pptx/chunks/{text-operations-BLodkuXE.d.ts → text-operations-BqHmLaLA.d.ts} +26 -2
  54. package/dist/pptx/chunks/text-operations-BqHmLaLA.d.ts.map +1 -0
  55. package/dist/pptx/cli/index.cjs +535 -182
  56. package/dist/pptx/cli/index.d.ts +1 -1
  57. package/dist/pptx/cli/index.mjs +4 -4
  58. package/dist/pptx/converter/index.cjs +1 -0
  59. package/dist/pptx/converter/index.d.ts +1 -1
  60. package/dist/pptx/converter/index.mjs +2 -2
  61. package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +2 -2
  62. package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +1 -1
  63. package/dist/pptx/editor/render/find-replace.cjs +18 -18
  64. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  65. package/dist/pptx/editor/render/find-replace.mjs +2 -2
  66. package/dist/pptx/editor/render/remap-text.cjs +2 -2
  67. package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
  68. package/dist/pptx/editor/render/remap-text.mjs +1 -1
  69. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  70. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  71. package/dist/pptx/index.cjs +762 -182
  72. package/dist/pptx/index.d.ts +5 -5
  73. package/dist/pptx/index.mjs +5 -5
  74. package/dist/pptx/smartart-layouts/index.d.ts +1 -1
  75. package/dist/teams/index.cjs +486 -114
  76. package/dist/teams/index.mjs +486 -114
  77. package/dist/visio/date-cache.d.ts +3 -0
  78. package/dist/visio/date-cache.d.ts.map +1 -0
  79. package/dist/visio/edit-text-field.d.ts.map +1 -1
  80. package/dist/visio/index.cjs +131 -22
  81. package/dist/visio/index.mjs +131 -22
  82. package/dist/visio/shape-metadata.d.ts.map +1 -1
  83. package/dist/visio/text-field-display.d.ts.map +1 -1
  84. package/dist/visio/text-field-fraction.d.ts +3 -0
  85. package/dist/visio/text-field-fraction.d.ts.map +1 -0
  86. package/dist/visio/text-field-numeric.d.ts +1 -1
  87. package/dist/visio/text-field-numeric.d.ts.map +1 -1
  88. package/dist/visio/text-field-system-date.d.ts +4 -0
  89. package/dist/visio/text-field-system-date.d.ts.map +1 -0
  90. package/dist/visio/text-fields.d.ts +1 -0
  91. package/dist/visio/text-fields.d.ts.map +1 -1
  92. package/dist/visio/ui/index.cjs +132 -22
  93. package/dist/visio/ui/index.mjs +132 -22
  94. package/dist/visio/ui/text-field-catalog.d.ts.map +1 -1
  95. package/dist/xlsx/edit/pivots.d.ts.map +1 -1
  96. package/dist/xlsx/index.cjs +614 -170
  97. package/dist/xlsx/index.mjs +614 -170
  98. package/dist/xlsx/load/index.cjs +575 -163
  99. package/dist/xlsx/load/index.mjs +575 -163
  100. package/dist/xlsx/model-pivots.d.ts +23 -2
  101. package/dist/xlsx/model-pivots.d.ts.map +1 -1
  102. package/dist/xlsx/pivot/admission.d.ts.map +1 -1
  103. package/dist/xlsx/pivot/aggregate.d.ts +3 -1
  104. package/dist/xlsx/pivot/aggregate.d.ts.map +1 -1
  105. package/dist/xlsx/pivot/data.d.ts +1 -1
  106. package/dist/xlsx/pivot/data.d.ts.map +1 -1
  107. package/dist/xlsx/pivot/hierarchy-first.d.ts +21 -0
  108. package/dist/xlsx/pivot/hierarchy-first.d.ts.map +1 -0
  109. package/dist/xlsx/pivot/hierarchy.d.ts +2 -4
  110. package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -1
  111. package/dist/xlsx/pivot/measures.d.ts +13 -0
  112. package/dist/xlsx/pivot/measures.d.ts.map +1 -0
  113. package/dist/xlsx/pivot/read.d.ts.map +1 -1
  114. package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
  115. package/dist/xlsx/pivot/values-axis.d.ts +9 -0
  116. package/dist/xlsx/pivot/values-axis.d.ts.map +1 -0
  117. package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
  118. package/dist/xlsx/ui/index.cjs +547 -127
  119. package/dist/xlsx/ui/index.mjs +547 -127
  120. package/package.json +1 -1
  121. package/dist/PptxHandler-AT7FVG5Q.mjs +0 -2
  122. package/dist/PptxHandler-VFSCECPL.cjs +0 -11
  123. package/dist/pptx/chunks/index-B4cnSPNz.d.ts.map +0 -1
  124. package/dist/pptx/chunks/index-BZh-IMkN.d.ts.map +0 -1
  125. package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +0 -1
  126. package/dist/pptx/chunks/text-operations-BLodkuXE.d.ts.map +0 -1
@@ -10557,6 +10557,32 @@ function inheritCustomGeometryCommandOrder(target, ...sources) {
10557
10557
  }
10558
10558
  }
10559
10559
  }
10560
+ function pathListPaths(pathLst) {
10561
+ if (!pathLst || typeof pathLst !== "object") {
10562
+ return [];
10563
+ }
10564
+ return ensureArrayLocal(childByLocalName(pathLst, "path")).filter(
10565
+ (path3) => Boolean(path3) && typeof path3 === "object"
10566
+ );
10567
+ }
10568
+ function readPathListCommandOrder(pathLst) {
10569
+ const orders = pathListPaths(pathLst).map((path3) => [...commandOrder.get(path3) ?? []]);
10570
+ return orders.some((order) => order.length > 0) ? orders : void 0;
10571
+ }
10572
+ function restorePathListCommandOrder(pathLst, orders) {
10573
+ if (!orders || orders.length === 0) {
10574
+ return;
10575
+ }
10576
+ pathListPaths(pathLst).forEach((path3, index) => {
10577
+ const order = orders[index];
10578
+ if (!order || order.length === 0 || commandOrder.has(path3)) {
10579
+ return;
10580
+ }
10581
+ if (orderSignature([...order]) === pathSignature(path3)) {
10582
+ commandOrder.set(path3, [...order]);
10583
+ }
10584
+ });
10585
+ }
10560
10586
  function orderedXmlKey(baseName, order) {
10561
10587
  return `${baseName}${ORDER_SUFFIX}${order}`;
10562
10588
  }
@@ -50075,6 +50101,7 @@ var init_custom_geometry_parser = __esm({
50075
50101
  // pptx/core/geometry/custom-geometry-live-eval.ts
50076
50102
  function pathNodesOf(rawData) {
50077
50103
  const pathLst = rawData?.pathLstXml;
50104
+ restorePathListCommandOrder(pathLst, rawData?.pathCommandOrder);
50078
50105
  return ensureArrayValue(pathLst?.["a:path"]);
50079
50106
  }
50080
50107
  function evaluateCustomGeometryPaths(rawData, pathWidth, pathHeight, overrides) {
@@ -50114,6 +50141,7 @@ var init_custom_geometry_live_eval = __esm({
50114
50141
  "pptx/core/geometry/custom-geometry-live-eval.ts"() {
50115
50142
  init_utils();
50116
50143
  init_custom_geometry();
50144
+ init_custom_geometry_command_order();
50117
50145
  init_custom_geometry_guides();
50118
50146
  init_custom_geometry_parser();
50119
50147
  ensureArray7 = (value) => ensureArrayValue(value);
@@ -51288,6 +51316,7 @@ var init_presentation_field_keys = __esm({
51288
51316
  modernCommentAuthors: true,
51289
51317
  conformance: true,
51290
51318
  embedTrueTypeFonts: true,
51319
+ firstSlideNumber: true,
51291
51320
  defaultTextStyle: true
51292
51321
  };
51293
51322
  PRESENTATION_FIELD_NAMES = Object.keys(PRESENTATION_FIELD_KEYS);
@@ -52881,7 +52910,7 @@ function rootRelsXml() {
52881
52910
  <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
52882
52911
  </Relationships>`;
52883
52912
  }
52884
- function presentationXml(width, height, slideCount) {
52913
+ function presentationXml(width, height, slideCount, firstSlideNumber) {
52885
52914
  const slideIdBase = 256;
52886
52915
  const slideRIdBase = 6;
52887
52916
  const sldIdLst = slideCount > 0 ? ` <p:sldIdLst>
@@ -52890,6 +52919,7 @@ ${Array.from(
52890
52919
  (_, i2) => ` <p:sldId id="${slideIdBase + i2}" r:id="rId${slideRIdBase + i2}"/>`
52891
52920
  ).join("\n")}
52892
52921
  </p:sldIdLst>` : "";
52922
+ const firstSlideNum = firstSlideNumber === void 0 ? "" : ` firstSlideNum="${Math.trunc(firstSlideNumber)}"`;
52893
52923
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
52894
52924
  <p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
52895
52925
  xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
@@ -52897,7 +52927,7 @@ ${Array.from(
52897
52927
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
52898
52928
  xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"
52899
52929
  xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"
52900
- saveSubsetFonts="1">
52930
+ saveSubsetFonts="1"${firstSlideNum}>
52901
52931
  <p:sldMasterIdLst>
52902
52932
  <p:sldMasterId id="2147483648" r:id="rId1"/>
52903
52933
  </p:sldMasterIdLst>
@@ -53134,7 +53164,10 @@ async function buildBlankPresentationArchive(options) {
53134
53164
  const zip = new JSZip7__default.default();
53135
53165
  zip.file("[Content_Types].xml", contentTypesXml(layoutCount, initialSlideCount));
53136
53166
  zip.file("_rels/.rels", rootRelsXml());
53137
- zip.file("ppt/presentation.xml", presentationXml(width, height, initialSlideCount));
53167
+ zip.file(
53168
+ "ppt/presentation.xml",
53169
+ presentationXml(width, height, initialSlideCount, options?.firstSlideNumber)
53170
+ );
53138
53171
  zip.file("ppt/_rels/presentation.xml.rels", presentationRelsXml(layoutCount, initialSlideCount));
53139
53172
  zip.file("ppt/slideMasters/slideMaster1.xml", slideMasterXml(layoutCount));
53140
53173
  zip.file("ppt/slideMasters/_rels/slideMaster1.xml.rels", slideMasterRelsXml(layoutCount));
@@ -60506,7 +60539,7 @@ function parseShapeLockNode(node, spec) {
60506
60539
  return void 0;
60507
60540
  }
60508
60541
  const locks = {};
60509
- let hasAny = false;
60542
+ let hasAny2 = false;
60510
60543
  for (const prop of spec.permitted) {
60511
60544
  const raw = node[LOCK_ATTRIBUTE[prop]];
60512
60545
  if (raw === void 0) {
@@ -60514,9 +60547,9 @@ function parseShapeLockNode(node, spec) {
60514
60547
  }
60515
60548
  const value = String(raw).trim().toLowerCase();
60516
60549
  locks[prop] = value === "1" || value === "true";
60517
- hasAny = true;
60550
+ hasAny2 = true;
60518
60551
  }
60519
- return hasAny ? locks : void 0;
60552
+ return hasAny2 ? locks : void 0;
60520
60553
  }
60521
60554
  var LOCK_ATTRIBUTE, MODELLED_ATTRIBUTES, CARRIED_WHEN_UNSET;
60522
60555
  var init_shape_lock_node = __esm({
@@ -61383,6 +61416,7 @@ var init_PptxLoadDataBuilder = __esm({
61383
61416
  modernCommentAuthors;
61384
61417
  conformance;
61385
61418
  embedTrueTypeFonts;
61419
+ firstSlideNumber;
61386
61420
  defaultTextStyle;
61387
61421
  withDimensions(width, height, widthEmu, heightEmu) {
61388
61422
  this.width = width;
@@ -61552,6 +61586,10 @@ var init_PptxLoadDataBuilder = __esm({
61552
61586
  this.embedTrueTypeFonts = embedTrueTypeFonts;
61553
61587
  return this;
61554
61588
  }
61589
+ withFirstSlideNumber(firstSlideNumber) {
61590
+ this.firstSlideNumber = firstSlideNumber;
61591
+ return this;
61592
+ }
61555
61593
  withDefaultTextStyle(defaultTextStyle) {
61556
61594
  this.defaultTextStyle = defaultTextStyle;
61557
61595
  return this;
@@ -61603,6 +61641,7 @@ var init_PptxLoadDataBuilder = __esm({
61603
61641
  modernCommentAuthors: this.modernCommentAuthors,
61604
61642
  conformance: this.conformance,
61605
61643
  embedTrueTypeFonts: this.embedTrueTypeFonts,
61644
+ firstSlideNumber: this.firstSlideNumber,
61606
61645
  defaultTextStyle: this.defaultTextStyle
61607
61646
  };
61608
61647
  }
@@ -65507,6 +65546,297 @@ var init_native_animation_media_duration = __esm({
65507
65546
  }
65508
65547
  });
65509
65548
 
65549
+ // pptx/core/services/editor-animation-entry.ts
65550
+ function hasAuthoredAnimationEffect(entry2) {
65551
+ return Boolean(
65552
+ [entry2.entrance, entry2.exit, entry2.emphasis].some((preset) => preset && preset !== "none") || entry2.motionPath
65553
+ );
65554
+ }
65555
+ function animationFor(slideAnimations, elementId) {
65556
+ return slideAnimations.find((a) => a.elementId === elementId);
65557
+ }
65558
+ var init_editor_animation_entry = __esm({
65559
+ "pptx/core/services/editor-animation-entry.ts"() {
65560
+ }
65561
+ });
65562
+
65563
+ // pptx/core/services/native-animation-after-effect.ts
65564
+ function hasAfterEffectFlag(cTn) {
65565
+ const raw = cTn?.["@_afterEffect"];
65566
+ return raw === "1" || raw === "true";
65567
+ }
65568
+ function extractSrgbHex(colorContainer) {
65569
+ const srgb = colorContainer?.["a:srgbClr"];
65570
+ const val = srgb?.["@_val"];
65571
+ return val !== void 0 ? `#${String(val).toUpperCase()}` : void 0;
65572
+ }
65573
+ function findDimBehaviour(subTnLst) {
65574
+ for (const node of ensureArray10(subTnLst["p:animClr"])) {
65575
+ const cBhvr = node["p:cBhvr"];
65576
+ if (extractAttrNameFromCBhvr(cBhvr) !== "ppt_c") {
65577
+ continue;
65578
+ }
65579
+ if (!hasAfterEffectFlag(cBhvr?.["p:cTn"])) {
65580
+ continue;
65581
+ }
65582
+ const toNode = node["p:to"];
65583
+ const color2 = extractSrgbHex(toNode);
65584
+ if (color2) {
65585
+ return { action: "dimToColor", color: color2 };
65586
+ }
65587
+ const colorRef = themeColorRefFromSchemeClr(toNode?.["a:schemeClr"]);
65588
+ return colorRef ? { action: "dimToColor", colorRef } : { action: "dimToColor" };
65589
+ }
65590
+ return void 0;
65591
+ }
65592
+ function findHideBehaviour(subTnLst) {
65593
+ for (const node of ensureArray10(subTnLst["p:set"])) {
65594
+ const cBhvr = node["p:cBhvr"];
65595
+ if (extractAttrNameFromCBhvr(cBhvr) !== "style.visibility") {
65596
+ continue;
65597
+ }
65598
+ const innerCTn = cBhvr?.["p:cTn"];
65599
+ if (!hasAfterEffectFlag(innerCTn)) {
65600
+ continue;
65601
+ }
65602
+ const toNode = node["p:to"];
65603
+ const strVal = toNode?.["p:strVal"]?.["@_val"];
65604
+ if (String(strVal ?? "").toLowerCase() !== "hidden") {
65605
+ continue;
65606
+ }
65607
+ const action = innerCTn?.["@_masterRel"] === "sameClick" ? "hideAfterAnimation" : "hideOnNextClick";
65608
+ return { action };
65609
+ }
65610
+ return void 0;
65611
+ }
65612
+ function extractAfterAnimationFromSubTnLst(cTn) {
65613
+ const subTnLst = cTn["p:subTnLst"];
65614
+ if (!subTnLst) {
65615
+ return void 0;
65616
+ }
65617
+ return findDimBehaviour(subTnLst) ?? findHideBehaviour(subTnLst);
65618
+ }
65619
+ var init_native_animation_after_effect = __esm({
65620
+ "pptx/core/services/native-animation-after-effect.ts"() {
65621
+ init_theme_color_ref();
65622
+ init_native_animation_attr_name();
65623
+ init_native_animation_helpers();
65624
+ }
65625
+ });
65626
+
65627
+ // pptx/core/services/animation-after-effect-write.ts
65628
+ function assertAfterAnimationClearSupported(effectCTn) {
65629
+ const shapeIds = /* @__PURE__ */ new Set();
65630
+ const checkTarget = (value) => {
65631
+ if (Array.isArray(value)) {
65632
+ value.forEach(checkTarget);
65633
+ return;
65634
+ }
65635
+ if (!isXmlObject5(value)) return;
65636
+ const shapeTarget = value["p:spTgt"];
65637
+ if (isXmlObject5(shapeTarget) && shapeTarget["@_spid"] !== void 0)
65638
+ shapeIds.add(String(shapeTarget["@_spid"]));
65639
+ if ([
65640
+ "p:bg",
65641
+ "p:txEl",
65642
+ "p:subSp",
65643
+ "p:graphicEl",
65644
+ "p:oleChartEl",
65645
+ "p:sndTgt",
65646
+ "p:inkTgt",
65647
+ "p:sldTgt"
65648
+ ].some((key2) => value[key2] !== void 0))
65649
+ throw new Error("Clearing after-animation supports whole-shape targets only");
65650
+ Object.values(value).forEach(checkTarget);
65651
+ };
65652
+ checkTarget(effectCTn["p:childTnLst"]);
65653
+ if (shapeIds.size > 1)
65654
+ throw new Error("Editing after-animation supports a single whole-shape target only");
65655
+ const sub = effectCTn["p:subTnLst"];
65656
+ if (!isXmlObject5(sub)) return;
65657
+ const countAfterFlags = (value) => {
65658
+ if (Array.isArray(value))
65659
+ return value.reduce((count, child30) => count + countAfterFlags(child30), 0);
65660
+ if (!isXmlObject5(value)) return 0;
65661
+ return Object.entries(value).reduce(
65662
+ (count, [key2, child30]) => count + (key2 === "@_afterEffect" && ["1", "true"].includes(String(child30)) ? 1 : countAfterFlags(child30)),
65663
+ 0
65664
+ );
65665
+ };
65666
+ for (const [key2, value] of Object.entries(sub)) {
65667
+ for (const node of ensureArray10(value)) {
65668
+ const flags = countAfterFlags(node);
65669
+ if (!flags) continue;
65670
+ if (flags !== 1 || !extractAfterAnimationFromSubTnLst({ "p:subTnLst": { [key2]: node } }))
65671
+ throw new Error("Cannot clear an unsupported native after-animation behavior");
65672
+ checkTarget(node);
65673
+ }
65674
+ }
65675
+ if (shapeIds.size > 1)
65676
+ throw new Error("Editing after-animation supports a single whole-shape target only");
65677
+ }
65678
+ function clearAfterAnimationBehavior(effectCTn) {
65679
+ const sub = effectCTn["p:subTnLst"];
65680
+ if (!isXmlObject5(sub)) return;
65681
+ for (const key2 of Object.keys(sub)) {
65682
+ const nodes = ensureArray10(sub[key2]);
65683
+ const remaining = nodes.filter(
65684
+ (node) => !extractAfterAnimationFromSubTnLst({ "p:subTnLst": { [key2]: node } })
65685
+ );
65686
+ if (remaining.length === nodes.length) continue;
65687
+ if (remaining.length === 0) delete sub[key2];
65688
+ else sub[key2] = remaining.length === 1 ? remaining[0] : remaining;
65689
+ }
65690
+ if (Object.keys(sub).length === 0) delete effectCTn["p:subTnLst"];
65691
+ }
65692
+ function applyAfterAnimationBehavior(effectCTn, anim, shapeId) {
65693
+ if (anim.afterAnimation === void 0) return;
65694
+ if (anim.afterAnimation === "none") {
65695
+ assertAfterAnimationClearSupported(effectCTn);
65696
+ clearAfterAnimationBehavior(effectCTn);
65697
+ return;
65698
+ }
65699
+ assertAfterAnimationClearSupported(effectCTn);
65700
+ clearAfterAnimationBehavior(effectCTn);
65701
+ delete effectCTn["@_afterEffect"];
65702
+ if (anim.afterAnimation === "dimToColor" && anim.afterAnimationColor) {
65703
+ appendAfterAnimationBehavior(effectCTn, buildDimSubTnLst(shapeId, anim.afterAnimationColor));
65704
+ return;
65705
+ }
65706
+ if (anim.afterAnimation === "hideAfterAnimation") {
65707
+ const entranceId = effectCTn["@_id"] !== void 0 ? String(effectCTn["@_id"]) : "0";
65708
+ appendAfterAnimationBehavior(effectCTn, buildHideSubTnLst(shapeId, "sameClick", entranceId));
65709
+ return;
65710
+ }
65711
+ if (anim.afterAnimation === "hideOnNextClick") {
65712
+ appendAfterAnimationBehavior(effectCTn, buildHideSubTnLst(shapeId, "nextClick"));
65713
+ }
65714
+ }
65715
+ function appendAfterAnimationBehavior(effect, addition) {
65716
+ const sub = isXmlObject5(effect["p:subTnLst"]) ? effect["p:subTnLst"] : {};
65717
+ for (const [key2, value] of Object.entries(addition)) {
65718
+ const nodes = [...ensureArray10(sub[key2]), ...ensureArray10(value)];
65719
+ sub[key2] = nodes.length === 1 ? nodes[0] : nodes;
65720
+ }
65721
+ effect["p:subTnLst"] = sub;
65722
+ }
65723
+ function buildDimSubTnLst(shapeId, colorHex) {
65724
+ const hex3 = colorHex.replace(/^#/u, "").toUpperCase();
65725
+ return {
65726
+ "p:animClr": {
65727
+ "@_clrSpc": "rgb",
65728
+ "@_dir": "cw",
65729
+ "p:cBhvr": {
65730
+ "@_override": "childStyle",
65731
+ "p:cTn": {
65732
+ "@_dur": "1",
65733
+ "@_fill": "hold",
65734
+ "@_display": "0",
65735
+ "@_masterRel": "nextClick",
65736
+ "@_afterEffect": "1"
65737
+ },
65738
+ "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
65739
+ "p:attrNameLst": { "p:attrName": "ppt_c" }
65740
+ },
65741
+ "p:to": { "a:srgbClr": { "@_val": hex3 } }
65742
+ }
65743
+ };
65744
+ }
65745
+ function buildHideSubTnLst(shapeId, masterRel, entranceId) {
65746
+ const cTn = {
65747
+ "@_dur": "1",
65748
+ "@_fill": "hold",
65749
+ "@_display": "0",
65750
+ "@_masterRel": masterRel,
65751
+ "@_afterEffect": "1"
65752
+ };
65753
+ if (masterRel === "sameClick") {
65754
+ cTn["p:stCondLst"] = {
65755
+ "p:cond": {
65756
+ "@_evt": "end",
65757
+ "@_delay": "0",
65758
+ "p:tn": { "@_val": entranceId ?? "0" }
65759
+ }
65760
+ };
65761
+ }
65762
+ return {
65763
+ "p:set": {
65764
+ "p:cBhvr": {
65765
+ "@_override": "childStyle",
65766
+ "p:cTn": cTn,
65767
+ "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
65768
+ "p:attrNameLst": { "p:attrName": "style.visibility" }
65769
+ },
65770
+ "p:to": { "p:strVal": { "@_val": "hidden" } }
65771
+ }
65772
+ };
65773
+ }
65774
+ var init_animation_after_effect_write = __esm({
65775
+ "pptx/core/services/animation-after-effect-write.ts"() {
65776
+ init_native_animation_after_effect();
65777
+ init_native_animation_helpers();
65778
+ }
65779
+ });
65780
+
65781
+ // pptx/core/services/editor-animation-after-effect.ts
65782
+ function mergeNativeAfterAnimationIntoEditorAnimations(nativeAnimations, animations, rawTiming) {
65783
+ for (const native of nativeAnimations ?? []) {
65784
+ const existing = native.targetId ? animationFor(animations, native.targetId) : void 0;
65785
+ const action = native.afterAnimationAction ?? (existing?.afterAnimation !== void 0 ? "none" : void 0);
65786
+ if ((nativeAnimations ?? []).filter(
65787
+ (other) => other.targetId === native.targetId && ["entr", "emph"].includes(other.presetClass ?? "")
65788
+ ).length !== 1)
65789
+ continue;
65790
+ if (!native.targetId || !action || !["entr", "emph"].includes(native.presetClass ?? "") || native.textTarget)
65791
+ continue;
65792
+ if (native.target && (native.target.type !== "shape" || native.target.backgroundOnly || native.target.subShapeId || native.target.graphicElement || native.target.oleChartElement))
65793
+ continue;
65794
+ try {
65795
+ if (rawTiming && native.target?.type === "shape" && indexEffectNodes(rawTiming).filter(
65796
+ (ref) => ref.spid === (native.target?.type === "shape" ? native.target.shapeId : void 0) && ["entr", "emph"].includes(ref.presetClass)
65797
+ ).length !== 1)
65798
+ continue;
65799
+ const effect = rawTiming ? indexEffectNodes(rawTiming).find(
65800
+ (ref) => String(ref.cTn["@_id"]) === String(native.nodeId) && native.target?.type === "shape" && ref.spid === native.target.shapeId
65801
+ ) : void 0;
65802
+ if (rawTiming && !effect) continue;
65803
+ assertAfterAnimationClearSupported(
65804
+ effect?.cTn ?? { "p:subTnLst": native.cTnAttributes?.["p:subTnLst"] }
65805
+ );
65806
+ } catch {
65807
+ continue;
65808
+ }
65809
+ let entry2 = animationFor(animations, native.targetId);
65810
+ if (!entry2) {
65811
+ entry2 = { elementId: native.targetId };
65812
+ animations.push(entry2);
65813
+ }
65814
+ if (entry2.nativeAfterAnimation !== void 0) continue;
65815
+ entry2.nativeAfterAnimation = action;
65816
+ entry2.nativeAfterAnimationColor = native.afterAnimationColor;
65817
+ }
65818
+ }
65819
+ function isNativeAfterAnimationFallback(entry2) {
65820
+ return entry2.nativeAfterAnimation !== void 0 && Object.entries(entry2).every(
65821
+ ([key2, value]) => value === void 0 || [
65822
+ "elementId",
65823
+ "nativeAfterAnimation",
65824
+ "nativeAfterAnimationColor",
65825
+ "soundRId",
65826
+ "soundPath",
65827
+ "soundName",
65828
+ "stopSound"
65829
+ ].includes(key2)
65830
+ );
65831
+ }
65832
+ var init_editor_animation_after_effect = __esm({
65833
+ "pptx/core/services/editor-animation-after-effect.ts"() {
65834
+ init_editor_animation_entry();
65835
+ init_animation_after_effect_write();
65836
+ init_animation_timing_tree();
65837
+ }
65838
+ });
65839
+
65510
65840
  // pptx/core/services/slide-name.ts
65511
65841
  function asNode3(value) {
65512
65842
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
@@ -65837,6 +66167,7 @@ var init_PptxSlideLoaderService = __esm({
65837
66167
  init_animation_target_reconcile();
65838
66168
  init_animation_timeline_anchors();
65839
66169
  init_native_animation_media_duration();
66170
+ init_editor_animation_after_effect();
65840
66171
  init_slide_name();
65841
66172
  init_slide_transition_envelope();
65842
66173
  PptxSlideLoaderService = class {
@@ -66048,6 +66379,8 @@ var init_PptxSlideLoaderService = __esm({
66048
66379
  }
66049
66380
  });
66050
66381
  reconcileAnimationTargets(elements2, nativeAnimations, animations, animationTimelineAnchors);
66382
+ animations ??= [];
66383
+ mergeNativeAfterAnimationIntoEditorAnimations(nativeAnimations, animations, rawTiming);
66051
66384
  mergeNativeSoundIntoEditorAnimations(nativeAnimations, animations);
66052
66385
  mergeNativeBuildTemplatesIntoEditorAnimations(nativeAnimations, animations);
66053
66386
  applyHiddenFlagFromRawXml(elements2);
@@ -66390,6 +66723,7 @@ function sortOrder(animation) {
66390
66723
  var PptxEditorAnimationService;
66391
66724
  var init_PptxEditorAnimationService = __esm({
66392
66725
  "pptx/core/services/PptxEditorAnimationService.ts"() {
66726
+ init_editor_animation_after_effect();
66393
66727
  init_editor_animation_normalizers();
66394
66728
  init_editor_animation_trigger_meta();
66395
66729
  PptxEditorAnimationService = class {
@@ -66488,7 +66822,7 @@ var init_PptxEditorAnimationService = __esm({
66488
66822
  * @param animations - Editor animations to serialize.
66489
66823
  */
66490
66824
  applyEditorAnimations(slideNode, animations) {
66491
- const sequenced = [...animations].sort((left, right) => sortOrder(left) - sortOrder(right));
66825
+ const sequenced = animations.filter((entry2) => !isNativeAfterAnimationFallback(entry2)).sort((left, right) => sortOrder(left) - sortOrder(right));
66492
66826
  const sanitizedAnimations = sequenced.map((animation) => {
66493
66827
  const elementId = String(animation.elementId || "").trim();
66494
66828
  if (elementId.length === 0) {
@@ -66502,7 +66836,7 @@ var init_PptxEditorAnimationService = __esm({
66502
66836
  const orderIsTreeDerived = animation.orderFromTimeline !== void 0 && animation.order === animation.orderFromTimeline;
66503
66837
  const order = typeof animation.order === "number" && Number.isFinite(animation.order) && !orderIsTreeDerived ? Math.round(animation.order) : void 0;
66504
66838
  const repeatCount = typeof animation.repeatCount === "number" && Number.isFinite(animation.repeatCount) && animation.repeatCount > 0 ? animation.repeatCount : void 0;
66505
- if (!entrance && !exit2 && !emphasis && !animation.motionPath) {
66839
+ if (!entrance && !exit2 && !emphasis && !animation.motionPath && animation.afterAnimation === void 0) {
66506
66840
  return null;
66507
66841
  }
66508
66842
  return {
@@ -66987,70 +67321,6 @@ var init_animation_effect_filter_parsing = __esm({
66987
67321
  }
66988
67322
  });
66989
67323
 
66990
- // pptx/core/services/native-animation-after-effect.ts
66991
- function hasAfterEffectFlag(cTn) {
66992
- const raw = cTn?.["@_afterEffect"];
66993
- return raw === "1" || raw === "true";
66994
- }
66995
- function extractSrgbHex(colorContainer) {
66996
- const srgb = colorContainer?.["a:srgbClr"];
66997
- const val = srgb?.["@_val"];
66998
- return val !== void 0 ? `#${String(val).toUpperCase()}` : void 0;
66999
- }
67000
- function findDimBehaviour(subTnLst) {
67001
- for (const node of ensureArray10(subTnLst["p:animClr"])) {
67002
- const cBhvr = node["p:cBhvr"];
67003
- if (extractAttrNameFromCBhvr(cBhvr) !== "ppt_c") {
67004
- continue;
67005
- }
67006
- if (!hasAfterEffectFlag(cBhvr?.["p:cTn"])) {
67007
- continue;
67008
- }
67009
- const toNode = node["p:to"];
67010
- const color2 = extractSrgbHex(toNode);
67011
- if (color2) {
67012
- return { action: "dimToColor", color: color2 };
67013
- }
67014
- const colorRef = themeColorRefFromSchemeClr(toNode?.["a:schemeClr"]);
67015
- return colorRef ? { action: "dimToColor", colorRef } : { action: "dimToColor" };
67016
- }
67017
- return void 0;
67018
- }
67019
- function findHideBehaviour(subTnLst) {
67020
- for (const node of ensureArray10(subTnLst["p:set"])) {
67021
- const cBhvr = node["p:cBhvr"];
67022
- if (extractAttrNameFromCBhvr(cBhvr) !== "style.visibility") {
67023
- continue;
67024
- }
67025
- const innerCTn = cBhvr?.["p:cTn"];
67026
- if (!hasAfterEffectFlag(innerCTn)) {
67027
- continue;
67028
- }
67029
- const toNode = node["p:to"];
67030
- const strVal = toNode?.["p:strVal"]?.["@_val"];
67031
- if (String(strVal ?? "").toLowerCase() !== "hidden") {
67032
- continue;
67033
- }
67034
- const action = innerCTn?.["@_masterRel"] === "sameClick" ? "hideAfterAnimation" : "hideOnNextClick";
67035
- return { action };
67036
- }
67037
- return void 0;
67038
- }
67039
- function extractAfterAnimationFromSubTnLst(cTn) {
67040
- const subTnLst = cTn["p:subTnLst"];
67041
- if (!subTnLst) {
67042
- return void 0;
67043
- }
67044
- return findDimBehaviour(subTnLst) ?? findHideBehaviour(subTnLst);
67045
- }
67046
- var init_native_animation_after_effect = __esm({
67047
- "pptx/core/services/native-animation-after-effect.ts"() {
67048
- init_theme_color_ref();
67049
- init_native_animation_attr_name();
67050
- init_native_animation_helpers();
67051
- }
67052
- });
67053
-
67054
67324
  // pptx/core/services/native-animation-cbhvr-attrs.ts
67055
67325
  function extractCBhvrAttrs(cBhvr) {
67056
67326
  if (!cBhvr) {
@@ -67199,6 +67469,16 @@ function readTiming(cTn) {
67199
67469
  return {};
67200
67470
  }
67201
67471
  const timing = {};
67472
+ const starts = ensureArray10(cTn["p:stCondLst"]?.["p:cond"]);
67473
+ if (starts.length > 1 || cTn["@_dur"] === "indefinite" || cTn["@_repeatCount"] === "indefinite" || cTn["@_repeatDur"] !== void 0 || cTn["p:endCondLst"] !== void 0 || cTn["p:endSync"] !== void 0 || starts.some(
67474
+ (condition) => condition === null || typeof condition !== "object" || condition["@_evt"] !== void 0 || condition["@_tn"] !== void 0 || condition["@_rtn"] !== void 0 || condition["p:tn"] !== void 0 || condition["p:rtn"] !== void 0 || condition["p:tgtEl"] !== void 0 || condition["@_delay"] !== void 0 && !/^\d+$/u.test(String(condition["@_delay"])) || condition["@_delay"] === "indefinite"
67475
+ )) {
67476
+ timing.unsupportedSetTiming = true;
67477
+ }
67478
+ const fill = cTn["@_fill"];
67479
+ if (fill === "remove" || fill === "freeze" || fill === "hold" || fill === "transition") {
67480
+ timing.fill = fill;
67481
+ }
67202
67482
  const durationMs = readTimingAttr(cTn["@_dur"]);
67203
67483
  if (durationMs !== void 0) {
67204
67484
  timing.durationMs = durationMs;
@@ -67604,6 +67884,7 @@ function buildTimingNodeAnimation(cTn, trigger, group) {
67604
67884
  commandString: cmdInfo2.commandString,
67605
67885
  textTarget: textTarget ?? void 0,
67606
67886
  cTnAttributes: roundTripAttrs,
67887
+ unsupportedOpacitySetTiming: cTn["@_dur"] === "indefinite" || cTn["p:endSync"] !== void 0 || void 0,
67607
67888
  afterEffect: afterEffectFlag,
67608
67889
  afterAnimationAction: parsedAfterAnimation?.action,
67609
67890
  afterAnimationColor: parsedAfterAnimation?.color,
@@ -68407,79 +68688,6 @@ var init_PptxSlideTransitionService = __esm({
68407
68688
  }
68408
68689
  });
68409
68690
 
68410
- // pptx/core/services/animation-after-effect-write.ts
68411
- function applyAfterAnimationBehavior(effectCTn, anim, shapeId) {
68412
- delete effectCTn["p:subTnLst"];
68413
- delete effectCTn["@_afterEffect"];
68414
- if (anim.afterAnimation === "dimToColor" && anim.afterAnimationColor) {
68415
- effectCTn["p:subTnLst"] = buildDimSubTnLst(shapeId, anim.afterAnimationColor);
68416
- return;
68417
- }
68418
- if (anim.afterAnimation === "hideAfterAnimation") {
68419
- const entranceId = effectCTn["@_id"] !== void 0 ? String(effectCTn["@_id"]) : "0";
68420
- effectCTn["p:subTnLst"] = buildHideSubTnLst(shapeId, "sameClick", entranceId);
68421
- return;
68422
- }
68423
- if (anim.afterAnimation === "hideOnNextClick") {
68424
- effectCTn["p:subTnLst"] = buildHideSubTnLst(shapeId, "nextClick");
68425
- }
68426
- }
68427
- function buildDimSubTnLst(shapeId, colorHex) {
68428
- const hex3 = colorHex.replace(/^#/u, "").toUpperCase();
68429
- return {
68430
- "p:animClr": {
68431
- "@_clrSpc": "rgb",
68432
- "@_dir": "cw",
68433
- "p:cBhvr": {
68434
- "@_override": "childStyle",
68435
- "p:cTn": {
68436
- "@_dur": "1",
68437
- "@_fill": "hold",
68438
- "@_display": "0",
68439
- "@_masterRel": "nextClick",
68440
- "@_afterEffect": "1"
68441
- },
68442
- "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
68443
- "p:attrNameLst": { "p:attrName": "ppt_c" }
68444
- },
68445
- "p:to": { "a:srgbClr": { "@_val": hex3 } }
68446
- }
68447
- };
68448
- }
68449
- function buildHideSubTnLst(shapeId, masterRel, entranceId) {
68450
- const cTn = {
68451
- "@_dur": "1",
68452
- "@_fill": "hold",
68453
- "@_display": "0",
68454
- "@_masterRel": masterRel,
68455
- "@_afterEffect": "1"
68456
- };
68457
- if (masterRel === "sameClick") {
68458
- cTn["p:stCondLst"] = {
68459
- "p:cond": {
68460
- "@_evt": "end",
68461
- "@_delay": "0",
68462
- "p:tn": { "@_val": entranceId ?? "0" }
68463
- }
68464
- };
68465
- }
68466
- return {
68467
- "p:set": {
68468
- "p:cBhvr": {
68469
- "@_override": "childStyle",
68470
- "p:cTn": cTn,
68471
- "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
68472
- "p:attrNameLst": { "p:attrName": "style.visibility" }
68473
- },
68474
- "p:to": { "p:strVal": { "@_val": "hidden" } }
68475
- }
68476
- };
68477
- }
68478
- var init_animation_after_effect_write = __esm({
68479
- "pptx/core/services/animation-after-effect-write.ts"() {
68480
- }
68481
- });
68482
-
68483
68691
  // pptx/core/services/animation-behavior-captures.json
68484
68692
  var animation_behavior_captures_default;
68485
68693
  var init_animation_behavior_captures = __esm({
@@ -86694,6 +86902,33 @@ function updateEffectNodeAttributes(cTn, anim, presetClass, shapeId, allocateId)
86694
86902
  applySoundToEffectCTn(cTn, anim);
86695
86903
  }
86696
86904
  function surgicallyUpdateTimingTree(rawTiming, animations) {
86905
+ const sourceRefs = indexEffectNodes(rawTiming);
86906
+ for (const entry2 of animations.filter((animation) => animation.afterAnimation !== void 0)) {
86907
+ if (sourceRefs.filter(
86908
+ (ref) => ref.spid === entry2.elementId && ["entr", "emph"].includes(ref.presetClass)
86909
+ ).length > 1)
86910
+ throw new Error(
86911
+ "Cannot edit an ambiguous native after-animation target with multiple effects"
86912
+ );
86913
+ }
86914
+ const explicitClears = new Map(
86915
+ animations.filter((a) => a.afterAnimation !== void 0 && !hasAuthoredAnimationEffect(a)).map((a) => [a.elementId, a])
86916
+ );
86917
+ const clearRefs = sourceRefs.filter(
86918
+ (ref) => ref.spid && explicitClears.has(ref.spid) && (ref.presetClass === "entr" || ref.presetClass === "emph")
86919
+ );
86920
+ for (const target of explicitClears.keys()) {
86921
+ if (!clearRefs.some((ref) => ref.spid === target))
86922
+ throw new Error("Cannot edit after-animation without a supported native effect");
86923
+ if (clearRefs.filter((ref) => ref.spid === target).length > 1)
86924
+ throw new Error(
86925
+ "Cannot clear an ambiguous native after-animation target with multiple effects"
86926
+ );
86927
+ }
86928
+ clearRefs.forEach((ref) => assertAfterAnimationClearSupported(ref.cTn));
86929
+ clearRefs.forEach(
86930
+ (ref) => applyAfterAnimationBehavior(ref.cTn, explicitClears.get(ref.spid), ref.spid)
86931
+ );
86697
86932
  const desired = collectDesiredEffects(animations);
86698
86933
  const previouslyOwned = readOwnedEffectKeys(rawTiming);
86699
86934
  if (desired.length === 0 && previouslyOwned.size === 0) {
@@ -86760,6 +86995,7 @@ function surgicallyUpdateTimingTree(rawTiming, animations) {
86760
86995
  }
86761
86996
  var init_animation_timing_surgical = __esm({
86762
86997
  "pptx/core/services/animation-timing-surgical.ts"() {
86998
+ init_editor_animation_entry();
86763
86999
  init_animation_after_effect_write();
86764
87000
  init_animation_behavior_captured();
86765
87001
  init_animation_timing_build_surgical();
@@ -86810,9 +87046,11 @@ var init_PptxAnimationWriteService = __esm({
86810
87046
  const validAnimations = animations.filter((a) => a.entrance || a.exit || a.emphasis || a.motionPath).sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
86811
87047
  if (existingRawTiming) {
86812
87048
  const cloned = typeof structuredClone === "function" ? structuredClone(existingRawTiming) : JSON.parse(JSON.stringify(existingRawTiming));
86813
- return surgicallyUpdateTimingTree(cloned, validAnimations);
87049
+ return surgicallyUpdateTimingTree(cloned, animations);
86814
87050
  }
86815
87051
  if (validAnimations.length === 0) {
87052
+ if (animations.some((entry2) => entry2.afterAnimation !== void 0))
87053
+ throw new Error("Cannot edit after-animation without a supported native effect");
86816
87054
  return void 0;
86817
87055
  }
86818
87056
  this.nextId = 1;
@@ -102901,8 +103139,8 @@ function buildDefRPr(style, existing, resolveColor2) {
102901
103139
  return rPr;
102902
103140
  }
102903
103141
  function applyChartAxisTitleStyleToXml(axisNode, style, getLocalName2, resolveColor2) {
102904
- const hasAny = style.fontFamily !== void 0 || style.fontSize !== void 0 || style.fontBold !== void 0 || style.fontColor !== void 0;
102905
- if (!hasAny) {
103142
+ const hasAny2 = style.fontFamily !== void 0 || style.fontSize !== void 0 || style.fontBold !== void 0 || style.fontColor !== void 0;
103143
+ if (!hasAny2) {
102906
103144
  return;
102907
103145
  }
102908
103146
  const titleKey = findKey6(axisNode, "title", getLocalName2);
@@ -104756,8 +104994,8 @@ function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
104756
104994
  const spPrKey = findChildKey2(node, "spPr");
104757
104995
  const container2 = spPrKey ? node[spPrKey] ?? node : node;
104758
104996
  const xfrmKey = findChildKey2(container2, "xfrm");
104759
- const hasAny = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
104760
- if (!xfrmKey && !hasAny) {
104997
+ const hasAny2 = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
104998
+ if (!xfrmKey && !hasAny2) {
104761
104999
  return;
104762
105000
  }
104763
105001
  const xfrm = xfrmKey ? container2[xfrmKey] : {};
@@ -104792,24 +105030,24 @@ function hexVal(hex3) {
104792
105030
  }
104793
105031
  function buildRunProps(para) {
104794
105032
  const rPr = {};
104795
- let hasAny = false;
105033
+ let hasAny2 = false;
104796
105034
  if (para.fontSize !== void 0) {
104797
105035
  rPr["@_sz"] = String(Math.round(para.fontSize * 100));
104798
- hasAny = true;
105036
+ hasAny2 = true;
104799
105037
  }
104800
105038
  if (para.bold) {
104801
105039
  rPr["@_b"] = "1";
104802
- hasAny = true;
105040
+ hasAny2 = true;
104803
105041
  }
104804
105042
  if (para.italic) {
104805
105043
  rPr["@_i"] = "1";
104806
- hasAny = true;
105044
+ hasAny2 = true;
104807
105045
  }
104808
105046
  if (para.color) {
104809
105047
  rPr["a:solidFill"] = { "a:srgbClr": { "@_val": hexVal(para.color) } };
104810
- hasAny = true;
105048
+ hasAny2 = true;
104811
105049
  }
104812
- return hasAny ? rPr : void 0;
105050
+ return hasAny2 ? rPr : void 0;
104813
105051
  }
104814
105052
  function buildParagraphNode(para) {
104815
105053
  const node = {};
@@ -106832,7 +107070,7 @@ var init_svg_stretch_fill = __esm({
106832
107070
 
106833
107071
  // pptx/core/core/runtime/image-a14-effects-model.ts
106834
107072
  function applyA14ExtensionToEffects(effects, a14) {
106835
- let hasAny = false;
107073
+ let hasAny2 = false;
106836
107074
  if (a14.artisticEffect !== void 0) {
106837
107075
  effects.artisticEffect = a14.artisticEffect;
106838
107076
  if (a14.originalImageRelId !== void 0) {
@@ -106844,15 +107082,15 @@ function applyA14ExtensionToEffects(effects, a14) {
106844
107082
  if (a14.artisticParams) {
106845
107083
  effects.artisticParams = a14.artisticParams;
106846
107084
  }
106847
- hasAny = true;
107085
+ hasAny2 = true;
106848
107086
  }
106849
107087
  if (a14.backgroundRemoval) {
106850
107088
  effects.backgroundRemoval = a14.backgroundRemoval;
106851
- hasAny = true;
107089
+ hasAny2 = true;
106852
107090
  }
106853
107091
  if (a14.originalImageRelId !== void 0) {
106854
107092
  effects.originalImageRelId = a14.originalImageRelId;
106855
- hasAny = true;
107093
+ hasAny2 = true;
106856
107094
  }
106857
107095
  const corrections = {};
106858
107096
  if (a14.sharpenSoften) {
@@ -106875,9 +107113,9 @@ function applyA14ExtensionToEffects(effects, a14) {
106875
107113
  if (a14.originalImageRelId !== void 0) {
106876
107114
  effects.prerenderedCorrections = corrections;
106877
107115
  }
106878
- hasAny = true;
107116
+ hasAny2 = true;
106879
107117
  }
106880
- return hasAny;
107118
+ return hasAny2;
106881
107119
  }
106882
107120
  var init_image_a14_effects_model = __esm({
106883
107121
  "pptx/core/core/runtime/image-a14-effects-model.ts"() {
@@ -108223,13 +108461,13 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108223
108461
  return null;
108224
108462
  }
108225
108463
  const effects = {};
108226
- let hasAny = false;
108464
+ let hasAny2 = false;
108227
108465
  const brightRaw = blip["@_bright"] ?? blip["@_brt"];
108228
108466
  if (brightRaw !== null) {
108229
108467
  const val = parseInt(String(brightRaw));
108230
108468
  if (Number.isFinite(val)) {
108231
108469
  effects.brightness = val / 1e3;
108232
- hasAny = true;
108470
+ hasAny2 = true;
108233
108471
  }
108234
108472
  }
108235
108473
  const contrastRaw = blip["@_contrast"] ?? blip["@_cont"];
@@ -108237,7 +108475,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108237
108475
  const val = parseInt(String(contrastRaw));
108238
108476
  if (Number.isFinite(val)) {
108239
108477
  effects.contrast = val / 1e3;
108240
- hasAny = true;
108478
+ hasAny2 = true;
108241
108479
  }
108242
108480
  }
108243
108481
  const colorEffects = parseImageColorEffects(
@@ -108247,12 +108485,12 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108247
108485
  );
108248
108486
  Object.assign(effects, colorEffects);
108249
108487
  if (Object.keys(colorEffects).length > 0) {
108250
- hasAny = true;
108488
+ hasAny2 = true;
108251
108489
  }
108252
108490
  const alphaEffects = parseImageAlphaEffects(blip, (node) => this.parseColor(node));
108253
108491
  Object.assign(effects, alphaEffects);
108254
108492
  if (Object.keys(alphaEffects).length > 0) {
108255
- hasAny = true;
108493
+ hasAny2 = true;
108256
108494
  }
108257
108495
  const lumNode = blip["a:lum"];
108258
108496
  if (lumNode) {
@@ -108272,7 +108510,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108272
108510
  }
108273
108511
  }
108274
108512
  effects.lum = lumEffect;
108275
- hasAny = true;
108513
+ hasAny2 = true;
108276
108514
  }
108277
108515
  const hslNode = blip["a:hsl"];
108278
108516
  if (hslNode) {
@@ -108299,7 +108537,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108299
108537
  }
108300
108538
  }
108301
108539
  effects.hsl = hslEffect;
108302
- hasAny = true;
108540
+ hasAny2 = true;
108303
108541
  }
108304
108542
  const tintNode = blip["a:tint"];
108305
108543
  if (tintNode) {
@@ -108319,7 +108557,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108319
108557
  }
108320
108558
  }
108321
108559
  effects.tint = tintEffect;
108322
- hasAny = true;
108560
+ hasAny2 = true;
108323
108561
  }
108324
108562
  const fillOverlay = blip["a:fillOverlay"];
108325
108563
  if (fillOverlay) {
@@ -108346,7 +108584,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108346
108584
  ...resolvedGradient ? { resolvedGradient } : {},
108347
108585
  ...resolvedPattern ? { resolvedPattern } : {}
108348
108586
  };
108349
- hasAny = true;
108587
+ hasAny2 = true;
108350
108588
  }
108351
108589
  const blurNode = blip["a:blur"];
108352
108590
  if (blurNode) {
@@ -108364,16 +108602,16 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108364
108602
  blurEffect.grow = s === "1" || s === "true";
108365
108603
  }
108366
108604
  effects.blur = blurEffect;
108367
- hasAny = true;
108605
+ hasAny2 = true;
108368
108606
  }
108369
108607
  const extLst = xmlChild(blip, "a:extLst");
108370
108608
  if (extLst) {
108371
108609
  const a14 = parseA14ImageExtension(this.ensureArray(extLst["a:ext"]));
108372
108610
  if (a14 && applyA14ExtensionToEffects(effects, a14)) {
108373
- hasAny = true;
108611
+ hasAny2 = true;
108374
108612
  }
108375
108613
  }
108376
- return hasAny ? effects : null;
108614
+ return hasAny2 ? effects : null;
108377
108615
  }
108378
108616
  /**
108379
108617
  * Resolve a blip `a:fillOverlay/a:gradFill` to the structured gradient a
@@ -110026,8 +110264,8 @@ function buildTextRunEffectListXml(style, parseColor) {
110026
110264
  const hasTextHsl = typeof style.textHslHue === "number" || typeof style.textHslSaturation === "number" || typeof style.textHslLuminance === "number";
110027
110265
  const hasTextClrChange = Boolean(style.textClrChangeFrom) && Boolean(style.textClrChangeTo);
110028
110266
  const hasTextDuotone = Boolean(style.textDuotone);
110029
- const hasAny = hasTextShadow || hasTextInnerShadow || hasTextPresetShadow || hasTextGlow || hasTextReflection || hasTextBlur || hasTextSoftEdge || hasTextAlphaModFix || hasTextAlphaMod || hasTextHsl || hasTextClrChange || hasTextDuotone;
110030
- if (!hasAny) {
110267
+ const hasAny2 = hasTextShadow || hasTextInnerShadow || hasTextPresetShadow || hasTextGlow || hasTextReflection || hasTextBlur || hasTextSoftEdge || hasTextAlphaModFix || hasTextAlphaMod || hasTextHsl || hasTextClrChange || hasTextDuotone;
110268
+ if (!hasAny2) {
110031
110269
  return void 0;
110032
110270
  }
110033
110271
  const effectLst = {};
@@ -114340,6 +114578,87 @@ var init_table_column_width_save = __esm({
114340
114578
  }
114341
114579
  });
114342
114580
 
114581
+ // pptx/core/core/runtime/table-style-change-cell-clear.ts
114582
+ function normaliseStyleId(id) {
114583
+ const text2 = typeof id === "string" || typeof id === "number" ? String(id) : "";
114584
+ const trimmed2 = text2.trim().toUpperCase();
114585
+ if (!trimmed2) {
114586
+ return "";
114587
+ }
114588
+ return trimmed2.startsWith("{") ? trimmed2 : `{${trimmed2}}`;
114589
+ }
114590
+ function xmlTableStyleId(tblPr) {
114591
+ if (!tblPr || typeof tblPr !== "object") {
114592
+ return "";
114593
+ }
114594
+ const props = tblPr;
114595
+ const node = props["a:tableStyleId"];
114596
+ const spec = normaliseStyleId(
114597
+ node && typeof node === "object" ? node["#text"] : node
114598
+ );
114599
+ if (spec) {
114600
+ return spec;
114601
+ }
114602
+ const legacy = props["a:tblStyle"];
114603
+ return normaliseStyleId(legacy?.["@_val"] || props["@_tblStyle"]);
114604
+ }
114605
+ function tableStyleIdChanged(tblPr, nextStyleId) {
114606
+ if (nextStyleId === void 0) {
114607
+ return false;
114608
+ }
114609
+ return normaliseStyleId(nextStyleId) !== xmlTableStyleId(tblPr);
114610
+ }
114611
+ function clearCellFormattingForStyleChange(xmlCell, style) {
114612
+ const tcPr = xmlCell["a:tcPr"];
114613
+ if (!tcPr || typeof tcPr !== "object") {
114614
+ return;
114615
+ }
114616
+ const props = tcPr;
114617
+ if (!hasAny(style, FILL_FIELDS)) {
114618
+ for (const key2 of FILL_KEYS) {
114619
+ delete props[key2];
114620
+ }
114621
+ }
114622
+ for (const [key2, fields] of LINE_KEYS) {
114623
+ if (!hasAny(style, fields)) {
114624
+ delete props[key2];
114625
+ }
114626
+ }
114627
+ if (!style?.cell3D) {
114628
+ delete props["a:cell3D"];
114629
+ }
114630
+ }
114631
+ var FILL_KEYS, LINE_KEYS, FILL_FIELDS, hasAny;
114632
+ var init_table_style_change_cell_clear = __esm({
114633
+ "pptx/core/core/runtime/table-style-change-cell-clear.ts"() {
114634
+ FILL_KEYS = [
114635
+ "a:noFill",
114636
+ "a:solidFill",
114637
+ "a:gradFill",
114638
+ "a:blipFill",
114639
+ "a:pattFill",
114640
+ "a:grpFill"
114641
+ ];
114642
+ LINE_KEYS = [
114643
+ ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash"]],
114644
+ ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash"]],
114645
+ ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash"]],
114646
+ ["a:lnB", ["borderBottomWidth", "borderBottomColor", "borderBottomDash"]],
114647
+ ["a:lnTlToBr", ["borderDiagDownWidth", "borderDiagDownColor"]],
114648
+ ["a:lnBlToTr", ["borderDiagUpWidth", "borderDiagUpColor"]]
114649
+ ];
114650
+ FILL_FIELDS = [
114651
+ "fillMode",
114652
+ "backgroundColor",
114653
+ "gradientFillStops",
114654
+ "patternFillPreset",
114655
+ "backgroundImageFillPath",
114656
+ "backgroundImageFillData"
114657
+ ];
114658
+ hasAny = (style, keys) => keys.some((key2) => style?.[key2] !== void 0);
114659
+ }
114660
+ });
114661
+
114343
114662
  // pptx/core/core/runtime/table-paragraph-save-order.ts
114344
114663
  function runTag(run) {
114345
114664
  return run.isLineBreak ? "a:br" : run.isField ? "a:fld" : "a:r";
@@ -114903,6 +115222,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114903
115222
  init_PptxHandlerRuntimeChartUserShapes();
114904
115223
  init_save_table_merge_helpers();
114905
115224
  init_table_column_width_save();
115225
+ init_table_style_change_cell_clear();
114906
115226
  init_table_paragraph_save_order();
114907
115227
  init_table_structural_ops();
114908
115228
  init_table_tblpr_save();
@@ -114924,6 +115244,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114924
115244
  if (!tbl) {
114925
115245
  return;
114926
115246
  }
115247
+ const styleChanged = tableData.clearDirectCellFormatting === true || tableStyleIdChanged(tbl["a:tblPr"], tableData.tableStyleId);
114927
115248
  serializeTablePropertyFlags(tbl, tableData);
114928
115249
  writeTablePropertiesOwnFillAndEffects(tbl["a:tblPr"], tableData);
114929
115250
  const xmlRows = this.ensureArray(tbl["a:tr"]);
@@ -114955,6 +115276,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114955
115276
  if (cell.text !== void 0) {
114956
115277
  this.writeTableCellText(xmlCell, cell.text);
114957
115278
  }
115279
+ if (styleChanged) {
115280
+ clearCellFormattingForStyleChange(xmlCell, cell.style);
115281
+ }
114958
115282
  if (cell.style) {
114959
115283
  this.writeTableCellStyle(xmlCell, cell.style, cell.paragraphs);
114960
115284
  }
@@ -114978,6 +115302,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114978
115302
  if (cell.text !== void 0) {
114979
115303
  this.writeTableCellText(xmlCell, cell.text);
114980
115304
  }
115305
+ if (styleChanged) {
115306
+ clearCellFormattingForStyleChange(xmlCell, cell.style);
115307
+ }
114981
115308
  if (cell.style) {
114982
115309
  this.writeTableCellStyle(xmlCell, cell.style, cell.paragraphs);
114983
115310
  }
@@ -125652,6 +125979,7 @@ var PptxHandlerRuntime60;
125652
125979
  var init_PptxHandlerRuntimeGeometryParsing = __esm({
125653
125980
  "pptx/core/core/runtime/PptxHandlerRuntimeGeometryParsing.ts"() {
125654
125981
  init_color_primitives();
125982
+ init_custom_geometry_command_order();
125655
125983
  init_custom_geometry_parser();
125656
125984
  init_guide_formula();
125657
125985
  init_PptxHandlerRuntimePlaceholderLookup();
@@ -125813,6 +126141,10 @@ var init_PptxHandlerRuntimeGeometryParsing = __esm({
125813
126141
  const pathLst = custGeom["a:pathLst"];
125814
126142
  if (isNonEmpty(pathLst)) {
125815
126143
  result.pathLstXml = pathLst;
126144
+ const pathCommandOrder = readPathListCommandOrder(pathLst);
126145
+ if (pathCommandOrder) {
126146
+ result.pathCommandOrder = pathCommandOrder;
126147
+ }
125816
126148
  }
125817
126149
  return Object.keys(result).length > 0 ? result : void 0;
125818
126150
  }
@@ -126723,7 +127055,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
126723
127055
  return void 0;
126724
127056
  }
126725
127057
  const locks = {};
126726
- let hasAny = false;
127058
+ let hasAny2 = false;
126727
127059
  const boolAttr2 = (attr6) => {
126728
127060
  const raw = spLocks[attr6];
126729
127061
  if (raw === void 0) {
@@ -126736,7 +127068,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
126736
127068
  const val = boolAttr2(attr6);
126737
127069
  if (val !== void 0) {
126738
127070
  fn(val);
126739
- hasAny = true;
127071
+ hasAny2 = true;
126740
127072
  }
126741
127073
  };
126742
127074
  set2("@_noGrp", (v) => {
@@ -126775,7 +127107,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
126775
127107
  set2("@_noCrop", (v) => {
126776
127108
  locks.noCrop = v;
126777
127109
  });
126778
- return hasAny ? locks : void 0;
127110
+ return hasAny2 ? locks : void 0;
126779
127111
  }
126780
127112
  /**
126781
127113
  * Parse the `@txBox` attribute from a `p:cNvSpPr` node. Returns `true` /
@@ -135403,13 +135735,15 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
135403
135735
  });
135404
135736
 
135405
135737
  // pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts
135406
- var PptxHandlerRuntime96;
135738
+ var XSD_INT_MIN, XSD_INT_MAX, PptxHandlerRuntime96;
135407
135739
  var init_PptxHandlerRuntimePresentationStructure = __esm({
135408
135740
  "pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts"() {
135409
135741
  init_kinsoku_parser();
135410
135742
  init_presentation_section_parser();
135411
135743
  init_header_footer_parts();
135412
135744
  init_PptxHandlerRuntimeChartParsing();
135745
+ XSD_INT_MIN = -2147483648;
135746
+ XSD_INT_MAX = 2147483647;
135413
135747
  PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
135414
135748
  parseEditorAnimations(slideXml3) {
135415
135749
  return this.editorAnimationService.parseEditorAnimations(slideXml3);
@@ -135592,6 +135926,22 @@ var init_PptxHandlerRuntimePresentationStructure = __esm({
135592
135926
  const lexical = String(raw).trim().toLowerCase();
135593
135927
  return lexical !== "0" && lexical !== "false";
135594
135928
  }
135929
+ /**
135930
+ * Extract `p:presentation/@firstSlideNum` (ECMA-376 §19.2.1.26, an
135931
+ * `xsd:int`). `undefined` when absent, not an integer, or outside the
135932
+ * `xsd:int` range (-2147483648 to 2147483647, which also rejects digit
135933
+ * strings too long to parse), so the spec default (`1`) is never forced
135934
+ * onto the typed model.
135935
+ */
135936
+ extractFirstSlideNumber() {
135937
+ const pres = this.presentationData?.["p:presentation"];
135938
+ const lexical = String(pres?.["@_firstSlideNum"] ?? "").trim();
135939
+ if (!/^[+-]?\d+$/.test(lexical)) {
135940
+ return void 0;
135941
+ }
135942
+ const value = Number(lexical);
135943
+ return value >= XSD_INT_MIN && value <= XSD_INT_MAX ? value : void 0;
135944
+ }
135595
135945
  };
135596
135946
  }
135597
135947
  });
@@ -136262,7 +136612,7 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
136262
136612
  this.commentAuthorDetails.size > 0 ? Array.from(this.commentAuthorDetails.values()) : void 0
136263
136613
  ).withModernCommentAuthors(
136264
136614
  this.modernCommentAuthors.size > 0 ? Array.from(this.modernCommentAuthors.values()) : void 0
136265
- ).withConformance(this.isStrictOoxml ? "strict" : "transitional").withEmbedTrueTypeFonts(embedTrueTypeFonts).withDefaultTextStyle(defaultTextStyle).build();
136615
+ ).withConformance(this.isStrictOoxml ? "strict" : "transitional").withEmbedTrueTypeFonts(embedTrueTypeFonts).withFirstSlideNumber(this.extractFirstSlideNumber()).withDefaultTextStyle(defaultTextStyle).build();
136266
136616
  }
136267
136617
  /**
136268
136618
  * Walk the raw XML of every slide to find the highest numeric `@_id`
@@ -140612,7 +140962,10 @@ var init_PptxHandler = __esm({
140612
140962
  const imported = deserializePptxFromJson(text2);
140613
140963
  const blankBytes = await buildBlankPresentationArchive({
140614
140964
  width: imported.widthEmu,
140615
- height: imported.heightEmu
140965
+ height: imported.heightEmu,
140966
+ // Saving writes presentation.xml from the loaded archive, not from
140967
+ // the overlaid model, so the archive must carry the value itself.
140968
+ firstSlideNumber: imported.firstSlideNumber
140616
140969
  });
140617
140970
  const base = await super.load(blankBytes, options);
140618
140971
  return applyImportedPptxData(base, imported);