pptx-react-viewer 3.16.6 → 3.17.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 (152) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +25 -3
  3. package/dist/{AiChatPanel-6IBPORZC.mjs → AiChatPanel-4LKH44IE.mjs} +3 -3
  4. package/dist/AiChatPanel-4LKH44IE.mjs.br +0 -0
  5. package/dist/AiChatPanel-4LKH44IE.mjs.gz +0 -0
  6. package/dist/{AiChatPanel-WDNBYHX7.js → AiChatPanel-VWVGQ5DD.js} +24 -24
  7. package/dist/AiChatPanel-VWVGQ5DD.js.br +0 -0
  8. package/dist/AiChatPanel-VWVGQ5DD.js.gz +0 -0
  9. package/dist/{Area3DChartScene-MRPRTJWY.js → Area3DChartScene-D7GSJGPQ.js} +2 -2
  10. package/dist/Area3DChartScene-D7GSJGPQ.js.br +0 -0
  11. package/dist/Area3DChartScene-D7GSJGPQ.js.gz +0 -0
  12. package/dist/{Area3DChartScene-EMOWMHHK.mjs → Area3DChartScene-X5SM67PZ.mjs} +1 -1
  13. package/dist/Area3DChartScene-X5SM67PZ.mjs.br +0 -0
  14. package/dist/Area3DChartScene-X5SM67PZ.mjs.gz +0 -0
  15. package/dist/{Bar3DChartScene-J3GJEGDJ.mjs → Bar3DChartScene-HWIFFGI3.mjs} +1 -1
  16. package/dist/{Bar3DChartScene-J3GJEGDJ.mjs.br → Bar3DChartScene-HWIFFGI3.mjs.br} +0 -0
  17. package/dist/Bar3DChartScene-HWIFFGI3.mjs.gz +0 -0
  18. package/dist/{Bar3DChartScene-THALZEYK.js → Bar3DChartScene-M72WQW5Y.js} +2 -2
  19. package/dist/Bar3DChartScene-M72WQW5Y.js.br +0 -0
  20. package/dist/Bar3DChartScene-M72WQW5Y.js.gz +0 -0
  21. package/dist/{Line3DChartScene-Y7MODOK2.mjs → Line3DChartScene-7MPZWVF3.mjs} +1 -1
  22. package/dist/Line3DChartScene-7MPZWVF3.mjs.br +0 -0
  23. package/dist/Line3DChartScene-7MPZWVF3.mjs.gz +0 -0
  24. package/dist/{Line3DChartScene-B26WZNO3.js → Line3DChartScene-YOZEEQZ3.js} +2 -2
  25. package/dist/Line3DChartScene-YOZEEQZ3.js.br +0 -0
  26. package/dist/Line3DChartScene-YOZEEQZ3.js.gz +0 -0
  27. package/dist/{Model3DScene-XM3JN7M6.mjs → Model3DScene-57LVY5QW.mjs} +1 -1
  28. package/dist/Model3DScene-57LVY5QW.mjs.br +0 -0
  29. package/dist/Model3DScene-57LVY5QW.mjs.gz +0 -0
  30. package/dist/{Model3DScene-27GN3D3U.js → Model3DScene-5IJSNGDZ.js} +2 -2
  31. package/dist/Model3DScene-5IJSNGDZ.js.br +0 -0
  32. package/dist/Model3DScene-5IJSNGDZ.js.gz +0 -0
  33. package/dist/{PieChart3DScene-URSRUABE.js → PieChart3DScene-UBI6X66Q.js} +2 -2
  34. package/dist/PieChart3DScene-UBI6X66Q.js.br +0 -0
  35. package/dist/PieChart3DScene-UBI6X66Q.js.gz +0 -0
  36. package/dist/{PieChart3DScene-4GP2B3PY.mjs → PieChart3DScene-WD5B6NP3.mjs} +1 -1
  37. package/dist/{PieChart3DScene-4GP2B3PY.mjs.br → PieChart3DScene-WD5B6NP3.mjs.br} +0 -0
  38. package/dist/PieChart3DScene-WD5B6NP3.mjs.gz +0 -0
  39. package/dist/{PowerPointViewer-Cl6jBPNw.d.ts → PowerPointViewer-Cde_wzd0.d.ts} +2 -2
  40. package/dist/{PowerPointViewer-Cl6jBPNw.d.ts.map → PowerPointViewer-Cde_wzd0.d.ts.map} +1 -1
  41. package/dist/{SurfaceChart3DScene-4OQNB3JY.js → SurfaceChart3DScene-JGNPYQ32.js} +2 -2
  42. package/dist/SurfaceChart3DScene-JGNPYQ32.js.br +0 -0
  43. package/dist/SurfaceChart3DScene-JGNPYQ32.js.gz +0 -0
  44. package/dist/{SurfaceChart3DScene-YJ4EYMWQ.mjs → SurfaceChart3DScene-JZGU6BBD.mjs} +1 -1
  45. package/dist/{SurfaceChart3DScene-YJ4EYMWQ.mjs.br → SurfaceChart3DScene-JZGU6BBD.mjs.br} +0 -0
  46. package/dist/SurfaceChart3DScene-JZGU6BBD.mjs.gz +0 -0
  47. package/dist/{audience-content-store-CB2WVM1K.d.ts → audience-content-store-A8Km8rBo.d.ts} +2 -2
  48. package/dist/{audience-content-store-CB2WVM1K.d.ts.map → audience-content-store-A8Km8rBo.d.ts.map} +1 -1
  49. package/dist/{chunk-U2H7CQ34.mjs → chunk-23PW4Y4R.mjs} +1 -1
  50. package/dist/chunk-23PW4Y4R.mjs.br +0 -0
  51. package/dist/chunk-23PW4Y4R.mjs.gz +0 -0
  52. package/dist/{chunk-TTCWWF47.js → chunk-3UGVURWU.js} +555 -499
  53. package/dist/chunk-3UGVURWU.js.br +0 -0
  54. package/dist/chunk-3UGVURWU.js.gz +0 -0
  55. package/dist/{chunk-VRMITIZZ.js → chunk-4SPZ5IZN.js} +1239 -506
  56. package/dist/chunk-4SPZ5IZN.js.br +0 -0
  57. package/dist/chunk-4SPZ5IZN.js.gz +0 -0
  58. package/dist/{chunk-LTQRC4WB.js → chunk-72LYFUGL.js} +1323 -1310
  59. package/dist/chunk-72LYFUGL.js.br +0 -0
  60. package/dist/chunk-72LYFUGL.js.gz +0 -0
  61. package/dist/{chunk-YUIXPWFT.mjs → chunk-7YJBRPCT.mjs} +9 -5
  62. package/dist/chunk-7YJBRPCT.mjs.br +0 -0
  63. package/dist/chunk-7YJBRPCT.mjs.gz +0 -0
  64. package/dist/{chunk-QLZHTIH6.mjs → chunk-7YOA4HNP.mjs} +106 -50
  65. package/dist/chunk-7YOA4HNP.mjs.br +0 -0
  66. package/dist/chunk-7YOA4HNP.mjs.gz +0 -0
  67. package/dist/{chunk-RWVMSJ7C.mjs → chunk-EDMJYVCS.mjs} +44 -31
  68. package/dist/chunk-EDMJYVCS.mjs.br +0 -0
  69. package/dist/chunk-EDMJYVCS.mjs.gz +0 -0
  70. package/dist/{chunk-C7H7NM2W.js → chunk-KVXB22D3.js} +13 -9
  71. package/dist/chunk-KVXB22D3.js.br +0 -0
  72. package/dist/chunk-KVXB22D3.js.gz +0 -0
  73. package/dist/{chunk-BJL5MJ7A.js → chunk-NJ3WCYYG.js} +169 -169
  74. package/dist/chunk-NJ3WCYYG.js.br +0 -0
  75. package/dist/{chunk-BJL5MJ7A.js.gz → chunk-NJ3WCYYG.js.gz} +0 -0
  76. package/dist/{chunk-PO2PYVHF.mjs → chunk-QTGCOL5H.mjs} +1233 -507
  77. package/dist/chunk-QTGCOL5H.mjs.br +0 -0
  78. package/dist/chunk-QTGCOL5H.mjs.gz +0 -0
  79. package/dist/index.d.ts +33 -3
  80. package/dist/index.js +45 -45
  81. package/dist/index.js.br +0 -0
  82. package/dist/index.js.gz +0 -0
  83. package/dist/index.mjs +5 -5
  84. package/dist/index.mjs.br +0 -0
  85. package/dist/index.mjs.gz +0 -0
  86. package/dist/internals.d.ts +38 -3
  87. package/dist/internals.d.ts.map +1 -1
  88. package/dist/internals.js +78 -78
  89. package/dist/internals.js.br +0 -0
  90. package/dist/internals.js.gz +0 -0
  91. package/dist/internals.mjs +3 -3
  92. package/dist/internals.mjs.br +0 -0
  93. package/dist/internals.mjs.gz +0 -0
  94. package/dist/pptx-viewer.css +1 -1
  95. package/dist/pptx-viewer.css.br +0 -0
  96. package/dist/pptx-viewer.css.gz +0 -0
  97. package/dist/{types-Bzdkiakq.d.ts → types-BqB2ZCwS.d.ts} +3 -3
  98. package/dist/{types-Bzdkiakq.d.ts.map → types-BqB2ZCwS.d.ts.map} +1 -1
  99. package/dist/{useViewerBuildingBlocks-FbK-4ORi.d.ts → useViewerBuildingBlocks-DkUGmlkP.d.ts} +4 -4
  100. package/dist/{useViewerBuildingBlocks-FbK-4ORi.d.ts.map → useViewerBuildingBlocks-DkUGmlkP.d.ts.map} +1 -1
  101. package/dist/viewer/index.d.ts +31 -1
  102. package/dist/viewer/index.js +26 -26
  103. package/dist/viewer/index.js.br +0 -0
  104. package/dist/viewer/index.js.gz +0 -0
  105. package/dist/viewer/index.mjs +5 -5
  106. package/dist/viewer/index.mjs.br +0 -0
  107. package/dist/viewer/index.mjs.gz +0 -0
  108. package/package.json +1 -1
  109. package/dist/AiChatPanel-6IBPORZC.mjs.br +0 -0
  110. package/dist/AiChatPanel-6IBPORZC.mjs.gz +0 -0
  111. package/dist/AiChatPanel-WDNBYHX7.js.br +0 -0
  112. package/dist/AiChatPanel-WDNBYHX7.js.gz +0 -0
  113. package/dist/Area3DChartScene-EMOWMHHK.mjs.br +0 -0
  114. package/dist/Area3DChartScene-EMOWMHHK.mjs.gz +0 -0
  115. package/dist/Area3DChartScene-MRPRTJWY.js.br +0 -0
  116. package/dist/Area3DChartScene-MRPRTJWY.js.gz +0 -0
  117. package/dist/Bar3DChartScene-J3GJEGDJ.mjs.gz +0 -0
  118. package/dist/Bar3DChartScene-THALZEYK.js.br +0 -0
  119. package/dist/Bar3DChartScene-THALZEYK.js.gz +0 -0
  120. package/dist/Line3DChartScene-B26WZNO3.js.br +0 -0
  121. package/dist/Line3DChartScene-B26WZNO3.js.gz +0 -0
  122. package/dist/Line3DChartScene-Y7MODOK2.mjs.br +0 -0
  123. package/dist/Line3DChartScene-Y7MODOK2.mjs.gz +0 -0
  124. package/dist/Model3DScene-27GN3D3U.js.br +0 -0
  125. package/dist/Model3DScene-27GN3D3U.js.gz +0 -0
  126. package/dist/Model3DScene-XM3JN7M6.mjs.br +0 -0
  127. package/dist/Model3DScene-XM3JN7M6.mjs.gz +0 -0
  128. package/dist/PieChart3DScene-4GP2B3PY.mjs.gz +0 -0
  129. package/dist/PieChart3DScene-URSRUABE.js.br +0 -0
  130. package/dist/PieChart3DScene-URSRUABE.js.gz +0 -0
  131. package/dist/SurfaceChart3DScene-4OQNB3JY.js.br +0 -0
  132. package/dist/SurfaceChart3DScene-4OQNB3JY.js.gz +0 -0
  133. package/dist/SurfaceChart3DScene-YJ4EYMWQ.mjs.gz +0 -0
  134. package/dist/chunk-BJL5MJ7A.js.br +0 -0
  135. package/dist/chunk-C7H7NM2W.js.br +0 -0
  136. package/dist/chunk-C7H7NM2W.js.gz +0 -0
  137. package/dist/chunk-LTQRC4WB.js.br +0 -0
  138. package/dist/chunk-LTQRC4WB.js.gz +0 -0
  139. package/dist/chunk-PO2PYVHF.mjs.br +0 -0
  140. package/dist/chunk-PO2PYVHF.mjs.gz +0 -0
  141. package/dist/chunk-QLZHTIH6.mjs.br +0 -0
  142. package/dist/chunk-QLZHTIH6.mjs.gz +0 -0
  143. package/dist/chunk-RWVMSJ7C.mjs.br +0 -0
  144. package/dist/chunk-RWVMSJ7C.mjs.gz +0 -0
  145. package/dist/chunk-TTCWWF47.js.br +0 -0
  146. package/dist/chunk-TTCWWF47.js.gz +0 -0
  147. package/dist/chunk-U2H7CQ34.mjs.br +0 -0
  148. package/dist/chunk-U2H7CQ34.mjs.gz +0 -0
  149. package/dist/chunk-VRMITIZZ.js.br +0 -0
  150. package/dist/chunk-VRMITIZZ.js.gz +0 -0
  151. package/dist/chunk-YUIXPWFT.mjs.br +0 -0
  152. package/dist/chunk-YUIXPWFT.mjs.gz +0 -0
