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
@@ -816,6 +816,7 @@ var init_presentation_field_keys = __esm({
816
816
  modernCommentAuthors: true,
817
817
  conformance: true,
818
818
  embedTrueTypeFonts: true,
819
+ firstSlideNumber: true,
819
820
  defaultTextStyle: true
820
821
  };
821
822
  PRESENTATION_FIELD_NAMES = Object.keys(PRESENTATION_FIELD_KEYS);
@@ -1288,6 +1289,32 @@ function inheritCustomGeometryCommandOrder(target, ...sources) {
1288
1289
  }
1289
1290
  }
1290
1291
  }
1292
+ function pathListPaths(pathLst) {
1293
+ if (!pathLst || typeof pathLst !== "object") {
1294
+ return [];
1295
+ }
1296
+ return ensureArrayLocal(childByLocalName(pathLst, "path")).filter(
1297
+ (path2) => Boolean(path2) && typeof path2 === "object"
1298
+ );
1299
+ }
1300
+ function readPathListCommandOrder(pathLst) {
1301
+ const orders = pathListPaths(pathLst).map((path2) => [...commandOrder.get(path2) ?? []]);
1302
+ return orders.some((order) => order.length > 0) ? orders : void 0;
1303
+ }
1304
+ function restorePathListCommandOrder(pathLst, orders) {
1305
+ if (!orders || orders.length === 0) {
1306
+ return;
1307
+ }
1308
+ pathListPaths(pathLst).forEach((path2, index) => {
1309
+ const order = orders[index];
1310
+ if (!order || order.length === 0 || commandOrder.has(path2)) {
1311
+ return;
1312
+ }
1313
+ if (orderSignature([...order]) === pathSignature(path2)) {
1314
+ commandOrder.set(path2, [...order]);
1315
+ }
1316
+ });
1317
+ }
1291
1318
  function orderedXmlKey(baseName, order) {
1292
1319
  return `${baseName}${ORDER_SUFFIX}${order}`;
1293
1320
  }
