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
@@ -51029,6 +51029,272 @@ var init_chart_data_sheet = __esm({
51029
51029
  }
51030
51030
  });
51031
51031
 
51032
+ // pptx/core/utils/modern-comment-mention-read.ts
51033
+ function readCommentMentions(node, authorName) {
51034
+ if (!node) {
51035
+ return void 0;
51036
+ }
51037
+ const found = [];
51038
+ for (const list3 of mentionChildrenNamed(node, "mentionLst")) {
51039
+ for (const entry2 of mentionChildrenNamed(list3, "mention")) {
51040
+ const mention = readMention(entry2, authorName);
51041
+ if (mention) {
51042
+ found.push(mention);
51043
+ }
51044
+ }
51045
+ }
51046
+ for (const extension of mentionChildrenNamed(mentionChildrenNamed(node, "extLst")[0], "ext")) {
51047
+ const uri = String(extension["@_uri"] || "");
51048
+ for (const list3 of mentionChildrenNamed(extension, "mentionLst")) {
51049
+ for (const entry2 of mentionChildrenNamed(list3, "mention")) {
51050
+ const mention = readMention(entry2, authorName, uri);
51051
+ if (mention) {
51052
+ found.push(mention);
51053
+ }
51054
+ }
51055
+ }
51056
+ }
51057
+ found.sort((a, b) => a.startIndex - b.startIndex);
51058
+ return found.length > 0 ? found : void 0;
51059
+ }
51060
+ var mentionLocalName, mentionNodesOf, mentionChildrenNamed, MENTION_PERSON_KEYS, MENTION_LENGTH_KEYS, attribute3, integer2, readMention;
51061
+ var init_modern_comment_mention_read = __esm({
51062
+ "pptx/core/utils/modern-comment-mention-read.ts"() {
51063
+ mentionLocalName = (key2) => key2.split(":").pop() || key2;
51064
+ mentionNodesOf = (value) => {
51065
+ if (Array.isArray(value)) {
51066
+ return value.filter((entry2) => Boolean(entry2) && typeof entry2 === "object");
51067
+ }
51068
+ return value && typeof value === "object" ? [value] : [];
51069
+ };
51070
+ mentionChildrenNamed = (node, name) => {
51071
+ if (!node) {
51072
+ return [];
51073
+ }
51074
+ const result = [];
51075
+ for (const [key2, value] of Object.entries(node)) {
51076
+ if (!key2.startsWith("@_") && mentionLocalName(key2) === name) {
51077
+ result.push(...mentionNodesOf(value));
51078
+ }
51079
+ }
51080
+ return result;
51081
+ };
51082
+ MENTION_PERSON_KEYS = [
51083
+ "@_mentionpersonId",
51084
+ "@_mentionPersonId",
51085
+ "@_personId",
51086
+ "@_authorId"
51087
+ ];
51088
+ MENTION_LENGTH_KEYS = ["@_length", "@_mentionCharCount", "@_len"];
51089
+ attribute3 = (node, keys) => {
51090
+ for (const key2 of keys) {
51091
+ const value = node[key2];
51092
+ if (value !== void 0 && value !== null && String(value).length > 0) {
51093
+ return String(value);
51094
+ }
51095
+ }
51096
+ return void 0;
51097
+ };
51098
+ integer2 = (value) => {
51099
+ if (value === void 0) {
51100
+ return void 0;
51101
+ }
51102
+ const parsed = Number.parseInt(value, 10);
51103
+ return Number.isFinite(parsed) && parsed >= 0 ? parsed : void 0;
51104
+ };
51105
+ readMention = (node, authorName, containerUri) => {
51106
+ const personId = attribute3(node, MENTION_PERSON_KEYS);
51107
+ const startIndex = integer2(attribute3(node, ["@_startIndex"]));
51108
+ const length = integer2(attribute3(node, MENTION_LENGTH_KEYS));
51109
+ if (!personId || startIndex === void 0 || length === void 0 || length === 0) {
51110
+ return void 0;
51111
+ }
51112
+ return {
51113
+ personId,
51114
+ startIndex,
51115
+ length,
51116
+ id: attribute3(node, ["@_mentionId", "@_id"]),
51117
+ authorName: authorName(personId),
51118
+ containerUri,
51119
+ rawXml: node
51120
+ };
51121
+ };
51122
+ }
51123
+ });
51124
+
51125
+ // pptx/core/utils/modern-comment-mentions.ts
51126
+ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
51127
+ if (!mentions || mentions.length === 0) {
51128
+ return void 0;
51129
+ }
51130
+ if (oldText === newText) {
51131
+ return mentions;
51132
+ }
51133
+ const prefix = commonPrefixLength(oldText, newText);
51134
+ const suffix = commonSuffixLength(
51135
+ oldText,
51136
+ newText,
51137
+ Math.min(oldText.length, newText.length) - prefix
51138
+ );
51139
+ const changeEnd = oldText.length - suffix;
51140
+ const delta2 = newText.length - oldText.length;
51141
+ const result = [];
51142
+ for (const mention of mentions) {
51143
+ const start = mention.startIndex;
51144
+ const end = start + mention.length;
51145
+ const coverage = loaded ? loadedCoverage(mention, loaded, oldText) : [];
51146
+ if (coverage === void 0 || coverage.includes(newText.slice(start, end))) {
51147
+ if (start >= 0 && mention.length > 0 && end <= newText.length) {
51148
+ result.push(mention);
51149
+ }
51150
+ continue;
51151
+ }
51152
+ const span = oldText.slice(start, end);
51153
+ if (span.length !== mention.length) {
51154
+ continue;
51155
+ }
51156
+ let next = -1;
51157
+ if (end <= prefix) {
51158
+ next = start;
51159
+ } else if (start >= changeEnd) {
51160
+ next = start + delta2;
51161
+ }
51162
+ if (next >= 0 && newText.slice(next, next + mention.length) === span) {
51163
+ result.push(next === start ? mention : { ...mention, startIndex: next });
51164
+ continue;
51165
+ }
51166
+ const relocated = nearestOccurrence(newText, span, next >= 0 ? next : start);
51167
+ if (relocated >= 0) {
51168
+ result.push({ ...mention, startIndex: relocated });
51169
+ }
51170
+ }
51171
+ return result.length > 0 ? result : void 0;
51172
+ }
51173
+ function buildMentionListNode(mentions) {
51174
+ if (!mentions || mentions.length === 0) {
51175
+ return void 0;
51176
+ }
51177
+ return { "p188:mention": mentions.map(buildMention) };
51178
+ }
51179
+ function applyCommentMentions(node, mentions, extension, replace) {
51180
+ if (!replace) {
51181
+ return extension;
51182
+ }
51183
+ const { direct, byUri } = groupByContainer(mentions);
51184
+ const directList = buildMentionListNode(direct);
51185
+ if (directList) {
51186
+ node["p188:mentionLst"] = directList;
51187
+ }
51188
+ if (!extension) {
51189
+ return void 0;
51190
+ }
51191
+ const rebuilt = stripMentionLists(extension);
51192
+ const extensionKey = Object.keys(rebuilt).find((key2) => mentionLocalName(key2) === "ext") || "p188:ext";
51193
+ const entries = mentionNodesOf(rebuilt[extensionKey]).map((entry2) => {
51194
+ const list3 = buildMentionListNode(byUri.get(String(entry2["@_uri"] || "")));
51195
+ const next = stripMentionLists(entry2);
51196
+ if (list3) {
51197
+ next["p188:mentionLst"] = list3;
51198
+ }
51199
+ return next;
51200
+ });
51201
+ if (entries.length > 0) {
51202
+ rebuilt[extensionKey] = entries.length === 1 ? entries[0] : entries;
51203
+ }
51204
+ return rebuilt;
51205
+ }
51206
+ var commonPrefixLength, commonSuffixLength, nearestOccurrence, loadedCoverage, buildMention, stripMentionLists, groupByContainer;
51207
+ var init_modern_comment_mentions = __esm({
51208
+ "pptx/core/utils/modern-comment-mentions.ts"() {
51209
+ init_modern_comment_mention_read();
51210
+ init_modern_comment_mention_read();
51211
+ commonPrefixLength = (a, b) => {
51212
+ const max = Math.min(a.length, b.length);
51213
+ let index = 0;
51214
+ while (index < max && a[index] === b[index]) {
51215
+ index += 1;
51216
+ }
51217
+ return index;
51218
+ };
51219
+ commonSuffixLength = (a, b, limit) => {
51220
+ let index = 0;
51221
+ while (index < limit && a[a.length - 1 - index] === b[b.length - 1 - index]) {
51222
+ index += 1;
51223
+ }
51224
+ return index;
51225
+ };
51226
+ nearestOccurrence = (text2, span, hint) => {
51227
+ let best = -1;
51228
+ let bestDistance = Number.POSITIVE_INFINITY;
51229
+ let at2 = text2.indexOf(span);
51230
+ while (at2 !== -1) {
51231
+ const distance = Math.abs(at2 - hint);
51232
+ if (distance < bestDistance) {
51233
+ best = at2;
51234
+ bestDistance = distance;
51235
+ }
51236
+ at2 = text2.indexOf(span, at2 + 1);
51237
+ }
51238
+ return best;
51239
+ };
51240
+ loadedCoverage = (mention, loaded, oldText) => {
51241
+ const records = loaded.filter(
51242
+ (record2) => mention.id ? record2.id === mention.id : !record2.id && record2.personId === mention.personId && record2.length === mention.length
51243
+ );
51244
+ if (records.length === 0) {
51245
+ return void 0;
51246
+ }
51247
+ return records.map(
51248
+ (record2) => oldText.slice(record2.startIndex, record2.startIndex + record2.length)
51249
+ );
51250
+ };
51251
+ buildMention = (mention) => {
51252
+ const node = {};
51253
+ for (const [key2, value] of Object.entries(mention.rawXml || {})) {
51254
+ if (key2.startsWith("@_")) {
51255
+ node[key2] = value;
51256
+ }
51257
+ }
51258
+ const personKey = MENTION_PERSON_KEYS.find((key2) => node[key2] !== void 0) || "@_mentionpersonId";
51259
+ const lengthKey = MENTION_LENGTH_KEYS.find((key2) => node[key2] !== void 0) || "@_length";
51260
+ node[personKey] = mention.personId;
51261
+ node[lengthKey] = String(mention.length);
51262
+ node["@_startIndex"] = String(mention.startIndex);
51263
+ if (mention.id) {
51264
+ const idKey = node["@_id"] !== void 0 && node["@_mentionId"] === void 0 ? "@_id" : "@_mentionId";
51265
+ node[idKey] = mention.id;
51266
+ }
51267
+ return node;
51268
+ };
51269
+ stripMentionLists = (node) => {
51270
+ const result = {};
51271
+ for (const [key2, value] of Object.entries(node)) {
51272
+ if (key2.startsWith("@_") || mentionLocalName(key2) !== "mentionLst") {
51273
+ result[key2] = value;
51274
+ }
51275
+ }
51276
+ return result;
51277
+ };
51278
+ groupByContainer = (mentions) => {
51279
+ const direct = [];
51280
+ const byUri = /* @__PURE__ */ new Map();
51281
+ for (const mention of mentions || []) {
51282
+ if (!mention.containerUri) {
51283
+ direct.push(mention);
51284
+ continue;
51285
+ }
51286
+ const bucket = byUri.get(mention.containerUri);
51287
+ if (bucket) {
51288
+ bucket.push(mention);
51289
+ } else {
51290
+ byUri.set(mention.containerUri, [mention]);
51291
+ }
51292
+ }
51293
+ return { direct, byUri };
51294
+ };
51295
+ }
51296
+ });
51297
+
51032
51298
  // pptx/core/utils/index.ts