@@ -7056,6 +7056,7 @@ var init_collaboration_field_schema = __esm({
7056
7056
  hidden: "scalar",
7057
7057
  opacity: "scalar",
7058
7058
  rawXml: "complex",
7059
+ inheritedTransform: "complex",
7059
7060
  actionClick: "complex",
7060
7061
  actionHover: "complex",
7061
7062
  locks: "complex",
@@ -34239,10 +34240,10 @@ function clampByRules(value, rules, type) {
34239
34240
  }
34240
34241
  function ratioConstraint(constraints, types, fallback, rules) {
34241
34242
  for (const type of types) {
34242
- const matches = (constraints ?? []).filter((constraint) => constraint.type === type);
34243
+ const matches2 = (constraints ?? []).filter((constraint) => constraint.type === type);
34243
34244
  const ordered4 = [
34244
- ...matches.filter((constraint) => constraint.for === "ch"),
34245
- ...matches.filter((constraint) => constraint.for !== "ch")
34245
+ ...matches2.filter((constraint) => constraint.for === "ch"),
34246
+ ...matches2.filter((constraint) => constraint.for !== "ch")
34246
34247
  ];
34247
34248
  for (const constraint of ordered4) {
34248
34249
  const ratio = constraintRatio(constraint);
@@ -37111,9 +37112,9 @@ function compoundChildIds(role, node, childrenOf) {
37111
37112
  const children13 = childrenOf.get(node.id) ?? [];
37112
37113
  const start = role.presentationOf?.start?.[chIndex] ?? 1;
37113
37114
  const count = role.presentationOf?.count?.[chIndex];
37114
- const positions = positionRange(start, count, 1, children13.length);
37115
+ const positions2 = positionRange(start, count, 1, children13.length);
37115
37116
  const ids = [];
37116
- for (const position2 of positions) {
37117
+ for (const position2 of positions2) {
37117
37118
  const child262 = children13[position2 - 1];
37118
37119
  if (!child262 || child262.text.trim().length === 0) {
37119
37120
  continue;
@@ -40444,14 +40445,14 @@ var init_smartart_hierarchy_composite_child = __esm({
40444
40445
  });
40445
40446
  function findByReference(constraints, type, referenceType, preferredName) {
40446
40447
  const list = constraints ?? [];
40447
- const matches = (c) => c.type === type && c.referenceType === referenceType && typeof c.factor === "number";
40448
+ const matches2 = (c) => c.type === type && c.referenceType === referenceType && typeof c.factor === "number";
40448
40449
  if (preferredName !== void 0) {
40449
- const named = list.find((c) => matches(c) && c.forName === preferredName);
40450
+ const named = list.find((c) => matches2(c) && c.forName === preferredName);
40450
40451
  if (named) {
40451
40452
  return named.factor;
40452
40453
  }
40453
40454
  }
40454
- return list.find(matches)?.factor;
40455
+ return list.find(matches2)?.factor;
40455
40456
  }
40456
40457
  function findDirectAspectRatio(constraints, preferredName) {
40457
40458
  const hRefW = findByReference(constraints, "h", "w", preferredName);
@@ -43119,14 +43120,14 @@ function findDrawingShapeIndex(shapes, nodes, nodeId) {
43119
43120
  const node = nodes.find((n) => n.id === nodeId);
43120
43121
  if (node?.text) {
43121
43122
  const text22 = node.text.trim();
43122
- const matches = [];
43123
+ const matches2 = [];
43123
43124
  for (let i2 = 0; i2 < shapes.length; i2++) {
43124
43125
  if (shapes[i2].text?.trim() === text22) {
43125
- matches.push(i2);
43126
+ matches2.push(i2);
43126
43127
  }
43127
43128
  }
43128
- if (matches.length === 1) {
43129
- return matches[0];
43129
+ if (matches2.length === 1) {
43130
+ return matches2[0];
43130
43131
  }
43131
43132
  }
43132
43133
  return -1;
@@ -43326,14 +43327,14 @@ function findShapeIndexForNode(shapes, nodes, nodeId) {
43326
43327
  const node = nodes.find((n) => n.id === nodeId);
43327
43328
  if (node?.text) {
43328
43329
  const text22 = node.text.trim();
43329
- const matches = [];
43330
+ const matches2 = [];
43330
43331
  for (let i2 = 0; i2 < shapes.length; i2++) {
43331
43332
  if (shapes[i2].text?.trim() === text22) {
43332
- matches.push(i2);
43333
+ matches2.push(i2);
43333
43334
  }
43334
43335
  }
43335
- if (matches.length === 1) {
43336
- return matches[0];
43336
+ if (matches2.length === 1) {
43337
+ return matches2[0];
43337
43338
  }
43338
43339
  }
43339
43340
  return -1;
@@ -48834,7 +48835,7 @@ function parseValueColors(node, colorParser) {
48834
48835
  return colors.length > 0 ? colors : void 0;
48835
48836
  }
48836
48837
  function parseValueColorPositions(node, xmlLookup) {
48837
- const positions = [];
48838
+ const positions2 = [];
48838
48839
  for (const posNode of xmlLookup.getChildrenArrayByLocalName(node, "pos")) {
48839
48840
  const kind = POSITION_KIND_MAP[String(posNode["@_type"] ?? "").trim()];
48840
48841
  if (!kind) {
@@ -48848,9 +48849,9 @@ function parseValueColorPositions(node, xmlLookup) {
48848
48849
  entry2.value = num;
48849
48850
  }
48850
48851
  }
48851
- positions.push(entry2);
48852
+ positions2.push(entry2);
48852
48853
  }
48853
- return positions.length > 0 ? positions : void 0;
48854
+ return positions2.length > 0 ? positions2 : void 0;
48854
48855
  }
48855
48856
  function parseCxValueColors(series, xmlLookup, colorParser) {
48856
48857
  const valueColorsNode = xmlLookup.getChildByLocalName(series, "valueColors");
@@ -48866,9 +48867,9 @@ function parseCxValueColors(series, xmlLookup, colorParser) {
48866
48867
  }
48867
48868
  }
48868
48869
  if (valueColorPositionsNode) {
48869
- const positions = parseValueColorPositions(valueColorPositionsNode, xmlLookup);
48870
- if (positions) {
48871
- result.valueColorPositions = positions;
48870
+ const positions2 = parseValueColorPositions(valueColorPositionsNode, xmlLookup);
48871
+ if (positions2) {
48872
+ result.valueColorPositions = positions2;
48872
48873
  }
48873
48874
  }
48874
48875
  return Object.keys(result).length > 0 ? result : void 0;
@@ -63577,15 +63578,48 @@ var init_group_tight_rewrap = __esm({
63577
63578
  init_group_tight_rewrap_own_box();
63578
63579
  }
63579
63580
  });
63581
+ function materializeInheritedShapeTransform(shape, element) {
63582
+ const baseline = element.inheritedTransform;
63583
+ const envelope = element.type === "text" || element.type === "shape" ? "p:nvSpPr" : element.type === "picture" || element.type === "media" ? "p:nvPicPr" : void 0;
63584
+ if (!baseline || !envelope || !xmlChild(shape, envelope)) {
63585
+ return void 0;
63586
+ }
63587
+ if (["x", "y", "width", "height"].some(
63588
+ (key2) => !Number.isFinite(element[key2]) || !Number.isFinite(baseline[key2])
63589
+ ) || NUMERIC_KEYS.some(
63590
+ (key2) => !Number.isFinite(element[key2] ?? 0) || !Number.isFinite(baseline[key2] ?? 0)
63591
+ ) || element.width < 0 || element.height < 0 || baseline.width < 0 || baseline.height < 0) {
63592
+ return void 0;
63593
+ }
63594
+ const changed = NUMERIC_KEYS.some((key2) => (element[key2] ?? 0) !== (baseline[key2] ?? 0)) || Boolean(element.flipHorizontal) !== Boolean(baseline.flipHorizontal) || Boolean(element.flipVertical) !== Boolean(baseline.flipVertical);
63595
+ if (!changed) {
63596
+ return void 0;
63597
+ }
63598
+ const transform6 = {};
63599
+ const properties = { ...xmlChild(shape, "p:spPr") };
63600
+ delete properties["a:xfrm"];
63601
+ shape["p:spPr"] = { "a:xfrm": transform6, ...properties };
63602
+ return transform6;
63603
+ }
63604
+ var NUMERIC_KEYS;
63605
+ var init_inherited_shape_transform = __esm({
63606
+ "src/core/core/builders/inherited-shape-transform.ts"() {
63607
+ init_xml_access();
63608
+ NUMERIC_KEYS = ["x", "y", "width", "height", "rotation", "skewX", "skewY"];
63609
+ }
63610
+ });
63580
63611
  var PptxElementTransformUpdater;
63581
63612
  var init_PptxElementTransformUpdater = __esm({
63582
63613
  "src/core/core/builders/PptxElementTransformUpdater.ts"() {
63583
63614
  init_rotated_resize_anchor();
63584
63615
  init_xfrm_emu_resolution();
63616
+ init_xml_access();
63585
63617
  init_group_tight_rewrap();
63618
+ init_inherited_shape_transform();
63586
63619
  PptxElementTransformUpdater = class {
63587
63620
  applyTransform(shape, element, emuPerPx, enclosingGroupChildSpace) {
63588
- const transform6 = shape["p:spPr"]?.["a:xfrm"] || shape["p:xfrm"];
63621
+ const transform6 = shape["p:spPr"]?.["a:xfrm"] || shape["p:xfrm"] || // A group's child geometry uses a different frame from the load-time baseline.
63622
+ !enclosingGroupChildSpace && materializeInheritedShapeTransform(shape, element);
63589
63623
  if (!transform6) {
63590
63624
  return;
63591
63625
  }
@@ -63606,8 +63640,9 @@ var init_PptxElementTransformUpdater = __esm({
63606
63640
  } else {
63607
63641
  const naiveOffX = resolveXfrmEmu(element.x, element.xEmu, emuPerPx);
63608
63642
  const naiveOffY = resolveXfrmEmu(element.y, element.yEmu, emuPerPx);
63643
+ const rotationChanged = element.inheritedTransform !== void 0 && (element.inheritedTransform.rotation ?? 0) !== (element.rotation ?? 0);
63609
63644
  const rotatedResize = resolveRotatedResizeOffset({
63610
- rotationDeg: element.rotation,
63645
+ rotationDeg: rotationChanged ? void 0 : element.rotation,
63611
63646
  oldOffXEmu: element.xEmu,
63612
63647
  oldOffYEmu: element.yEmu,
63613
63648
  oldExtWidthEmu: element.widthEmu,
@@ -63633,14 +63668,20 @@ var init_PptxElementTransformUpdater = __esm({
63633
63668
  if (element.skewY !== void 0) {
63634
63669
  transform6["@_skewY"] = String(Math.round(element.skewY * 6e4));
63635
63670
  }
63671
+ const nonVisual = xmlChild(shape, "p:nvSpPr") ?? xmlChild(shape, "p:nvPicPr");
63672
+ const isPlaceholder = xmlHasChild(xmlChild(nonVisual, "p:nvPr"), "p:ph");
63636
63673
  if (element.flipHorizontal) {
63637
63674
  transform6["@_flipH"] = "1";
63638
- } else {
63675
+ } else if (element.inheritedTransform?.flipHorizontal || isPlaceholder && transform6["@_flipH"] !== void 0 && transform6["@_flipH"] !== "false") {
63676
+ transform6["@_flipH"] = "0";
63677
+ } else if (transform6["@_flipH"] !== "0" && transform6["@_flipH"] !== "false") {
63639
63678
  delete transform6["@_flipH"];
63640
63679
  }
63641
63680
  if (element.flipVertical) {
63642
63681
  transform6["@_flipV"] = "1";
63643
- } else {
63682
+ } else if (element.inheritedTransform?.flipVertical || isPlaceholder && transform6["@_flipV"] !== void 0 && transform6["@_flipV"] !== "false") {
63683
+ transform6["@_flipV"] = "0";
63684
+ } else if (transform6["@_flipV"] !== "0" && transform6["@_flipV"] !== "false") {
63644
63685
  delete transform6["@_flipV"];
63645
63686
  }
63646
63687
  }
@@ -74208,45 +74249,40 @@ var init_PptxEditorAnimationService = __esm({
74208
74249
  };
74209
74250
  }
74210
74251
  });
74211
- function flattenElements(elements2, out) {
74212
- for (const el of elements2) {
74213
- out.push(el);
74214
- if (el.type === "group" && Array.isArray(el.children)) {
74215
- flattenElements(el.children, out);
74216
- }
74217
- }
74218
- }
74219
- function maxShapeId(elements2) {
74220
- let max = 0;
74221
- for (const el of elements2) {
74222
- if (el.shapeId !== void 0) {
74223
- const n = Number.parseInt(el.shapeId, 10);
74224
- if (Number.isFinite(n) && n > max) {
74225
- max = n;
74252
+ function createShapeIdResolver(elements2, reservedMaxId = 0) {
74253
+ const byId = /* @__PURE__ */ new Map();
74254
+ let maxId = reservedMaxId;
74255
+ const visit = (element) => {
74256
+ byId.set(element.id, element);
74257
+ if (element.shapeId !== void 0) {
74258
+ const value = Number.parseInt(element.shapeId, 10);
74259
+ if (Number.isFinite(value)) {
74260
+ maxId = Math.max(maxId, value);
74226
74261
  }
74227
74262
  }
74228
- }
74229
- return max;
74230
- }
74231
- function remapEditorAnimationsToShapeIds(elements2, animations, reservedMaxId = 0) {
74232
- const flat = [];
74233
- flattenElements(elements2, flat);
74234
- const byId = /* @__PURE__ */ new Map();
74235
- for (const el of flat) {
74236
- byId.set(el.id, el);
74237
- }
74238
- let nextId2 = Math.max(maxShapeId(flat), reservedMaxId) + 1;
74239
- const resolve2 = (elementId) => {
74240
- const el = byId.get(elementId);
74241
- if (!el) {
74263
+ if (element.type === "group") {
74264
+ element.children.forEach(visit);
74265
+ }
74266
+ };
74267
+ elements2.forEach(visit);
74268
+ return (elementId) => {
74269
+ const element = byId.get(elementId);
74270
+ if (!element) {
74242
74271
  return void 0;
74243
74272
  }
74244
- if (el.shapeId === void 0) {
74245
- el.shapeId = String(nextId2);
74246
- nextId2 += 1;
74273
+ if (element.shapeId === void 0) {
74274
+ maxId += 1;
74275
+ element.shapeId = String(maxId);
74247
74276
  }
74248
- return el.shapeId;
74277
+ return element.shapeId;
74249
74278
  };
74279
+ }
74280
+ var init_shape_id_resolver = __esm({
74281
+ "src/core/services/shape-id-resolver.ts"() {
74282
+ }
74283
+ });
74284
+ function remapEditorAnimationsToShapeIds(elements2, animations, reservedMaxId = 0) {
74285
+ const resolve2 = createShapeIdResolver(elements2, reservedMaxId);
74250
74286
  return animations.map((anim) => {
74251
74287
  const resolvedElement = resolve2(anim.elementId);
74252
74288
  const resolvedTrigger = anim.triggerShapeId !== void 0 ? resolve2(anim.triggerShapeId) : void 0;
@@ -74262,6 +74298,67 @@ function remapEditorAnimationsToShapeIds(elements2, animations, reservedMaxId =
74262
74298
  }
74263
74299
  var init_animation_shape_id_assign = __esm({
74264
74300
  "src/core/services/animation-shape-id-assign.ts"() {
74301
+ init_shape_id_resolver();
74302
+ }
74303
+ });
74304
+ function resolveConnectorShapeIds(elements2, reservedMaxId) {
74305
+ const resolve2 = createShapeIdResolver(elements2, reservedMaxId);
74306
+ const result = /* @__PURE__ */ new Map();
74307
+ const visit = (element) => {
74308
+ const nativeId = resolve2(element.id);
74309
+ if (nativeId !== void 0) {
74310
+ result.set(element.id, nativeId);
74311
+ }
74312
+ if (element.type === "group") {
74313
+ element.children.forEach(visit);
74314
+ }
74315
+ };
74316
+ elements2.forEach(visit);
74317
+ return result;
74318
+ }
74319
+ function applyConnectorShapeIds(shape, element, nativeIds) {
74320
+ if (element.type !== "connector" || !element.shapeStyle) {
74321
+ return;
74322
+ }
74323
+ const nv = xmlChild(shape, "p:nvCxnSpPr");
74324
+ if (!nv) {
74325
+ return;
74326
+ }
74327
+ const connections = xmlChild(nv, "p:cNvCxnSpPr") ?? {};
74328
+ for (const [tag, reference] of [
74329
+ ["a:stCxn", element.shapeStyle.connectorStartConnection],
74330
+ ["a:endCxn", element.shapeStyle.connectorEndConnection]
74331
+ ]) {
74332
+ if (!reference?.shapeId) {
74333
+ continue;
74334
+ }
74335
+ const nativeId = nativeIds.get(reference.shapeId) ?? (/^\d+$/.test(reference.shapeId) ? reference.shapeId : void 0);
74336
+ if (nativeId === void 0) {
74337
+ if (!element.rawXml) {
74338
+ delete connections[tag];
74339
+ }
74340
+ continue;
74341
+ }
74342
+ connections[tag] = {
74343
+ ...xmlChild(connections, tag),
74344
+ "@_id": nativeId,
74345
+ "@_idx": String(reference.connectionSiteIndex ?? 0)
74346
+ };
74347
+ }
74348
+ if (Object.keys(connections).length > 0) {
74349
+ nv["p:cNvCxnSpPr"] = reorderObjectKeys(connections, [
74350
+ "a:cxnSpLocks",
74351
+ "a:stCxn",
74352
+ "a:endCxn",
74353
+ "a:extLst"
74354
+ ]);
74355
+ }
74356
+ }
74357
+ var init_connector_shape_id_assign = __esm({
74358
+ "src/core/services/connector-shape-id-assign.ts"() {
74359
+ init_xml_access();
74360
+ init_xml_reorder();
74361
+ init_shape_id_resolver();
74265
74362
  }
74266
74363
  });
74267
74364
  function createGroupContext() {
@@ -77600,6 +77697,7 @@ var init_services = __esm({
77600
77697
  init_PptxEditorAnimationService();
77601
77698
  init_animation_target_reconcile();
77602
77699
  init_animation_shape_id_assign();
77700
+ init_connector_shape_id_assign();
77603
77701
  init_animation_sound_merge();
77604
77702
  init_PptxNativeAnimationService();
77605
77703
  init_PptxSlideTransitionService();
@@ -83816,10 +83914,10 @@ function buildFbse(picture, foDelay, size) {
83816
83914
  function buildDgg(shapesPerDrawing, totalShapes) {
83817
83915
  const drawingCount = shapesPerDrawing.length;
83818
83916
  const lastDrawingShapeCount = shapesPerDrawing[drawingCount - 1] ?? 0;
83819
- const maxShapeId2 = drawingCount * SHAPE_ID_CLUSTER_SIZE + lastDrawingShapeCount;
83917
+ const maxShapeId = drawingCount * SHAPE_ID_CLUSTER_SIZE + lastDrawingShapeCount;
83820
83918
  const cidcl = drawingCount + 1;
83821
83919
  const cspSaved = totalShapes - drawingCount;
83822
- const w = new ByteWriter().u32(maxShapeId2).u32(cidcl).u32(cspSaved).u32(drawingCount);
83920
+ const w = new ByteWriter().u32(maxShapeId).u32(cidcl).u32(cspSaved).u32(drawingCount);
83823
83921
  shapesPerDrawing.forEach((count, i2) => {
83824
83922
  const drawingId = i2 + 1;
83825
83923
  w.u32(drawingId).u32(count);
@@ -91993,6 +92091,51 @@ var init_notes_paragraph_scoped_xml = __esm({
91993
92091
  DEFAULT_END_PARA_RPR = { "@_lang": "en-US" };
91994
92092
  }
91995
92093
  });
92094
+ function updateEndParagraphProperties(existing, style, serialize) {
92095
+ if (!style?.inheritedRunStyle) {
92096
+ return existing;
92097
+ }
92098
+ const baseline = serialize({ ...style, ...style.inheritedRunStyle, ...style.authoredRunStyle });
92099
+ const current = serialize(style);
92100
+ const attributes = {};
92101
+ const children13 = /* @__PURE__ */ new Map();
92102
+ for (const key2 of /* @__PURE__ */ new Set([...Object.keys(baseline), ...Object.keys(current)])) {
92103
+ if (JSON.stringify(baseline[key2]) === JSON.stringify(current[key2])) {
92104
+ continue;
92105
+ }
92106
+ if (key2.startsWith("@_")) {
92107
+ attributes[key2.slice(2)] = current[key2] === void 0 ? null : String(current[key2]);
92108
+ } else {
92109
+ children13.set(key2, current[key2] ?? null);
92110
+ }
92111
+ }
92112
+ if (Object.keys(attributes).length === 0 && children13.size === 0) {
92113
+ return existing;
92114
+ }
92115
+ const fillKeys = [
92116
+ "a:noFill",
92117
+ "a:solidFill",
92118
+ "a:gradFill",
92119
+ "a:blipFill",
92120
+ "a:pattFill",
92121
+ "a:grpFill"
92122
+ ];
92123
+ const changedFill = fillKeys.find((key2) => children13.get(key2));
92124
+ if (changedFill) {
92125
+ for (const key2 of fillKeys) {
92126
+ if (key2 !== changedFill) {
92127
+ children13.set(key2, null);
92128
+ }
92129
+ }
92130
+ }
92131
+ return mergeOrderedXml(existing, attributes, children13, DEF_RPR_CHILD_ORDER);
92132
+ }
92133
+ var init_paragraph_insertion_style = __esm({
92134
+ "src/core/core/runtime/paragraph-insertion-style.ts"() {
92135
+ init_ordered_xml_merge();
92136
+ init_placeholder_level_style_serializer();
92137
+ }
92138
+ });
91996
92139
  function stripMarker(run, marker) {
91997
92140
  const { [marker]: _drop, ...rest } = run;
91998
92141
  return rest;
@@ -92086,6 +92229,10 @@ function computeUniformSegmentOverrides(textStyle, textSegments) {
92086
92229
  if (nextValue === void 0) {
92087
92230
  return;
92088
92231
  }
92232
+ const baseline = textStyle?.inheritedRunStyle;
92233
+ if (baseline && nextValue === (textStyle?.authoredRunStyle?.[styleKey] ?? baseline[styleKey])) {
92234
+ return;
92235
+ }
92089
92236
  const firstValue = textSegments[0]?.style?.[styleKey];
92090
92237
  const isUniform = textSegments.every((segment) => segment.style?.[styleKey] === firstValue);
92091
92238
  if (isUniform) {
@@ -96987,15 +97134,19 @@ var PptxHandlerRuntime13;
96987
97134
  var init_PptxHandlerRuntimeSaveParagraphs = __esm({
96988
97135
  "src/core/core/runtime/PptxHandlerRuntimeSaveParagraphs.ts"() {
96989
97136
  init_auto_number_format();
97137
+ init_paragraph_insertion_style();
96990
97138
  init_PptxHandlerRuntimeSaveParagraphHelpers();
96991
97139
  init_PptxHandlerRuntimeSaveRunProperties();
96992
97140
  init_run_scoped_text_style();
96993
97141
  PptxHandlerRuntime13 = class extends PptxHandlerRuntime12 {
96994
97142
  isRenderedBulletMarker(segment) {
96995
97143
  const bullet = segment.bulletInfo;
96996
- if (!bullet) {
97144
+ if (!bullet || bullet.none) {
96997
97145
  return false;
96998
97146
  }
97147
+ if (segment.text === "" && (bullet.imageRelId || bullet.imageDataUrl) && !segment.fieldType && !segment.equationXml && segment.rubyText === void 0) {
97148
+ return true;
97149
+ }
96999
97150
  if (bullet.autoNumType) {
97000
97151
  if (bullet.paragraphIndex === void 0) {
97001
97152
  return false;
@@ -97129,6 +97280,11 @@ var init_PptxHandlerRuntimeSaveParagraphs = __esm({
97129
97280
  if (segment.endParaRunProperties) {
97130
97281
  currentEndParaRunProperties = segment.endParaRunProperties;
97131
97282
  }
97283
+ currentEndParaRunProperties = updateEndParagraphProperties(
97284
+ currentEndParaRunProperties,
97285
+ segment.paragraphInsertionStyle,
97286
+ (style) => this.createRunPropertiesFromTextStyle(style, resolveHyperlinkRelationshipId)
97287
+ );
97132
97288
  if (segment.paragraphProperties) {
97133
97289
  currentParagraphProperties = segment.paragraphProperties;
97134
97290
  }
@@ -97159,7 +97315,10 @@ var init_PptxHandlerRuntimeSaveParagraphs = __esm({
97159
97315
  currentRuns.push(eqNode);
97160
97316
  return;
97161
97317
  }
97162
- const segmentText2 = String(segment.text ?? "");
97318
+ const segmentText2 = segment.isParagraphBreak ? "\n" : String(segment.text ?? "");
97319
+ if (segmentText2 === "" && segment.paragraphInsertionStyle && !segment.fieldType && segment.rubyText === void 0) {
97320
+ return;
97321
+ }
97163
97322
  const lineParts = segmentText2.split("\n");
97164
97323
  const isSplitProduct = lineParts.length > 1;
97165
97324
  lineParts.forEach((linePart, lineIndex) => {
@@ -97191,7 +97350,7 @@ var init_PptxHandlerRuntimeSaveParagraphs = __esm({
97191
97350
  }
97192
97351
  });
97193
97352
  });
97194
- if (currentRuns.length > 0 || paragraphs.length === 0) {
97353
+ if (currentRuns.length > 0 || paragraphs.length === 0 || capturedParagraphMeta) {
97195
97354
  pushParagraph();
97196
97355
  }
97197
97356
  return paragraphs;
@@ -97423,17 +97582,20 @@ function classifyGroupChildTag(elementType, xml) {
97423
97582
  function cloneXmlNode(node) {
97424
97583
  return JSON.parse(JSON.stringify(node));
97425
97584
  }
97426
- function buildGroupNonVisualXml(rawGroupXml, modelName, fallbackName) {
97585
+ function buildGroupNonVisualXml(rawGroupXml, modelName, fallbackName, modelShapeId) {
97427
97586
  const rawNv = rawGroupXml?.["p:nvGrpSpPr"];
97428
97587
  if (!rawNv) {
97429
97588
  return {
97430
- "p:cNvPr": { "@_id": "0", "@_name": modelName ?? fallbackName },
97589
+ "p:cNvPr": { "@_id": modelShapeId ?? "0", "@_name": modelName ?? fallbackName },
97431
97590
  "p:cNvGrpSpPr": {},
97432
97591
  "p:nvPr": {}
97433
97592
  };
97434
97593
  }
97435
97594
  const nv = cloneXmlNode(rawNv);
97436
97595
  const cNvPr = nv["p:cNvPr"] ?? {};
97596
+ if (modelShapeId !== void 0) {
97597
+ cNvPr["@_id"] = modelShapeId;
97598
+ }
97437
97599
  if (typeof cNvPr["@_id"] !== "string" || cNvPr["@_id"].length === 0) {
97438
97600
  cNvPr["@_id"] = "0";
97439
97601
  }
@@ -97972,7 +98134,10 @@ var init_PptxHandlerRuntimeSaveShapeXml = __esm({
97972
98134
  */
97973
98135
  buildGroupShapeXml(group2, ctx, ownEmuOverride) {
97974
98136
  if (group2.rawXml && group2.children.length === 0) {
97975
- return group2.rawXml;
98137
+ return {
98138
+ ...group2.rawXml,
98139
+ "p:nvGrpSpPr": buildGroupNonVisualXml(group2.rawXml, group2.name, group2.id, group2.shapeId)
98140
+ };
97976
98141
  }
97977
98142
  const EMU = _PptxHandlerRuntime.EMU_PER_PX;
97978
98143
  const rawGroupXml = group2.rawXml;
@@ -97980,7 +98145,7 @@ var init_PptxHandlerRuntimeSaveShapeXml = __esm({
97980
98145
  const xfrm = buildGroupTransformXml(group2, EMU, ownEmuOverride, rewrap);
97981
98146
  const childSpace = group2;
97982
98147
  const grpXml2 = {
97983
- "p:nvGrpSpPr": buildGroupNonVisualXml(rawGroupXml, group2.name, group2.id),
98148
+ "p:nvGrpSpPr": buildGroupNonVisualXml(rawGroupXml, group2.name, group2.id, group2.shapeId),
97984
98149
  "p:grpSpPr": buildGroupPropertiesXml(rawGroupXml, xfrm)
97985
98150
  };
97986
98151
  const rawExtLst = rawGroupXml?.["p:extLst"];
@@ -106815,6 +106980,7 @@ var init_template_group_node = __esm({
106815
106980
  var PptxHandlerRuntime41;
106816
106981
  var init_PptxHandlerRuntimeSaveElementWriter = __esm({
106817
106982
  "src/core/core/runtime/PptxHandlerRuntimeSaveElementWriter.ts"() {
106983
+ init_services();
106818
106984
  init_types();
106819
106985
  init_chart_color_style_writer();
106820
106986
  init_chart_cx_generator();
@@ -107347,6 +107513,9 @@ var init_PptxHandlerRuntimeSaveElementWriter = __esm({
107347
107513
  );
107348
107514
  }
107349
107515
  this.applyDataSerialization(shape, el, ctx.slide.id);
107516
+ if (ctx.connectorShapeIds) {
107517
+ applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
107518
+ }
107350
107519
  this.serializeElementActions(shape, el, ctx.resolveHyperlinkRelationshipId);
107351
107520
  this.serializeShapeLocks(shape, el);
107352
107521
  this.applyHiddenToCnvPr(shape, el);
@@ -108285,6 +108454,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
108285
108454
  zooms: []
108286
108455
  };
108287
108456
  const ctx = {
108457
+ connectorShapeIds: resolveConnectorShapeIds(slide.elements, this.maxCnvPrId(spTree)),
108288
108458
  slide,
108289
108459
  slideRelationships,
108290
108460
  slideRelationshipRegistry,
@@ -109082,7 +109252,7 @@ function asObjects3(value) {
109082
109252
  return isXmlObject9(value) ? [value] : [];
109083
109253
  }
109084
109254
  function rememberTemplateSpTreePositions(runtime, partPath, spTree, positionOf) {
109085
- const positions = /* @__PURE__ */ new Map();
109255
+ const positions2 = /* @__PURE__ */ new Map();
109086
109256
  for (const [key2, value] of Object.entries(spTree)) {
109087
109257
  if (!SHAPE_TREE_ELEMENT_TAGS.has(key2) && key2 !== ALTERNATE_CONTENT_TAG3) {
109088
109258
  continue;
@@ -109090,7 +109260,7 @@ function rememberTemplateSpTreePositions(runtime, partPath, spTree, positionOf)
109090
109260
  for (const node of asObjects3(value)) {
109091
109261
  const position2 = positionOf(node);
109092
109262
  if (position2 !== void 0) {
109093
- positions.set(node, position2);
109263
+ positions2.set(node, position2);
109094
109264
  }
109095
109265
  }
109096
109266
  }
@@ -109099,7 +109269,7 @@ function rememberTemplateSpTreePositions(runtime, partPath, spTree, positionOf)
109099
109269
  byPart = /* @__PURE__ */ new Map();
109100
109270
  positionsByRuntime.set(runtime, byPart);
109101
109271
  }
109102
- byPart.set(partPath, positions);
109272
+ byPart.set(partPath, positions2);
109103
109273
  }
109104
109274
  function withReplacedChild(container, tag, indexInType, replacement) {
109105
109275
  const existing = container[tag];
@@ -109128,17 +109298,17 @@ function orderContainer(container, plan, getLocalName2) {
109128
109298
  working = withReplacedChild(working, entry2.tag, entry2.indexInType, ordered4);
109129
109299
  }
109130
109300
  }
109131
- const positions = /* @__PURE__ */ new Map();
109301
+ const positions2 = /* @__PURE__ */ new Map();
109132
109302
  plan.forEach((entry2, position2) => {
109133
109303
  const node = asObjects3(working[entry2.tag])[entry2.indexInType];
109134
- if (node && !positions.has(node)) {
109135
- positions.set(node, position2);
109304
+ if (node && !positions2.has(node)) {
109305
+ positions2.set(node, position2);
109136
109306
  }
109137
109307
  });
109138
- if (positions.size === 0) {
109308
+ if (positions2.size === 0) {
109139
109309
  return working;
109140
109310
  }
109141
- return orderShapeTreeChildren(working, (node) => positions.get(node), getLocalName2);
109311
+ return orderShapeTreeChildren(working, (node) => positions2.get(node), getLocalName2);
109142
109312
  }
109143
109313
  function orderedTemplatePartXml(options) {
109144
109314
  const {
@@ -109190,6 +109360,7 @@ var shapeIdValidator2;
109190
109360
  var PptxHandlerRuntime46;
109191
109361
  var init_PptxHandlerRuntimeSaveMasterElements = __esm({
109192
109362
  "src/core/core/runtime/PptxHandlerRuntimeSaveMasterElements.ts"() {
109363
+ init_services();
109193
109364
  init_builders();
109194
109365
  init_auxiliary_master_node_cache();
109195
109366
  init_master_part_element_signature();
@@ -109279,6 +109450,7 @@ var init_PptxHandlerRuntimeSaveMasterElements = __esm({
109279
109450
  elements: elements2
109280
109451
  };
109281
109452
  const ctx = {
109453
+ connectorShapeIds: resolveConnectorShapeIds(elements2, this.maxCnvPrId(spTree)),
109282
109454
  slide,
109283
109455
  slideRelationships: relationships,
109284
109456
  slideRelationshipRegistry: relationshipRegistry,
@@ -111196,13 +111368,13 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
111196
111368
  findPlaceholderInShapeTree(spTree, expected) {
111197
111369
  return this.scanPlaceholderBuckets(spTree, (info) => this.placeholderMatches(expected, info));
111198
111370
  }
111199
- scanPlaceholderBuckets(spTree, matches) {
111371
+ scanPlaceholderBuckets(spTree, matches2) {
111200
111372
  if (!spTree) {
111201
111373
  return void 0;
111202
111374
  }
111203
111375
  for (const { bucket, nvKey, contextKey } of PLACEHOLDER_BUCKETS) {
111204
111376
  for (const node of this.ensureArray(spTree[bucket])) {
111205
- if (matches(this.extractPlaceholderInfo(xmlPath(node, nvKey, "p:nvPr")))) {
111377
+ if (matches2(this.extractPlaceholderInfo(xmlPath(node, nvKey, "p:nvPr")))) {
111206
111378
  return { [contextKey]: node };
111207
111379
  }
111208
111380
  }
@@ -113057,7 +113229,7 @@ var init_PptxHandlerRuntimeShapeParagraphContentParsing = __esm({
113057
113229
  bulletText = "\u2022 ";
113058
113230
  }
113059
113231
  const bulletStyle = { ...mergedDefaultRunStyle };
113060
- if (paragraphBulletInfo.sizePercent === void 0 && paragraphBulletInfo.sizePts === void 0) {
113232
+ if (paragraphBulletInfo.sizePts === void 0) {
113061
113233
  const firstRunSize = this.resolveFirstRunFontSize(p, paraAlign, ctx);
113062
113234
  if (firstRunSize !== void 0) {
113063
113235
  bulletStyle.fontSize = firstRunSize;
@@ -113270,6 +113442,15 @@ var init_PptxHandlerRuntimeShapeParagraphContentParsing = __esm({
113270
113442
  ...endParaRPrRaw
113271
113443
  };
113272
113444
  }
113445
+ if (entries.length === 0) {
113446
+ segments[firstSegmentIndex].paragraphInsertionStyle = withAuthoredSplit(
113447
+ endParaRPrRaw && typeof endParaRPrRaw === "object" ? this.extractTextRunStyle(
113448
+ endParaRPrRaw,
113449
+ paraAlign,
113450
+ ctx.slideRelationshipMap
113451
+ ) : {}
113452
+ );
113453
+ }
113273
113454
  const basisFontSize = typeof mergedDefaultRunStyle.fontSize === "number" ? mergedDefaultRunStyle.fontSize : void 0;
113274
113455
  const paragraphOwnProps = this.extractParagraphOwnProperties(p, basisFontSize);
113275
113456
  if (paragraphOwnProps) {
@@ -113290,27 +113471,22 @@ var init_PptxHandlerRuntimeShapeParagraphContentParsing = __esm({
113290
113471
  }
113291
113472
  /**
113292
113473
  * Font size (px) of the first text run in a paragraph, or `undefined` when
113293
- * the paragraph has no run that declares one.
113474
+ * that first run inherits its size.
113294
113475
  *
113295
- * Used to size an unsized bullet the way PowerPoint does: `a:buChar` /
113296
- * `a:buAutoNum` with no `a:buSzPct`/`a:buSzPts` inherits the first run's
113297
- * size. Only `a:r` and `a:fld` carry renderable text; `a:br` does not.
113476
+ * Used as the base for unsized and percentage-sized bullets. Only `a:r`
113477
+ * and `a:fld` carry renderable text; `a:br` does not.
113298
113478
  */
113299
113479
  resolveFirstRunFontSize(p, paraAlign, ctx) {
113300
- for (const key2 of ["a:r", "a:fld"]) {
113301
- const node = p[key2];
113302
- if (!node) {
113480
+ for (const [tag, node] of paragraphContentEntries(p, PARAGRAPH_CONTENT_TAGS).entries) {
113481
+ if (tag !== "a:r" && tag !== "a:fld") {
113303
113482
  continue;
113304
113483
  }
113305
- const first = this.ensureArray(node)[0];
113306
- const runProps = first?.["a:rPr"];
113484
+ const runProps = node?.["a:rPr"];
113307
113485
  if (!runProps) {
113308
- continue;
113486
+ return void 0;
113309
113487
  }
113310
113488
  const style = this.extractTextRunStyle(runProps, paraAlign, ctx.slideRelationshipMap);
113311
- if (typeof style.fontSize === "number") {
113312
- return style.fontSize;
113313
- }
113489
+ return typeof style.fontSize === "number" ? style.fontSize : void 0;
113314
113490
  }
113315
113491
  return void 0;
113316
113492
  }
@@ -113694,6 +113870,7 @@ var init_PptxHandlerRuntimeShapeParsing = __esm({
113694
113870
  skewY,
113695
113871
  flipHorizontal,
113696
113872
  flipVertical,
113873
+ inheritedTransform: !spPr?.["a:xfrm"] && xfrm && off && ext ? { x, y, width, height, rotation, skewX, skewY, flipHorizontal, flipVertical } : void 0,
113697
113874
  actionClick,
113698
113875
  actionHover,
113699
113876
  locks,
@@ -113782,6 +113959,7 @@ var init_PptxHandlerRuntimePictureParsing = __esm({
113782
113959
  const skewX = xfrm["@_skewX"] ? parseEmuInt2(xfrm["@_skewX"]) / 6e4 : void 0;
113783
113960
  const skewY = xfrm["@_skewY"] ? parseEmuInt2(xfrm["@_skewY"]) / 6e4 : void 0;
113784
113961
  const { flipHorizontal, flipVertical } = this.readFlipState(xfrm);
113962
+ const inheritedTransform = !spPr?.["a:xfrm"] && off && ext ? { x, y, width, height, rotation, skewX, skewY, flipHorizontal, flipVertical } : void 0;
113785
113963
  const nvPr = pic?.["p:nvPicPr"]?.["p:nvPr"];
113786
113964
  const mediaReference = parseDrawingMediaReference(nvPr, this.externalRelsMap.get(slidePath));
113787
113965
  if (mediaReference) {
@@ -113842,6 +114020,7 @@ var init_PptxHandlerRuntimePictureParsing = __esm({
113842
114020
  return {
113843
114021
  id,
113844
114022
  type: "media",
114023
+ inheritedTransform,
113845
114024
  x,
113846
114025
  y,
113847
114026
  width,
@@ -114050,6 +114229,7 @@ var init_PptxHandlerRuntimePictureParsing = __esm({
114050
114229
  id,
114051
114230
  name: picElementName || void 0,
114052
114231
  type: "picture",
114232
+ inheritedTransform,
114053
114233
  x,
114054
114234
  y,
114055
114235
  width,
@@ -116386,6 +116566,7 @@ var init_PptxHandlerRuntimeMasterElements = __esm({
116386
116566
  var PptxHandlerRuntime77;
116387
116567
  var init_PptxHandlerRuntimeAuxiliaryMasterElements = __esm({
116388
116568
  "src/core/core/runtime/PptxHandlerRuntimeAuxiliaryMasterElements.ts"() {
116569
+ init_services();
116389
116570
  init_auxiliary_master_node_cache();
116390
116571
  init_master_part_background_cache();
116391
116572
  init_master_part_element_signature();
@@ -116443,6 +116624,7 @@ var init_PptxHandlerRuntimeAuxiliaryMasterElements = __esm({
116443
116624
  } finally {
116444
116625
  this.currentSlideClrMapOverride = previousClrMapOverride;
116445
116626
  }
116627
+ reconcileAnimationTargets(part.elements, void 0, void 0);
116446
116628
  rememberMasterPartElementSignature(this, partPath, part.elements);
116447
116629
  this.rememberUnparsedMasterNodes(partPath, spTree, part.elements);
116448
116630
  }
@@ -122578,6 +122760,7 @@ var init_core = __esm({
122578
122760
  init_types2();
122579
122761
  init_table_structural_ops();
122580
122762
  init_table_style_defaults();
122763
+ init_auto_number_sequence();
122581
122764
  init_table_style_editor();
122582
122765
  init_table_style_entry_parse();
122583
122766
  }
@@ -139433,8 +139616,8 @@ var TextSegmentRenderer = class {
139433
139616
  return defaultText;
139434
139617
  }
139435
139618
  wrapCode(text22) {
139436
- const matches = text22.match(/`+/g);
139437
- const maxTicks = matches && matches.length > 0 ? Math.max(...matches.map((entry2) => entry2.length)) : 0;
139619
+ const matches2 = text22.match(/`+/g);
139620
+ const maxTicks = matches2 && matches2.length > 0 ? Math.max(...matches2.map((entry2) => entry2.length)) : 0;
139438
139621
  const fence = "`".repeat(Math.max(1, maxTicks + 1));
139439
139622
  return `${fence}${text22}${fence}`;
139440
139623
  }
@@ -153031,21 +153214,21 @@ function categoryX3(value, count, layout, mode) {
153031
153214
  }
153032
153215
  return layout.plotLeft + value / Math.max(count - 1, 1) * layout.plotWidth;
153033
153216
  }
153034
- function positionedCategoryX(value, positions, fallback) {
153035
- if (!positions || positions.length === 0) {
153217
+ function positionedCategoryX(value, positions2, fallback) {
153218
+ if (!positions2 || positions2.length === 0) {
153036
153219
  return fallback(value);
153037
153220
  }
153038
153221
  const lower = Math.floor(value);
153039
153222
  const upper = Math.ceil(value);
153040
153223
  const at = (index) => {
153041
- if (positions[index] !== void 0) {
153042
- return positions[index];
153224
+ if (positions2[index] !== void 0) {
153225
+ return positions2[index];
153043
153226
  }
153044
- const lastIndex = positions.length - 1;
153045
- const last = positions[lastIndex] ?? 0;
153046
- const beforeLast = lastIndex > 0 ? positions[lastIndex - 1] ?? positions[0] ?? 0 : positions[0] ?? 0;
153227
+ const lastIndex = positions2.length - 1;
153228
+ const last = positions2[lastIndex] ?? 0;
153229
+ const beforeLast = lastIndex > 0 ? positions2[lastIndex - 1] ?? positions2[0] ?? 0 : positions2[0] ?? 0;
153047
153230
  const gap = last - beforeLast;
153048
- return last + gap * (index - positions.length + 1);
153231
+ return last + gap * (index - positions2.length + 1);
153049
153232
  };
153050
153233
  return at(lower) + (at(upper) - at(lower)) * (value - lower);
153051
153234
  }
@@ -161488,9 +161671,9 @@ function resolveDrawingShapeNodeId(shape, shapeIndex, shapes, nodes) {
161488
161671
  }
161489
161672
  const text22 = shape.text?.trim();
161490
161673
  if (text22) {
161491
- const matches = nodes.filter((n) => n.text.trim() === text22);
161492
- if (matches.length === 1) {
161493
- return matches[0].id;
161674
+ const matches2 = nodes.filter((n) => n.text.trim() === text22);
161675
+ if (matches2.length === 1) {
161676
+ return matches2[0].id;
161494
161677
  }
161495
161678
  }
161496
161679
  return void 0;
@@ -174963,16 +175146,580 @@ function resolveParagraphIndent(paraIndent, paragraphLevel) {
174963
175146
  }
174964
175147
  return { marginLeftPx: marginLeft, textIndentPx: textIndent };
174965
175148
  }
175149
+ var DEFAULT_BULLET_CHAR = "\u2022";
175150
+ var DEFAULT_AUTONUM_TYPE = "arabicPeriod";
175151
+ function bulletInfoForKind(kind, ordinal = 0) {
175152
+ if (kind === "none") {
175153
+ return { none: true };
175154
+ }
175155
+ if (kind === "bullet") {
175156
+ return { char: DEFAULT_BULLET_CHAR };
175157
+ }
175158
+ return { autoNumType: DEFAULT_AUTONUM_TYPE, autoNumStartAt: 1, paragraphIndex: ordinal };
175159
+ }
174966
175160
  function isBulletMarkerSegment(segment) {
174967
- const bullet = segment.bulletInfo;
174968
- if (!bullet || bullet.none) {
175161
+ const info = segment.bulletInfo;
175162
+ if (!info || info.none || segment.fieldType || segment.isLineBreak) {
174969
175163
  return false;
174970
175164
  }
174971
- const resolved = resolveParagraphBullet(segment);
174972
- if (!resolved) {
175165
+ if (!info.char && !info.autoNumType && !info.imageRelId && !info.imageDataUrl && !info.imageBlipFillXml) {
174973
175166
  return false;
174974
175167
  }
174975
- return segment.text.trim() === resolved.marker.trim() && segment.text.trim().length > 0;
175168
+ if (info.autoNumType) {
175169
+ if (info.paragraphIndex === void 0) {
175170
+ return false;
175171
+ }
175172
+ const marker = markerText(info);
175173
+ return segment.text === marker || segment.text === `${marker} `;
175174
+ }
175175
+ return segment.text === markerText(info);
175176
+ }
175177
+ function paragraphBulletKind(paragraph) {
175178
+ const resolved = resolveParagraphBullet(paragraph[0]);
175179
+ return resolved ? resolved.isNumbered ? "numbered" : "bullet" : "none";
175180
+ }
175181
+ function withoutListType(style) {
175182
+ const next = { ...style };
175183
+ delete next.listType;
175184
+ return next;
175185
+ }
175186
+ function markerText(info) {
175187
+ if (info.imageRelId || info.imageDataUrl || info.imageBlipFillXml) {
175188
+ return "\u{1F4CE} ";
175189
+ }
175190
+ if (info.autoNumType) {
175191
+ return formatAutoNumberMarker(
175192
+ info.autoNumType,
175193
+ Math.max(1, (info.autoNumStartAt ?? 1) + (info.paragraphIndex ?? 0))
175194
+ );
175195
+ }
175196
+ return `${info.char ?? DEFAULT_BULLET_CHAR} `;
175197
+ }
175198
+ function infoForParagraph(previous, kind, ordinal) {
175199
+ if (kind === "none") {
175200
+ return { ...previous, none: true };
175201
+ }
175202
+ const sameKind = previous && (kind === "numbered" ? Boolean(previous.autoNumType) : Boolean(
175203
+ previous.char || previous.imageRelId || previous.imageDataUrl || previous.imageBlipFillXml
175204
+ ) && !previous.autoNumType);
175205
+ const info = sameKind ? { ...previous } : bulletInfoForKind(kind, ordinal);
175206
+ delete info.none;
175207
+ if (kind === "numbered" && ordinal !== void 0) {
175208
+ info.paragraphIndex = ordinal;
175209
+ }
175210
+ return info;
175211
+ }
175212
+ function toggleParagraphBullet(paragraph, kind, ordinal) {
175213
+ const source = paragraph[0];
175214
+ if (!source) {
175215
+ return [];
175216
+ }
175217
+ if (paragraph.length === 1 && source.paragraphInsertionStyle && (source.text === "" || isBulletMarkerSegment(source))) {
175218
+ const info2 = infoForParagraph(source.bulletInfo, kind, ordinal);
175219
+ const picture = info2.imageRelId || info2.imageDataUrl || info2.imageBlipFillXml;
175220
+ return [
175221
+ {
175222
+ ...source,
175223
+ text: kind === "none" || picture ? "" : markerText(info2),
175224
+ style: withoutListType(source.style),
175225
+ bulletInfo: info2
175226
+ }
175227
+ ];
175228
+ }
175229
+ const content = isBulletMarkerSegment(source) ? paragraph.slice(1) : [...paragraph];
175230
+ const first = content[0] ?? { text: "", style: source.style };
175231
+ const meta = {
175232
+ ...source.paragraphLevel !== void 0 ? { paragraphLevel: source.paragraphLevel } : {},
175233
+ ...source.paragraphProperties ? { paragraphProperties: source.paragraphProperties } : {},
175234
+ ...source.endParaRunProperties ? { endParaRunProperties: source.endParaRunProperties } : {},
175235
+ ...source.paragraphInsertionStyle ? { paragraphInsertionStyle: source.paragraphInsertionStyle } : {}
175236
+ };
175237
+ const info = infoForParagraph(source.bulletInfo, kind, ordinal);
175238
+ const body = { ...first, ...meta, style: withoutListType(first.style) };
175239
+ const rest = content.slice(1).map((segment) => {
175240
+ if (!segment.bulletInfo) {
175241
+ return segment;
175242
+ }
175243
+ const run = { ...segment };
175244
+ delete run.bulletInfo;
175245
+ return run;
175246
+ });
175247
+ if (kind === "none" || info.imageRelId || info.imageDataUrl || info.imageBlipFillXml) {
175248
+ return [{ ...body, bulletInfo: info }, ...rest];
175249
+ }
175250
+ delete body.bulletInfo;
175251
+ delete body.paragraphInsertionStyle;
175252
+ const markerStyle = isBulletMarkerSegment(source) && paragraphBulletKind([source]) === kind ? source.style : first.style;
175253
+ return [
175254
+ { text: markerText(info), style: withoutListType(markerStyle), ...meta, bulletInfo: info },
175255
+ body,
175256
+ ...rest
175257
+ ];
175258
+ }
175259
+ function elementSegments(element) {
175260
+ if (!hasTextProperties(element)) {
175261
+ return [];
175262
+ }
175263
+ if (element.textSegments?.length) {
175264
+ return element.textSegments;
175265
+ }
175266
+ return (element.text ?? "").split("\n").flatMap((text22, index) => [
175267
+ ...index ? [{ text: "\n", style: { ...element.textStyle }, isParagraphBreak: true }] : [],
175268
+ { text: text22, style: { ...element.textStyle } }
175269
+ ]);
175270
+ }
175271
+ function splitParagraphs2(segments) {
175272
+ const paragraphs = [
175273
+ { segments: [] }
175274
+ ];
175275
+ for (const segment of segments) {
175276
+ if (isParagraphSeparatorSegment(segment)) {
175277
+ paragraphs[paragraphs.length - 1].terminator = segment;
175278
+ paragraphs.push({ segments: [] });
175279
+ } else {
175280
+ paragraphs[paragraphs.length - 1].segments.push(segment);
175281
+ }
175282
+ }
175283
+ return paragraphs;
175284
+ }
175285
+ function elementBulletKind(element) {
175286
+ for (const paragraph of splitParagraphs2(elementSegments(element))) {
175287
+ if (paragraph.segments.length) {
175288
+ return paragraphBulletKind(paragraph.segments);
175289
+ }
175290
+ }
175291
+ return "none";
175292
+ }
175293
+ function setElementBullets(element, kind, range) {
175294
+ if (!hasTextProperties(element)) {
175295
+ return {};
175296
+ }
175297
+ if (range && (!Number.isInteger(range.startParagraph) || !Number.isInteger(range.endParagraph) || range.startParagraph < 0 || range.endParagraph < range.startParagraph)) {
175298
+ return {};
175299
+ }
175300
+ const paragraphs = splitParagraphs2(elementSegments(element));
175301
+ if (range && range.startParagraph >= paragraphs.length) {
175302
+ return {};
175303
+ }
175304
+ const next = [];
175305
+ const sequence = createAutoNumberSequence();
175306
+ for (const [index, paragraph] of paragraphs.entries()) {
175307
+ const selected = !range || index >= range.startParagraph && index <= range.endParagraph;
175308
+ let segments = paragraph.segments;
175309
+ if (selected) {
175310
+ const empty = {
175311
+ ...paragraph.terminator,
175312
+ text: "",
175313
+ style: { ...paragraph.terminator?.style }
175314
+ };
175315
+ delete empty.isParagraphBreak;
175316
+ delete empty.isLineBreak;
175317
+ segments = toggleParagraphBullet(segments.length ? segments : [empty], kind);
175318
+ }
175319
+ const first = segments[0] ?? paragraph.terminator;
175320
+ const info = first?.bulletInfo;
175321
+ const level = first?.paragraphLevel ?? 0;
175322
+ if (info?.autoNumType && paragraphBulletKind(segments) === "numbered") {
175323
+ const startAt = info.autoNumStartAt ?? 1;
175324
+ const ordinal = nextAutoNumber(sequence, level, info.autoNumType, startAt) - startAt;
175325
+ if (info.paragraphIndex !== ordinal) {
175326
+ segments = toggleParagraphBullet(segments, "numbered", ordinal);
175327
+ }
175328
+ } else {
175329
+ breakAutoNumberRun(sequence, level);
175330
+ }
175331
+ next.push(...segments);
175332
+ if (paragraph.terminator) {
175333
+ next.push(paragraph.terminator);
175334
+ }
175335
+ }
175336
+ return {
175337
+ textSegments: next,
175338
+ textStyle: withoutListType(element.textStyle)
175339
+ };
175340
+ }
175341
+ function updateTextSegmentStyle(segment, updates, options = {}) {
175342
+ return {
175343
+ ...segment,
175344
+ ...options.updateBodyStyle === false ? {} : { style: { ...segment.style, ...updates } },
175345
+ ...segment.paragraphInsertionStyle ? { paragraphInsertionStyle: { ...segment.paragraphInsertionStyle, ...updates } } : {}
175346
+ };
175347
+ }
175348
+ function getInlineEditorSelection(segments) {
175349
+ if (!segments?.length) {
175350
+ return null;
175351
+ }
175352
+ const selection = window.getSelection();
175353
+ if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
175354
+ return null;
175355
+ }
175356
+ const range = selection.getRangeAt(0);
175357
+ const editor = findEditorContainer(range.startContainer);
175358
+ if (!editor || !editor.contains(range.endContainer) || range.toString().length === 0) {
175359
+ return null;
175360
+ }
175361
+ const start = getSegmentPosition(editor, range.startContainer, range.startOffset, segments);
175362
+ const end = getSegmentPosition(editor, range.endContainer, range.endOffset, segments);
175363
+ if (!start || !end) {
175364
+ return null;
175365
+ }
175366
+ const renderedSpans = Array.from(editor.querySelectorAll("[data-seg-idx]"));
175367
+ const startSpanIndex = renderedSpans.indexOf(start.span);
175368
+ const endSpanIndex = renderedSpans.indexOf(end.span);
175369
+ if (startSpanIndex < 0 || endSpanIndex < startSpanIndex) {
175370
+ return null;
175371
+ }
175372
+ const selectedSpans = renderedSpans.slice(startSpanIndex, endSpanIndex + 1);
175373
+ const first = selectedSpans.find(
175374
+ (span) => isEditableSpan(span, segments) && (span !== start.span || start.offset < start.textLength)
175375
+ );
175376
+ const last = [...selectedSpans].reverse().find((span) => isEditableSpan(span, segments) && (span !== end.span || end.offset > 0));
175377
+ if (!first || !last) {
175378
+ return null;
175379
+ }
175380
+ return {
175381
+ startSegIdx: getSegmentIndex(first),
175382
+ startOffset: first === start.span ? start.offset : 0,
175383
+ endSegIdx: getSegmentIndex(last),
175384
+ endOffset: last === end.span ? end.offset : last.textContent?.length ?? 0
175385
+ };
175386
+ }
175387
+ function isEditableSpan(span, segments) {
175388
+ const segment = segments[getSegmentIndex(span)];
175389
+ return Boolean(
175390
+ segment && !segment.isParagraphBreak && segment.text !== "\n" && !isBulletMarkerSegment(segment) && (span.textContent?.length ?? 0) > 0
175391
+ );
175392
+ }
175393
+ function getSegmentIndex(span) {
175394
+ return Number(span.getAttribute("data-seg-idx"));
175395
+ }
175396
+ function findEditorContainer(node) {
175397
+ const element = node.nodeType === Node.ELEMENT_NODE ? node : node.parentElement;
175398
+ return element?.closest("[data-inline-editor]") ?? null;
175399
+ }
175400
+ function getSegmentPosition(editor, node, offset, segments) {
175401
+ const element = node.nodeType === Node.ELEMENT_NODE ? node : node.parentElement;
175402
+ const span = element?.closest("[data-seg-idx]");
175403
+ if (!span || !editor.contains(span)) {
175404
+ return null;
175405
+ }
175406
+ const segIdx = getSegmentIndex(span);
175407
+ if (!Number.isInteger(segIdx) || segIdx < 0 || segIdx >= segments.length) {
175408
+ return null;
175409
+ }
175410
+ return {
175411
+ segIdx,
175412
+ offset: getTextOffsetWithin(span, node, offset),
175413
+ span,
175414
+ textLength: span.textContent?.length ?? 0
175415
+ };
175416
+ }
175417
+ function getTextOffsetWithin(container, targetNode, targetOffset) {
175418
+ if (targetNode === container || targetNode.nodeType === Node.ELEMENT_NODE) {
175419
+ const parent = targetNode === container ? container : targetNode;
175420
+ let count = 0;
175421
+ for (let index = 0; index < targetOffset && index < parent.childNodes.length; index++) {
175422
+ count += parent.childNodes[index].textContent?.length ?? 0;
175423
+ }
175424
+ return count;
175425
+ }
175426
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT);
175427
+ let charCount = 0;
175428
+ let node;
175429
+ while (node = walker.nextNode()) {
175430
+ if (node === targetNode) {
175431
+ return charCount + targetOffset;
175432
+ }
175433
+ charCount += node.length;
175434
+ }
175435
+ return charCount;
175436
+ }
175437
+ var pendingRestore = null;
175438
+ function setPendingSelectionRestore(sel) {
175439
+ pendingRestore = sel;
175440
+ }
175441
+ function getPendingSelectionRestore() {
175442
+ const sel = pendingRestore;
175443
+ pendingRestore = null;
175444
+ return sel;
175445
+ }
175446
+ function applyStyleToSelectedSegments(segments, selection, updates) {
175447
+ const { startSegIdx, startOffset, endSegIdx, endOffset } = selection;
175448
+ const result = [];
175449
+ let newStartSegIdx = -1;
175450
+ let newStartOffset = 0;
175451
+ let newEndSegIdx = -1;
175452
+ let newEndOffset = 0;
175453
+ for (let i2 = 0; i2 < segments.length; i2++) {
175454
+ const seg = i2 >= startSegIdx && i2 <= endSegIdx ? updateTextSegmentStyle(segments[i2], updates, { updateBodyStyle: false }) : segments[i2];
175455
+ if (seg.isParagraphBreak || seg.text === "\n") {
175456
+ result.push({ ...seg, style: { ...seg.style } });
175457
+ continue;
175458
+ }
175459
+ if (i2 < startSegIdx) {
175460
+ result.push({ ...seg, style: { ...seg.style } });
175461
+ continue;
175462
+ }
175463
+ if (i2 > endSegIdx) {
175464
+ result.push({ ...seg, style: { ...seg.style } });
175465
+ continue;
175466
+ }
175467
+ if (seg.paragraphInsertionStyle && (seg.text === "" || isBulletMarkerSegment(seg))) {
175468
+ newStartSegIdx = newStartSegIdx < 0 ? result.length : newStartSegIdx;
175469
+ newEndSegIdx = result.length;
175470
+ result.push(seg);
175471
+ continue;
175472
+ }
175473
+ if (i2 === startSegIdx && i2 === endSegIdx) {
175474
+ splitSingle(seg, startOffset, endOffset, updates, result);
175475
+ const partsAdded = (startOffset > 0 ? 1 : 0) + 1 + (endOffset < seg.text.length ? 1 : 0);
175476
+ const selectedPartIdx = result.length - partsAdded + (startOffset > 0 ? 1 : 0);
175477
+ newStartSegIdx = selectedPartIdx;
175478
+ newStartOffset = 0;
175479
+ newEndSegIdx = selectedPartIdx;
175480
+ newEndOffset = endOffset - startOffset;
175481
+ continue;
175482
+ }
175483
+ if (i2 === startSegIdx) {
175484
+ if (startOffset === 0) {
175485
+ newStartSegIdx = result.length;
175486
+ newStartOffset = 0;
175487
+ result.push({ ...seg, style: { ...seg.style, ...updates } });
175488
+ } else {
175489
+ const beforeSeg = {
175490
+ text: seg.text.slice(0, startOffset),
175491
+ style: { ...seg.style }
175492
+ };
175493
+ if (seg.bulletInfo) {
175494
+ beforeSeg.bulletInfo = seg.bulletInfo;
175495
+ }
175496
+ result.push(beforeSeg);
175497
+ newStartSegIdx = result.length;
175498
+ newStartOffset = 0;
175499
+ result.push({
175500
+ text: seg.text.slice(startOffset),
175501
+ style: { ...seg.style, ...updates }
175502
+ });
175503
+ }
175504
+ continue;
175505
+ }
175506
+ if (i2 === endSegIdx) {
175507
+ if (endOffset >= seg.text.length) {
175508
+ result.push({ ...seg, style: { ...seg.style, ...updates } });
175509
+ newEndSegIdx = result.length - 1;
175510
+ newEndOffset = seg.text.length;
175511
+ } else {
175512
+ result.push({
175513
+ text: seg.text.slice(0, endOffset),
175514
+ style: { ...seg.style, ...updates }
175515
+ });
175516
+ newEndSegIdx = result.length - 1;
175517
+ newEndOffset = endOffset;
175518
+ result.push({
175519
+ text: seg.text.slice(endOffset),
175520
+ style: { ...seg.style }
175521
+ });
175522
+ }
175523
+ continue;
175524
+ }
175525
+ result.push({ ...seg, style: { ...seg.style, ...updates } });
175526
+ }
175527
+ return {
175528
+ newSegments: result,
175529
+ newSelection: {
175530
+ startSegIdx: newStartSegIdx,
175531
+ startOffset: newStartOffset,
175532
+ endSegIdx: newEndSegIdx,
175533
+ endOffset: newEndOffset
175534
+ }
175535
+ };
175536
+ }
175537
+ function splitSingle(seg, startOffset, endOffset, updates, result) {
175538
+ if (startOffset === 0 && endOffset >= seg.text.length) {
175539
+ result.push({ ...seg, style: { ...seg.style, ...updates } });
175540
+ return;
175541
+ }
175542
+ if (startOffset > 0) {
175543
+ const beforeSeg = {
175544
+ text: seg.text.slice(0, startOffset),
175545
+ style: { ...seg.style }
175546
+ };
175547
+ if (seg.bulletInfo) {
175548
+ beforeSeg.bulletInfo = seg.bulletInfo;
175549
+ }
175550
+ result.push(beforeSeg);
175551
+ }
175552
+ result.push({
175553
+ text: seg.text.slice(startOffset, endOffset),
175554
+ style: { ...seg.style, ...updates }
175555
+ });
175556
+ if (endOffset < seg.text.length) {
175557
+ result.push({
175558
+ text: seg.text.slice(endOffset),
175559
+ style: { ...seg.style }
175560
+ });
175561
+ }
175562
+ }
175563
+ function restoreSegmentSelection(editor, startSegIdx, startOffset, endSegIdx, endOffset) {
175564
+ const sel = window.getSelection();
175565
+ if (!sel) {
175566
+ return;
175567
+ }
175568
+ const startPos = findTextPositionInSegment(editor, startSegIdx, startOffset);
175569
+ const endPos = findTextPositionInSegment(editor, endSegIdx, endOffset);
175570
+ if (!startPos || !endPos) {
175571
+ return;
175572
+ }
175573
+ const range = document.createRange();
175574
+ range.setStart(startPos.node, startPos.offset);
175575
+ range.setEnd(endPos.node, endPos.offset);
175576
+ sel.removeAllRanges();
175577
+ sel.addRange(range);
175578
+ }
175579
+ function findTextPositionInSegment(editor, segIdx, charOffset) {
175580
+ const segSpan = editor.querySelector(`[data-seg-idx="${segIdx}"]`);
175581
+ if (!segSpan) {
175582
+ return null;
175583
+ }
175584
+ const walker = document.createTreeWalker(segSpan, NodeFilter.SHOW_TEXT);
175585
+ let charCount = 0;
175586
+ let node;
175587
+ while (node = walker.nextNode()) {
175588
+ const textLen = node.length;
175589
+ if (charCount + textLen >= charOffset) {
175590
+ return { node, offset: charOffset - charCount };
175591
+ }
175592
+ charCount += textLen;
175593
+ }
175594
+ const lastTextNode = segSpan.querySelector("*") ? null : segSpan.firstChild;
175595
+ if (lastTextNode && lastTextNode.nodeType === Node.TEXT_NODE) {
175596
+ return { node: lastTextNode, offset: lastTextNode.length };
175597
+ }
175598
+ return null;
175599
+ }
175600
+ function positions(segments) {
175601
+ let offset = 0;
175602
+ let paragraph = 0;
175603
+ let first = true;
175604
+ return segments.map((segment) => {
175605
+ const marker = first && isBulletMarkerSegment(segment);
175606
+ const start = offset;
175607
+ if (!marker) {
175608
+ offset += segment.text.length;
175609
+ }
175610
+ const entry2 = {
175611
+ start,
175612
+ end: offset,
175613
+ paragraph,
175614
+ editable: !marker && !isParagraphSeparatorSegment(segment)
175615
+ };
175616
+ first = isParagraphSeparatorSegment(segment);
175617
+ if (first) {
175618
+ paragraph += 1;
175619
+ }
175620
+ return entry2;
175621
+ });
175622
+ }
175623
+ function restorePoint(segments, offset, end) {
175624
+ const entries = positions(segments);
175625
+ let fallback = { index: 0, offset: 0 };
175626
+ for (const [index, entry2] of entries.entries()) {
175627
+ if (!entry2.editable) {
175628
+ continue;
175629
+ }
175630
+ fallback = { index, offset: segments[index].text.length };
175631
+ if (end ? offset <= entry2.end : offset < entry2.end) {
175632
+ return { index, offset: Math.max(0, offset - entry2.start) };
175633
+ }
175634
+ }
175635
+ return fallback;
175636
+ }
175637
+ function restoreParagraphMetadata(original, updated) {
175638
+ const firstRuns = original.filter(
175639
+ (_, index) => index === 0 || isParagraphSeparatorSegment(original[index - 1])
175640
+ );
175641
+ let paragraph = 0;
175642
+ return updated.map((segment, index) => {
175643
+ const first = index === 0 || isParagraphSeparatorSegment(updated[index - 1]);
175644
+ if (!first) {
175645
+ return segment;
175646
+ }
175647
+ const source = firstRuns[paragraph++];
175648
+ if (!source) {
175649
+ return segment;
175650
+ }
175651
+ return {
175652
+ ...segment,
175653
+ bulletInfo: source.bulletInfo,
175654
+ paragraphLevel: source.paragraphLevel,
175655
+ paragraphProperties: source.paragraphProperties,
175656
+ endParaRunProperties: source.endParaRunProperties
175657
+ };
175658
+ });
175659
+ }
175660
+ function selectedParagraphBulletKind(element, selection) {
175661
+ if (!selection || !hasTextProperties(element) || !element.textSegments) {
175662
+ return elementBulletKind(element);
175663
+ }
175664
+ let first = selection.startSegIdx;
175665
+ while (first > 0 && !isParagraphSeparatorSegment(element.textSegments[first - 1])) {
175666
+ first -= 1;
175667
+ }
175668
+ return paragraphBulletKind(element.textSegments.slice(first));
175669
+ }
175670
+ function applyListStyleUpdate(element, updates, selection) {
175671
+ if (!hasTextProperties(element) || !updates.listType) {
175672
+ return { patch: {}, selection };
175673
+ }
175674
+ const { listType, ...characterStyle } = updates;
175675
+ let segments = element.textSegments;
175676
+ let workingSelection = selection;
175677
+ if (segments && Object.keys(characterStyle).length > 0) {
175678
+ if (selection) {
175679
+ const styled = applyStyleToSelectedSegments(segments, selection, characterStyle);
175680
+ segments = restoreParagraphMetadata(segments, styled.newSegments);
175681
+ workingSelection = styled.newSelection;
175682
+ } else {
175683
+ segments = segments.map((segment) => updateTextSegmentStyle(segment, characterStyle));
175684
+ }
175685
+ }
175686
+ const working = {
175687
+ ...element,
175688
+ textSegments: segments,
175689
+ textStyle: selection ? element.textStyle : { ...element.textStyle, ...characterStyle }
175690
+ };
175691
+ if (!workingSelection || !segments) {
175692
+ return { patch: setElementBullets(working, listType), selection: null };
175693
+ }
175694
+ const entries = positions(segments);
175695
+ const startEntry = entries[workingSelection.startSegIdx];
175696
+ const endEntry = entries[workingSelection.endSegIdx];
175697
+ if (!startEntry || !endEntry) {
175698
+ return { patch: {}, selection: null };
175699
+ }
175700
+ const startOffset = startEntry.start + workingSelection.startOffset;
175701
+ const endOffset = endEntry.start + workingSelection.endOffset;
175702
+ const lastSelected = [...entries].reverse().find((entry2) => entry2.start < endOffset);
175703
+ const patch = setElementBullets(working, listType, {
175704
+ startParagraph: startEntry.paragraph,
175705
+ endParagraph: lastSelected?.paragraph ?? endEntry.paragraph
175706
+ });
175707
+ const next = { ...working, ...patch };
175708
+ const nextSegments = hasTextProperties(next) ? next.textSegments : void 0;
175709
+ if (!nextSegments) {
175710
+ return { patch, selection: null };
175711
+ }
175712
+ const start = restorePoint(nextSegments, startOffset, false);
175713
+ const end = restorePoint(nextSegments, endOffset, true);
175714
+ return {
175715
+ patch,
175716
+ selection: {
175717
+ startSegIdx: start.index,
175718
+ startOffset: start.offset,
175719
+ endSegIdx: end.index,
175720
+ endOffset: end.offset
175721
+ }
175722
+ };
174976
175723
  }
174977
175724
  var DEBOUNCE_MS = 600;
174978
175725
  var EXPANDED_MAX_HEIGHT = 200;
@@ -175695,15 +176442,15 @@ function computeTabSize(tabStops, defaultTabSize) {
175695
176442
  const pos2 = tabStops[0].position;
175696
176443
  return typeof pos2 === "number" && pos2 > 0 ? `${Math.round(pos2)}px` : fromDefault;
175697
176444
  }
175698
- const positions = tabStops.map((t) => t.position).filter((p) => typeof p === "number" && p > 0).sort((a, b) => a - b);
175699
- if (positions.length < 2) {
175700
- return positions.length === 1 ? `${Math.round(positions[0])}px` : fromDefault;
176445
+ const positions2 = tabStops.map((t) => t.position).filter((p) => typeof p === "number" && p > 0).sort((a, b) => a - b);
176446
+ if (positions2.length < 2) {
176447
+ return positions2.length === 1 ? `${Math.round(positions2[0])}px` : fromDefault;
175701
176448
  }
175702
176449
  let totalGap = 0;
175703
- for (let i2 = 1; i2 < positions.length; i2++) {
175704
- totalGap += positions[i2] - positions[i2 - 1];
176450
+ for (let i2 = 1; i2 < positions2.length; i2++) {
176451
+ totalGap += positions2[i2] - positions2[i2 - 1];
175705
176452
  }
175706
- const avgGap = totalGap / (positions.length - 1);
176453
+ const avgGap = totalGap / (positions2.length - 1);
175707
176454
  return avgGap > 0 ? `${Math.round(avgGap)}px` : fromDefault;
175708
176455
  }
175709
176456
  function resolveTextOverflowClip(textStyle) {
@@ -176335,8 +177082,8 @@ function splitWordsForUnderline(text22) {
176335
177082
  return [];
176336
177083
  }
176337
177084
  const pieces = [];
176338
- const matches = text22.matchAll(/(\s+)|(\S+)/gu);
176339
- for (const match of matches) {
177085
+ const matches2 = text22.matchAll(/(\s+)|(\S+)/gu);
177086
+ for (const match of matches2) {
176340
177087
  if (match[1] !== void 0) {
176341
177088
  pieces.push({ text: match[1], underline: false });
176342
177089
  } else if (match[2] !== void 0) {
@@ -179868,252 +180615,6 @@ function buildThemeColorGrid(colorScheme, translate) {
179868
180615
  function themeColorLabel(key2, translate) {
179869
180616
  return translate ? schemaLabel(THEME_COLOR_SLOT_LABEL_KEYS, key2, translate) : THEME_COLOR_LABELS[key2];
179870
180617
  }
179871
- function getInlineEditorSelection(segments) {
179872
- if (!segments?.length) {
179873
- return null;
179874
- }
179875
- const selection = window.getSelection();
179876
- if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
179877
- return null;
179878
- }
179879
- const range = selection.getRangeAt(0);
179880
- const editor = findEditorContainer(range.startContainer);
179881
- if (!editor || !editor.contains(range.endContainer) || range.toString().length === 0) {
179882
- return null;
179883
- }
179884
- const start = getSegmentPosition(editor, range.startContainer, range.startOffset, segments);
179885
- const end = getSegmentPosition(editor, range.endContainer, range.endOffset, segments);
179886
- if (!start || !end) {
179887
- return null;
179888
- }
179889
- const renderedSpans = Array.from(editor.querySelectorAll("[data-seg-idx]"));
179890
- const startSpanIndex = renderedSpans.indexOf(start.span);
179891
- const endSpanIndex = renderedSpans.indexOf(end.span);
179892
- if (startSpanIndex < 0 || endSpanIndex < startSpanIndex) {
179893
- return null;
179894
- }
179895
- const selectedSpans = renderedSpans.slice(startSpanIndex, endSpanIndex + 1);
179896
- const first = selectedSpans.find(
179897
- (span) => isEditableSpan(span, segments) && (span !== start.span || start.offset < start.textLength)
179898
- );
179899
- const last = [...selectedSpans].reverse().find((span) => isEditableSpan(span, segments) && (span !== end.span || end.offset > 0));
179900
- if (!first || !last) {
179901
- return null;
179902
- }
179903
- return {
179904
- startSegIdx: getSegmentIndex(first),
179905
- startOffset: first === start.span ? start.offset : 0,
179906
- endSegIdx: getSegmentIndex(last),
179907
- endOffset: last === end.span ? end.offset : last.textContent?.length ?? 0
179908
- };
179909
- }
179910
- function isEditableSpan(span, segments) {
179911
- const segment = segments[getSegmentIndex(span)];
179912
- return Boolean(
179913
- segment && !segment.isParagraphBreak && segment.text !== "\n" && !isBulletMarkerSegment(segment) && (span.textContent?.length ?? 0) > 0
179914
- );
179915
- }
179916
- function getSegmentIndex(span) {
179917
- return Number(span.getAttribute("data-seg-idx"));
179918
- }
179919
- function findEditorContainer(node) {
179920
- const element = node.nodeType === Node.ELEMENT_NODE ? node : node.parentElement;
179921
- return element?.closest("[data-inline-editor]") ?? null;
179922
- }
179923
- function getSegmentPosition(editor, node, offset, segments) {
179924
- const element = node.nodeType === Node.ELEMENT_NODE ? node : node.parentElement;
179925
- const span = element?.closest("[data-seg-idx]");
179926
- if (!span || !editor.contains(span)) {
179927
- return null;
179928
- }
179929
- const segIdx = getSegmentIndex(span);
179930
- if (!Number.isInteger(segIdx) || segIdx < 0 || segIdx >= segments.length) {
179931
- return null;
179932
- }
179933
- return {
179934
- segIdx,
179935
- offset: getTextOffsetWithin(span, node, offset),
179936
- span,
179937
- textLength: span.textContent?.length ?? 0
179938
- };
179939
- }
179940
- function getTextOffsetWithin(container, targetNode, targetOffset) {
179941
- if (targetNode === container || targetNode.nodeType === Node.ELEMENT_NODE) {
179942
- const parent = targetNode === container ? container : targetNode;
179943
- let count = 0;
179944
- for (let index = 0; index < targetOffset && index < parent.childNodes.length; index++) {
179945
- count += parent.childNodes[index].textContent?.length ?? 0;
179946
- }
179947
- return count;
179948
- }
179949
- const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT);
179950
- let charCount = 0;
179951
- let node;
179952
- while (node = walker.nextNode()) {
179953
- if (node === targetNode) {
179954
- return charCount + targetOffset;
179955
- }
179956
- charCount += node.length;
179957
- }
179958
- return charCount;
179959
- }
179960
- var pendingRestore = null;
179961
- function setPendingSelectionRestore(sel) {
179962
- pendingRestore = sel;
179963
- }
179964
- function getPendingSelectionRestore() {
179965
- const sel = pendingRestore;
179966
- pendingRestore = null;
179967
- return sel;
179968
- }
179969
- function applyStyleToSelectedSegments(segments, selection, updates) {
179970
- const { startSegIdx, startOffset, endSegIdx, endOffset } = selection;
179971
- const result = [];
179972
- let newStartSegIdx = -1;
179973
- let newStartOffset = 0;
179974
- let newEndSegIdx = -1;
179975
- let newEndOffset = 0;
179976
- for (let i2 = 0; i2 < segments.length; i2++) {
179977
- const seg = segments[i2];
179978
- if (seg.isParagraphBreak || seg.text === "\n") {
179979
- result.push({ ...seg, style: { ...seg.style } });
179980
- continue;
179981
- }
179982
- if (i2 < startSegIdx) {
179983
- result.push({ ...seg, style: { ...seg.style } });
179984
- continue;
179985
- }
179986
- if (i2 > endSegIdx) {
179987
- result.push({ ...seg, style: { ...seg.style } });
179988
- continue;
179989
- }
179990
- if (i2 === startSegIdx && i2 === endSegIdx) {
179991
- splitSingle(seg, startOffset, endOffset, updates, result);
179992
- const partsAdded = (startOffset > 0 ? 1 : 0) + 1 + (endOffset < seg.text.length ? 1 : 0);
179993
- const selectedPartIdx = result.length - partsAdded + (startOffset > 0 ? 1 : 0);
179994
- newStartSegIdx = selectedPartIdx;
179995
- newStartOffset = 0;
179996
- newEndSegIdx = selectedPartIdx;
179997
- newEndOffset = endOffset - startOffset;
179998
- continue;
179999
- }
180000
- if (i2 === startSegIdx) {
180001
- if (startOffset === 0) {
180002
- newStartSegIdx = result.length;
180003
- newStartOffset = 0;
180004
- result.push({ ...seg, style: { ...seg.style, ...updates } });
180005
- } else {
180006
- const beforeSeg = {
180007
- text: seg.text.slice(0, startOffset),
180008
- style: { ...seg.style }
180009
- };
180010
- if (seg.bulletInfo) {
180011
- beforeSeg.bulletInfo = seg.bulletInfo;
180012
- }
180013
- result.push(beforeSeg);
180014
- newStartSegIdx = result.length;
180015
- newStartOffset = 0;
180016
- result.push({
180017
- text: seg.text.slice(startOffset),
180018
- style: { ...seg.style, ...updates }
180019
- });
180020
- }
180021
- continue;
180022
- }
180023
- if (i2 === endSegIdx) {
180024
- if (endOffset >= seg.text.length) {
180025
- result.push({ ...seg, style: { ...seg.style, ...updates } });
180026
- newEndSegIdx = result.length - 1;
180027
- newEndOffset = seg.text.length;
180028
- } else {
180029
- result.push({
180030
- text: seg.text.slice(0, endOffset),
180031
- style: { ...seg.style, ...updates }
180032
- });
180033
- newEndSegIdx = result.length - 1;
180034
- newEndOffset = endOffset;
180035
- result.push({
180036
- text: seg.text.slice(endOffset),
180037
- style: { ...seg.style }
180038
- });
180039
- }
180040
- continue;
180041
- }
180042
- result.push({ ...seg, style: { ...seg.style, ...updates } });
180043
- }
180044
- return {
180045
- newSegments: result,
180046
- newSelection: {
180047
- startSegIdx: newStartSegIdx,
180048
- startOffset: newStartOffset,
180049
- endSegIdx: newEndSegIdx,
180050
- endOffset: newEndOffset
180051
- }
180052
- };
180053
- }
180054
- function splitSingle(seg, startOffset, endOffset, updates, result) {
180055
- if (startOffset === 0 && endOffset >= seg.text.length) {
180056
- result.push({ ...seg, style: { ...seg.style, ...updates } });
180057
- return;
180058
- }
180059
- if (startOffset > 0) {
180060
- const beforeSeg = {
180061
- text: seg.text.slice(0, startOffset),
180062
- style: { ...seg.style }
180063
- };
180064
- if (seg.bulletInfo) {
180065
- beforeSeg.bulletInfo = seg.bulletInfo;
180066
- }
180067
- result.push(beforeSeg);
180068
- }
180069
- result.push({
180070
- text: seg.text.slice(startOffset, endOffset),
180071
- style: { ...seg.style, ...updates }
180072
- });
180073
- if (endOffset < seg.text.length) {
180074
- result.push({
180075
- text: seg.text.slice(endOffset),
180076
- style: { ...seg.style }
180077
- });
180078
- }
180079
- }
180080
- function restoreSegmentSelection(editor, startSegIdx, startOffset, endSegIdx, endOffset) {
180081
- const sel = window.getSelection();
180082
- if (!sel) {
180083
- return;
180084
- }
180085
- const startPos = findTextPositionInSegment(editor, startSegIdx, startOffset);
180086
- const endPos = findTextPositionInSegment(editor, endSegIdx, endOffset);
180087
- if (!startPos || !endPos) {
180088
- return;
180089
- }
180090
- const range = document.createRange();
180091
- range.setStart(startPos.node, startPos.offset);
180092
- range.setEnd(endPos.node, endPos.offset);
180093
- sel.removeAllRanges();
180094
- sel.addRange(range);
180095
- }
180096
- function findTextPositionInSegment(editor, segIdx, charOffset) {
180097
- const segSpan = editor.querySelector(`[data-seg-idx="${segIdx}"]`);
180098
- if (!segSpan) {
180099
- return null;
180100
- }
180101
- const walker = document.createTreeWalker(segSpan, NodeFilter.SHOW_TEXT);
180102
- let charCount = 0;
180103
- let node;
180104
- while (node = walker.nextNode()) {
180105
- const textLen = node.length;
180106
- if (charCount + textLen >= charOffset) {
180107
- return { node, offset: charOffset - charCount };
180108
- }
180109
- charCount += textLen;
180110
- }
180111
- const lastTextNode = segSpan.querySelector("*") ? null : segSpan.firstChild;
180112
- if (lastTextNode && lastTextNode.nodeType === Node.TEXT_NODE) {
180113
- return { node: lastTextNode, offset: lastTextNode.length };
180114
- }
180115
- return null;
180116
- }
180117
180618
  function placeCaretAtEnd(el) {
180118
180619
  const doc = el.ownerDocument;
180119
180620
  const win = doc.defaultView;
@@ -180540,6 +181041,100 @@ function withConnectorEndpointUpdate(connector, update) {
180540
181041
  function connectorWrapperTransform(element) {
180541
181042
  return element.rotation ? `rotate(${element.rotation}deg)` : void 0;
180542
181043
  }
181044
+ function textFontSizePxToPt(fontSizePx2) {
181045
+ return Math.round(fontSizePx2 * (72 / 96) * 100) / 100;
181046
+ }
181047
+ function textFontSizePtToPx(fontSizePt) {
181048
+ return fontSizePt * (96 / 72);
181049
+ }
181050
+ var COMMON_FONT_FAMILIES = [
181051
+ "Abadi",
181052
+ "Aptos",
181053
+ "Aptos Display",
181054
+ "Arial",
181055
+ "Arial Black",
181056
+ "Arial Narrow",
181057
+ "Bahnschrift",
181058
+ "Book Antiqua",
181059
+ "Bookman Old Style",
181060
+ "Calibri",
181061
+ "Calibri Light",
181062
+ "Cambria",
181063
+ "Candara",
181064
+ "Century Gothic",
181065
+ "Comic Sans MS",
181066
+ "Consolas",
181067
+ "Corbel",
181068
+ "Courier New",
181069
+ "Franklin Gothic Book",
181070
+ "Franklin Gothic Medium",
181071
+ "Garamond",
181072
+ "Georgia",
181073
+ "Gill Sans MT",
181074
+ "Helvetica",
181075
+ "Impact",
181076
+ "Inter",
181077
+ "Lucida Console",
181078
+ "Lucida Sans Unicode",
181079
+ "Microsoft Sans Serif",
181080
+ "Montserrat",
181081
+ "Noto Sans",
181082
+ "Open Sans",
181083
+ "Palatino Linotype",
181084
+ "Poppins",
181085
+ "Roboto",
181086
+ "Rockwell",
181087
+ "Segoe UI",
181088
+ "Source Sans Pro",
181089
+ "Tahoma",
181090
+ "Times New Roman",
181091
+ "Trebuchet MS",
181092
+ "Tw Cen MT",
181093
+ "Verdana"
181094
+ ];
181095
+ var COMMON_FONT_SIZES = [
181096
+ 8,
181097
+ 9,
181098
+ 10,
181099
+ 11,
181100
+ 12,
181101
+ 14,
181102
+ 16,
181103
+ 18,
181104
+ 20,
181105
+ 24,
181106
+ 28,
181107
+ 32,
181108
+ 36,
181109
+ 40,
181110
+ 44,
181111
+ 48,
181112
+ 54,
181113
+ 60,
181114
+ 72,
181115
+ 96
181116
+ ];
181117
+ var CHARACTER_SPACING_OPTIONS = [
181118
+ { label: "Very Tight", i18nKey: "pptx.text.characterSpacingVeryTight", value: -150 },
181119
+ { label: "Tight", i18nKey: "pptx.text.characterSpacingTight", value: -75 },
181120
+ { label: "Normal", i18nKey: "pptx.text.characterSpacingNormal", value: 0 },
181121
+ { label: "Loose", i18nKey: "pptx.text.characterSpacingLoose", value: 75 },
181122
+ { label: "Very Loose", i18nKey: "pptx.text.characterSpacingVeryLoose", value: 150 }
181123
+ ];
181124
+ function textStylePatch(el, changes) {
181125
+ const base = hasTextProperties(el) ? el.textStyle ?? {} : {};
181126
+ return {
181127
+ ...hasTextProperties(el) && el.textSegments?.some((segment) => segment.paragraphInsertionStyle) ? {
181128
+ textSegments: el.textSegments.map(
181129
+ (segment) => updateTextSegmentStyle(segment, changes, { updateBodyStyle: false })
181130
+ )
181131
+ } : {},
181132
+ textStyle: {
181133
+ ...base,
181134
+ ...changes
181135
+ }
181136
+ };
181137
+ }
180543
181138
  function copyFormatFromElement(element) {
180544
181139
  const result = {};
180545
181140
  if (hasShapeProperties(element) && element.shapeStyle) {
@@ -180614,10 +181209,7 @@ function applyFormatToElement(element, format) {
180614
181209
  if (format.textStyle && hasTextProperties(updated)) {
180615
181210
  updated = {
180616
181211
  ...updated,
180617
- textStyle: {
180618
- ...updated.textStyle,
180619
- ...definedEntries2(format.textStyle)
180620
- }
181212
+ ...textStylePatch(updated, definedEntries2(format.textStyle))
180621
181213
  };
180622
181214
  }
180623
181215
  return updated;
@@ -180628,6 +181220,53 @@ function hasCopyableFormat(element) {
180628
181220
  }
180629
181221
  return hasShapeProperties(element) || hasTextProperties(element);
180630
181222
  }
181223
+ function remapEmptyParagraph(text22, segments, terminator) {
181224
+ const source = segments[0] ?? terminator;
181225
+ const insertionStyle = source?.paragraphInsertionStyle;
181226
+ if (!source || !insertionStyle || segments.length > 1 || segments.length > 0 && source.text !== "" && !isBulletMarkerSegment(source)) {
181227
+ return void 0;
181228
+ }
181229
+ if (text22.length === 0) {
181230
+ return segments.map((segment) => ({ ...segment }));
181231
+ }
181232
+ const first = { ...source };
181233
+ delete first.paragraphInsertionStyle;
181234
+ const bullet = first.bulletInfo;
181235
+ if (bullet && !bullet.none && segments.length > 0) {
181236
+ return [first, { text: text22, style: { ...insertionStyle } }];
181237
+ }
181238
+ delete first.isParagraphBreak;
181239
+ return [{ ...first, text: text22, style: { ...insertionStyle } }];
181240
+ }
181241
+ function renumberRemappedParagraphs(segments) {
181242
+ const sequence = createAutoNumberSequence();
181243
+ let first = true;
181244
+ return segments.map((segment) => {
181245
+ const paragraphStart = first;
181246
+ first = isParagraphSeparatorSegment(segment);
181247
+ if (!paragraphStart) {
181248
+ return segment;
181249
+ }
181250
+ const info = segment.bulletInfo;
181251
+ const level = segment.paragraphLevel ?? 0;
181252
+ if (!info?.autoNumType || !resolveParagraphBullet(segment)?.isNumbered) {
181253
+ breakAutoNumberRun(sequence, level);
181254
+ return segment;
181255
+ }
181256
+ const ordinal = nextAutoNumber(sequence, level, info.autoNumType, info.autoNumStartAt ?? 1) - (info.autoNumStartAt ?? 1);
181257
+ if (info.paragraphIndex === void 0 || info.paragraphIndex === ordinal) {
181258
+ return segment;
181259
+ }
181260
+ const updated = { ...segment, bulletInfo: { ...info, paragraphIndex: ordinal } };
181261
+ if (isBulletMarkerSegment(segment)) {
181262
+ const resolved = resolveParagraphBullet(updated);
181263
+ if (resolved) {
181264
+ updated.text = resolved.marker + (segment.text.match(/\s+$/u)?.[0] ?? "");
181265
+ }
181266
+ }
181267
+ return updated;
181268
+ });
181269
+ }
180631
181270
  function withoutRenderedBulletPrefix(text22, originalSegments, dedicatedMarker) {
180632
181271
  if (!dedicatedMarker) {
180633
181272
  return text22;
@@ -180648,10 +181287,14 @@ function withoutRenderedBulletPrefix(text22, originalSegments, dedicatedMarker)
180648
181287
  }
180649
181288
  return withoutMarker;
180650
181289
  }
180651
- function continueAutoNumberedParagraph(segments, donorSegments, offset) {
181290
+ function continueListParagraph(segments, donorSegments) {
180652
181291
  const donor = donorSegments[0];
180653
181292
  const paragraphIndex = donor?.bulletInfo?.paragraphIndex;
180654
- if (segments.length === 0 || !donor?.bulletInfo?.autoNumType || typeof paragraphIndex !== "number" || !Number.isFinite(paragraphIndex)) {
181293
+ const bullet = resolveParagraphBullet(donor);
181294
+ if (segments.length === 0 || !bullet) {
181295
+ return segments;
181296
+ }
181297
+ if (bullet.isNumbered && (typeof paragraphIndex !== "number" || !Number.isFinite(paragraphIndex))) {
180655
181298
  return segments;
180656
181299
  }
180657
181300
  const [first, ...rest] = segments;
@@ -180659,13 +181302,13 @@ function continueAutoNumberedParagraph(segments, donorSegments, offset) {
180659
181302
  ...first,
180660
181303
  bulletInfo: {
180661
181304
  ...donor.bulletInfo,
180662
- paragraphIndex: paragraphIndex + offset
181305
+ ...bullet.isNumbered && typeof paragraphIndex === "number" && Number.isFinite(paragraphIndex) ? { paragraphIndex: paragraphIndex + 1 } : {}
180663
181306
  }
180664
181307
  };
180665
181308
  if (donor.paragraphLevel !== void 0) {
180666
181309
  continued.paragraphLevel = donor.paragraphLevel;
180667
181310
  }
180668
- if (isBulletMarkerSegment(donor)) {
181311
+ if (bullet.isNumbered && typeof paragraphIndex === "number" && Number.isFinite(paragraphIndex) && isBulletMarkerSegment(donor)) {
180669
181312
  const resolved = resolveParagraphBullet(continued);
180670
181313
  if (resolved) {
180671
181314
  const trailingWhitespace = donor.text.match(/\s+$/u)?.[0] ?? "";
@@ -180674,10 +181317,91 @@ function continueAutoNumberedParagraph(segments, donorSegments, offset) {
180674
181317
  }
180675
181318
  return [continued, ...rest];
180676
181319
  }
181320
+ function restoreParagraphMetadata2(from, segments) {
181321
+ if (segments.length === 0) {
181322
+ return segments;
181323
+ }
181324
+ const [first, ...rest] = segments;
181325
+ const restored = { ...first };
181326
+ delete restored.paragraphLevel;
181327
+ delete restored.paragraphProperties;
181328
+ delete restored.endParaRunProperties;
181329
+ if (!from) {
181330
+ delete restored.paragraphInsertionStyle;
181331
+ }
181332
+ if (from?.paragraphLevel !== void 0) {
181333
+ restored.paragraphLevel = from.paragraphLevel;
181334
+ }
181335
+ if (from?.paragraphProperties !== void 0) {
181336
+ restored.paragraphProperties = from.paragraphProperties;
181337
+ }
181338
+ if (from?.endParaRunProperties !== void 0) {
181339
+ restored.endParaRunProperties = from.endParaRunProperties;
181340
+ }
181341
+ return [restored, ...rest];
181342
+ }
181343
+ function matches(text22, paragraph) {
181344
+ const first = paragraph.segments[0];
181345
+ const marker = first && isBulletMarkerSegment(first) && (!first.bulletInfo?.autoNumType || first.bulletInfo.paragraphIndex !== void 0) ? first : void 0;
181346
+ const body = paragraph.segments.slice(marker ? 1 : 0).map((segment) => segment.text).join("");
181347
+ return text22 === body || withoutRenderedBulletPrefix(text22, paragraph.segments, marker) === body;
181348
+ }
181349
+ function alignParagraphSources(texts, original) {
181350
+ const sources = Array.from({ length: texts.length });
181351
+ let prefix = 0;
181352
+ while (prefix < texts.length && prefix < original.length && matches(texts[prefix], original[prefix])) {
181353
+ sources[prefix] = prefix;
181354
+ prefix += 1;
181355
+ }
181356
+ let oldEnd = original.length;
181357
+ let newEnd = texts.length;
181358
+ while (oldEnd > prefix && newEnd > prefix && matches(texts[newEnd - 1], original[oldEnd - 1])) {
181359
+ sources[--newEnd] = --oldEnd;
181360
+ }
181361
+ const anchors = [];
181362
+ const oldCount = oldEnd - prefix;
181363
+ const newCount = newEnd - prefix;
181364
+ if (oldCount * newCount <= 1e4) {
181365
+ const lengths = Array.from({ length: oldCount + 1 }, () => new Uint16Array(newCount + 1));
181366
+ for (let old2 = oldCount - 1; old2 >= 0; old2--) {
181367
+ for (let next2 = newCount - 1; next2 >= 0; next2--) {
181368
+ lengths[old2][next2] = matches(texts[prefix + next2], original[prefix + old2]) ? lengths[old2 + 1][next2 + 1] + 1 : Math.max(lengths[old2 + 1][next2], lengths[old2][next2 + 1]);
181369
+ }
181370
+ }
181371
+ let old = 0;
181372
+ let next = 0;
181373
+ while (old < oldCount && next < newCount) {
181374
+ if (matches(texts[prefix + next], original[prefix + old])) {
181375
+ anchors.push([prefix + next++, prefix + old++]);
181376
+ } else if (lengths[old + 1][next] >= lengths[old][next + 1]) {
181377
+ old++;
181378
+ } else {
181379
+ next++;
181380
+ }
181381
+ }
181382
+ }
181383
+ anchors.push([newEnd, oldEnd]);
181384
+ let oldCursor = prefix;
181385
+ let newCursor = prefix;
181386
+ for (const [newAnchor, oldAnchor] of anchors) {
181387
+ while (oldCursor < oldAnchor && newCursor < newAnchor) {
181388
+ sources[newCursor++] = oldCursor++;
181389
+ }
181390
+ if (newAnchor < newEnd) {
181391
+ sources[newAnchor] = oldAnchor;
181392
+ }
181393
+ oldCursor = oldAnchor + 1;
181394
+ newCursor = newAnchor + 1;
181395
+ }
181396
+ return sources;
181397
+ }
180677
181398
  function isAtomicOriginalSegment(seg) {
180678
181399
  return seg.fieldType !== void 0 || seg.equationXml !== void 0;
180679
181400
  }
180680
181401
  function copySegmentMetadata(from, to) {
181402
+ if (!from) {
181403
+ return to;
181404
+ }
180681
181405
  if (from.equationXml !== void 0) {
180682
181406
  to.equationXml = from.equationXml;
180683
181407
  }
@@ -180698,26 +181422,6 @@ function copySegmentMetadata(from, to) {
180698
181422
  }
180699
181423
  return to;
180700
181424
  }
180701
- function restoreParagraphMetadata(from, segments) {
180702
- if (segments.length === 0) {
180703
- return segments;
180704
- }
180705
- const [first, ...rest] = segments;
180706
- const restored = { ...first };
180707
- delete restored.paragraphLevel;
180708
- delete restored.paragraphProperties;
180709
- delete restored.endParaRunProperties;
180710
- if (from?.paragraphLevel !== void 0) {
180711
- restored.paragraphLevel = from.paragraphLevel;
180712
- }
180713
- if (from?.paragraphProperties !== void 0) {
180714
- restored.paragraphProperties = from.paragraphProperties;
180715
- }
180716
- if (from?.endParaRunProperties !== void 0) {
180717
- restored.endParaRunProperties = from.endParaRunProperties;
180718
- }
180719
- return [restored, ...rest];
180720
- }
180721
181425
  function remapTextToSegments(newText, originalSegments, elementTextStyle) {
180722
181426
  const fallbackStyle = { ...elementTextStyle };
180723
181427
  if (!originalSegments || originalSegments.length === 0) {
@@ -180735,9 +181439,10 @@ function remapTextToSegments(newText, originalSegments, elementTextStyle) {
180735
181439
  }
180736
181440
  }
180737
181441
  const newParagraphTexts = newText.split("\n");
181442
+ const paragraphSources = alignParagraphSources(newParagraphTexts, originalParagraphs);
180738
181443
  const firstContentSeg = originalParagraphs.flatMap((paragraph) => paragraph.segments).find((s) => s.text.trim().length > 0);
180739
181444
  const baseFallbackStyle = firstContentSeg?.style ? { ...firstContentSeg.style } : fallbackStyle;
180740
- function remapParagraph(paraNewText, paraOrigSegments) {
181445
+ function remapParagraph(paraNewText, paraOrigSegments, isOriginalParagraph = true) {
180741
181446
  if (paraOrigSegments.length === 0) {
180742
181447
  return paraNewText.length > 0 ? [{ text: paraNewText, style: { ...baseFallbackStyle } }] : [{ text: "", style: { ...baseFallbackStyle } }];
180743
181448
  }
@@ -180745,12 +181450,8 @@ function remapTextToSegments(newText, originalSegments, elementTextStyle) {
180745
181450
  const dedicatedMarker = isBulletMarkerSegment(firstSegment) && (!firstSegment.bulletInfo?.autoNumType || firstSegment.bulletInfo.paragraphIndex !== void 0) ? firstSegment : void 0;
180746
181451
  if (dedicatedMarker) {
180747
181452
  const contentSegments = paraOrigSegments.slice(1);
180748
- const contentText = withoutRenderedBulletPrefix(
180749
- paraNewText,
180750
- paraOrigSegments,
180751
- dedicatedMarker
180752
- );
180753
- const content = contentSegments.length > 0 ? remapParagraph(contentText, contentSegments) : [{ text: contentText, style: { ...dedicatedMarker.style } }];
181453
+ const contentText = isOriginalParagraph ? withoutRenderedBulletPrefix(paraNewText, paraOrigSegments, dedicatedMarker) : paraNewText;
181454
+ const content = contentSegments.length > 0 ? remapParagraph(contentText, contentSegments, isOriginalParagraph) : [{ text: contentText, style: { ...dedicatedMarker.style } }];
180754
181455
  return [dedicatedMarker, ...content];
180755
181456
  }
180756
181457
  const paragraphBulletInfo = paraOrigSegments[0].bulletInfo;
@@ -180765,7 +181466,7 @@ function remapTextToSegments(newText, originalSegments, elementTextStyle) {
180765
181466
  const totalOrigLen = paraOrigSegments.reduce((sum, s) => sum + s.text.length, 0);
180766
181467
  if (totalOrigLen === 0) {
180767
181468
  const result = [
180768
- copySegmentMetadata(paraOrigSegments[0], {
181469
+ copySegmentMetadata(isOriginalParagraph ? paraOrigSegments[0] : void 0, {
180769
181470
  text: paraNewText,
180770
181471
  style: { ...paraOrigSegments[0].style }
180771
181472
  })
@@ -180779,7 +181480,7 @@ function remapTextToSegments(newText, originalSegments, elementTextStyle) {
180779
181480
  let newPos = 0;
180780
181481
  for (let i2 = 0; i2 < paraOrigSegments.length; i2++) {
180781
181482
  const origSeg = paraOrigSegments[i2];
180782
- const isLastSeg = i2 === paraOrigSegments.length - 1 && !isAtomicOriginalSegment(origSeg);
181483
+ const isLastSeg = i2 === paraOrigSegments.length - 1 && (!isOriginalParagraph || !isAtomicOriginalSegment(origSeg));
180783
181484
  const origLen = origSeg.text.length;
180784
181485
  if (newPos >= paraNewText.length) {
180785
181486
  break;
@@ -180791,7 +181492,7 @@ function remapTextToSegments(newText, originalSegments, elementTextStyle) {
180791
181492
  segText = paraNewText.slice(newPos, newPos + origLen);
180792
181493
  }
180793
181494
  if (segText.length > 0) {
180794
- const outSeg = copySegmentMetadata(origSeg, {
181495
+ const outSeg = copySegmentMetadata(isOriginalParagraph ? origSeg : void 0, {
180795
181496
  text: segText,
180796
181497
  style: { ...origSeg.style }
180797
181498
  });
@@ -180810,10 +181511,13 @@ function remapTextToSegments(newText, originalSegments, elementTextStyle) {
180810
181511
  });
180811
181512
  }
180812
181513
  if (remapped.length === 0) {
180813
- const fallback = copySegmentMetadata(paraOrigSegments[0], {
180814
- text: paraNewText,
180815
- style: { ...paraOrigSegments[0].style }
180816
- });
181514
+ const fallback = copySegmentMetadata(
181515
+ isOriginalParagraph ? paraOrigSegments[0] : void 0,
181516
+ {
181517
+ text: paraNewText,
181518
+ style: { ...paraOrigSegments[0].style }
181519
+ }
181520
+ );
180817
181521
  if (paragraphBulletInfo) {
180818
181522
  fallback.bulletInfo = paragraphBulletInfo;
180819
181523
  }
@@ -180823,26 +181527,30 @@ function remapTextToSegments(newText, originalSegments, elementTextStyle) {
180823
181527
  }
180824
181528
  const output = [];
180825
181529
  const lastOrigPara = originalParagraphs[originalParagraphs.length - 1]?.segments;
181530
+ let precedingParagraph;
180826
181531
  for (let pi = 0; pi < newParagraphTexts.length; pi++) {
180827
181532
  if (pi > 0) {
180828
- const precedingOrigPara = originalParagraphs[pi - 1]?.segments ?? [];
181533
+ const precedingOrigPara = originalParagraphs[paragraphSources[pi - 1] ?? -1]?.segments ?? [];
180829
181534
  const breakStyle = precedingOrigPara[0]?.style ? { ...precedingOrigPara[0].style } : { ...baseFallbackStyle };
180830
- output.push({ text: "\n", style: breakStyle, isParagraphBreak: true });
181535
+ const terminator = originalParagraphs[paragraphSources[pi - 1] ?? -1]?.terminator;
181536
+ output.push(
181537
+ terminator?.paragraphInsertionStyle && newParagraphTexts[pi - 1] === "" ? { ...terminator, text: "\n", isParagraphBreak: true } : { text: "\n", style: breakStyle, isParagraphBreak: true }
181538
+ );
180831
181539
  }
180832
- const originalParagraph = originalParagraphs[pi];
180833
- const origPara = originalParagraph?.segments ?? lastOrigPara ?? [];
180834
- let paraSegments = restoreParagraphMetadata(
181540
+ const originalParagraph = originalParagraphs[paragraphSources[pi] ?? -1];
181541
+ const origPara = originalParagraph?.segments ?? precedingParagraph ?? lastOrigPara ?? [];
181542
+ let paraSegments = restoreParagraphMetadata2(
180835
181543
  originalParagraph?.segments[0] ?? originalParagraph?.terminator,
180836
- remapParagraph(newParagraphTexts[pi], origPara)
181544
+ (originalParagraph && remapEmptyParagraph(newParagraphTexts[pi], origPara, originalParagraph.terminator)) ?? remapParagraph(newParagraphTexts[pi], origPara, originalParagraph !== void 0)
180837
181545
  );
180838
- if (!originalParagraph) {
180839
- paraSegments = continueAutoNumberedParagraph(
180840
- paraSegments,
180841
- lastOrigPara ?? [],
180842
- pi - originalParagraphs.length + 1
180843
- );
181546
+ if (!originalParagraph && precedingParagraph) {
181547
+ paraSegments = continueListParagraph(paraSegments, precedingParagraph);
180844
181548
  }
180845
181549
  output.push(...paraSegments);
181550
+ precedingParagraph = paraSegments;
181551
+ }
181552
+ if (paragraphSources.some((source, index) => source !== void 0 && source !== index)) {
181553
+ return renumberRemappedParagraphs(output);
180846
181554
  }
180847
181555
  return output.length > 0 ? output : [{ text: "", style: { ...baseFallbackStyle } }];
180848
181556
  }
@@ -181757,6 +182465,9 @@ function buildSegmentAttrs(seg) {
181757
182465
  if (seg.endParaRunProperties) {
181758
182466
  a.pr = JSON.stringify(seg.endParaRunProperties);
181759
182467
  }
182468
+ if (seg.paragraphInsertionStyle) {
182469
+ a.pi = JSON.stringify(seg.paragraphInsertionStyle);
182470
+ }
181760
182471
  if (typeof seg.fieldType === "string") {
181761
182472
  a.ft = seg.fieldType;
181762
182473
  }
@@ -181863,6 +182574,12 @@ function decodeDelta(delta) {
181863
182574
  } catch {
181864
182575
  }
181865
182576
  }
182577
+ if (a.pi) {
182578
+ try {
182579
+ seg.paragraphInsertionStyle = JSON.parse(a.pi);
182580
+ } catch {
182581
+ }
182582
+ }
181866
182583
  if (a.ft) {
181867
182584
  seg.fieldType = a.ft;
181868
182585
  }
@@ -182051,6 +182768,7 @@ var COMPLEX_ELEMENT_FIELDS = {
182051
182768
  children: "_ch",
182052
182769
  paragraphIndents: "_pi",
182053
182770
  rawXml: "_rx",
182771
+ inheritedTransform: "_it",
182054
182772
  extLstXml: "_elx",
182055
182773
  actionClick: "_ac",
182056
182774
  actionHover: "_av",
@@ -190053,86 +190771,6 @@ function projectDrawingShapes(elementId, shapes, viewBox, palette, style) {
190053
190771
  function styleShadowFilter(style) {
190054
190772
  return styleShadow(style);
190055
190773
  }
190056
- function textFontSizePxToPt(fontSizePx2) {
190057
- return Math.round(fontSizePx2 * (72 / 96) * 100) / 100;
190058
- }
190059
- function textFontSizePtToPx(fontSizePt) {
190060
- return fontSizePt * (96 / 72);
190061
- }
190062
- var COMMON_FONT_FAMILIES = [
190063
- "Abadi",
190064
- "Aptos",
190065
- "Aptos Display",
190066
- "Arial",
190067
- "Arial Black",
190068
- "Arial Narrow",
190069
- "Bahnschrift",
190070
- "Book Antiqua",
190071
- "Bookman Old Style",
190072
- "Calibri",
190073
- "Calibri Light",
190074
- "Cambria",
190075
- "Candara",
190076
- "Century Gothic",
190077
- "Comic Sans MS",
190078
- "Consolas",
190079
- "Corbel",
190080
- "Courier New",
190081
- "Franklin Gothic Book",
190082
- "Franklin Gothic Medium",
190083
- "Garamond",
190084
- "Georgia",
190085
- "Gill Sans MT",
190086
- "Helvetica",
190087
- "Impact",
190088
- "Inter",
190089
- "Lucida Console",
190090
- "Lucida Sans Unicode",
190091
- "Microsoft Sans Serif",
190092
- "Montserrat",
190093
- "Noto Sans",
190094
- "Open Sans",
190095
- "Palatino Linotype",
190096
- "Poppins",
190097
- "Roboto",
190098
- "Rockwell",
190099
- "Segoe UI",
190100
- "Source Sans Pro",
190101
- "Tahoma",
190102
- "Times New Roman",
190103
- "Trebuchet MS",
190104
- "Tw Cen MT",
190105
- "Verdana"
190106
- ];
190107
- var COMMON_FONT_SIZES = [
190108
- 8,
190109
- 9,
190110
- 10,
190111
- 11,
190112
- 12,
190113
- 14,
190114
- 16,
190115
- 18,
190116
- 20,
190117
- 24,
190118
- 28,
190119
- 32,
190120
- 36,
190121
- 40,
190122
- 44,
190123
- 48,
190124
- 54,
190125
- 60,
190126
- 72,
190127
- 96
190128
- ];
190129
- var CHARACTER_SPACING_OPTIONS = [
190130
- { label: "Very Tight", i18nKey: "pptx.text.characterSpacingVeryTight", value: -150 },
190131
- { label: "Tight", i18nKey: "pptx.text.characterSpacingTight", value: -75 },
190132
- { label: "Normal", i18nKey: "pptx.text.characterSpacingNormal", value: 0 },
190133
- { label: "Loose", i18nKey: "pptx.text.characterSpacingLoose", value: 75 },
190134
- { label: "Very Loose", i18nKey: "pptx.text.characterSpacingVeryLoose", value: 150 }
190135
- ];
190136
190774
  var GOOGLE_FONTS_CSS2_BASE = "https://fonts.googleapis.com/css2";
190137
190775
  var GOOGLE_WEBFONT_AXIS = "ital,wght@0,400;0,700;1,400;1,700";
190138
190776
  var DISPLAY_PARAM = "display=swap";
@@ -192343,7 +192981,7 @@ function isBulletMarker(segment) {
192343
192981
  const marker = bullet.char ? `${bullet.char} ` : bullet.imageRelId || bullet.imageDataUrl ? "\u{1F4CE} " : "\u2022 ";
192344
192982
  return segment.text === marker;
192345
192983
  }
192346
- function isParagraphSeparator2(segment) {
192984
+ function isParagraphSeparator(segment) {
192347
192985
  return Boolean(segment.isParagraphBreak) || segment.text === "\n" && !segment.isLineBreak;
192348
192986
  }
192349
192987
  function groupElementParagraphs(element) {
@@ -192357,7 +192995,7 @@ function groupElementParagraphs(element) {
192357
192995
  }
192358
192996
  const groups = [{ content: [] }];
192359
192997
  for (const segment of segments) {
192360
- if (isParagraphSeparator2(segment)) {
192998
+ if (isParagraphSeparator(segment)) {
192361
192999
  groups.push({ content: [] });
192362
193000
  continue;
192363
193001
  }
@@ -192449,8 +193087,37 @@ function buildElementClipboardPayload(element, isTemplate) {
192449
193087
  function cloneElementForPaste(element, options = {}) {
192450
193088
  const clone3 = structuredClone(element);
192451
193089
  const intoTemplate = options.intoTemplate ?? false;
192452
- clone3.id = makeCloneId(intoTemplate, element.id);
192453
- reassignDescendantIds(clone3, () => makeCloneId(intoTemplate, element.id));
193090
+ const modelIds = /* @__PURE__ */ new Map();
193091
+ const nativeIds = /* @__PURE__ */ new Map();
193092
+ const mintId = (node) => {
193093
+ const id = makeCloneId(intoTemplate, element.id);
193094
+ modelIds.set(node.id, id);
193095
+ if (node.shapeId !== void 0) {
193096
+ nativeIds.set(node.shapeId, id);
193097
+ }
193098
+ delete node.shapeId;
193099
+ return id;
193100
+ };
193101
+ clone3.id = mintId(clone3);
193102
+ reassignDescendantIds(clone3, mintId);
193103
+ const remapConnections = (node) => {
193104
+ if (node.type === "group") {
193105
+ node.children.forEach(remapConnections);
193106
+ }
193107
+ if (node.type !== "connector") {
193108
+ return;
193109
+ }
193110
+ for (const ref of [
193111
+ node.shapeStyle?.connectorStartConnection,
193112
+ node.shapeStyle?.connectorEndConnection
193113
+ ]) {
193114
+ if (!ref?.shapeId) {
193115
+ continue;
193116
+ }
193117
+ ref.shapeId = modelIds.get(ref.shapeId) ?? nativeIds.get(ref.shapeId) ?? ref.shapeId;
193118
+ }
193119
+ };
193120
+ remapConnections(clone3);
192454
193121
  clone3.x += options.offsetX ?? PASTE_OFFSET_PX;
192455
193122
  clone3.y += options.offsetY ?? PASTE_OFFSET_PX;
192456
193123
  return clone3;
@@ -192691,6 +193358,7 @@ var GUARD_DEFAULTS = {
192691
193358
  canEdit: true,
192692
193359
  isPresenting: false,
192693
193360
  hasSelection: false,
193361
+ canPaste: true,
192694
193362
  isEditingText: false,
192695
193363
  isDrawing: false,
192696
193364
  isTextInputTarget: false
@@ -192748,6 +193416,9 @@ function mapEditorKey(input, guard = {}) {
192748
193416
  if (mod && !alt) {
192749
193417
  const chord2 = resolveChord(key2, Boolean(input.shiftKey), state.hasSelection);
192750
193418
  if (chord2) {
193419
+ if (chord2.action === "paste" && state.canPaste === false) {
193420
+ return NO_ACTION;
193421
+ }
192751
193422
  return chord2;
192752
193423
  }
192753
193424
  }
@@ -193606,8 +194277,8 @@ function applyFindReplacements(slides, toReplace, replacement) {
193606
194277
  }
193607
194278
  const nextSlides = slides.slice();
193608
194279
  let totalReplacements = 0;
193609
- for (const [, matches] of grouped) {
193610
- const sorted = matches.slice().sort((a, b) => b.startOffset - a.startOffset);
194280
+ for (const [, matches2] of grouped) {
194281
+ const sorted = matches2.slice().sort((a, b) => b.startOffset - a.startOffset);
193611
194282
  for (const match of sorted) {
193612
194283
  const slide = nextSlides[match.slideIndex];
193613
194284
  if (!slide) {
@@ -196058,6 +196729,12 @@ var COMMON_FONTS = [
196058
196729
  "Tw Cen MT",
196059
196730
  "Verdana"
196060
196731
  ];
196732
+ function prepareElementForInsertion(element, target) {
196733
+ if (!target.canEdit || target.mode !== "edit" || !target.hasActiveSlide || target.editTemplateMode) {
196734
+ return void 0;
196735
+ }
196736
+ return cloneElementForPaste(element, { offsetX: 0, offsetY: 0 });
196737
+ }
196061
196738
  function isHeaderFooterDateTextVisible(draft) {
196062
196739
  return Boolean(draft.hasDateTime) && !draft.dateTimeAuto;
196063
196740
  }
@@ -199787,10 +200464,15 @@ function resolveSlideSizeRescaleTransform(oldSize, newSize, mode) {
199787
200464
  };
199788
200465
  }
199789
200466
  function scaleTextSegment(segment, scale2) {
199790
- if (typeof segment.style.fontSize !== "number") {
200467
+ const insertion = segment.paragraphInsertionStyle;
200468
+ if (typeof segment.style.fontSize !== "number" && typeof insertion?.fontSize !== "number") {
199791
200469
  return segment;
199792
200470
  }
199793
- return { ...segment, style: { ...segment.style, fontSize: segment.style.fontSize * scale2 } };
200471
+ return {
200472
+ ...segment,
200473
+ ...typeof segment.style.fontSize === "number" ? { style: { ...segment.style, fontSize: segment.style.fontSize * scale2 } } : {},
200474
+ ...typeof insertion?.fontSize === "number" ? { paragraphInsertionStyle: { ...insertion, fontSize: insertion.fontSize * scale2 } } : {}
200475
+ };
199794
200476
  }
199795
200477
  function scaleFontSizesDeep(element, scale2) {
199796
200478
  let next = element;
@@ -200603,6 +201285,50 @@ function wrapForeignObjectSvg(bodyMarkup, tile) {
200603
201285
  const { viewBoxX, viewBoxY, viewBoxWidth, viewBoxHeight, outputWidth, outputHeight } = tile;
200604
201286
  return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${outputWidth}" height="${outputHeight}" viewBox="${viewBoxX} ${viewBoxY} ${viewBoxWidth} ${viewBoxHeight}">${bodyMarkup}</svg>`;
200605
201287
  }
201288
+ var DEFAULTS2 = {
201289
+ fitPadding: { horizontal: 0, vertical: 0 },
201290
+ maxFitScale: null
201291
+ };
201292
+ function validPadding(value, fallback) {
201293
+ return Number.isFinite(value) && value >= 0 ? value : fallback;
201294
+ }
201295
+ function resolveViewportFitOptions(options = {}, defaults = DEFAULTS2) {
201296
+ const base = typeof defaults.fitPadding === "number" ? { horizontal: defaults.fitPadding, vertical: defaults.fitPadding } : defaults.fitPadding;
201297
+ const padding = options.fitPadding ?? base;
201298
+ const horizontal = typeof padding === "number" ? padding : padding.horizontal;
201299
+ const vertical = typeof padding === "number" ? padding : padding.vertical;
201300
+ const cap = options.maxFitScale;
201301
+ return {
201302
+ fitPadding: {
201303
+ horizontal: validPadding(horizontal, base.horizontal),
201304
+ vertical: validPadding(vertical, base.vertical)
201305
+ },
201306
+ maxFitScale: cap === null ? null : typeof cap === "number" && Number.isFinite(cap) && cap > 0 ? cap : defaults.maxFitScale
201307
+ };
201308
+ }
201309
+ function calculateViewportFit(input, defaults = DEFAULTS2) {
201310
+ const { fitPadding, maxFitScale } = resolveViewportFitOptions(input, defaults);
201311
+ const availableWidth = Math.max(
201312
+ 0,
201313
+ validPadding(input.viewportWidth, 0) - 2 * fitPadding.horizontal - validPadding(input.horizontalGutter ?? 0, 0)
201314
+ );
201315
+ const availableHeight = Math.max(
201316
+ 0,
201317
+ validPadding(input.viewportHeight, 0) - 2 * fitPadding.vertical - validPadding(input.verticalGutter ?? 0, 0)
201318
+ );
201319
+ const fallback = typeof input.fallbackScale === "number" && Number.isFinite(input.fallbackScale) && input.fallbackScale > 0 ? input.fallbackScale : 1;
201320
+ const validCanvas = Number.isFinite(input.canvasWidth) && input.canvasWidth > 0 && Number.isFinite(input.canvasHeight) && input.canvasHeight > 0;
201321
+ const scale2 = availableWidth > 0 && availableHeight > 0 && validCanvas ? Math.min(
201322
+ availableWidth / input.canvasWidth,
201323
+ availableHeight / input.canvasHeight,
201324
+ maxFitScale ?? Number.POSITIVE_INFINITY
201325
+ ) : fallback;
201326
+ return {
201327
+ scale: Number.isFinite(scale2) && scale2 > 0 ? scale2 : fallback,
201328
+ availableWidth,
201329
+ availableHeight
201330
+ };
201331
+ }
200606
201332
  var FALLBACK_DOWNLOAD_NAME = "presentation.pptx";
200607
201333
  var REVOKE_DELAY_MS = 200;
200608
201334
  var OPEN_REVOKE_DELAY_MS = 6e4;
@@ -203197,6 +203923,7 @@ exports.applyFindReplacements = applyFindReplacements;
203197
203923
  exports.applyFormatToElement = applyFormatToElement;
203198
203924
  exports.applyHighlightClickStyle = applyHighlightClickStyle;
203199
203925
  exports.applyImagePathPatches = applyImagePathPatches;
203926
+ exports.applyListStyleUpdate = applyListStyleUpdate;
203200
203927
  exports.applyMasterViewCrudAction = applyMasterViewCrudAction;
203201
203928
  exports.applyMotionPathPreset = applyMotionPathPreset;
203202
203929
  exports.applyOleDocumentParagraphEdit = applyOleDocumentParagraphEdit;
@@ -203311,6 +204038,7 @@ exports.buildThemeColorMap = buildThemeColorMap;
203311
204038
  exports.buildThemeColorSwatchGrid = buildThemeColorSwatchGrid;
203312
204039
  exports.buildTiledSlidesPdfBytes = buildTiledSlidesPdfBytes;
203313
204040
  exports.buildUserFontFaceStyles = buildUserFontFaceStyles;
204041
+ exports.calculateViewportFit = calculateViewportFit;
203314
204042
  exports.canAddTopLevelNode = canAddTopLevelNode;
203315
204043
  exports.canCommitActionType = canCommitActionType;
203316
204044
  exports.canDrillDown = canDrillDown;
@@ -203443,6 +204171,7 @@ exports.downloadBlob = downloadBlob;
203443
204171
  exports.downloadDataUrl = downloadDataUrl;
203444
204172
  exports.editCommentInList = editCommentInList;
203445
204173
  exports.elementActionToPptxAction = elementActionToPptxAction;
204174
+ exports.elementBulletKind = elementBulletKind;
203446
204175
  exports.elementIdSelector = elementIdSelector;
203447
204176
  exports.elementLockTogglePatch = elementLockTogglePatch;
203448
204177
  exports.encodeGif = encodeGif;
@@ -203712,6 +204441,7 @@ exports.playGroup = playGroup;
203712
204441
  exports.playSlideTransitionPreview = playSlideTransitionPreview;
203713
204442
  exports.polygonsToSvgPath = polygonsToSvgPath;
203714
204443
  exports.pptxActionToElementAction = pptxActionToElementAction;
204444
+ exports.prepareElementForInsertion = prepareElementForInsertion;
203715
204445
  exports.preprocessCssForCapture = preprocessCssForCapture;
203716
204446
  exports.presentationBaseName = presentationBaseName;
203717
204447
  exports.presentationEntrySlideIndex = presentationEntrySlideIndex;
@@ -203835,6 +204565,7 @@ exports.resolveTransitionDurationMs = resolveTransitionDurationMs;
203835
204565
  exports.resolveTransitionSoundAction = resolveTransitionSoundAction;
203836
204566
  exports.resolveTransportForServerUrl = resolveTransportForServerUrl;
203837
204567
  exports.resolveViewerAddinRows = resolveViewerAddinRows;
204568
+ exports.resolveViewportFitOptions = resolveViewportFitOptions;
203838
204569
  exports.restoreFilteredSeries = restoreFilteredSeries;
203839
204570
  exports.restoreSegmentSelection = restoreSegmentSelection;
203840
204571
  exports.restoreSessionDeck = restoreSessionDeck;
@@ -203862,6 +204593,7 @@ exports.segmentsToEditorHtml = segmentsToEditorHtml;
203862
204593
  exports.segmentsToParagraphs = segmentsToParagraphs;
203863
204594
  exports.segmentsToPlainText = segmentsToPlainText;
203864
204595
  exports.selectGoogleWebfontFamilies = selectGoogleWebfontFamilies;
204596
+ exports.selectedParagraphBulletKind = selectedParagraphBulletKind;
203865
204597
  exports.sendBackward = sendBackward;
203866
204598
  exports.sendToBack = sendToBack;
203867
204599
  exports.seriesSecondaryAxisPatch = seriesSecondaryAxisPatch;
@@ -203970,6 +204702,7 @@ exports.updateMasterViewElement = updateMasterViewElement;
203970
204702
  exports.updateMergeAttrsInRawXml = updateMergeAttrsInRawXml;
203971
204703
  exports.updateSmartArtNodeText = updateSmartArtNodeText;
203972
204704
  exports.updateTagInCollections = updateTagInCollections;
204705
+ exports.updateTextSegmentStyle = updateTextSegmentStyle;
203973
204706
  exports.validateMediaTrimRange = validateMediaTrimRange;
203974
204707
  exports.validateRoomId = validateRoomId;
203975
204708
  exports.vermilionDarkColors = vermilionDarkColors;