ooxml-core 1.27.0 → 1.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{PptxHandler-6ZGALYYM.cjs → PptxHandler-NHOKKZ4S.cjs} +3 -3
  2. package/dist/{PptxHandler-HEPPGI32.mjs → PptxHandler-OIR3ZY4Q.mjs} +2 -2
  3. package/dist/PptxHandler-TZJNIXPX.mjs +4 -0
  4. package/dist/{PresentationBuilder-HFGK2BWN.cjs → PresentationBuilder-EX6DAE5X.cjs} +5 -5
  5. package/dist/{PresentationBuilder-OQOZE76H.mjs → PresentationBuilder-RFTSZUPR.mjs} +2 -2
  6. package/dist/{PresentationBuilder-BCDRASRT.mjs → PresentationBuilder-X5WFSHLB.mjs} +2 -2
  7. package/dist/{chunk-MU3XSASV.cjs → chunk-36TR3PER.cjs} +270 -13
  8. package/dist/{chunk-KE2FUFIU.mjs → chunk-5KJAQKZG.mjs} +41 -271
  9. package/dist/{chunk-VRJOOHWV.mjs → chunk-5NJPYCGO.mjs} +271 -17
  10. package/dist/{chunk-4SGBL2H4.mjs → chunk-BXZF7H5G.mjs} +4 -4
  11. package/dist/{chunk-HYCOBPCC.cjs → chunk-DMJIDRJE.cjs} +1118 -1348
  12. package/dist/{chunk-7E45SAZJ.mjs → chunk-GZ4DIXZZ.mjs} +41 -271
  13. package/dist/{chunk-2XMK5SXU.mjs → chunk-I57SMSU6.mjs} +268 -14
  14. package/dist/{chunk-63GRFYAN.mjs → chunk-QIMNQDON.mjs} +1 -1
  15. package/dist/{chunk-ANIFYTKH.mjs → chunk-ZWTXVWMY.mjs} +1 -1
  16. package/dist/pptx/automation/index.cjs +331 -307
  17. package/dist/pptx/automation/index.d.ts +1 -1
  18. package/dist/pptx/automation/index.mjs +5 -5
  19. package/dist/pptx/chunks/{index-CbFowkp4.d.ts → index-GWpMAY-f.d.ts} +16 -3
  20. package/dist/pptx/chunks/index-GWpMAY-f.d.ts.map +1 -0
  21. package/dist/pptx/cli/index.cjs +331 -307
  22. package/dist/pptx/cli/index.mjs +4 -4
  23. package/dist/pptx/converter/index.mjs +2 -2
  24. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  25. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  26. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  27. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  28. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  29. package/dist/pptx/index.cjs +333 -307
  30. package/dist/pptx/index.d.ts +2 -2
  31. package/dist/pptx/index.mjs +5 -5
  32. package/package.json +1 -1
  33. package/dist/PptxHandler-NO7MNGOW.mjs +0 -4
  34. package/dist/pptx/chunks/index-CbFowkp4.d.ts.map +0 -1
@@ -59619,6 +59619,272 @@ var init_chart_data_sheet = __esm({
59619
59619
  }
59620
59620
  });
59621
59621
 