51033
51299
  var init_utils = __esm({
51034
51300
  "pptx/core/utils/index.ts"() {
@@ -58758,7 +59024,7 @@ var init_effect_style_extractor_fill_overlay = __esm({
58758
59024
  });
58759
59025
 
58760
59026
  // pptx/core/core/builders/effect-style-extractor-reflection.ts
58761
- function integer2(value) {
59027
+ function integer3(value) {
58762
59028
  if (value === void 0 || value === null || value === "") {
58763
59029
  return void 0;
58764
59030
  }
@@ -58775,19 +59041,19 @@ function boolean2(value) {
58775
59041
  return void 0;
58776
59042
  }
58777
59043
  function fixedFraction(value) {
58778
- const parsed = integer2(value);
59044
+ const parsed = integer3(value);
58779
59045
  return parsed !== void 0 && parsed >= 0 && parsed <= 1e5 ? parsed / 1e5 : void 0;
58780
59046
  }
58781
59047
  function extractReflectionAttributes(node, emuPerPx) {
58782
- const blur = integer2(node["@_blurRad"]);
58783
- const distance = integer2(node["@_dist"]);
58784
- const startOpacity = integer2(node["@_stA"]);
58785
- const endOpacity = integer2(node["@_endA"]);
58786
- const startPosition = integer2(node["@_stPos"]);
58787
- const endPosition = integer2(node["@_endPos"]);
58788
- const direction = integer2(node["@_dir"]);
58789
- const rotation = integer2(node["@_rot"]);
58790
- const fadeDirection = integer2(node["@_fadeDir"]);
59048
+ const blur = integer3(node["@_blurRad"]);
59049
+ const distance = integer3(node["@_dist"]);
59050
+ const startOpacity = integer3(node["@_stA"]);
59051
+ const endOpacity = integer3(node["@_endA"]);
59052
+ const startPosition = integer3(node["@_stPos"]);
59053
+ const endPosition = integer3(node["@_endPos"]);
59054
+ const direction = integer3(node["@_dir"]);
59055
+ const rotation = integer3(node["@_rot"]);
59056
+ const fadeDirection = integer3(node["@_fadeDir"]);
58791
59057
  const alignment = String(node["@_algn"] ?? "").trim();
58792
59058
  return {
58793
59059
  reflectionBlurRadius: blur !== void 0 && blur >= 0 ? blur / emuPerPx : void 0,
@@ -58799,10 +59065,10 @@ function extractReflectionAttributes(node, emuPerPx) {
58799
59065
  reflectionRotation: rotation !== void 0 ? rotation / 6e4 : void 0,
58800
59066
  reflectionDistance: distance !== void 0 && distance >= 0 ? distance / emuPerPx : void 0,
58801
59067
  reflectionFadeDirection: fadeDirection !== void 0 ? fadeDirection / 6e4 : void 0,
58802
- reflectionScaleX: integer2(node["@_sx"]),
58803
- reflectionScaleY: integer2(node["@_sy"]),
58804
- reflectionSkewX: integer2(node["@_kx"]),
58805
- reflectionSkewY: integer2(node["@_ky"]),
59068
+ reflectionScaleX: integer3(node["@_sx"]),
59069
+ reflectionScaleY: integer3(node["@_sy"]),
59070
+ reflectionSkewX: integer3(node["@_kx"]),
59071
+ reflectionSkewY: integer3(node["@_ky"]),
58806
59072
  reflectionAlignment: VALID_ALIGNMENTS.has(alignment) ? alignment : void 0,
58807
59073
  reflectionRotateWithShape: boolean2(node["@_rotWithShape"])
58808
59074
  };
@@ -92868,7 +93134,7 @@ function malformed(context, element, value) {
92868
93134
  function cBool(context, parent, local) {
92869
93135
  const element = cChild(parent, local);
92870
93136
  if (!element) return void 0;
92871
- const raw2 = attribute3(element, "val");
93137
+ const raw2 = attribute4(element, "val");
92872
93138
  if (raw2 === void 0) return true;
92873
93139
  const value = raw2.trim().toLowerCase();
92874
93140
  if (value === "1" || value === "true") return true;
@@ -92878,7 +93144,7 @@ function cBool(context, parent, local) {
92878
93144
  }
92879
93145
  function cNumber(context, parent, local) {
92880
93146
  const element = cChild(parent, local);
92881
- const raw2 = attribute3(element, "val");
93147
+ const raw2 = attribute4(element, "val");
92882
93148
  if (!element || raw2 === void 0) return void 0;
92883
93149
  const value = raw2.trim() ? Number(raw2) : Number.NaN;
92884
93150
  if (Number.isFinite(value)) return value;
@@ -92887,7 +93153,7 @@ function cNumber(context, parent, local) {
92887
93153
  }
92888
93154
  function cEnum(context, parent, local, allowed) {
92889
93155
  const element = cChild(parent, local);
92890
- const raw2 = attribute3(element, "val");
93156
+ const raw2 = attribute4(element, "val");
92891
93157
  if (!element || raw2 === void 0) return void 0;
92892
93158
  if (allowed.includes(raw2)) return raw2;
92893
93159
  malformed(context, element, raw2);
@@ -92944,9 +93210,9 @@ function chartLines(parent, local) {
92944
93210
  }
92945
93211
  function numberFormat(parent) {
92946
93212
  const element = cChild(parent, "numFmt");
92947
- const formatCode2 = attribute3(element, "formatCode");
93213
+ const formatCode2 = attribute4(element, "formatCode");
92948
93214
  if (formatCode2 === void 0) return void 0;
92949
- const linked = attribute3(element, "sourceLinked");
93215
+ const linked = attribute4(element, "sourceLinked");
92950
93216
  return {
92951
93217
  formatCode: formatCode2,
92952
93218
  ...linked === "1" || linked === "true" ? { sourceLinked: true } : {},
@@ -92970,7 +93236,7 @@ function assignDefined(target, values) {
92970
93236
  if (value !== void 0) target[key2] = value;
92971
93237
  return target;
92972
93238
  }
92973
- var cChild, attribute3, cVal, path, textProperties;
93239
+ var cChild, attribute4, cVal, path, textProperties;
92974
93240
  var init_parse_util = __esm({
92975
93241
  "chart/parse-util.ts"() {
92976
93242
  init_xml2();
@@ -92979,8 +93245,8 @@ var init_parse_util = __esm({
92979
93245
  init_manual_layout();
92980
93246
  init_xml_fragment();
92981
93247
  cChild = (parent, local) => first(parent, local, NS.c);
92982
- attribute3 = (element, name) => element?.hasAttribute(name) ? element.getAttribute(name) ?? void 0 : void 0;
92983
- cVal = (parent, local) => attribute3(cChild(parent, local), "val");
93248
+ attribute4 = (element, name) => element?.hasAttribute(name) ? element.getAttribute(name) ?? void 0 : void 0;
93249
+ cVal = (parent, local) => attribute4(cChild(parent, local), "val");
92984
93250
  path = (element) => `c:${element.parentNode?.localName ?? ""}/c:${element.localName}`;
92985
93251
  textProperties = (parent) => chartTextBody(cChild(parent, "txPr"));
92986
93252
  }
@@ -92992,9 +93258,9 @@ function parseCache(node) {
92992
93258
  type: node.localName === "numCache" || node.localName === "numLit" ? "number" : "string",
92993
93259
  points: children2(node, "pt", NS.c).map((pt2) => {
92994
93260
  const point2 = { value: cChild(pt2, "v")?.textContent ?? "" };
92995
- const index = Number(attribute3(pt2, "idx") ?? Number.NaN);
93261
+ const index = Number(attribute4(pt2, "idx") ?? Number.NaN);
92996
93262
  if (Number.isInteger(index) && index >= 0) point2.index = index;
92997
- const formatCode3 = attribute3(pt2, "formatCode");
93263
+ const formatCode3 = attribute4(pt2, "formatCode");
92998
93264
  if (formatCode3 !== void 0) point2.formatCode = formatCode3;
92999
93265
  return point2;
93000
93266
  })
@@ -93197,10 +93463,10 @@ function readDisplayNaAsBlank(chartExtLst) {
93197
93463
  return void 0;
93198
93464
  }
93199
93465
  for (const ext of elements(root)) {
93200
- if (ext.localName !== "ext" || attribute3(ext, "uri") !== DATA_DISPLAY_OPTIONS_URI) continue;
93466
+ if (ext.localName !== "ext" || attribute4(ext, "uri") !== DATA_DISPLAY_OPTIONS_URI) continue;
93201
93467
  const flag2 = first(first(ext, "dataDisplayOptions16", C16R3), "dispNaAsBlank", C16R3);
93202
93468
  if (!flag2) continue;
93203
- const raw2 = attribute3(flag2, "val")?.trim().toLowerCase();
93469
+ const raw2 = attribute4(flag2, "val")?.trim().toLowerCase();
93204
93470
  return raw2 === void 0 || raw2 === "1" || raw2 === "true";
93205
93471
  }
93206
93472
  return void 0;
@@ -93445,7 +93711,7 @@ function customSplit(context, element) {
93445
93711
  if (!element) return void 0;
93446
93712
  reportUnmodelled(context, element, /* @__PURE__ */ new Set(["secondPiePt"]));
93447
93713
  return children2(element, "secondPiePt", NS.c).flatMap((point2) => {
93448
- const raw2 = attribute3(point2, "val")?.trim();
93714
+ const raw2 = attribute4(point2, "val")?.trim();
93449
93715
  const index = raw2 ? Number(raw2) : Number.NaN;
93450
93716
  return Number.isInteger(index) && index >= 0 ? [index] : [];
93451
93717
  });
@@ -93466,7 +93732,7 @@ function parseGroup(context, element) {
93466
93732
  is3D,
93467
93733
  series: children2(element, "ser", NS.c).map((ser) => parseSeries(context, ser)),
93468
93734
  axisIds: children2(element, "axId", NS.c).flatMap((axis) => {
93469
- const raw2 = attribute3(axis, "val")?.trim();
93735
+ const raw2 = attribute4(axis, "val")?.trim();
93470
93736
  const id = raw2 ? Number(raw2) : Number.NaN;
93471
93737
  return Number.isFinite(id) ? [id] : [];
93472
93738
  })
@@ -93748,7 +94014,7 @@ function chartStyle(context, space) {
93748
94014
  }
93749
94015
  function c14Style(space) {
93750
94016
  for (const alternate of children2(space, "AlternateContent", NS.mc)) {
93751
- const raw2 = attribute3(first(first(alternate, "Choice", NS.mc), "style", NS.c14, false), "val");
94017
+ const raw2 = attribute4(first(first(alternate, "Choice", NS.mc), "style", NS.c14, false), "val");
93752
94018
  const value = raw2?.trim() ? Number(raw2) : Number.NaN;
93753
94019
  if (Number.isFinite(value)) return value;
93754
94020
  }
@@ -94437,7 +94703,7 @@ function malformed2(context, where, value) {
94437
94703
  });
94438
94704
  }
94439
94705
  function boolAttribute(context, element, name) {
94440
- const raw2 = attribute3(element, name);
94706
+ const raw2 = attribute4(element, name);
94441
94707
  if (!element || raw2 === void 0) return void 0;
94442
94708
  const value = raw2.trim().toLowerCase();
94443
94709
  if (value === "1" || value === "true") return true;
@@ -94446,7 +94712,7 @@ function boolAttribute(context, element, name) {
94446
94712
  return void 0;
94447
94713
  }
94448
94714
  function numberAttribute(context, element, name) {
94449
- const raw2 = attribute3(element, name);
94715
+ const raw2 = attribute4(element, name);
94450
94716
  if (!element || raw2 === void 0) return void 0;
94451
94717
  const value = raw2.trim() ? Number(raw2) : Number.NaN;
94452
94718
  if (Number.isFinite(value)) return value;
@@ -94456,11 +94722,11 @@ function numberAttribute(context, element, name) {
94456
94722
  function indexAttribute(context, element, name) {
94457
94723
  const value = numberAttribute(context, element, name);
94458
94724
  if (value === void 0 || Number.isInteger(value) && value >= 0) return value;
94459
- malformed2(context, path2(element, name), attribute3(element, name) ?? "");
94725
+ malformed2(context, path2(element, name), attribute4(element, name) ?? "");
94460
94726
  return void 0;
94461
94727
  }
94462
94728
  function autoNumberAttribute(context, element, name) {
94463
- return attribute3(element, name)?.trim() === "auto" ? "auto" : numberAttribute(context, element, name);
94729
+ return attribute4(element, name)?.trim() === "auto" ? "auto" : numberAttribute(context, element, name);
94464
94730
  }
94465
94731
  function reportUnmodelled2(context, element, handled) {
94466
94732
  for (const child31 of elements(element)) {
@@ -94491,9 +94757,9 @@ function lines(parent, local) {
94491
94757
  }
94492
94758
  function numberFormat2(parent) {
94493
94759
  const element = cxChild(parent, "numFmt");
94494
- const formatCode2 = attribute3(element, "formatCode");
94760
+ const formatCode2 = attribute4(element, "formatCode");
94495
94761
  if (formatCode2 === void 0) return void 0;
94496
- const linked = attribute3(element, "sourceLinked");
94762
+ const linked = attribute4(element, "sourceLinked");
94497
94763
  return {
94498
94764
  formatCode: formatCode2,
94499
94765
  ...linked === "1" || linked === "true" ? { sourceLinked: true } : {},
@@ -94504,7 +94770,7 @@ function formula(parent, local) {
94504
94770
  const element = cxChild(parent, local);
94505
94771
  if (!element) return void 0;
94506
94772
  const out = { formula: element.textContent ?? "" };
94507
- const direction = attribute3(element, "dir");
94773
+ const direction = attribute4(element, "dir");
94508
94774
  if (direction !== void 0) out.direction = direction;
94509
94775
  return out;
94510
94776
  }
@@ -94538,8 +94804,8 @@ function parseLevel(context, element) {
94538
94804
  { points: points7 },
94539
94805
  {
94540
94806
  pointCount: indexAttribute(context, element, "ptCount"),
94541
- formatCode: attribute3(element, "formatCode"),
94542
- name: attribute3(element, "name"),
94807
+ formatCode: attribute4(element, "formatCode"),
94808
+ name: attribute4(element, "name"),
94543
94809
  extLst: extensionList2(element)
94544
94810
  }
94545
94811
  );
@@ -94552,7 +94818,7 @@ function parseDimension(context, element) {
94552
94818
  levels: cxChildren(element, "lvl").map((level2) => parseLevel(context, level2))
94553
94819
  },
94554
94820
  {
94555
- type: attribute3(element, "type"),
94821
+ type: attribute4(element, "type"),
94556
94822
  formula: formula(element, "f"),
94557
94823
  nameFormula: formula(element, "nf"),
94558
94824
  extLst: extensionList2(element)
@@ -94609,8 +94875,8 @@ function parseTitle2(context, element) {
94609
94875
  tx: parseText2(context, cxChild(element, "tx")),
94610
94876
  spPr: shapeProperties2(element),
94611
94877
  txPr: textProperties2(element),
94612
- position: attribute3(element, "pos"),
94613
- align: attribute3(element, "align"),
94878
+ position: attribute4(element, "pos"),
94879
+ align: attribute4(element, "align"),
94614
94880
  overlay: boolAttribute(context, element, "overlay"),
94615
94881
  extLst: extensionList2(element)
94616
94882
  }
@@ -94621,8 +94887,8 @@ function parseLegend2(context, element) {
94621
94887
  return assignDefined(
94622
94888
  {},
94623
94889
  {
94624
- position: attribute3(element, "pos"),
94625
- align: attribute3(element, "align"),
94890
+ position: attribute4(element, "pos"),
94891
+ align: attribute4(element, "align"),
94626
94892
  overlay: boolAttribute(context, element, "overlay"),
94627
94893
  spPr: shapeProperties2(element),
94628
94894
  txPr: textProperties2(element),
@@ -94671,7 +94937,7 @@ function parseUnits(context, element) {
94671
94937
  return assignDefined(
94672
94938
  {},
94673
94939
  {
94674
- unit: attribute3(element, "unit"),
94940
+ unit: attribute4(element, "unit"),
94675
94941
  label: label ? parseTitle2(context, label) : void 0,
94676
94942
  extLst: extensionList2(element)
94677
94943
  }
@@ -94722,7 +94988,7 @@ var init_parse_axis = __esm({
94722
94988
  "txPr",
94723
94989
  "extLst"
94724
94990
  ]);
94725
- tickMarks = (element) => element ? assignDefined({}, { type: attribute3(element, "type") }) : void 0;
94991
+ tickMarks = (element) => element ? assignDefined({}, { type: attribute4(element, "type") }) : void 0;
94726
94992
  }
94727
94993
  });
94728
94994
 
@@ -94741,7 +95007,7 @@ function labelVisibility(context, element) {
94741
95007
  function labelOptions2(context, element) {
94742
95008
  const separator = cxChild(element, "separator");
94743
95009
  return {
94744
- position: attribute3(element, "pos"),
95010
+ position: attribute4(element, "pos"),
94745
95011
  numberFormat: numberFormat2(element),
94746
95012
  spPr: shapeProperties2(element),
94747
95013
  txPr: textProperties2(element),
@@ -94774,7 +95040,7 @@ function parseBinning(context, element) {
94774
95040
  return assignDefined(
94775
95041
  {},
94776
95042
  {
94777
- intervalClosed: attribute3(element, "intervalClosed"),
95043
+ intervalClosed: attribute4(element, "intervalClosed"),
94778
95044
  underflow: autoNumberAttribute(context, element, "underflow"),
94779
95045
  overflow: autoNumberAttribute(context, element, "overflow"),
94780
95046
  binSize: scalar4("binSize"),
@@ -94787,11 +95053,11 @@ function parseGeography(context, element) {
94787
95053
  return assignDefined(
94788
95054
  {},
94789
95055
  {
94790
- projectionType: attribute3(element, "projectionType"),
94791
- viewedRegionType: attribute3(element, "viewedRegionType"),
94792
- cultureLanguage: attribute3(element, "cultureLanguage"),
94793
- cultureRegion: attribute3(element, "cultureRegion"),
94794
- attribution: attribute3(element, "attribution"),
95056
+ projectionType: attribute4(element, "projectionType"),
95057
+ viewedRegionType: attribute4(element, "viewedRegionType"),
95058
+ cultureLanguage: attribute4(element, "cultureLanguage"),
95059
+ cultureRegion: attribute4(element, "cultureRegion"),
95060
+ attribution: attribute4(element, "attribution"),
94795
95061
  geoCacheXml: rawChild2(element, "geoCache"),
94796
95062
  extLst: extensionList2(element)
94797
95063
  }
@@ -94807,8 +95073,8 @@ function parseLayout(context, element) {
94807
95073
  return assignDefined(
94808
95074
  {},
94809
95075
  {
94810
- parentLabelLayout: attribute3(cxChild(element, "parentLabelLayout"), "val"),
94811
- regionLabelLayout: attribute3(cxChild(element, "regionLabelLayout"), "val"),
95076
+ parentLabelLayout: attribute4(cxChild(element, "parentLabelLayout"), "val"),
95077
+ regionLabelLayout: attribute4(cxChild(element, "regionLabelLayout"), "val"),
94812
95078
  visibility: visibility ? assignDefined(
94813
95079
  {},
94814
95080
  Object.fromEntries(
@@ -94820,7 +95086,7 @@ function parseLayout(context, element) {
94820
95086
  geography: geography ? parseGeography(context, geography) : void 0,
94821
95087
  statistics: statistics ? assignDefined(
94822
95088
  {},
94823
- { quartileMethod: attribute3(statistics, "quartileMethod") }
95089
+ { quartileMethod: attribute4(statistics, "quartileMethod") }
94824
95090
  ) : void 0,
94825
95091
  subtotals: subtotals ? cxChildren(subtotals, "idx").map((idx) => indexAttribute(context, idx, "val")).filter((index) => index !== void 0) : void 0,
94826
95092
  extLst: extensionList2(element)
@@ -94845,11 +95111,11 @@ function parseSeries2(context, element) {
94845
95111
  const layout = cxChild(element, "layoutPr");
94846
95112
  const axisIds = cxChildren(element, "axisId").map((axis) => indexAttribute(context, axis, "val")).filter((id) => id !== void 0);
94847
95113
  return assignDefined(
94848
- { layoutId: attribute3(element, "layoutId") ?? "", dataPoints, axisIds },
95114
+ { layoutId: attribute4(element, "layoutId") ?? "", dataPoints, axisIds },
94849
95115
  {
94850
95116
  hidden: boolAttribute(context, element, "hidden"),
94851
95117
  ownerIndex: numberAttribute(context, element, "ownerIdx"),
94852
- uniqueId: attribute3(element, "uniqueId"),
95118
+ uniqueId: attribute4(element, "uniqueId"),
94853
95119
  formatIndex: numberAttribute(context, element, "formatIdx"),
94854
95120
  tx: parseText2(context, cxChild(element, "tx")),
94855
95121
  spPr: shapeProperties2(element),
@@ -98510,254 +98776,6 @@ var init_modern_comment_fields = __esm({
98510
98776
  }
98511
98777
  });
98512
98778
 
98513
- // pptx/core/utils/modern-comment-mention-read.ts
98514
- function readCommentMentions(node, authorName) {
98515
- if (!node) {
98516
- return void 0;
98517
- }
98518
- const found = [];
98519
- for (const list3 of mentionChildrenNamed(node, "mentionLst")) {
98520
- for (const entry2 of mentionChildrenNamed(list3, "mention")) {
98521
- const mention = readMention(entry2, authorName);
98522
- if (mention) {
98523
- found.push(mention);
98524
- }
98525
- }
98526
- }
98527
- for (const extension of mentionChildrenNamed(mentionChildrenNamed(node, "extLst")[0], "ext")) {
98528
- const uri = String(extension["@_uri"] || "");
98529
- for (const list3 of mentionChildrenNamed(extension, "mentionLst")) {
98530
- for (const entry2 of mentionChildrenNamed(list3, "mention")) {
98531
- const mention = readMention(entry2, authorName, uri);
98532
- if (mention) {
98533
- found.push(mention);
98534
- }
98535
- }
98536
- }
98537
- }
98538
- found.sort((a, b) => a.startIndex - b.startIndex);
98539
- return found.length > 0 ? found : void 0;
98540
- }
98541
- var mentionLocalName, mentionNodesOf, mentionChildrenNamed, MENTION_PERSON_KEYS, MENTION_LENGTH_KEYS, attribute4, integer3, readMention;
98542
- var init_modern_comment_mention_read = __esm({
98543
- "pptx/core/utils/modern-comment-mention-read.ts"() {
98544
- mentionLocalName = (key2) => key2.split(":").pop() || key2;
98545
- mentionNodesOf = (value) => {
98546
- if (Array.isArray(value)) {
98547
- return value.filter((entry2) => Boolean(entry2) && typeof entry2 === "object");
98548
- }
98549
- return value && typeof value === "object" ? [value] : [];
98550
- };
98551
- mentionChildrenNamed = (node, name) => {
98552
- if (!node) {
98553
- return [];
98554
- }
98555
- const result = [];
98556
- for (const [key2, value] of Object.entries(node)) {
98557
- if (!key2.startsWith("@_") && mentionLocalName(key2) === name) {
98558
- result.push(...mentionNodesOf(value));
98559
- }
98560
- }
98561
- return result;
98562
- };
98563
- MENTION_PERSON_KEYS = [
98564
- "@_mentionpersonId",
98565
- "@_mentionPersonId",
98566
- "@_personId",
98567
- "@_authorId"
98568
- ];
98569
- MENTION_LENGTH_KEYS = ["@_length", "@_mentionCharCount", "@_len"];
98570
- attribute4 = (node, keys) => {
98571
- for (const key2 of keys) {
98572
- const value = node[key2];
98573
- if (value !== void 0 && value !== null && String(value).length > 0) {
98574
- return String(value);
98575
- }
98576
- }
98577
- return void 0;
98578
- };
98579
- integer3 = (value) => {
98580
- if (value === void 0) {
98581
- return void 0;
98582
- }
98583
- const parsed = Number.parseInt(value, 10);
98584
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : void 0;
98585
- };
98586
- readMention = (node, authorName, containerUri) => {
98587
- const personId = attribute4(node, MENTION_PERSON_KEYS);
98588
- const startIndex = integer3(attribute4(node, ["@_startIndex"]));
98589
- const length = integer3(attribute4(node, MENTION_LENGTH_KEYS));
98590
- if (!personId || startIndex === void 0 || length === void 0 || length === 0) {
98591
- return void 0;
98592
- }
98593
- return {
98594
- personId,
98595
- startIndex,
98596
- length,
98597
- id: attribute4(node, ["@_mentionId", "@_id"]),
98598
- authorName: authorName(personId),
98599
- containerUri,
98600
- rawXml: node
98601
- };
98602
- };
98603
- }
98604
- });
98605
-
98606
- // pptx/core/utils/modern-comment-mentions.ts
98607
- function rebaseCommentMentions(mentions, oldText, newText) {
98608
- if (!mentions || mentions.length === 0) {
98609
- return void 0;
98610
- }
98611
- if (oldText === newText) {
98612
- return mentions;
98613
- }
98614
- const prefix = commonPrefixLength(oldText, newText);
98615
- const suffix = commonSuffixLength(
98616
- oldText,
98617
- newText,
98618
- Math.min(oldText.length, newText.length) - prefix
98619
- );
98620
- const changeEnd = oldText.length - suffix;
98621
- const delta2 = newText.length - oldText.length;
98622
- const result = [];
98623
- for (const mention of mentions) {
98624
- const start = mention.startIndex;
98625
- const end = start + mention.length;
98626
- const span = oldText.slice(start, end);
98627
- if (span.length !== mention.length) {
98628
- continue;
98629
- }
98630
- let next = -1;
98631
- if (end <= prefix) {
98632
- next = start;
98633
- } else if (start >= changeEnd) {
98634
- next = start + delta2;
98635
- }
98636
- if (next >= 0 && newText.slice(next, next + mention.length) === span) {
98637
- result.push(next === start ? mention : { ...mention, startIndex: next });
98638
- continue;
98639
- }
98640
- const relocated = nearestOccurrence(newText, span, next >= 0 ? next : start);
98641
- if (relocated >= 0) {
98642
- result.push({ ...mention, startIndex: relocated });
98643
- }
98644
- }
98645
- return result.length > 0 ? result : void 0;
98646
- }
98647
- function buildMentionListNode(mentions) {
98648
- if (!mentions || mentions.length === 0) {
98649
- return void 0;
98650
- }
98651
- return { "p188:mention": mentions.map(buildMention) };
98652
- }
98653
- function applyCommentMentions(node, mentions, extension, replace) {
98654
- if (!replace) {
98655
- return extension;
98656
- }
98657
- const { direct, byUri } = groupByContainer(mentions);
98658
- const directList = buildMentionListNode(direct);
98659
- if (directList) {
98660
- node["p188:mentionLst"] = directList;
98661
- }
98662
- if (!extension) {
98663
- return void 0;
98664
- }
98665
- const rebuilt = stripMentionLists(extension);
98666
- const extensionKey = Object.keys(rebuilt).find((key2) => mentionLocalName(key2) === "ext") || "p188:ext";
98667
- const entries = mentionNodesOf(rebuilt[extensionKey]).map((entry2) => {
98668
- const list3 = buildMentionListNode(byUri.get(String(entry2["@_uri"] || "")));
98669
- const next = stripMentionLists(entry2);
98670
- if (list3) {
98671
- next["p188:mentionLst"] = list3;
98672
- }
98673
- return next;
98674
- });
98675
- if (entries.length > 0) {
98676
- rebuilt[extensionKey] = entries.length === 1 ? entries[0] : entries;
98677
- }
98678
- return rebuilt;
98679
- }
98680
- var commonPrefixLength, commonSuffixLength, nearestOccurrence, buildMention, stripMentionLists, groupByContainer;
98681
- var init_modern_comment_mentions = __esm({
98682
- "pptx/core/utils/modern-comment-mentions.ts"() {
98683
- init_modern_comment_mention_read();
98684
- init_modern_comment_mention_read();
98685
- commonPrefixLength = (a, b) => {
98686
- const max = Math.min(a.length, b.length);
98687
- let index = 0;
98688
- while (index < max && a[index] === b[index]) {
98689
- index += 1;
98690
- }
98691
- return index;
98692
- };
98693
- commonSuffixLength = (a, b, limit) => {
98694
- let index = 0;
98695
- while (index < limit && a[a.length - 1 - index] === b[b.length - 1 - index]) {
98696
- index += 1;
98697
- }
98698
- return index;
98699
- };
98700
- nearestOccurrence = (text2, span, hint) => {
98701
- let best = -1;
98702
- let bestDistance = Number.POSITIVE_INFINITY;
98703
- let at2 = text2.indexOf(span);
98704
- while (at2 !== -1) {
98705
- const distance = Math.abs(at2 - hint);
98706
- if (distance < bestDistance) {
98707
- best = at2;
98708
- bestDistance = distance;
98709
- }
98710
- at2 = text2.indexOf(span, at2 + 1);
98711
- }
98712
- return best;
98713
- };
98714
- buildMention = (mention) => {
98715
- const node = {};
98716
- for (const [key2, value] of Object.entries(mention.rawXml || {})) {
98717
- if (key2.startsWith("@_")) {
98718
- node[key2] = value;
98719
- }
98720
- }
98721
- const personKey = MENTION_PERSON_KEYS.find((key2) => node[key2] !== void 0) || "@_mentionpersonId";
98722
- const lengthKey = MENTION_LENGTH_KEYS.find((key2) => node[key2] !== void 0) || "@_length";
98723
- node[personKey] = mention.personId;
98724
- node[lengthKey] = String(mention.length);
98725
- node["@_startIndex"] = String(mention.startIndex);
98726
- if (mention.id) {
98727
- const idKey = node["@_id"] !== void 0 && node["@_mentionId"] === void 0 ? "@_id" : "@_mentionId";
98728
- node[idKey] = mention.id;
98729
- }
98730
- return node;
98731
- };
98732
- stripMentionLists = (node) => {
98733
- const result = {};
98734
- for (const [key2, value] of Object.entries(node)) {
98735
- if (key2.startsWith("@_") || mentionLocalName(key2) !== "mentionLst") {
98736
- result[key2] = value;
98737
- }
98738
- }
98739
- return result;
98740
- };
98741
- groupByContainer = (mentions) => {
98742
- const direct = [];
98743
- const byUri = /* @__PURE__ */ new Map();
98744
- for (const mention of mentions || []) {
98745
- if (!mention.containerUri) {
98746
- direct.push(mention);
98747
- continue;
98748
- }
98749
- const bucket = byUri.get(mention.containerUri);
98750
- if (bucket) {
98751
- bucket.push(mention);
98752
- } else {
98753
- byUri.set(mention.containerUri, [mention]);
98754
- }
98755
- }
98756
- return { direct, byUri };
98757
- };
98758
- }
98759
- });
98760
-
98761
98779
  // pptx/core/utils/modern-comment-text-body.ts
98762
98780
  function flattenBodyText(node) {
98763
98781
  if (!node) {
@@ -99151,7 +99169,13 @@ var init_modern_comment_xml = __esm({
99151
99169
  const originalBody = child23(raw2, "txBody");
99152
99170
  node["p188:txBody"] = applyModernCommentText(originalBody, comment.text);
99153
99171
  const originalText = originalBody ? flattenBodyText(originalBody).join("\n") : comment.text;
99154
- const mentions = rebaseCommentMentions(comment.mentions, originalText, comment.text);
99172
+ const loadedMentions = raw2 ? readCommentMentions(raw2, () => void 0) : void 0;
99173
+ const mentions = rebaseCommentMentions(
99174
+ comment.mentions,
99175
+ originalText,
99176
+ comment.text,
99177
+ loadedMentions ?? []
99178
+ );
99155
99179
  const extension = applyCommentMentions(node, mentions, child23(raw2, "extLst"), ownsMentions);
99156
99180
  if (extension) {
99157
99181
  node["p188:extLst"] = extension;