@@ -4412,7 +4439,7 @@ function rootRelsXml() {
4412
4439
  <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
4413
4440
  </Relationships>`;
4414
4441
  }
4415
- function presentationXml(width, height, slideCount) {
4442
+ function presentationXml(width, height, slideCount, firstSlideNumber) {
4416
4443
  const slideIdBase = 256;
4417
4444
  const slideRIdBase = 6;
4418
4445
  const sldIdLst = slideCount > 0 ? ` <p:sldIdLst>
@@ -4421,6 +4448,7 @@ ${Array.from(
4421
4448
  (_, i2) => ` <p:sldId id="${slideIdBase + i2}" r:id="rId${slideRIdBase + i2}"/>`
4422
4449
  ).join("\n")}
4423
4450
  </p:sldIdLst>` : "";
4451
+ const firstSlideNum = firstSlideNumber === void 0 ? "" : ` firstSlideNum="${Math.trunc(firstSlideNumber)}"`;
4424
4452
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4425
4453
  <p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
4426
4454
  xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
@@ -4428,7 +4456,7 @@ ${Array.from(
4428
4456
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
4429
4457
  xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"
4430
4458
  xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"
4431
- saveSubsetFonts="1">
4459
+ saveSubsetFonts="1"${firstSlideNum}>
4432
4460
  <p:sldMasterIdLst>
4433
4461
  <p:sldMasterId id="2147483648" r:id="rId1"/>
4434
4462
  </p:sldMasterIdLst>
@@ -4665,7 +4693,10 @@ async function buildBlankPresentationArchive(options) {
4665
4693
  const zip = new JSZip3__default.default();
4666
4694
  zip.file("[Content_Types].xml", contentTypesXml(layoutCount, initialSlideCount));
4667
4695
  zip.file("_rels/.rels", rootRelsXml());
4668
- zip.file("ppt/presentation.xml", presentationXml(width, height, initialSlideCount));
4696
+ zip.file(
4697
+ "ppt/presentation.xml",
4698
+ presentationXml(width, height, initialSlideCount, options?.firstSlideNumber)
4699
+ );
4669
4700
  zip.file("ppt/_rels/presentation.xml.rels", presentationRelsXml(layoutCount, initialSlideCount));
4670
4701
  zip.file("ppt/slideMasters/slideMaster1.xml", slideMasterXml(layoutCount));
4671
4702
  zip.file("ppt/slideMasters/_rels/slideMaster1.xml.rels", slideMasterRelsXml(layoutCount));
@@ -58471,6 +58502,7 @@ var init_custom_geometry_parser = __esm({
58471
58502
  // pptx/core/geometry/custom-geometry-live-eval.ts
58472
58503
  function pathNodesOf(rawData) {
58473
58504
  const pathLst = rawData?.pathLstXml;
58505
+ restorePathListCommandOrder(pathLst, rawData?.pathCommandOrder);
58474
58506
  return ensureArrayValue(pathLst?.["a:path"]);
58475
58507
  }
58476
58508
  function evaluateCustomGeometryPaths(rawData, pathWidth, pathHeight, overrides) {
@@ -58510,6 +58542,7 @@ var init_custom_geometry_live_eval = __esm({
58510
58542
  "pptx/core/geometry/custom-geometry-live-eval.ts"() {
58511
58543
  init_utils();
58512
58544
  init_custom_geometry();
58545
+ init_custom_geometry_command_order();
58513
58546
  init_custom_geometry_guides();
58514
58547
  init_custom_geometry_parser();
58515
58548
  ensureArray8 = (value) => ensureArrayValue(value);
@@ -65836,7 +65869,7 @@ function parseShapeLockNode(node, spec) {
65836
65869
  return void 0;
65837
65870
  }
65838
65871
  const locks = {};
65839
- let hasAny = false;
65872
+ let hasAny2 = false;
65840
65873
  for (const prop of spec.permitted) {
65841
65874
  const raw = node[LOCK_ATTRIBUTE[prop]];
65842
65875
  if (raw === void 0) {
@@ -65844,9 +65877,9 @@ function parseShapeLockNode(node, spec) {
65844
65877
  }
65845
65878
  const value = String(raw).trim().toLowerCase();
65846
65879
  locks[prop] = value === "1" || value === "true";
65847
- hasAny = true;
65880
+ hasAny2 = true;
65848
65881
  }
65849
- return hasAny ? locks : void 0;
65882
+ return hasAny2 ? locks : void 0;
65850
65883
  }
65851
65884
  var LOCK_ATTRIBUTE, MODELLED_ATTRIBUTES, CARRIED_WHEN_UNSET;
65852
65885
  var init_shape_lock_node = __esm({
@@ -66713,6 +66746,7 @@ var init_PptxLoadDataBuilder = __esm({
66713
66746
  modernCommentAuthors;
66714
66747
  conformance;
66715
66748
  embedTrueTypeFonts;
66749
+ firstSlideNumber;
66716
66750
  defaultTextStyle;
66717
66751
  withDimensions(width, height, widthEmu, heightEmu) {
66718
66752
  this.width = width;
@@ -66882,6 +66916,10 @@ var init_PptxLoadDataBuilder = __esm({
66882
66916
  this.embedTrueTypeFonts = embedTrueTypeFonts;
66883
66917
  return this;
66884
66918
  }
66919
+ withFirstSlideNumber(firstSlideNumber) {
66920
+ this.firstSlideNumber = firstSlideNumber;
66921
+ return this;
66922
+ }
66885
66923
  withDefaultTextStyle(defaultTextStyle) {
66886
66924
  this.defaultTextStyle = defaultTextStyle;
66887
66925
  return this;
@@ -66933,6 +66971,7 @@ var init_PptxLoadDataBuilder = __esm({
66933
66971
  modernCommentAuthors: this.modernCommentAuthors,
66934
66972
  conformance: this.conformance,
66935
66973
  embedTrueTypeFonts: this.embedTrueTypeFonts,
66974
+ firstSlideNumber: this.firstSlideNumber,
66936
66975
  defaultTextStyle: this.defaultTextStyle
66937
66976
  };
66938
66977
  }
@@ -70837,6 +70876,297 @@ var init_native_animation_media_duration = __esm({
70837
70876
  }
70838
70877
  });
70839
70878
 
70879
+ // pptx/core/services/editor-animation-entry.ts
70880
+ function hasAuthoredAnimationEffect(entry2) {
70881
+ return Boolean(
70882
+ [entry2.entrance, entry2.exit, entry2.emphasis].some((preset) => preset && preset !== "none") || entry2.motionPath
70883
+ );
70884
+ }
70885
+ function animationFor(slideAnimations, elementId) {
70886
+ return slideAnimations.find((a) => a.elementId === elementId);
70887
+ }
70888
+ var init_editor_animation_entry = __esm({
70889
+ "pptx/core/services/editor-animation-entry.ts"() {
70890
+ }
70891
+ });
70892
+
70893
+ // pptx/core/services/native-animation-after-effect.ts
70894
+ function hasAfterEffectFlag(cTn) {
70895
+ const raw = cTn?.["@_afterEffect"];
70896
+ return raw === "1" || raw === "true";
70897
+ }
70898
+ function extractSrgbHex(colorContainer) {
70899
+ const srgb = colorContainer?.["a:srgbClr"];
70900
+ const val = srgb?.["@_val"];
70901
+ return val !== void 0 ? `#${String(val).toUpperCase()}` : void 0;
70902
+ }
70903
+ function findDimBehaviour(subTnLst) {
70904
+ for (const node of ensureArray11(subTnLst["p:animClr"])) {
70905
+ const cBhvr = node["p:cBhvr"];
70906
+ if (extractAttrNameFromCBhvr(cBhvr) !== "ppt_c") {
70907
+ continue;
70908
+ }
70909
+ if (!hasAfterEffectFlag(cBhvr?.["p:cTn"])) {
70910
+ continue;
70911
+ }
70912
+ const toNode = node["p:to"];
70913
+ const color2 = extractSrgbHex(toNode);
70914
+ if (color2) {
70915
+ return { action: "dimToColor", color: color2 };
70916
+ }
70917
+ const colorRef = themeColorRefFromSchemeClr(toNode?.["a:schemeClr"]);
70918
+ return colorRef ? { action: "dimToColor", colorRef } : { action: "dimToColor" };
70919
+ }
70920
+ return void 0;
70921
+ }
70922
+ function findHideBehaviour(subTnLst) {
70923
+ for (const node of ensureArray11(subTnLst["p:set"])) {
70924
+ const cBhvr = node["p:cBhvr"];
70925
+ if (extractAttrNameFromCBhvr(cBhvr) !== "style.visibility") {
70926
+ continue;
70927
+ }
70928
+ const innerCTn = cBhvr?.["p:cTn"];
70929
+ if (!hasAfterEffectFlag(innerCTn)) {
70930
+ continue;
70931
+ }
70932
+ const toNode = node["p:to"];
70933
+ const strVal = toNode?.["p:strVal"]?.["@_val"];
70934
+ if (String(strVal ?? "").toLowerCase() !== "hidden") {
70935
+ continue;
70936
+ }
70937
+ const action = innerCTn?.["@_masterRel"] === "sameClick" ? "hideAfterAnimation" : "hideOnNextClick";
70938
+ return { action };
70939
+ }
70940
+ return void 0;
70941
+ }
70942
+ function extractAfterAnimationFromSubTnLst(cTn) {
70943
+ const subTnLst = cTn["p:subTnLst"];
70944
+ if (!subTnLst) {
70945
+ return void 0;
70946
+ }
70947
+ return findDimBehaviour(subTnLst) ?? findHideBehaviour(subTnLst);
70948
+ }
70949
+ var init_native_animation_after_effect = __esm({
70950
+ "pptx/core/services/native-animation-after-effect.ts"() {
70951
+ init_theme_color_ref();
70952
+ init_native_animation_attr_name();
70953
+ init_native_animation_helpers();
70954
+ }
70955
+ });
70956
+
70957
+ // pptx/core/services/animation-after-effect-write.ts
70958
+ function assertAfterAnimationClearSupported(effectCTn) {
70959
+ const shapeIds = /* @__PURE__ */ new Set();
70960
+ const checkTarget = (value) => {
70961
+ if (Array.isArray(value)) {
70962
+ value.forEach(checkTarget);
70963
+ return;
70964
+ }
70965
+ if (!isXmlObject5(value)) return;
70966
+ const shapeTarget = value["p:spTgt"];
70967
+ if (isXmlObject5(shapeTarget) && shapeTarget["@_spid"] !== void 0)
70968
+ shapeIds.add(String(shapeTarget["@_spid"]));
70969
+ if ([
70970
+ "p:bg",
70971
+ "p:txEl",
70972
+ "p:subSp",
70973
+ "p:graphicEl",
70974
+ "p:oleChartEl",
70975
+ "p:sndTgt",
70976
+ "p:inkTgt",
70977
+ "p:sldTgt"
70978
+ ].some((key2) => value[key2] !== void 0))
70979
+ throw new Error("Clearing after-animation supports whole-shape targets only");
70980
+ Object.values(value).forEach(checkTarget);
70981
+ };
70982
+ checkTarget(effectCTn["p:childTnLst"]);
70983
+ if (shapeIds.size > 1)
70984
+ throw new Error("Editing after-animation supports a single whole-shape target only");
70985
+ const sub = effectCTn["p:subTnLst"];
70986
+ if (!isXmlObject5(sub)) return;
70987
+ const countAfterFlags = (value) => {
70988
+ if (Array.isArray(value))
70989
+ return value.reduce((count, child30) => count + countAfterFlags(child30), 0);
70990
+ if (!isXmlObject5(value)) return 0;
70991
+ return Object.entries(value).reduce(
70992
+ (count, [key2, child30]) => count + (key2 === "@_afterEffect" && ["1", "true"].includes(String(child30)) ? 1 : countAfterFlags(child30)),
70993
+ 0
70994
+ );
70995
+ };
70996
+ for (const [key2, value] of Object.entries(sub)) {
70997
+ for (const node of ensureArray11(value)) {
70998
+ const flags = countAfterFlags(node);
70999
+ if (!flags) continue;
71000
+ if (flags !== 1 || !extractAfterAnimationFromSubTnLst({ "p:subTnLst": { [key2]: node } }))
71001
+ throw new Error("Cannot clear an unsupported native after-animation behavior");
71002
+ checkTarget(node);
71003
+ }
71004
+ }
71005
+ if (shapeIds.size > 1)
71006
+ throw new Error("Editing after-animation supports a single whole-shape target only");
71007
+ }
71008
+ function clearAfterAnimationBehavior(effectCTn) {
71009
+ const sub = effectCTn["p:subTnLst"];
71010
+ if (!isXmlObject5(sub)) return;
71011
+ for (const key2 of Object.keys(sub)) {
71012
+ const nodes = ensureArray11(sub[key2]);
71013
+ const remaining = nodes.filter(
71014
+ (node) => !extractAfterAnimationFromSubTnLst({ "p:subTnLst": { [key2]: node } })
71015
+ );
71016
+ if (remaining.length === nodes.length) continue;
71017
+ if (remaining.length === 0) delete sub[key2];
71018
+ else sub[key2] = remaining.length === 1 ? remaining[0] : remaining;
71019
+ }
71020
+ if (Object.keys(sub).length === 0) delete effectCTn["p:subTnLst"];
71021
+ }
71022
+ function applyAfterAnimationBehavior(effectCTn, anim, shapeId) {
71023
+ if (anim.afterAnimation === void 0) return;
71024
+ if (anim.afterAnimation === "none") {
71025
+ assertAfterAnimationClearSupported(effectCTn);
71026
+ clearAfterAnimationBehavior(effectCTn);
71027
+ return;
71028
+ }
71029
+ assertAfterAnimationClearSupported(effectCTn);
71030
+ clearAfterAnimationBehavior(effectCTn);
71031
+ delete effectCTn["@_afterEffect"];
71032
+ if (anim.afterAnimation === "dimToColor" && anim.afterAnimationColor) {
71033
+ appendAfterAnimationBehavior(effectCTn, buildDimSubTnLst(shapeId, anim.afterAnimationColor));
71034
+ return;
71035
+ }
71036
+ if (anim.afterAnimation === "hideAfterAnimation") {
71037
+ const entranceId = effectCTn["@_id"] !== void 0 ? String(effectCTn["@_id"]) : "0";
71038
+ appendAfterAnimationBehavior(effectCTn, buildHideSubTnLst(shapeId, "sameClick", entranceId));
71039
+ return;
71040
+ }
71041
+ if (anim.afterAnimation === "hideOnNextClick") {
71042
+ appendAfterAnimationBehavior(effectCTn, buildHideSubTnLst(shapeId, "nextClick"));
71043
+ }
71044
+ }
71045
+ function appendAfterAnimationBehavior(effect, addition) {
71046
+ const sub = isXmlObject5(effect["p:subTnLst"]) ? effect["p:subTnLst"] : {};
71047
+ for (const [key2, value] of Object.entries(addition)) {
71048
+ const nodes = [...ensureArray11(sub[key2]), ...ensureArray11(value)];
71049
+ sub[key2] = nodes.length === 1 ? nodes[0] : nodes;
71050
+ }
71051
+ effect["p:subTnLst"] = sub;
71052
+ }
71053
+ function buildDimSubTnLst(shapeId, colorHex) {
71054
+ const hex3 = colorHex.replace(/^#/u, "").toUpperCase();
71055
+ return {
71056
+ "p:animClr": {
71057
+ "@_clrSpc": "rgb",
71058
+ "@_dir": "cw",
71059
+ "p:cBhvr": {
71060
+ "@_override": "childStyle",
71061
+ "p:cTn": {
71062
+ "@_dur": "1",
71063
+ "@_fill": "hold",
71064
+ "@_display": "0",
71065
+ "@_masterRel": "nextClick",
71066
+ "@_afterEffect": "1"
71067
+ },
71068
+ "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
71069
+ "p:attrNameLst": { "p:attrName": "ppt_c" }
71070
+ },
71071
+ "p:to": { "a:srgbClr": { "@_val": hex3 } }
71072
+ }
71073
+ };
71074
+ }
71075
+ function buildHideSubTnLst(shapeId, masterRel, entranceId) {
71076
+ const cTn = {
71077
+ "@_dur": "1",
71078
+ "@_fill": "hold",
71079
+ "@_display": "0",
71080
+ "@_masterRel": masterRel,
71081
+ "@_afterEffect": "1"
71082
+ };
71083
+ if (masterRel === "sameClick") {
71084
+ cTn["p:stCondLst"] = {
71085
+ "p:cond": {
71086
+ "@_evt": "end",
71087
+ "@_delay": "0",
71088
+ "p:tn": { "@_val": entranceId ?? "0" }
71089
+ }
71090
+ };
71091
+ }
71092
+ return {
71093
+ "p:set": {
71094
+ "p:cBhvr": {
71095
+ "@_override": "childStyle",
71096
+ "p:cTn": cTn,
71097
+ "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
71098
+ "p:attrNameLst": { "p:attrName": "style.visibility" }
71099
+ },
71100
+ "p:to": { "p:strVal": { "@_val": "hidden" } }
71101
+ }
71102
+ };
71103
+ }
71104
+ var init_animation_after_effect_write = __esm({
71105
+ "pptx/core/services/animation-after-effect-write.ts"() {
71106
+ init_native_animation_after_effect();
71107
+ init_native_animation_helpers();
71108
+ }
71109
+ });
71110
+
71111
+ // pptx/core/services/editor-animation-after-effect.ts
71112
+ function mergeNativeAfterAnimationIntoEditorAnimations(nativeAnimations, animations, rawTiming) {
71113
+ for (const native of nativeAnimations ?? []) {
71114
+ const existing = native.targetId ? animationFor(animations, native.targetId) : void 0;
71115
+ const action = native.afterAnimationAction ?? (existing?.afterAnimation !== void 0 ? "none" : void 0);
71116
+ if ((nativeAnimations ?? []).filter(
71117
+ (other) => other.targetId === native.targetId && ["entr", "emph"].includes(other.presetClass ?? "")
71118
+ ).length !== 1)
71119
+ continue;
71120
+ if (!native.targetId || !action || !["entr", "emph"].includes(native.presetClass ?? "") || native.textTarget)
71121
+ continue;
71122
+ if (native.target && (native.target.type !== "shape" || native.target.backgroundOnly || native.target.subShapeId || native.target.graphicElement || native.target.oleChartElement))
71123
+ continue;
71124
+ try {
71125
+ if (rawTiming && native.target?.type === "shape" && indexEffectNodes(rawTiming).filter(
71126
+ (ref) => ref.spid === (native.target?.type === "shape" ? native.target.shapeId : void 0) && ["entr", "emph"].includes(ref.presetClass)
71127
+ ).length !== 1)
71128
+ continue;
71129
+ const effect = rawTiming ? indexEffectNodes(rawTiming).find(
71130
+ (ref) => String(ref.cTn["@_id"]) === String(native.nodeId) && native.target?.type === "shape" && ref.spid === native.target.shapeId
71131
+ ) : void 0;
71132
+ if (rawTiming && !effect) continue;
71133
+ assertAfterAnimationClearSupported(
71134
+ effect?.cTn ?? { "p:subTnLst": native.cTnAttributes?.["p:subTnLst"] }
71135
+ );
71136
+ } catch {
71137
+ continue;
71138
+ }
71139
+ let entry2 = animationFor(animations, native.targetId);
71140
+ if (!entry2) {
71141
+ entry2 = { elementId: native.targetId };
71142
+ animations.push(entry2);
71143
+ }
71144
+ if (entry2.nativeAfterAnimation !== void 0) continue;
71145
+ entry2.nativeAfterAnimation = action;
71146
+ entry2.nativeAfterAnimationColor = native.afterAnimationColor;
71147
+ }
71148
+ }
71149
+ function isNativeAfterAnimationFallback(entry2) {
71150
+ return entry2.nativeAfterAnimation !== void 0 && Object.entries(entry2).every(
71151
+ ([key2, value]) => value === void 0 || [
71152
+ "elementId",
71153
+ "nativeAfterAnimation",
71154
+ "nativeAfterAnimationColor",
71155
+ "soundRId",
71156
+ "soundPath",
71157
+ "soundName",
71158
+ "stopSound"
71159
+ ].includes(key2)
71160
+ );
71161
+ }
71162
+ var init_editor_animation_after_effect = __esm({
71163
+ "pptx/core/services/editor-animation-after-effect.ts"() {
71164
+ init_editor_animation_entry();
71165
+ init_animation_after_effect_write();
71166
+ init_animation_timing_tree();
71167
+ }
71168
+ });
71169
+
70840
71170
  // pptx/core/services/slide-name.ts
70841
71171
  function asNode3(value) {
70842
71172
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
@@ -71167,6 +71497,7 @@ var init_PptxSlideLoaderService = __esm({
71167
71497
  init_animation_target_reconcile();
71168
71498
  init_animation_timeline_anchors();
71169
71499
  init_native_animation_media_duration();
71500
+ init_editor_animation_after_effect();
71170
71501
  init_slide_name();
71171
71502
  init_slide_transition_envelope();
71172
71503
  PptxSlideLoaderService = class {
@@ -71378,6 +71709,8 @@ var init_PptxSlideLoaderService = __esm({
71378
71709
  }
71379
71710
  });
71380
71711
  reconcileAnimationTargets(elements3, nativeAnimations, animations, animationTimelineAnchors);
71712
+ animations ??= [];
71713
+ mergeNativeAfterAnimationIntoEditorAnimations(nativeAnimations, animations, rawTiming);
71381
71714
  mergeNativeSoundIntoEditorAnimations(nativeAnimations, animations);
71382
71715
  mergeNativeBuildTemplatesIntoEditorAnimations(nativeAnimations, animations);
71383
71716
  applyHiddenFlagFromRawXml(elements3);
@@ -71720,6 +72053,7 @@ function sortOrder(animation) {
71720
72053
  var PptxEditorAnimationService;
71721
72054
  var init_PptxEditorAnimationService = __esm({
71722
72055
  "pptx/core/services/PptxEditorAnimationService.ts"() {
72056
+ init_editor_animation_after_effect();
71723
72057
  init_editor_animation_normalizers();
71724
72058
  init_editor_animation_trigger_meta();
71725
72059
  PptxEditorAnimationService = class {
@@ -71818,7 +72152,7 @@ var init_PptxEditorAnimationService = __esm({
71818
72152
  * @param animations - Editor animations to serialize.
71819
72153
  */
71820
72154
  applyEditorAnimations(slideNode, animations) {
71821
- const sequenced = [...animations].sort((left, right) => sortOrder(left) - sortOrder(right));
72155
+ const sequenced = animations.filter((entry2) => !isNativeAfterAnimationFallback(entry2)).sort((left, right) => sortOrder(left) - sortOrder(right));
71822
72156
  const sanitizedAnimations = sequenced.map((animation) => {
71823
72157
  const elementId = String(animation.elementId || "").trim();
71824
72158
  if (elementId.length === 0) {
@@ -71832,7 +72166,7 @@ var init_PptxEditorAnimationService = __esm({
71832
72166
  const orderIsTreeDerived = animation.orderFromTimeline !== void 0 && animation.order === animation.orderFromTimeline;
71833
72167
  const order = typeof animation.order === "number" && Number.isFinite(animation.order) && !orderIsTreeDerived ? Math.round(animation.order) : void 0;
71834
72168
  const repeatCount = typeof animation.repeatCount === "number" && Number.isFinite(animation.repeatCount) && animation.repeatCount > 0 ? animation.repeatCount : void 0;
71835
- if (!entrance && !exit2 && !emphasis && !animation.motionPath) {
72169
+ if (!entrance && !exit2 && !emphasis && !animation.motionPath && animation.afterAnimation === void 0) {
71836
72170
  return null;
71837
72171
  }
71838
72172
  return {
@@ -72317,70 +72651,6 @@ var init_animation_effect_filter_parsing = __esm({
72317
72651
  }
72318
72652
  });
72319
72653
 
72320
- // pptx/core/services/native-animation-after-effect.ts
72321
- function hasAfterEffectFlag(cTn) {
72322
- const raw = cTn?.["@_afterEffect"];
72323
- return raw === "1" || raw === "true";
72324
- }
72325
- function extractSrgbHex(colorContainer) {
72326
- const srgb = colorContainer?.["a:srgbClr"];
72327
- const val = srgb?.["@_val"];
72328
- return val !== void 0 ? `#${String(val).toUpperCase()}` : void 0;
72329
- }
72330
- function findDimBehaviour(subTnLst) {
72331
- for (const node of ensureArray11(subTnLst["p:animClr"])) {
72332
- const cBhvr = node["p:cBhvr"];
72333
- if (extractAttrNameFromCBhvr(cBhvr) !== "ppt_c") {
72334
- continue;
72335
- }
72336
- if (!hasAfterEffectFlag(cBhvr?.["p:cTn"])) {
72337
- continue;
72338
- }
72339
- const toNode = node["p:to"];
72340
- const color2 = extractSrgbHex(toNode);
72341
- if (color2) {
72342
- return { action: "dimToColor", color: color2 };
72343
- }
72344
- const colorRef = themeColorRefFromSchemeClr(toNode?.["a:schemeClr"]);
72345
- return colorRef ? { action: "dimToColor", colorRef } : { action: "dimToColor" };
72346
- }
72347
- return void 0;
72348
- }
72349
- function findHideBehaviour(subTnLst) {
72350
- for (const node of ensureArray11(subTnLst["p:set"])) {
72351
- const cBhvr = node["p:cBhvr"];
72352
- if (extractAttrNameFromCBhvr(cBhvr) !== "style.visibility") {
72353
- continue;
72354
- }
72355
- const innerCTn = cBhvr?.["p:cTn"];
72356
- if (!hasAfterEffectFlag(innerCTn)) {
72357
- continue;
72358
- }
72359
- const toNode = node["p:to"];
72360
- const strVal = toNode?.["p:strVal"]?.["@_val"];
72361
- if (String(strVal ?? "").toLowerCase() !== "hidden") {
72362
- continue;
72363
- }
72364
- const action = innerCTn?.["@_masterRel"] === "sameClick" ? "hideAfterAnimation" : "hideOnNextClick";
72365
- return { action };
72366
- }
72367
- return void 0;
72368
- }
72369
- function extractAfterAnimationFromSubTnLst(cTn) {
72370
- const subTnLst = cTn["p:subTnLst"];
72371
- if (!subTnLst) {
72372
- return void 0;
72373
- }
72374
- return findDimBehaviour(subTnLst) ?? findHideBehaviour(subTnLst);
72375
- }
72376
- var init_native_animation_after_effect = __esm({
72377
- "pptx/core/services/native-animation-after-effect.ts"() {
72378
- init_theme_color_ref();
72379
- init_native_animation_attr_name();
72380
- init_native_animation_helpers();
72381
- }
72382
- });
72383
-
72384
72654
  // pptx/core/services/native-animation-cbhvr-attrs.ts
72385
72655
  function extractCBhvrAttrs(cBhvr) {
72386
72656
  if (!cBhvr) {
@@ -72529,6 +72799,16 @@ function readTiming(cTn) {
72529
72799
  return {};
72530
72800
  }
72531
72801
  const timing = {};
72802
+ const starts = ensureArray11(cTn["p:stCondLst"]?.["p:cond"]);
72803
+ 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(
72804
+ (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"
72805
+ )) {
72806
+ timing.unsupportedSetTiming = true;
72807
+ }
72808
+ const fill = cTn["@_fill"];
72809
+ if (fill === "remove" || fill === "freeze" || fill === "hold" || fill === "transition") {
72810
+ timing.fill = fill;
72811
+ }
72532
72812
  const durationMs = readTimingAttr(cTn["@_dur"]);
72533
72813
  if (durationMs !== void 0) {
72534
72814
  timing.durationMs = durationMs;
@@ -72934,6 +73214,7 @@ function buildTimingNodeAnimation(cTn, trigger, group) {
72934
73214
  commandString: cmdInfo.commandString,
72935
73215
  textTarget: textTarget ?? void 0,
72936
73216
  cTnAttributes: roundTripAttrs,
73217
+ unsupportedOpacitySetTiming: cTn["@_dur"] === "indefinite" || cTn["p:endSync"] !== void 0 || void 0,
72937
73218
  afterEffect: afterEffectFlag,
72938
73219
  afterAnimationAction: parsedAfterAnimation?.action,
72939
73220
  afterAnimationColor: parsedAfterAnimation?.color,
@@ -73737,79 +74018,6 @@ var init_PptxSlideTransitionService = __esm({
73737
74018
  }
73738
74019
  });
73739
74020
 
73740
- // pptx/core/services/animation-after-effect-write.ts
73741
- function applyAfterAnimationBehavior(effectCTn, anim, shapeId) {
73742
- delete effectCTn["p:subTnLst"];
73743
- delete effectCTn["@_afterEffect"];
73744
- if (anim.afterAnimation === "dimToColor" && anim.afterAnimationColor) {
73745
- effectCTn["p:subTnLst"] = buildDimSubTnLst(shapeId, anim.afterAnimationColor);
73746
- return;
73747
- }
73748
- if (anim.afterAnimation === "hideAfterAnimation") {
73749
- const entranceId = effectCTn["@_id"] !== void 0 ? String(effectCTn["@_id"]) : "0";
73750
- effectCTn["p:subTnLst"] = buildHideSubTnLst(shapeId, "sameClick", entranceId);
73751
- return;
73752
- }
73753
- if (anim.afterAnimation === "hideOnNextClick") {
73754
- effectCTn["p:subTnLst"] = buildHideSubTnLst(shapeId, "nextClick");
73755
- }
73756
- }
73757
- function buildDimSubTnLst(shapeId, colorHex) {
73758
- const hex3 = colorHex.replace(/^#/u, "").toUpperCase();
73759
- return {
73760
- "p:animClr": {
73761
- "@_clrSpc": "rgb",
73762
- "@_dir": "cw",
73763
- "p:cBhvr": {
73764
- "@_override": "childStyle",
73765
- "p:cTn": {
73766
- "@_dur": "1",
73767
- "@_fill": "hold",
73768
- "@_display": "0",
73769
- "@_masterRel": "nextClick",
73770
- "@_afterEffect": "1"
73771
- },
73772
- "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
73773
- "p:attrNameLst": { "p:attrName": "ppt_c" }
73774
- },
73775
- "p:to": { "a:srgbClr": { "@_val": hex3 } }
73776
- }
73777
- };
73778
- }
73779
- function buildHideSubTnLst(shapeId, masterRel, entranceId) {
73780
- const cTn = {
73781
- "@_dur": "1",
73782
- "@_fill": "hold",
73783
- "@_display": "0",
73784
- "@_masterRel": masterRel,
73785
- "@_afterEffect": "1"
73786
- };
73787
- if (masterRel === "sameClick") {
73788
- cTn["p:stCondLst"] = {
73789
- "p:cond": {
73790
- "@_evt": "end",
73791
- "@_delay": "0",
73792
- "p:tn": { "@_val": entranceId ?? "0" }
73793
- }
73794
- };
73795
- }
73796
- return {
73797
- "p:set": {
73798
- "p:cBhvr": {
73799
- "@_override": "childStyle",
73800
- "p:cTn": cTn,
73801
- "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
73802
- "p:attrNameLst": { "p:attrName": "style.visibility" }
73803
- },
73804
- "p:to": { "p:strVal": { "@_val": "hidden" } }
73805
- }
73806
- };
73807
- }
73808
- var init_animation_after_effect_write = __esm({
73809
- "pptx/core/services/animation-after-effect-write.ts"() {
73810
- }
73811
- });
73812
-
73813
74021
  // pptx/core/services/animation-behavior-captures.json
73814
74022
  var animation_behavior_captures_default;
73815
74023
  var init_animation_behavior_captures = __esm({
@@ -92024,6 +92232,33 @@ function updateEffectNodeAttributes(cTn, anim, presetClass, shapeId, allocateId)
92024
92232
  applySoundToEffectCTn(cTn, anim);
92025
92233
  }
92026
92234
  function surgicallyUpdateTimingTree(rawTiming, animations) {
92235
+ const sourceRefs = indexEffectNodes(rawTiming);
92236
+ for (const entry2 of animations.filter((animation) => animation.afterAnimation !== void 0)) {
92237
+ if (sourceRefs.filter(
92238
+ (ref) => ref.spid === entry2.elementId && ["entr", "emph"].includes(ref.presetClass)
92239
+ ).length > 1)
92240
+ throw new Error(
92241
+ "Cannot edit an ambiguous native after-animation target with multiple effects"
92242
+ );
92243
+ }
92244
+ const explicitClears = new Map(
92245
+ animations.filter((a) => a.afterAnimation !== void 0 && !hasAuthoredAnimationEffect(a)).map((a) => [a.elementId, a])
92246
+ );
92247
+ const clearRefs = sourceRefs.filter(
92248
+ (ref) => ref.spid && explicitClears.has(ref.spid) && (ref.presetClass === "entr" || ref.presetClass === "emph")
92249
+ );
92250
+ for (const target of explicitClears.keys()) {
92251
+ if (!clearRefs.some((ref) => ref.spid === target))
92252
+ throw new Error("Cannot edit after-animation without a supported native effect");
92253
+ if (clearRefs.filter((ref) => ref.spid === target).length > 1)
92254
+ throw new Error(
92255
+ "Cannot clear an ambiguous native after-animation target with multiple effects"
92256
+ );
92257
+ }
92258
+ clearRefs.forEach((ref) => assertAfterAnimationClearSupported(ref.cTn));
92259
+ clearRefs.forEach(
92260
+ (ref) => applyAfterAnimationBehavior(ref.cTn, explicitClears.get(ref.spid), ref.spid)
92261
+ );
92027
92262
  const desired = collectDesiredEffects(animations);
92028
92263
  const previouslyOwned = readOwnedEffectKeys(rawTiming);
92029
92264
  if (desired.length === 0 && previouslyOwned.size === 0) {
@@ -92090,6 +92325,7 @@ function surgicallyUpdateTimingTree(rawTiming, animations) {
92090
92325
  }
92091
92326
  var init_animation_timing_surgical = __esm({
92092
92327
  "pptx/core/services/animation-timing-surgical.ts"() {
92328
+ init_editor_animation_entry();
92093
92329
  init_animation_after_effect_write();
92094
92330
  init_animation_behavior_captured();
92095
92331
  init_animation_timing_build_surgical();
@@ -92140,9 +92376,11 @@ var init_PptxAnimationWriteService = __esm({
92140
92376
  const validAnimations = animations.filter((a) => a.entrance || a.exit || a.emphasis || a.motionPath).sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
92141
92377
  if (existingRawTiming) {
92142
92378
  const cloned = typeof structuredClone === "function" ? structuredClone(existingRawTiming) : JSON.parse(JSON.stringify(existingRawTiming));
92143
- return surgicallyUpdateTimingTree(cloned, validAnimations);
92379
+ return surgicallyUpdateTimingTree(cloned, animations);
92144
92380
  }
92145
92381
  if (validAnimations.length === 0) {
92382
+ if (animations.some((entry2) => entry2.afterAnimation !== void 0))
92383
+ throw new Error("Cannot edit after-animation without a supported native effect");
92146
92384
  return void 0;
92147
92385
  }
92148
92386
  this.nextId = 1;
@@ -108300,8 +108538,8 @@ function buildDefRPr(style, existing, resolveColor2) {
108300
108538
  return rPr;
108301
108539
  }
108302
108540
  function applyChartAxisTitleStyleToXml(axisNode, style, getLocalName2, resolveColor2) {
108303
- const hasAny = style.fontFamily !== void 0 || style.fontSize !== void 0 || style.fontBold !== void 0 || style.fontColor !== void 0;
108304
- if (!hasAny) {
108541
+ const hasAny2 = style.fontFamily !== void 0 || style.fontSize !== void 0 || style.fontBold !== void 0 || style.fontColor !== void 0;
108542
+ if (!hasAny2) {
108305
108543
  return;
108306
108544
  }
108307
108545
  const titleKey = findKey7(axisNode, "title", getLocalName2);
@@ -110155,8 +110393,8 @@ function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
110155
110393
  const spPrKey = findChildKey2(node, "spPr");
110156
110394
  const container2 = spPrKey ? node[spPrKey] ?? node : node;
110157
110395
  const xfrmKey = findChildKey2(container2, "xfrm");
110158
- const hasAny = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
110159
- if (!xfrmKey && !hasAny) {
110396
+ const hasAny2 = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
110397
+ if (!xfrmKey && !hasAny2) {
110160
110398
  return;
110161
110399
  }
110162
110400
  const xfrm = xfrmKey ? container2[xfrmKey] : {};
@@ -110191,24 +110429,24 @@ function hexVal(hex3) {
110191
110429
  }
110192
110430
  function buildRunProps(para) {
110193
110431
  const rPr = {};
110194
- let hasAny = false;
110432
+ let hasAny2 = false;
110195
110433
  if (para.fontSize !== void 0) {
110196
110434
  rPr["@_sz"] = String(Math.round(para.fontSize * 100));
110197
- hasAny = true;
110435
+ hasAny2 = true;
110198
110436
  }
110199
110437
  if (para.bold) {
110200
110438
  rPr["@_b"] = "1";
110201
- hasAny = true;
110439
+ hasAny2 = true;
110202
110440
  }
110203
110441
  if (para.italic) {
110204
110442
  rPr["@_i"] = "1";
110205
- hasAny = true;
110443
+ hasAny2 = true;
110206
110444
  }
110207
110445
  if (para.color) {
110208
110446
  rPr["a:solidFill"] = { "a:srgbClr": { "@_val": hexVal(para.color) } };
110209
- hasAny = true;
110447
+ hasAny2 = true;
110210
110448
  }
110211
- return hasAny ? rPr : void 0;
110449
+ return hasAny2 ? rPr : void 0;
110212
110450
  }
110213
110451
  function buildParagraphNode(para) {
110214
110452
  const node = {};
@@ -112251,7 +112489,7 @@ var init_blob_url_to_data_url = __esm({
112251
112489
 
112252
112490
  // pptx/core/core/runtime/image-a14-effects-model.ts
112253
112491
  function applyA14ExtensionToEffects(effects, a14) {
112254
- let hasAny = false;
112492
+ let hasAny2 = false;
112255
112493
  if (a14.artisticEffect !== void 0) {
112256
112494
  effects.artisticEffect = a14.artisticEffect;
112257
112495
  if (a14.originalImageRelId !== void 0) {
@@ -112263,15 +112501,15 @@ function applyA14ExtensionToEffects(effects, a14) {
112263
112501
  if (a14.artisticParams) {
112264
112502
  effects.artisticParams = a14.artisticParams;
112265
112503
  }
112266
- hasAny = true;
112504
+ hasAny2 = true;
112267
112505
  }
112268
112506
  if (a14.backgroundRemoval) {
112269
112507
  effects.backgroundRemoval = a14.backgroundRemoval;
112270
- hasAny = true;
112508
+ hasAny2 = true;
112271
112509
  }
112272
112510
  if (a14.originalImageRelId !== void 0) {
112273
112511
  effects.originalImageRelId = a14.originalImageRelId;
112274
- hasAny = true;
112512
+ hasAny2 = true;
112275
112513
  }
112276
112514
  const corrections = {};
112277
112515
  if (a14.sharpenSoften) {
@@ -112294,9 +112532,9 @@ function applyA14ExtensionToEffects(effects, a14) {
112294
112532
  if (a14.originalImageRelId !== void 0) {
112295
112533
  effects.prerenderedCorrections = corrections;
112296
112534
  }
112297
- hasAny = true;
112535
+ hasAny2 = true;
112298
112536
  }
112299
- return hasAny;
112537
+ return hasAny2;
112300
112538
  }
112301
112539
  var init_image_a14_effects_model = __esm({
112302
112540
  "pptx/core/core/runtime/image-a14-effects-model.ts"() {
@@ -114567,13 +114805,13 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
114567
114805
  return null;
114568
114806
  }
114569
114807
  const effects = {};
114570
- let hasAny = false;
114808
+ let hasAny2 = false;
114571
114809
  const brightRaw = blip["@_bright"] ?? blip["@_brt"];
114572
114810
  if (brightRaw !== null) {
114573
114811
  const val = parseInt(String(brightRaw));
114574
114812
  if (Number.isFinite(val)) {
114575
114813
  effects.brightness = val / 1e3;
114576
- hasAny = true;
114814
+ hasAny2 = true;
114577
114815
  }
114578
114816
  }
114579
114817
  const contrastRaw = blip["@_contrast"] ?? blip["@_cont"];
@@ -114581,7 +114819,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
114581
114819
  const val = parseInt(String(contrastRaw));
114582
114820
  if (Number.isFinite(val)) {
114583
114821
  effects.contrast = val / 1e3;
114584
- hasAny = true;
114822
+ hasAny2 = true;
114585
114823
  }
114586
114824
  }
114587
114825
  const colorEffects = parseImageColorEffects(
@@ -114591,12 +114829,12 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
114591
114829
  );
114592
114830
  Object.assign(effects, colorEffects);
114593
114831
  if (Object.keys(colorEffects).length > 0) {
114594
- hasAny = true;
114832
+ hasAny2 = true;
114595
114833
  }
114596
114834
  const alphaEffects = parseImageAlphaEffects(blip, (node) => this.parseColor(node));
114597
114835
  Object.assign(effects, alphaEffects);
114598
114836
  if (Object.keys(alphaEffects).length > 0) {
114599
- hasAny = true;
114837
+ hasAny2 = true;
114600
114838
  }
114601
114839
  const lumNode = blip["a:lum"];
114602
114840
  if (lumNode) {
@@ -114616,7 +114854,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
114616
114854
  }
114617
114855
  }
114618
114856
  effects.lum = lumEffect;
114619
- hasAny = true;
114857
+ hasAny2 = true;
114620
114858
  }
114621
114859
  const hslNode = blip["a:hsl"];
114622
114860
  if (hslNode) {
@@ -114643,7 +114881,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
114643
114881
  }
114644
114882
  }
114645
114883
  effects.hsl = hslEffect;
114646
- hasAny = true;
114884
+ hasAny2 = true;
114647
114885
  }
114648
114886
  const tintNode = blip["a:tint"];
114649
114887
  if (tintNode) {
@@ -114663,7 +114901,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
114663
114901
  }
114664
114902
  }
114665
114903
  effects.tint = tintEffect;
114666
- hasAny = true;
114904
+ hasAny2 = true;
114667
114905
  }
114668
114906
  const fillOverlay = blip["a:fillOverlay"];
114669
114907
  if (fillOverlay) {
@@ -114690,7 +114928,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
114690
114928
  ...resolvedGradient ? { resolvedGradient } : {},
114691
114929
  ...resolvedPattern ? { resolvedPattern } : {}
114692
114930
  };
114693
- hasAny = true;
114931
+ hasAny2 = true;
114694
114932
  }
114695
114933
  const blurNode = blip["a:blur"];
114696
114934
  if (blurNode) {
@@ -114708,16 +114946,16 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
114708
114946
  blurEffect.grow = s === "1" || s === "true";
114709
114947
  }
114710
114948
  effects.blur = blurEffect;
114711
- hasAny = true;
114949
+ hasAny2 = true;
114712
114950
  }
114713
114951
  const extLst = xmlChild(blip, "a:extLst");
114714
114952
  if (extLst) {
114715
114953
  const a14 = parseA14ImageExtension(this.ensureArray(extLst["a:ext"]));
114716
114954
  if (a14 && applyA14ExtensionToEffects(effects, a14)) {
114717
- hasAny = true;
114955
+ hasAny2 = true;
114718
114956
  }
114719
114957
  }
114720
- return hasAny ? effects : null;
114958
+ return hasAny2 ? effects : null;
114721
114959
  }
114722
114960
  /**
114723
114961
  * Resolve a blip `a:fillOverlay/a:gradFill` to the structured gradient a
@@ -116370,8 +116608,8 @@ function buildTextRunEffectListXml(style, parseColor) {
116370
116608
  const hasTextHsl = typeof style.textHslHue === "number" || typeof style.textHslSaturation === "number" || typeof style.textHslLuminance === "number";
116371
116609
  const hasTextClrChange = Boolean(style.textClrChangeFrom) && Boolean(style.textClrChangeTo);
116372
116610
  const hasTextDuotone = Boolean(style.textDuotone);
116373
- const hasAny = hasTextShadow || hasTextInnerShadow || hasTextPresetShadow || hasTextGlow || hasTextReflection || hasTextBlur || hasTextSoftEdge || hasTextAlphaModFix || hasTextAlphaMod || hasTextHsl || hasTextClrChange || hasTextDuotone;
116374
- if (!hasAny) {
116611
+ const hasAny2 = hasTextShadow || hasTextInnerShadow || hasTextPresetShadow || hasTextGlow || hasTextReflection || hasTextBlur || hasTextSoftEdge || hasTextAlphaModFix || hasTextAlphaMod || hasTextHsl || hasTextClrChange || hasTextDuotone;
116612
+ if (!hasAny2) {
116375
116613
  return void 0;
116376
116614
  }
116377
116615
  const effectLst = {};
@@ -120695,6 +120933,87 @@ var init_table_column_width_save = __esm({
120695
120933
  }
120696
120934
  });
120697
120935
 
120936
+ // pptx/core/core/runtime/table-style-change-cell-clear.ts
120937
+ function normaliseStyleId(id) {
120938
+ const text2 = typeof id === "string" || typeof id === "number" ? String(id) : "";
120939
+ const trimmed2 = text2.trim().toUpperCase();
120940
+ if (!trimmed2) {
120941
+ return "";
120942
+ }
120943
+ return trimmed2.startsWith("{") ? trimmed2 : `{${trimmed2}}`;
120944
+ }
120945
+ function xmlTableStyleId(tblPr) {
120946
+ if (!tblPr || typeof tblPr !== "object") {
120947
+ return "";
120948
+ }
120949
+ const props = tblPr;
120950
+ const node = props["a:tableStyleId"];
120951
+ const spec = normaliseStyleId(
120952
+ node && typeof node === "object" ? node["#text"] : node
120953
+ );
120954
+ if (spec) {
120955
+ return spec;
120956
+ }
120957
+ const legacy = props["a:tblStyle"];
120958
+ return normaliseStyleId(legacy?.["@_val"] || props["@_tblStyle"]);
120959
+ }
120960
+ function tableStyleIdChanged(tblPr, nextStyleId) {
120961
+ if (nextStyleId === void 0) {
120962
+ return false;
120963
+ }
120964
+ return normaliseStyleId(nextStyleId) !== xmlTableStyleId(tblPr);
120965
+ }
120966
+ function clearCellFormattingForStyleChange(xmlCell, style) {
120967
+ const tcPr = xmlCell["a:tcPr"];
120968
+ if (!tcPr || typeof tcPr !== "object") {
120969
+ return;
120970
+ }
120971
+ const props = tcPr;
120972
+ if (!hasAny(style, FILL_FIELDS)) {
120973
+ for (const key2 of FILL_KEYS) {
120974
+ delete props[key2];
120975
+ }
120976
+ }
120977
+ for (const [key2, fields] of LINE_KEYS) {
120978
+ if (!hasAny(style, fields)) {
120979
+ delete props[key2];
120980
+ }
120981
+ }
120982
+ if (!style?.cell3D) {
120983
+ delete props["a:cell3D"];
120984
+ }
120985
+ }
120986
+ var FILL_KEYS, LINE_KEYS, FILL_FIELDS, hasAny;
120987
+ var init_table_style_change_cell_clear = __esm({
120988
+ "pptx/core/core/runtime/table-style-change-cell-clear.ts"() {
120989
+ FILL_KEYS = [
120990
+ "a:noFill",
120991
+ "a:solidFill",
120992
+ "a:gradFill",
120993
+ "a:blipFill",
120994
+ "a:pattFill",
120995
+ "a:grpFill"
120996
+ ];
120997
+ LINE_KEYS = [
120998
+ ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash"]],
120999
+ ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash"]],
121000
+ ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash"]],
121001
+ ["a:lnB", ["borderBottomWidth", "borderBottomColor", "borderBottomDash"]],
121002
+ ["a:lnTlToBr", ["borderDiagDownWidth", "borderDiagDownColor"]],
121003
+ ["a:lnBlToTr", ["borderDiagUpWidth", "borderDiagUpColor"]]
121004
+ ];
121005
+ FILL_FIELDS = [
121006
+ "fillMode",
121007
+ "backgroundColor",
121008
+ "gradientFillStops",
121009
+ "patternFillPreset",
121010
+ "backgroundImageFillPath",
121011
+ "backgroundImageFillData"
121012
+ ];
121013
+ hasAny = (style, keys) => keys.some((key2) => style?.[key2] !== void 0);
121014
+ }
121015
+ });
121016
+
120698
121017
  // pptx/core/core/runtime/table-paragraph-save-order.ts
120699
121018
  function runTag(run) {
120700
121019
  return run.isLineBreak ? "a:br" : run.isField ? "a:fld" : "a:r";
@@ -121421,6 +121740,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
121421
121740
  init_PptxHandlerRuntimeChartUserShapes();
121422
121741
  init_save_table_merge_helpers();
121423
121742
  init_table_column_width_save();
121743
+ init_table_style_change_cell_clear();
121424
121744
  init_table_paragraph_save_order();
121425
121745
  init_table_structural_ops();
121426
121746
  init_table_tblpr_save();
@@ -121442,6 +121762,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
121442
121762
  if (!tbl) {
121443
121763
  return;
121444
121764
  }
121765
+ const styleChanged = tableData.clearDirectCellFormatting === true || tableStyleIdChanged(tbl["a:tblPr"], tableData.tableStyleId);
121445
121766
  serializeTablePropertyFlags(tbl, tableData);
121446
121767
  writeTablePropertiesOwnFillAndEffects(tbl["a:tblPr"], tableData);
121447
121768
  const xmlRows = this.ensureArray(tbl["a:tr"]);
@@ -121473,6 +121794,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
121473
121794
  if (cell.text !== void 0) {
121474
121795
  this.writeTableCellText(xmlCell, cell.text);
121475
121796
  }
121797
+ if (styleChanged) {
121798
+ clearCellFormattingForStyleChange(xmlCell, cell.style);
121799
+ }
121476
121800
  if (cell.style) {
121477
121801
  this.writeTableCellStyle(xmlCell, cell.style, cell.paragraphs);
121478
121802
  }
@@ -121496,6 +121820,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
121496
121820
  if (cell.text !== void 0) {
121497
121821
  this.writeTableCellText(xmlCell, cell.text);
121498
121822
  }
121823
+ if (styleChanged) {
121824
+ clearCellFormattingForStyleChange(xmlCell, cell.style);
121825
+ }
121499
121826
  if (cell.style) {
121500
121827
  this.writeTableCellStyle(xmlCell, cell.style, cell.paragraphs);
121501
121828
  }
@@ -132170,6 +132497,7 @@ var PptxHandlerRuntime60;
132170
132497
  var init_PptxHandlerRuntimeGeometryParsing = __esm({
132171
132498
  "pptx/core/core/runtime/PptxHandlerRuntimeGeometryParsing.ts"() {
132172
132499
  init_color_primitives();
132500
+ init_custom_geometry_command_order();
132173
132501
  init_custom_geometry_parser();
132174
132502
  init_guide_formula();
132175
132503
  init_PptxHandlerRuntimePlaceholderLookup();
@@ -132331,6 +132659,10 @@ var init_PptxHandlerRuntimeGeometryParsing = __esm({
132331
132659
  const pathLst = custGeom["a:pathLst"];
132332
132660
  if (isNonEmpty(pathLst)) {
132333
132661
  result.pathLstXml = pathLst;
132662
+ const pathCommandOrder = readPathListCommandOrder(pathLst);
132663
+ if (pathCommandOrder) {
132664
+ result.pathCommandOrder = pathCommandOrder;
132665
+ }
132334
132666
  }
132335
132667
  return Object.keys(result).length > 0 ? result : void 0;
132336
132668
  }
@@ -133241,7 +133573,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
133241
133573
  return void 0;
133242
133574
  }
133243
133575
  const locks = {};
133244
- let hasAny = false;
133576
+ let hasAny2 = false;
133245
133577
  const boolAttr2 = (attr6) => {
133246
133578
  const raw = spLocks[attr6];
133247
133579
  if (raw === void 0) {
@@ -133254,7 +133586,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
133254
133586
  const val = boolAttr2(attr6);
133255
133587
  if (val !== void 0) {
133256
133588
  fn(val);
133257
- hasAny = true;
133589
+ hasAny2 = true;
133258
133590
  }
133259
133591
  };
133260
133592
  set2("@_noGrp", (v) => {
@@ -133293,7 +133625,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
133293
133625
  set2("@_noCrop", (v) => {
133294
133626
  locks.noCrop = v;
133295
133627
  });
133296
- return hasAny ? locks : void 0;
133628
+ return hasAny2 ? locks : void 0;
133297
133629
  }
133298
133630
  /**
133299
133631
  * Parse the `@txBox` attribute from a `p:cNvSpPr` node. Returns `true` /
@@ -141921,13 +142253,15 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
141921
142253
  });
141922
142254
 
141923
142255
  // pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts
141924
- var PptxHandlerRuntime96;
142256
+ var XSD_INT_MIN, XSD_INT_MAX, PptxHandlerRuntime96;
141925
142257
  var init_PptxHandlerRuntimePresentationStructure = __esm({
141926
142258
  "pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts"() {
141927
142259
  init_kinsoku_parser();
141928
142260
  init_presentation_section_parser();
141929
142261
  init_header_footer_parts();
141930
142262
  init_PptxHandlerRuntimeChartParsing();
142263
+ XSD_INT_MIN = -2147483648;
142264
+ XSD_INT_MAX = 2147483647;
141931
142265
  PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
141932
142266
  parseEditorAnimations(slideXml3) {
141933
142267
  return this.editorAnimationService.parseEditorAnimations(slideXml3);
@@ -142110,6 +142444,22 @@ var init_PptxHandlerRuntimePresentationStructure = __esm({
142110
142444
  const lexical = String(raw).trim().toLowerCase();
142111
142445
  return lexical !== "0" && lexical !== "false";
142112
142446
  }
142447
+ /**
142448
+ * Extract `p:presentation/@firstSlideNum` (ECMA-376 §19.2.1.26, an
142449
+ * `xsd:int`). `undefined` when absent, not an integer, or outside the
142450
+ * `xsd:int` range (-2147483648 to 2147483647, which also rejects digit
142451
+ * strings too long to parse), so the spec default (`1`) is never forced
142452
+ * onto the typed model.
142453
+ */
142454
+ extractFirstSlideNumber() {
142455
+ const pres = this.presentationData?.["p:presentation"];
142456
+ const lexical = String(pres?.["@_firstSlideNum"] ?? "").trim();
142457
+ if (!/^[+-]?\d+$/.test(lexical)) {
142458
+ return void 0;
142459
+ }
142460
+ const value = Number(lexical);
142461
+ return value >= XSD_INT_MIN && value <= XSD_INT_MAX ? value : void 0;
142462
+ }
142113
142463
  };
142114
142464
  }
142115
142465
  });
@@ -142780,7 +143130,7 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
142780
143130
  this.commentAuthorDetails.size > 0 ? Array.from(this.commentAuthorDetails.values()) : void 0
142781
143131
  ).withModernCommentAuthors(
142782
143132
  this.modernCommentAuthors.size > 0 ? Array.from(this.modernCommentAuthors.values()) : void 0
142783
- ).withConformance(this.isStrictOoxml ? "strict" : "transitional").withEmbedTrueTypeFonts(embedTrueTypeFonts).withDefaultTextStyle(defaultTextStyle).build();
143133
+ ).withConformance(this.isStrictOoxml ? "strict" : "transitional").withEmbedTrueTypeFonts(embedTrueTypeFonts).withFirstSlideNumber(this.extractFirstSlideNumber()).withDefaultTextStyle(defaultTextStyle).build();
142784
143134
  }
142785
143135
  /**
142786
143136
  * Walk the raw XML of every slide to find the highest numeric `@_id`
@@ -147187,7 +147537,10 @@ var init_PptxHandler = __esm({
147187
147537
  const imported = deserializePptxFromJson(text2);
147188
147538
  const blankBytes = await buildBlankPresentationArchive({
147189
147539
  width: imported.widthEmu,
147190
- height: imported.heightEmu
147540
+ height: imported.heightEmu,
147541
+ // Saving writes presentation.xml from the loaded archive, not from
147542
+ // the overlaid model, so the archive must carry the value itself.
147543
+ firstSlideNumber: imported.firstSlideNumber
147191
147544
  });
147192
147545
  const base = await super.load(blankBytes, options);
147193
147546
  return applyImportedPptxData(base, imported);