59622
+ // pptx/core/utils/modern-comment-mention-read.ts
59623
+ function readCommentMentions(node2, authorName) {
59624
+ if (!node2) {
59625
+ return void 0;
59626
+ }
59627
+ const found = [];
59628
+ for (const list3 of mentionChildrenNamed(node2, "mentionLst")) {
59629
+ for (const entry2 of mentionChildrenNamed(list3, "mention")) {
59630
+ const mention = readMention(entry2, authorName);
59631
+ if (mention) {
59632
+ found.push(mention);
59633
+ }
59634
+ }
59635
+ }
59636
+ for (const extension of mentionChildrenNamed(mentionChildrenNamed(node2, "extLst")[0], "ext")) {
59637
+ const uri = String(extension["@_uri"] || "");
59638
+ for (const list3 of mentionChildrenNamed(extension, "mentionLst")) {
59639
+ for (const entry2 of mentionChildrenNamed(list3, "mention")) {
59640
+ const mention = readMention(entry2, authorName, uri);
59641
+ if (mention) {
59642
+ found.push(mention);
59643
+ }
59644
+ }
59645
+ }
59646
+ }
59647
+ found.sort((a, b) => a.startIndex - b.startIndex);
59648
+ return found.length > 0 ? found : void 0;
59649
+ }
59650
+ var mentionLocalName, mentionNodesOf, mentionChildrenNamed, MENTION_PERSON_KEYS, MENTION_LENGTH_KEYS, attribute5, integer2, readMention;
59651
+ var init_modern_comment_mention_read = __esm({
59652
+ "pptx/core/utils/modern-comment-mention-read.ts"() {
59653
+ mentionLocalName = (key2) => key2.split(":").pop() || key2;
59654
+ mentionNodesOf = (value) => {
59655
+ if (Array.isArray(value)) {
59656
+ return value.filter((entry2) => Boolean(entry2) && typeof entry2 === "object");
59657
+ }
59658
+ return value && typeof value === "object" ? [value] : [];
59659
+ };
59660
+ mentionChildrenNamed = (node2, name) => {
59661
+ if (!node2) {
59662
+ return [];
59663
+ }
59664
+ const result = [];
59665
+ for (const [key2, value] of Object.entries(node2)) {
59666
+ if (!key2.startsWith("@_") && mentionLocalName(key2) === name) {
59667
+ result.push(...mentionNodesOf(value));
59668
+ }
59669
+ }
59670
+ return result;
59671
+ };
59672
+ MENTION_PERSON_KEYS = [
59673
+ "@_mentionpersonId",
59674
+ "@_mentionPersonId",
59675
+ "@_personId",
59676
+ "@_authorId"
59677
+ ];
59678
+ MENTION_LENGTH_KEYS = ["@_length", "@_mentionCharCount", "@_len"];
59679
+ attribute5 = (node2, keys) => {
59680
+ for (const key2 of keys) {
59681
+ const value = node2[key2];
59682
+ if (value !== void 0 && value !== null && String(value).length > 0) {
59683
+ return String(value);
59684
+ }
59685
+ }
59686
+ return void 0;
59687
+ };
59688
+ integer2 = (value) => {
59689
+ if (value === void 0) {
59690
+ return void 0;
59691
+ }
59692
+ const parsed = Number.parseInt(value, 10);
59693
+ return Number.isFinite(parsed) && parsed >= 0 ? parsed : void 0;
59694
+ };
59695
+ readMention = (node2, authorName, containerUri) => {
59696
+ const personId = attribute5(node2, MENTION_PERSON_KEYS);
59697
+ const startIndex = integer2(attribute5(node2, ["@_startIndex"]));
59698
+ const length = integer2(attribute5(node2, MENTION_LENGTH_KEYS));
59699
+ if (!personId || startIndex === void 0 || length === void 0 || length === 0) {
59700
+ return void 0;
59701
+ }
59702
+ return {
59703
+ personId,
59704
+ startIndex,
59705
+ length,
59706
+ id: attribute5(node2, ["@_mentionId", "@_id"]),
59707
+ authorName: authorName(personId),
59708
+ containerUri,
59709
+ rawXml: node2
59710
+ };
59711
+ };
59712
+ }
59713
+ });
59714
+
59715
+ // pptx/core/utils/modern-comment-mentions.ts
59716
+ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
59717
+ if (!mentions || mentions.length === 0) {
59718
+ return void 0;
59719
+ }
59720
+ if (oldText === newText) {
59721
+ return mentions;
59722
+ }
59723
+ const prefix = commonPrefixLength(oldText, newText);
59724
+ const suffix = commonSuffixLength(
59725
+ oldText,
59726
+ newText,
59727
+ Math.min(oldText.length, newText.length) - prefix
59728
+ );
59729
+ const changeEnd = oldText.length - suffix;
59730
+ const delta2 = newText.length - oldText.length;
59731
+ const result = [];
59732
+ for (const mention of mentions) {
59733
+ const start = mention.startIndex;
59734
+ const end = start + mention.length;
59735
+ const coverage = loaded ? loadedCoverage(mention, loaded, oldText) : [];
59736
+ if (coverage === void 0 || coverage.includes(newText.slice(start, end))) {
59737
+ if (start >= 0 && mention.length > 0 && end <= newText.length) {
59738
+ result.push(mention);
59739
+ }
59740
+ continue;
59741
+ }
59742
+ const span = oldText.slice(start, end);
59743
+ if (span.length !== mention.length) {
59744
+ continue;
59745
+ }
59746
+ let next = -1;
59747
+ if (end <= prefix) {
59748
+ next = start;
59749
+ } else if (start >= changeEnd) {
59750
+ next = start + delta2;
59751
+ }
59752
+ if (next >= 0 && newText.slice(next, next + mention.length) === span) {
59753
+ result.push(next === start ? mention : { ...mention, startIndex: next });
59754
+ continue;
59755
+ }
59756
+ const relocated = nearestOccurrence(newText, span, next >= 0 ? next : start);
59757
+ if (relocated >= 0) {
59758
+ result.push({ ...mention, startIndex: relocated });
59759
+ }
59760
+ }
59761
+ return result.length > 0 ? result : void 0;
59762
+ }
59763
+ function buildMentionListNode(mentions) {
59764
+ if (!mentions || mentions.length === 0) {
59765
+ return void 0;
59766
+ }
59767
+ return { "p188:mention": mentions.map(buildMention) };
59768
+ }
59769
+ function applyCommentMentions(node2, mentions, extension, replace) {
59770
+ if (!replace) {
59771
+ return extension;
59772
+ }
59773
+ const { direct, byUri } = groupByContainer(mentions);
59774
+ const directList = buildMentionListNode(direct);
59775
+ if (directList) {
59776
+ node2["p188:mentionLst"] = directList;
59777
+ }
59778
+ if (!extension) {
59779
+ return void 0;
59780
+ }
59781
+ const rebuilt = stripMentionLists(extension);
59782
+ const extensionKey = Object.keys(rebuilt).find((key2) => mentionLocalName(key2) === "ext") || "p188:ext";
59783
+ const entries = mentionNodesOf(rebuilt[extensionKey]).map((entry2) => {
59784
+ const list3 = buildMentionListNode(byUri.get(String(entry2["@_uri"] || "")));
59785
+ const next = stripMentionLists(entry2);
59786
+ if (list3) {
59787
+ next["p188:mentionLst"] = list3;
59788
+ }
59789
+ return next;
59790
+ });
59791
+ if (entries.length > 0) {
59792
+ rebuilt[extensionKey] = entries.length === 1 ? entries[0] : entries;
59793
+ }
59794
+ return rebuilt;
59795
+ }
59796
+ var commonPrefixLength, commonSuffixLength, nearestOccurrence, loadedCoverage, buildMention, stripMentionLists, groupByContainer;
59797
+ var init_modern_comment_mentions = __esm({
59798
+ "pptx/core/utils/modern-comment-mentions.ts"() {
59799
+ init_modern_comment_mention_read();
59800
+ init_modern_comment_mention_read();
59801
+ commonPrefixLength = (a, b) => {
59802
+ const max = Math.min(a.length, b.length);
59803
+ let index2 = 0;
59804
+ while (index2 < max && a[index2] === b[index2]) {
59805
+ index2 += 1;
59806
+ }
59807
+ return index2;
59808
+ };
59809
+ commonSuffixLength = (a, b, limit) => {
59810
+ let index2 = 0;
59811
+ while (index2 < limit && a[a.length - 1 - index2] === b[b.length - 1 - index2]) {
59812
+ index2 += 1;
59813
+ }
59814
+ return index2;
59815
+ };
59816
+ nearestOccurrence = (text2, span, hint) => {
59817
+ let best = -1;
59818
+ let bestDistance = Number.POSITIVE_INFINITY;
59819
+ let at2 = text2.indexOf(span);
59820
+ while (at2 !== -1) {
59821
+ const distance = Math.abs(at2 - hint);
59822
+ if (distance < bestDistance) {
59823
+ best = at2;
59824
+ bestDistance = distance;
59825
+ }
59826
+ at2 = text2.indexOf(span, at2 + 1);
59827
+ }
59828
+ return best;
59829
+ };
59830
+ loadedCoverage = (mention, loaded, oldText) => {
59831
+ const records = loaded.filter(
59832
+ (record3) => mention.id ? record3.id === mention.id : !record3.id && record3.personId === mention.personId && record3.length === mention.length
59833
+ );
59834
+ if (records.length === 0) {
59835
+ return void 0;
59836
+ }
59837
+ return records.map(
59838
+ (record3) => oldText.slice(record3.startIndex, record3.startIndex + record3.length)
59839
+ );
59840
+ };
59841
+ buildMention = (mention) => {
59842
+ const node2 = {};
59843
+ for (const [key2, value] of Object.entries(mention.rawXml || {})) {
59844
+ if (key2.startsWith("@_")) {
59845
+ node2[key2] = value;
59846
+ }
59847
+ }
59848
+ const personKey = MENTION_PERSON_KEYS.find((key2) => node2[key2] !== void 0) || "@_mentionpersonId";
59849
+ const lengthKey = MENTION_LENGTH_KEYS.find((key2) => node2[key2] !== void 0) || "@_length";
59850
+ node2[personKey] = mention.personId;
59851
+ node2[lengthKey] = String(mention.length);
59852
+ node2["@_startIndex"] = String(mention.startIndex);
59853
+ if (mention.id) {
59854
+ const idKey = node2["@_id"] !== void 0 && node2["@_mentionId"] === void 0 ? "@_id" : "@_mentionId";
59855
+ node2[idKey] = mention.id;
59856
+ }
59857
+ return node2;
59858
+ };
59859
+ stripMentionLists = (node2) => {
59860
+ const result = {};
59861
+ for (const [key2, value] of Object.entries(node2)) {
59862
+ if (key2.startsWith("@_") || mentionLocalName(key2) !== "mentionLst") {
59863
+ result[key2] = value;
59864
+ }
59865
+ }
59866
+ return result;
59867
+ };
59868
+ groupByContainer = (mentions) => {
59869
+ const direct = [];
59870
+ const byUri = /* @__PURE__ */ new Map();
59871
+ for (const mention of mentions || []) {
59872
+ if (!mention.containerUri) {
59873
+ direct.push(mention);
59874
+ continue;
59875
+ }
59876
+ const bucket = byUri.get(mention.containerUri);
59877
+ if (bucket) {
59878
+ bucket.push(mention);
59879
+ } else {
59880
+ byUri.set(mention.containerUri, [mention]);
59881
+ }
59882
+ }
59883
+ return { direct, byUri };
59884
+ };
59885
+ }
59886
+ });
59887
+
59622
59888
  // pptx/core/utils/index.ts
59623
59889
  var init_utils = __esm({
59624
59890
  "pptx/core/utils/index.ts"() {
@@ -64097,7 +64363,7 @@ var init_effect_style_extractor_fill_overlay = __esm({
64097
64363
  });
64098
64364
 
64099
64365
  // pptx/core/core/builders/effect-style-extractor-reflection.ts
64100
- function integer2(value) {
64366
+ function integer3(value) {
64101
64367
  if (value === void 0 || value === null || value === "") {
64102
64368
  return void 0;
64103
64369
  }
@@ -64114,19 +64380,19 @@ function boolean2(value) {
64114
64380
  return void 0;
64115
64381
  }
64116
64382
  function fixedFraction(value) {
64117
- const parsed = integer2(value);
64383
+ const parsed = integer3(value);
64118
64384
  return parsed !== void 0 && parsed >= 0 && parsed <= 1e5 ? parsed / 1e5 : void 0;
64119
64385
  }
64120
64386
  function extractReflectionAttributes(node2, emuPerPx) {
64121
- const blur = integer2(node2["@_blurRad"]);
64122
- const distance = integer2(node2["@_dist"]);
64123
- const startOpacity = integer2(node2["@_stA"]);
64124
- const endOpacity = integer2(node2["@_endA"]);
64125
- const startPosition = integer2(node2["@_stPos"]);
64126
- const endPosition = integer2(node2["@_endPos"]);
64127
- const direction = integer2(node2["@_dir"]);
64128
- const rotation = integer2(node2["@_rot"]);
64129
- const fadeDirection = integer2(node2["@_fadeDir"]);
64387
+ const blur = integer3(node2["@_blurRad"]);
64388
+ const distance = integer3(node2["@_dist"]);
64389
+ const startOpacity = integer3(node2["@_stA"]);
64390
+ const endOpacity = integer3(node2["@_endA"]);
64391
+ const startPosition = integer3(node2["@_stPos"]);
64392
+ const endPosition = integer3(node2["@_endPos"]);
64393
+ const direction = integer3(node2["@_dir"]);
64394
+ const rotation = integer3(node2["@_rot"]);
64395
+ const fadeDirection = integer3(node2["@_fadeDir"]);
64130
64396
  const alignment = String(node2["@_algn"] ?? "").trim();
64131
64397
  return {
64132
64398
  reflectionBlurRadius: blur !== void 0 && blur >= 0 ? blur / emuPerPx : void 0,
@@ -64138,10 +64404,10 @@ function extractReflectionAttributes(node2, emuPerPx) {
64138
64404
  reflectionRotation: rotation !== void 0 ? rotation / 6e4 : void 0,
64139
64405
  reflectionDistance: distance !== void 0 && distance >= 0 ? distance / emuPerPx : void 0,
64140
64406
  reflectionFadeDirection: fadeDirection !== void 0 ? fadeDirection / 6e4 : void 0,
64141
- reflectionScaleX: integer2(node2["@_sx"]),
64142
- reflectionScaleY: integer2(node2["@_sy"]),
64143
- reflectionSkewX: integer2(node2["@_kx"]),
64144
- reflectionSkewY: integer2(node2["@_ky"]),
64407
+ reflectionScaleX: integer3(node2["@_sx"]),
64408
+ reflectionScaleY: integer3(node2["@_sy"]),
64409
+ reflectionSkewX: integer3(node2["@_kx"]),
64410
+ reflectionSkewY: integer3(node2["@_ky"]),
64145
64411
  reflectionAlignment: VALID_ALIGNMENTS.has(alignment) ? alignment : void 0,
64146
64412
  reflectionRotateWithShape: boolean2(node2["@_rotWithShape"])
64147
64413
  };
@@ -98207,7 +98473,7 @@ function malformed(context, element, value) {
98207
98473
  function cBool(context, parent, local) {
98208
98474
  const element = cChild(parent, local);
98209
98475
  if (!element) return void 0;
98210
- const raw2 = attribute5(element, "val");
98476
+ const raw2 = attribute6(element, "val");
98211
98477
  if (raw2 === void 0) return true;
98212
98478
  const value = raw2.trim().toLowerCase();
98213
98479
  if (value === "1" || value === "true") return true;
@@ -98217,7 +98483,7 @@ function cBool(context, parent, local) {
98217
98483
  }
98218
98484
  function cNumber(context, parent, local) {
98219
98485
  const element = cChild(parent, local);
98220
- const raw2 = attribute5(element, "val");
98486
+ const raw2 = attribute6(element, "val");
98221
98487
  if (!element || raw2 === void 0) return void 0;
98222
98488
  const value = raw2.trim() ? Number(raw2) : Number.NaN;
98223
98489
  if (Number.isFinite(value)) return value;
@@ -98226,7 +98492,7 @@ function cNumber(context, parent, local) {
98226
98492
  }
98227
98493
  function cEnum(context, parent, local, allowed) {
98228
98494
  const element = cChild(parent, local);
98229
- const raw2 = attribute5(element, "val");
98495
+ const raw2 = attribute6(element, "val");
98230
98496
  if (!element || raw2 === void 0) return void 0;
98231
98497
  if (allowed.includes(raw2)) return raw2;
98232
98498
  malformed(context, element, raw2);
@@ -98283,9 +98549,9 @@ function chartLines(parent, local) {
98283
98549
  }
98284
98550
  function numberFormat(parent) {
98285
98551
  const element = cChild(parent, "numFmt");
98286
- const formatCode2 = attribute5(element, "formatCode");
98552
+ const formatCode2 = attribute6(element, "formatCode");
98287
98553
  if (formatCode2 === void 0) return void 0;
98288
- const linked = attribute5(element, "sourceLinked");
98554
+ const linked = attribute6(element, "sourceLinked");
98289
98555
  return {
98290
98556
  formatCode: formatCode2,
98291
98557
  ...linked === "1" || linked === "true" ? { sourceLinked: true } : {},
@@ -98309,7 +98575,7 @@ function assignDefined(target, values) {
98309
98575
  if (value !== void 0) target[key2] = value;
98310
98576
  return target;
98311
98577
  }
98312
- var cChild, attribute5, cVal, path, textProperties;
98578
+ var cChild, attribute6, cVal, path, textProperties;
98313
98579
  var init_parse_util = __esm({
98314
98580
  "chart/parse-util.ts"() {
98315
98581
  init_xml2();
@@ -98318,8 +98584,8 @@ var init_parse_util = __esm({
98318
98584
  init_manual_layout();
98319
98585
  init_xml_fragment();
98320
98586
  cChild = (parent, local) => first(parent, local, NS.c);
98321
- attribute5 = (element, name) => element?.hasAttribute(name) ? element.getAttribute(name) ?? void 0 : void 0;
98322
- cVal = (parent, local) => attribute5(cChild(parent, local), "val");
98587
+ attribute6 = (element, name) => element?.hasAttribute(name) ? element.getAttribute(name) ?? void 0 : void 0;
98588
+ cVal = (parent, local) => attribute6(cChild(parent, local), "val");
98323
98589
  path = (element) => `c:${element.parentNode?.localName ?? ""}/c:${element.localName}`;
98324
98590
  textProperties = (parent) => chartTextBody(cChild(parent, "txPr"));
98325
98591
  }
@@ -98331,9 +98597,9 @@ function parseCache(node2) {
98331
98597
  type: node2.localName === "numCache" || node2.localName === "numLit" ? "number" : "string",
98332
98598
  points: children2(node2, "pt", NS.c).map((pt2) => {
98333
98599
  const point2 = { value: cChild(pt2, "v")?.textContent ?? "" };
98334
- const index2 = Number(attribute5(pt2, "idx") ?? Number.NaN);
98600
+ const index2 = Number(attribute6(pt2, "idx") ?? Number.NaN);
98335
98601
  if (Number.isInteger(index2) && index2 >= 0) point2.index = index2;
98336
- const formatCode3 = attribute5(pt2, "formatCode");
98602
+ const formatCode3 = attribute6(pt2, "formatCode");
98337
98603
  if (formatCode3 !== void 0) point2.formatCode = formatCode3;
98338
98604
  return point2;
98339
98605
  })
@@ -98536,10 +98802,10 @@ function readDisplayNaAsBlank(chartExtLst) {
98536
98802
  return void 0;
98537
98803
  }
98538
98804
  for (const ext of elements(root)) {
98539
- if (ext.localName !== "ext" || attribute5(ext, "uri") !== DATA_DISPLAY_OPTIONS_URI) continue;
98805
+ if (ext.localName !== "ext" || attribute6(ext, "uri") !== DATA_DISPLAY_OPTIONS_URI) continue;
98540
98806
  const flag2 = first(first(ext, "dataDisplayOptions16", C16R3), "dispNaAsBlank", C16R3);
98541
98807
  if (!flag2) continue;
98542
- const raw2 = attribute5(flag2, "val")?.trim().toLowerCase();
98808
+ const raw2 = attribute6(flag2, "val")?.trim().toLowerCase();
98543
98809
  return raw2 === void 0 || raw2 === "1" || raw2 === "true";
98544
98810
  }
98545
98811
  return void 0;
@@ -98784,7 +99050,7 @@ function customSplit(context, element) {
98784
99050
  if (!element) return void 0;
98785
99051
  reportUnmodelled(context, element, /* @__PURE__ */ new Set(["secondPiePt"]));
98786
99052
  return children2(element, "secondPiePt", NS.c).flatMap((point2) => {
98787
- const raw2 = attribute5(point2, "val")?.trim();
99053
+ const raw2 = attribute6(point2, "val")?.trim();
98788
99054
  const index2 = raw2 ? Number(raw2) : Number.NaN;
98789
99055
  return Number.isInteger(index2) && index2 >= 0 ? [index2] : [];
98790
99056
  });
@@ -98805,7 +99071,7 @@ function parseGroup(context, element) {
98805
99071
  is3D,
98806
99072
  series: children2(element, "ser", NS.c).map((ser) => parseSeries(context, ser)),
98807
99073
  axisIds: children2(element, "axId", NS.c).flatMap((axis) => {
98808
- const raw2 = attribute5(axis, "val")?.trim();
99074
+ const raw2 = attribute6(axis, "val")?.trim();
98809
99075
  const id = raw2 ? Number(raw2) : Number.NaN;
98810
99076
  return Number.isFinite(id) ? [id] : [];
98811
99077
  })
@@ -99087,7 +99353,7 @@ function chartStyle(context, space) {
99087
99353
  }
99088
99354
  function c14Style(space) {
99089
99355
  for (const alternate of children2(space, "AlternateContent", NS.mc)) {
99090
- const raw2 = attribute5(first(first(alternate, "Choice", NS.mc), "style", NS.c14, false), "val");
99356
+ const raw2 = attribute6(first(first(alternate, "Choice", NS.mc), "style", NS.c14, false), "val");
99091
99357
  const value = raw2?.trim() ? Number(raw2) : Number.NaN;
99092
99358
  if (Number.isFinite(value)) return value;
99093
99359
  }
@@ -99776,7 +100042,7 @@ function malformed2(context, where, value) {
99776
100042
  });
99777
100043
  }
99778
100044
  function boolAttribute(context, element, name) {
99779
- const raw2 = attribute5(element, name);
100045
+ const raw2 = attribute6(element, name);
99780
100046
  if (!element || raw2 === void 0) return void 0;
99781
100047
  const value = raw2.trim().toLowerCase();
99782
100048
  if (value === "1" || value === "true") return true;
@@ -99785,7 +100051,7 @@ function boolAttribute(context, element, name) {
99785
100051
  return void 0;
99786
100052
  }
99787
100053
  function numberAttribute(context, element, name) {
99788
- const raw2 = attribute5(element, name);
100054
+ const raw2 = attribute6(element, name);
99789
100055
  if (!element || raw2 === void 0) return void 0;
99790
100056
  const value = raw2.trim() ? Number(raw2) : Number.NaN;
99791
100057
  if (Number.isFinite(value)) return value;
@@ -99795,11 +100061,11 @@ function numberAttribute(context, element, name) {
99795
100061
  function indexAttribute(context, element, name) {
99796
100062
  const value = numberAttribute(context, element, name);
99797
100063
  if (value === void 0 || Number.isInteger(value) && value >= 0) return value;
99798
- malformed2(context, path2(element, name), attribute5(element, name) ?? "");
100064
+ malformed2(context, path2(element, name), attribute6(element, name) ?? "");
99799
100065
  return void 0;
99800
100066
  }
99801
100067
  function autoNumberAttribute(context, element, name) {
99802
- return attribute5(element, name)?.trim() === "auto" ? "auto" : numberAttribute(context, element, name);
100068
+ return attribute6(element, name)?.trim() === "auto" ? "auto" : numberAttribute(context, element, name);
99803
100069
  }
99804
100070
  function reportUnmodelled2(context, element, handled) {
99805
100071
  for (const child31 of elements(element)) {
@@ -99830,9 +100096,9 @@ function lines(parent, local) {
99830
100096
  }
99831
100097
  function numberFormat2(parent) {
99832
100098
  const element = cxChild(parent, "numFmt");
99833
- const formatCode2 = attribute5(element, "formatCode");
100099
+ const formatCode2 = attribute6(element, "formatCode");
99834
100100
  if (formatCode2 === void 0) return void 0;
99835
- const linked = attribute5(element, "sourceLinked");
100101
+ const linked = attribute6(element, "sourceLinked");
99836
100102
  return {
99837
100103
  formatCode: formatCode2,
99838
100104
  ...linked === "1" || linked === "true" ? { sourceLinked: true } : {},
@@ -99843,7 +100109,7 @@ function formula(parent, local) {
99843
100109
  const element = cxChild(parent, local);
99844
100110
  if (!element) return void 0;
99845
100111
  const out = { formula: element.textContent ?? "" };
99846
- const direction = attribute5(element, "dir");
100112
+ const direction = attribute6(element, "dir");
99847
100113
  if (direction !== void 0) out.direction = direction;
99848
100114
  return out;
99849
100115
  }
@@ -99877,8 +100143,8 @@ function parseLevel(context, element) {
99877
100143
  { points: points7 },
99878
100144
  {
99879
100145
  pointCount: indexAttribute(context, element, "ptCount"),
99880
- formatCode: attribute5(element, "formatCode"),
99881
- name: attribute5(element, "name"),
100146
+ formatCode: attribute6(element, "formatCode"),
100147
+ name: attribute6(element, "name"),
99882
100148
  extLst: extensionList2(element)
99883
100149
  }
99884
100150
  );
@@ -99891,7 +100157,7 @@ function parseDimension(context, element) {
99891
100157
  levels: cxChildren(element, "lvl").map((level2) => parseLevel(context, level2))
99892
100158
  },
99893
100159
  {
99894
- type: attribute5(element, "type"),
100160
+ type: attribute6(element, "type"),
99895
100161
  formula: formula(element, "f"),
99896
100162
  nameFormula: formula(element, "nf"),
99897
100163
  extLst: extensionList2(element)
@@ -99948,8 +100214,8 @@ function parseTitle2(context, element) {
99948
100214
  tx: parseText2(context, cxChild(element, "tx")),
99949
100215
  spPr: shapeProperties2(element),
99950
100216
  txPr: textProperties2(element),
99951
- position: attribute5(element, "pos"),
99952
- align: attribute5(element, "align"),
100217
+ position: attribute6(element, "pos"),
100218
+ align: attribute6(element, "align"),
99953
100219
  overlay: boolAttribute(context, element, "overlay"),
99954
100220
  extLst: extensionList2(element)
99955
100221
  }
@@ -99960,8 +100226,8 @@ function parseLegend2(context, element) {
99960
100226
  return assignDefined(
99961
100227
  {},
99962
100228
  {
99963
- position: attribute5(element, "pos"),
99964
- align: attribute5(element, "align"),
100229
+ position: attribute6(element, "pos"),
100230
+ align: attribute6(element, "align"),
99965
100231
  overlay: boolAttribute(context, element, "overlay"),
99966
100232
  spPr: shapeProperties2(element),
99967
100233
  txPr: textProperties2(element),
@@ -100010,7 +100276,7 @@ function parseUnits(context, element) {
100010
100276
  return assignDefined(
100011
100277
  {},
100012
100278
  {
100013
- unit: attribute5(element, "unit"),
100279
+ unit: attribute6(element, "unit"),
100014
100280
  label: label ? parseTitle2(context, label) : void 0,
100015
100281
  extLst: extensionList2(element)
100016
100282
  }
@@ -100061,7 +100327,7 @@ var init_parse_axis = __esm({
100061
100327
  "txPr",
100062
100328
  "extLst"
100063
100329
  ]);
100064
- tickMarks = (element) => element ? assignDefined({}, { type: attribute5(element, "type") }) : void 0;
100330
+ tickMarks = (element) => element ? assignDefined({}, { type: attribute6(element, "type") }) : void 0;
100065
100331
  }
100066
100332
  });
100067
100333
 
@@ -100080,7 +100346,7 @@ function labelVisibility(context, element) {
100080
100346
  function labelOptions2(context, element) {
100081
100347
  const separator = cxChild(element, "separator");
100082
100348
  return {
100083
- position: attribute5(element, "pos"),
100349
+ position: attribute6(element, "pos"),
100084
100350
  numberFormat: numberFormat2(element),
100085
100351
  spPr: shapeProperties2(element),
100086
100352
  txPr: textProperties2(element),
@@ -100113,7 +100379,7 @@ function parseBinning(context, element) {
100113
100379
  return assignDefined(
100114
100380
  {},
100115
100381
  {
100116
- intervalClosed: attribute5(element, "intervalClosed"),
100382
+ intervalClosed: attribute6(element, "intervalClosed"),
100117
100383
  underflow: autoNumberAttribute(context, element, "underflow"),
100118
100384
  overflow: autoNumberAttribute(context, element, "overflow"),
100119
100385
  binSize: scalar4("binSize"),
@@ -100126,11 +100392,11 @@ function parseGeography(context, element) {
100126
100392
  return assignDefined(
100127
100393
  {},
100128
100394
  {
100129
- projectionType: attribute5(element, "projectionType"),
100130
- viewedRegionType: attribute5(element, "viewedRegionType"),
100131
- cultureLanguage: attribute5(element, "cultureLanguage"),
100132
- cultureRegion: attribute5(element, "cultureRegion"),
100133
- attribution: attribute5(element, "attribution"),
100395
+ projectionType: attribute6(element, "projectionType"),
100396
+ viewedRegionType: attribute6(element, "viewedRegionType"),
100397
+ cultureLanguage: attribute6(element, "cultureLanguage"),
100398
+ cultureRegion: attribute6(element, "cultureRegion"),
100399
+ attribution: attribute6(element, "attribution"),
100134
100400
  geoCacheXml: rawChild2(element, "geoCache"),
100135
100401
  extLst: extensionList2(element)
100136
100402
  }
@@ -100146,8 +100412,8 @@ function parseLayout(context, element) {
100146
100412
  return assignDefined(
100147
100413
  {},
100148
100414
  {
100149
- parentLabelLayout: attribute5(cxChild(element, "parentLabelLayout"), "val"),
100150
- regionLabelLayout: attribute5(cxChild(element, "regionLabelLayout"), "val"),
100415
+ parentLabelLayout: attribute6(cxChild(element, "parentLabelLayout"), "val"),
100416
+ regionLabelLayout: attribute6(cxChild(element, "regionLabelLayout"), "val"),
100151
100417
  visibility: visibility ? assignDefined(
100152
100418
  {},
100153
100419
  Object.fromEntries(
@@ -100159,7 +100425,7 @@ function parseLayout(context, element) {
100159
100425
  geography: geography ? parseGeography(context, geography) : void 0,
100160
100426
  statistics: statistics ? assignDefined(
100161
100427
  {},
100162
- { quartileMethod: attribute5(statistics, "quartileMethod") }
100428
+ { quartileMethod: attribute6(statistics, "quartileMethod") }
100163
100429
  ) : void 0,
100164
100430
  subtotals: subtotals ? cxChildren(subtotals, "idx").map((idx) => indexAttribute(context, idx, "val")).filter((index2) => index2 !== void 0) : void 0,
100165
100431
  extLst: extensionList2(element)
@@ -100184,11 +100450,11 @@ function parseSeries2(context, element) {
100184
100450
  const layout = cxChild(element, "layoutPr");
100185
100451
  const axisIds = cxChildren(element, "axisId").map((axis) => indexAttribute(context, axis, "val")).filter((id) => id !== void 0);
100186
100452
  return assignDefined(
100187
- { layoutId: attribute5(element, "layoutId") ?? "", dataPoints, axisIds },
100453
+ { layoutId: attribute6(element, "layoutId") ?? "", dataPoints, axisIds },
100188
100454
  {
100189
100455
  hidden: boolAttribute(context, element, "hidden"),
100190
100456
  ownerIndex: numberAttribute(context, element, "ownerIdx"),
100191
- uniqueId: attribute5(element, "uniqueId"),
100457
+ uniqueId: attribute6(element, "uniqueId"),
100192
100458
  formatIndex: numberAttribute(context, element, "formatIdx"),
100193
100459
  tx: parseText2(context, cxChild(element, "tx")),
100194
100460
  spPr: shapeProperties2(element),
@@ -103918,254 +104184,6 @@ var init_modern_comment_fields = __esm({
103918
104184
  }
103919
104185
  });
103920
104186
 
103921
- // pptx/core/utils/modern-comment-mention-read.ts
103922
- function readCommentMentions(node2, authorName) {
103923
- if (!node2) {
103924
- return void 0;
103925
- }
103926
- const found = [];
103927
- for (const list3 of mentionChildrenNamed(node2, "mentionLst")) {
103928
- for (const entry2 of mentionChildrenNamed(list3, "mention")) {
103929
- const mention = readMention(entry2, authorName);
103930
- if (mention) {
103931
- found.push(mention);
103932
- }
103933
- }
103934
- }
103935
- for (const extension of mentionChildrenNamed(mentionChildrenNamed(node2, "extLst")[0], "ext")) {
103936
- const uri = String(extension["@_uri"] || "");
103937
- for (const list3 of mentionChildrenNamed(extension, "mentionLst")) {
103938
- for (const entry2 of mentionChildrenNamed(list3, "mention")) {
103939
- const mention = readMention(entry2, authorName, uri);
103940
- if (mention) {
103941
- found.push(mention);
103942
- }
103943
- }
103944
- }
103945
- }
103946
- found.sort((a, b) => a.startIndex - b.startIndex);
103947
- return found.length > 0 ? found : void 0;
103948
- }
103949
- var mentionLocalName, mentionNodesOf, mentionChildrenNamed, MENTION_PERSON_KEYS, MENTION_LENGTH_KEYS, attribute6, integer3, readMention;
103950
- var init_modern_comment_mention_read = __esm({
103951
- "pptx/core/utils/modern-comment-mention-read.ts"() {
103952
- mentionLocalName = (key2) => key2.split(":").pop() || key2;
103953
- mentionNodesOf = (value) => {
103954
- if (Array.isArray(value)) {
103955
- return value.filter((entry2) => Boolean(entry2) && typeof entry2 === "object");
103956
- }
103957
- return value && typeof value === "object" ? [value] : [];
103958
- };
103959
- mentionChildrenNamed = (node2, name) => {
103960
- if (!node2) {
103961
- return [];
103962
- }
103963
- const result = [];
103964
- for (const [key2, value] of Object.entries(node2)) {
103965
- if (!key2.startsWith("@_") && mentionLocalName(key2) === name) {
103966
- result.push(...mentionNodesOf(value));
103967
- }
103968
- }
103969
- return result;
103970
- };
103971
- MENTION_PERSON_KEYS = [
103972
- "@_mentionpersonId",
103973
- "@_mentionPersonId",
103974
- "@_personId",
103975
- "@_authorId"
103976
- ];
103977
- MENTION_LENGTH_KEYS = ["@_length", "@_mentionCharCount", "@_len"];
103978
- attribute6 = (node2, keys) => {
103979
- for (const key2 of keys) {
103980
- const value = node2[key2];
103981
- if (value !== void 0 && value !== null && String(value).length > 0) {
103982
- return String(value);
103983
- }
103984
- }
103985
- return void 0;
103986
- };
103987
- integer3 = (value) => {
103988
- if (value === void 0) {
103989
- return void 0;
103990
- }
103991
- const parsed = Number.parseInt(value, 10);
103992
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : void 0;
103993
- };
103994
- readMention = (node2, authorName, containerUri) => {
103995
- const personId = attribute6(node2, MENTION_PERSON_KEYS);
103996
- const startIndex = integer3(attribute6(node2, ["@_startIndex"]));
103997
- const length = integer3(attribute6(node2, MENTION_LENGTH_KEYS));
103998
- if (!personId || startIndex === void 0 || length === void 0 || length === 0) {
103999
- return void 0;
104000
- }
104001
- return {
104002
- personId,
104003
- startIndex,
104004
- length,
104005
- id: attribute6(node2, ["@_mentionId", "@_id"]),
104006
- authorName: authorName(personId),
104007
- containerUri,
104008
- rawXml: node2
104009
- };
104010
- };
104011
- }
104012
- });
104013
-
104014
- // pptx/core/utils/modern-comment-mentions.ts
104015
- function rebaseCommentMentions(mentions, oldText, newText) {
104016
- if (!mentions || mentions.length === 0) {
104017
- return void 0;
104018
- }
104019
- if (oldText === newText) {
104020
- return mentions;
104021
- }
104022
- const prefix = commonPrefixLength(oldText, newText);
104023
- const suffix = commonSuffixLength(
104024
- oldText,
104025
- newText,
104026
- Math.min(oldText.length, newText.length) - prefix
104027
- );
104028
- const changeEnd = oldText.length - suffix;
104029
- const delta2 = newText.length - oldText.length;
104030
- const result = [];
104031
- for (const mention of mentions) {
104032
- const start = mention.startIndex;
104033
- const end = start + mention.length;
104034
- const span = oldText.slice(start, end);
104035
- if (span.length !== mention.length) {
104036
- continue;
104037
- }
104038
- let next = -1;
104039
- if (end <= prefix) {
104040
- next = start;
104041
- } else if (start >= changeEnd) {
104042
- next = start + delta2;
104043
- }
104044
- if (next >= 0 && newText.slice(next, next + mention.length) === span) {
104045
- result.push(next === start ? mention : { ...mention, startIndex: next });
104046
- continue;
104047
- }
104048
- const relocated = nearestOccurrence(newText, span, next >= 0 ? next : start);
104049
- if (relocated >= 0) {
104050
- result.push({ ...mention, startIndex: relocated });
104051
- }
104052
- }
104053
- return result.length > 0 ? result : void 0;
104054
- }
104055
- function buildMentionListNode(mentions) {
104056
- if (!mentions || mentions.length === 0) {
104057
- return void 0;
104058
- }
104059
- return { "p188:mention": mentions.map(buildMention) };
104060
- }
104061
- function applyCommentMentions(node2, mentions, extension, replace) {
104062
- if (!replace) {
104063
- return extension;
104064
- }
104065
- const { direct, byUri } = groupByContainer(mentions);
104066
- const directList = buildMentionListNode(direct);
104067
- if (directList) {
104068
- node2["p188:mentionLst"] = directList;
104069
- }
104070
- if (!extension) {
104071
- return void 0;
104072
- }
104073
- const rebuilt = stripMentionLists(extension);
104074
- const extensionKey = Object.keys(rebuilt).find((key2) => mentionLocalName(key2) === "ext") || "p188:ext";
104075
- const entries = mentionNodesOf(rebuilt[extensionKey]).map((entry2) => {
104076
- const list3 = buildMentionListNode(byUri.get(String(entry2["@_uri"] || "")));
104077
- const next = stripMentionLists(entry2);
104078
- if (list3) {
104079
- next["p188:mentionLst"] = list3;
104080
- }
104081
- return next;
104082
- });
104083
- if (entries.length > 0) {
104084
- rebuilt[extensionKey] = entries.length === 1 ? entries[0] : entries;
104085
- }
104086
- return rebuilt;
104087
- }
104088
- var commonPrefixLength, commonSuffixLength, nearestOccurrence, buildMention, stripMentionLists, groupByContainer;
104089
- var init_modern_comment_mentions = __esm({
104090
- "pptx/core/utils/modern-comment-mentions.ts"() {
104091
- init_modern_comment_mention_read();
104092
- init_modern_comment_mention_read();
104093
- commonPrefixLength = (a, b) => {
104094
- const max = Math.min(a.length, b.length);
104095
- let index2 = 0;
104096
- while (index2 < max && a[index2] === b[index2]) {
104097
- index2 += 1;
104098
- }
104099
- return index2;
104100
- };
104101
- commonSuffixLength = (a, b, limit) => {
104102
- let index2 = 0;
104103
- while (index2 < limit && a[a.length - 1 - index2] === b[b.length - 1 - index2]) {
104104
- index2 += 1;
104105
- }
104106
- return index2;
104107
- };
104108
- nearestOccurrence = (text2, span, hint) => {
104109
- let best = -1;
104110
- let bestDistance = Number.POSITIVE_INFINITY;
104111
- let at2 = text2.indexOf(span);
104112
- while (at2 !== -1) {
104113
- const distance = Math.abs(at2 - hint);
104114
- if (distance < bestDistance) {
104115
- best = at2;
104116
- bestDistance = distance;
104117
- }
104118
- at2 = text2.indexOf(span, at2 + 1);
104119
- }
104120
- return best;
104121
- };
104122
- buildMention = (mention) => {
104123
- const node2 = {};
104124
- for (const [key2, value] of Object.entries(mention.rawXml || {})) {
104125
- if (key2.startsWith("@_")) {
104126
- node2[key2] = value;
104127
- }
104128
- }
104129
- const personKey = MENTION_PERSON_KEYS.find((key2) => node2[key2] !== void 0) || "@_mentionpersonId";
104130
- const lengthKey = MENTION_LENGTH_KEYS.find((key2) => node2[key2] !== void 0) || "@_length";
104131
- node2[personKey] = mention.personId;
104132
- node2[lengthKey] = String(mention.length);
104133
- node2["@_startIndex"] = String(mention.startIndex);
104134
- if (mention.id) {
104135
- const idKey = node2["@_id"] !== void 0 && node2["@_mentionId"] === void 0 ? "@_id" : "@_mentionId";
104136
- node2[idKey] = mention.id;
104137
- }
104138
- return node2;
104139
- };
104140
- stripMentionLists = (node2) => {
104141
- const result = {};
104142
- for (const [key2, value] of Object.entries(node2)) {
104143
- if (key2.startsWith("@_") || mentionLocalName(key2) !== "mentionLst") {
104144
- result[key2] = value;
104145
- }
104146
- }
104147
- return result;
104148
- };
104149
- groupByContainer = (mentions) => {
104150
- const direct = [];
104151
- const byUri = /* @__PURE__ */ new Map();
104152
- for (const mention of mentions || []) {
104153
- if (!mention.containerUri) {
104154
- direct.push(mention);
104155
- continue;
104156
- }
104157
- const bucket = byUri.get(mention.containerUri);
104158
- if (bucket) {
104159
- bucket.push(mention);
104160
- } else {
104161
- byUri.set(mention.containerUri, [mention]);
104162
- }
104163
- }
104164
- return { direct, byUri };
104165
- };
104166
- }
104167
- });
104168
-
104169
104187
  // pptx/core/utils/modern-comment-text-body.ts
104170
104188
  function flattenBodyText(node2) {
104171
104189
  if (!node2) {
@@ -104559,7 +104577,13 @@ var init_modern_comment_xml = __esm({
104559
104577
  const originalBody = child23(raw2, "txBody");
104560
104578
  node2["p188:txBody"] = applyModernCommentText(originalBody, comment.text);
104561
104579
  const originalText = originalBody ? flattenBodyText(originalBody).join("\n") : comment.text;
104562
- const mentions = rebaseCommentMentions(comment.mentions, originalText, comment.text);
104580
+ const loadedMentions = raw2 ? readCommentMentions(raw2, () => void 0) : void 0;
104581
+ const mentions = rebaseCommentMentions(
104582
+ comment.mentions,
104583
+ originalText,
104584
+ comment.text,
104585
+ loadedMentions ?? []
104586
+ );
104563
104587
  const extension = applyCommentMentions(node2, mentions, child23(raw2, "extLst"), ownsMentions);
104564
104588
  if (extension) {
104565
104589
  node2["p188:extLst"] = extension;