ooxml-ui 1.27.1 → 1.28.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 (29) hide show
  1. package/dist/chart/format-pane-types.d.ts +1 -0
  2. package/dist/chart/format-pane-view.d.ts +1 -0
  3. package/dist/comments/mentions.d.ts +63 -0
  4. package/dist/comments/mentions.d.ts.map +1 -0
  5. package/dist/pptx/{chunk-VMDMICQC.cjs → chunk-34A7YWVZ.cjs} +292 -143
  6. package/dist/pptx/{chunk-TMCN2OVN.cjs → chunk-BYSLCSDL.cjs} +41 -41
  7. package/dist/pptx/{chunk-OD6REJDV.mjs → chunk-SJX7SFED.mjs} +1 -1
  8. package/dist/pptx/{chunk-XZX7EHX4.mjs → chunk-TOPXMCGQ.mjs} +287 -145
  9. package/dist/pptx/dom/index.cjs +381 -381
  10. package/dist/pptx/dom/index.mjs +4 -4
  11. package/dist/pptx/index.cjs +3030 -3002
  12. package/dist/pptx/index.mjs +1 -1
  13. package/dist/pptx/render/comment-mentions.d.ts +16 -1
  14. package/dist/pptx/render/comment-mentions.d.ts.map +1 -1
  15. package/dist/pptx/render/comments-list.d.ts +11 -7
  16. package/dist/pptx/render/comments-list.d.ts.map +1 -1
  17. package/dist/pptx/render/customization/customization-controller.d.ts +8 -0
  18. package/dist/pptx/render/customization/customization-controller.d.ts.map +1 -1
  19. package/dist/pptx/render/options/external-content-policy.d.ts +31 -0
  20. package/dist/pptx/render/options/external-content-policy.d.ts.map +1 -0
  21. package/dist/pptx/render/options/index.d.ts +1 -0
  22. package/dist/pptx/render/options/index.d.ts.map +1 -1
  23. package/dist/pptx/render/options/viewer-options-constraints.d.ts +15 -1
  24. package/dist/pptx/render/options/viewer-options-constraints.d.ts.map +1 -1
  25. package/dist/pptx/render/options/viewer-options-store.d.ts.map +1 -1
  26. package/dist/pptx/render/viewer-props-manifest.d.ts.map +1 -1
  27. package/dist/pptx/{smartart-insert-preview-MCDHVWHZ.cjs → smartart-insert-preview-OW6RXM7M.cjs} +3 -3
  28. package/dist/pptx/{smartart-insert-preview-QQH5ZBSF.mjs → smartart-insert-preview-RAWXO2RH.mjs} +2 -2
  29. package/package.json +2 -2
@@ -6873,8 +6873,8 @@ function layoutEnvelopeBlock(paragraphs2, align2, getGlyphOutline) {
6873
6873
  const char = chars[i];
6874
6874
  const advance = advances[i] ?? 0;
6875
6875
  const outline = WHITESPACE_RE.test(char) ? void 0 : getGlyphOutline?.(char, seg.font, x, baseline);
6876
- const usable = outline && outline.length > 0 ? outline : void 0;
6877
- const ink = glyphInk(char, seg.font, x, baseline, advance, usable);
6876
+ const usable2 = outline && outline.length > 0 ? outline : void 0;
6877
+ const ink = glyphInk(char, seg.font, x, baseline, advance, usable2);
6878
6878
  if (ink) {
6879
6879
  hasInk = true;
6880
6880
  box.left = Math.min(box.left, ink.left);
@@ -6892,7 +6892,7 @@ function layoutEnvelopeBlock(paragraphs2, align2, getGlyphOutline) {
6892
6892
  x,
6893
6893
  baseline,
6894
6894
  advance,
6895
- outline: usable,
6895
+ outline: usable2,
6896
6896
  ink
6897
6897
  });
6898
6898
  x += advance;
@@ -7878,9 +7878,9 @@ function computeTrendlinePoints(trendline, values, catCount, layout, range, mode
7878
7878
  };
7879
7879
  }
7880
7880
  function valueToYLocal(val, range, topY, bottomY) {
7881
- const usable = bottomY - topY;
7881
+ const usable2 = bottomY - topY;
7882
7882
  const ratio = (val - range.min) / range.span;
7883
- return range.reverseOrder ? topY + ratio * usable : bottomY - ratio * usable;
7883
+ return range.reverseOrder ? topY + ratio * usable2 : bottomY - ratio * usable2;
7884
7884
  }
7885
7885
 
7886
7886
  // src/pptx/render/chart-sparkline.ts
@@ -47917,9 +47917,9 @@ function deserializeElementClipboard(text4) {
47917
47917
  try {
47918
47918
  parsed = JSON.parse(text4, (_key, value) => {
47919
47919
  if (typeof value === "object" && value !== null) {
47920
- const tagged = value[BINARY_TAG];
47921
- if (typeof tagged === "string") {
47922
- return base64ToUint8(tagged);
47920
+ const tagged2 = value[BINARY_TAG];
47921
+ if (typeof tagged2 === "string") {
47922
+ return base64ToUint8(tagged2);
47923
47923
  }
47924
47924
  }
47925
47925
  return value;
@@ -51603,6 +51603,153 @@ function applyUniformCellPaddingPatch(el, padding) {
51603
51603
  };
51604
51604
  }
51605
51605
 
51606
+ // src/comments/mentions.ts
51607
+ var usable = (text4, mentions) => (mentions ?? []).filter(
51608
+ (m) => Number.isFinite(m.start) && Number.isFinite(m.length) && m.length > 0 && m.start >= 0 && m.start + m.length <= text4.length
51609
+ ).sort((a, b) => a.start - b.start);
51610
+ function commentSegments(text4, mentions) {
51611
+ const body = String(text4 ?? "");
51612
+ const segments = [];
51613
+ let cursor = 0;
51614
+ for (const mention of usable(body, mentions)) {
51615
+ if (mention.start < cursor) continue;
51616
+ if (mention.start > cursor)
51617
+ segments.push({ kind: "text", text: body.slice(cursor, mention.start) });
51618
+ segments.push({
51619
+ kind: "mention",
51620
+ text: body.slice(mention.start, mention.start + mention.length),
51621
+ ...mention.id !== void 0 ? { id: mention.id } : {},
51622
+ ...mention.name !== void 0 ? { name: mention.name } : {}
51623
+ });
51624
+ cursor = mention.start + mention.length;
51625
+ }
51626
+ if (cursor < body.length) segments.push({ kind: "text", text: body.slice(cursor) });
51627
+ return segments;
51628
+ }
51629
+ function mentionQueryAt(text4, caret) {
51630
+ const body = String(text4 ?? "");
51631
+ const end = Math.max(0, Math.min(caret, body.length));
51632
+ for (let index = end - 1; index >= 0; index -= 1) {
51633
+ const character = body[index];
51634
+ if (character === "@") {
51635
+ if (index > 0 && !/\s/u.test(body[index - 1])) return null;
51636
+ return { query: body.slice(index + 1, end).toLowerCase(), start: index };
51637
+ }
51638
+ if (/\s/u.test(character)) return null;
51639
+ }
51640
+ return null;
51641
+ }
51642
+ var score = (candidate, needle) => {
51643
+ if (!needle) return 1;
51644
+ const name = candidate.name.toLowerCase();
51645
+ if (name.startsWith(needle)) return 0;
51646
+ if (name.includes(needle) || (candidate.initials ?? "").toLowerCase().startsWith(needle))
51647
+ return 2;
51648
+ return -1;
51649
+ };
51650
+ function matchMentionCandidates(candidates, query, limit = 6) {
51651
+ const needle = String(query ?? "").trim().toLowerCase();
51652
+ return candidates.filter((candidate) => candidate.id && candidate.name).map((candidate) => ({ candidate, rank: score(candidate, needle) })).filter(({ rank }) => rank >= 0).sort((a, b) => a.rank - b.rank || a.candidate.name.localeCompare(b.candidate.name)).slice(0, limit).map(({ candidate }) => candidate);
51653
+ }
51654
+ function insertMention(text4, mentions, caret, candidate) {
51655
+ const body = String(text4 ?? "");
51656
+ const at = Math.max(0, Math.min(caret, body.length));
51657
+ const active2 = mentionQueryAt(body, at);
51658
+ const start = active2 ? active2.start : at;
51659
+ const end = at;
51660
+ const label3 = `@${candidate.name}`;
51661
+ const delta = label3.length + 1 - (end - start);
51662
+ const next = (mentions ?? []).filter((m) => m.start >= end || m.start + m.length <= start).map((m) => m.start >= end ? { ...m, start: m.start + delta } : m);
51663
+ next.push({ start, length: label3.length, id: candidate.id, name: candidate.name });
51664
+ next.sort((a, b) => a.start - b.start);
51665
+ return {
51666
+ text: `${body.slice(0, start)}${label3} ${body.slice(end)}`,
51667
+ mentions: next,
51668
+ caret: start + label3.length + 1
51669
+ };
51670
+ }
51671
+ function trimMentionText(text4, mentions) {
51672
+ const body = String(text4 ?? "");
51673
+ const trimmed = body.trim();
51674
+ const lead = trimmed ? body.length - body.trimStart().length : 0;
51675
+ return {
51676
+ text: trimmed,
51677
+ mentions: usable(body, mentions).filter((m) => m.start >= lead && m.start + m.length <= lead + trimmed.length).map((m) => ({ ...m, start: m.start - lead }))
51678
+ };
51679
+ }
51680
+
51681
+ // src/pptx/render/comment-mentions.ts
51682
+ var COMMENT_MENTION_ATTRIBUTE = "data-pptx-comment-mention";
51683
+ var COMMENT_MENTION_CLASS = "pptx-comment-mention";
51684
+ var toSpan = (mention) => ({
51685
+ start: mention.startIndex,
51686
+ length: mention.length,
51687
+ ...mention.personId !== void 0 ? { id: mention.personId } : {},
51688
+ ...mention.authorName !== void 0 ? { name: mention.authorName } : {}
51689
+ });
51690
+ function commentTextSegments(text4, mentions) {
51691
+ return commentSegments(text4, mentions?.map(toSpan)).map((segment) => ({
51692
+ kind: segment.kind,
51693
+ text: segment.text,
51694
+ ...segment.name !== void 0 ? { authorName: segment.name } : {},
51695
+ ...segment.id !== void 0 ? { personId: segment.id } : {}
51696
+ }));
51697
+ }
51698
+ function hasCommentMentions(text4, mentions) {
51699
+ return commentTextSegments(text4, mentions).some((segment) => segment.kind === "mention");
51700
+ }
51701
+ function commentMentionQuery(text4, caret) {
51702
+ return mentionQueryAt(text4, caret);
51703
+ }
51704
+ function matchCommentMentionAuthors(authors, query, limit = 6) {
51705
+ return matchMentionCandidates(authors, query, limit);
51706
+ }
51707
+ function tagged(mentions) {
51708
+ return mentions.map((mention, index) => ({
51709
+ start: mention.startIndex,
51710
+ length: mention.length,
51711
+ id: String(index)
51712
+ }));
51713
+ }
51714
+ function untagged(spans, records) {
51715
+ return spans.map((span) => ({ ...records[Number(span.id)], startIndex: span.start }));
51716
+ }
51717
+ function trimCommentMentions(text4, mentions) {
51718
+ const records = mentions ?? [];
51719
+ const result = trimMentionText(text4, tagged(records));
51720
+ return { text: result.text, mentions: untagged(result.mentions, records) };
51721
+ }
51722
+ function followCommentEdit(before, after, mentions) {
51723
+ return pptx.rebaseCommentMentions(mentions ? [...mentions] : void 0, before, after) ?? [];
51724
+ }
51725
+ function defaultMentionId() {
51726
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
51727
+ return `{${crypto.randomUUID().toUpperCase()}}`;
51728
+ }
51729
+ const hex2 = (length) => Array.from(
51730
+ { length },
51731
+ () => Math.floor(Math.random() * 16).toString(16).toUpperCase()
51732
+ ).join("");
51733
+ return `{${hex2(8)}-${hex2(4)}-4${hex2(3)}-8${hex2(3)}-${hex2(12)}}`;
51734
+ }
51735
+ function insertCommentMention(text4, mentions, caret, author, generateId = defaultMentionId) {
51736
+ const existing = mentions ?? [];
51737
+ const result = insertMention(text4, tagged(existing), caret, { id: author.id, name: author.name });
51738
+ return {
51739
+ text: result.text,
51740
+ caret: result.caret,
51741
+ mentions: result.mentions.map(
51742
+ (span) => span.name === void 0 ? { ...existing[Number(span.id)], startIndex: span.start } : {
51743
+ id: generateId(),
51744
+ personId: author.id,
51745
+ authorName: author.name,
51746
+ startIndex: span.start,
51747
+ length: span.length
51748
+ }
51749
+ )
51750
+ };
51751
+ }
51752
+
51606
51753
  // src/pptx/render/comments-list.ts
51607
51754
  function generateCommentId() {
51608
51755
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -51611,14 +51758,18 @@ function generateCommentId() {
51611
51758
  const rand = Math.random().toString(36).slice(2);
51612
51759
  return `comment-${Date.now().toString(36)}-${rand}`;
51613
51760
  }
51614
- function addCommentToList(comments, text4, authorName, x, y, elementId) {
51615
- const trimmed = text4.trim();
51616
- if (trimmed.length === 0) {
51761
+ function bodyWithMentions(text4, mentions) {
51762
+ const body = trimCommentMentions(text4, mentions);
51763
+ return body.mentions.length > 0 ? body : { text: body.text };
51764
+ }
51765
+ function addCommentToList(comments, text4, authorName, x, y, elementId, mentions) {
51766
+ const body = bodyWithMentions(text4, mentions);
51767
+ if (body.text.length === 0) {
51617
51768
  return null;
51618
51769
  }
51619
51770
  const comment = {
51620
51771
  id: generateCommentId(),
51621
- text: trimmed,
51772
+ ...body,
51622
51773
  author: authorName,
51623
51774
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
51624
51775
  resolved: false,
@@ -51670,20 +51821,22 @@ function removeCommentFromList(comments, id) {
51670
51821
  const [next, changed] = filterCommentTree(comments, id);
51671
51822
  return changed ? next : null;
51672
51823
  }
51673
- function editCommentInList(comments, id, text4) {
51674
- const trimmed = text4.trim();
51824
+ function editCommentInList(comments, id, text4, mentions) {
51825
+ const given = mentions ? bodyWithMentions(text4, mentions) : null;
51826
+ const trimmed = given ? given.text : text4.trim();
51675
51827
  if (trimmed.length === 0) {
51676
51828
  return null;
51677
51829
  }
51678
- const [next, changed] = mapCommentTree(comments, id, (comment) => ({
51679
- ...comment,
51680
- text: trimmed
51681
- }));
51830
+ const [next, changed] = mapCommentTree(comments, id, (comment) => {
51831
+ const { mentions: previous, ...rest } = comment;
51832
+ const kept = given ? given.mentions ?? [] : followCommentEdit(comment.text, trimmed, previous);
51833
+ return { ...rest, text: trimmed, ...kept.length > 0 ? { mentions: kept } : {} };
51834
+ });
51682
51835
  return changed ? next : null;
51683
51836
  }
51684
- function replyToCommentInList(comments, parentId, text4, authorName) {
51685
- const trimmed = text4.trim();
51686
- if (trimmed.length === 0) {
51837
+ function replyToCommentInList(comments, parentId, text4, authorName, mentions) {
51838
+ const body = bodyWithMentions(text4, mentions);
51839
+ if (body.text.length === 0) {
51687
51840
  return null;
51688
51841
  }
51689
51842
  const parent = comments.find((comment) => comment.id === parentId);
@@ -51692,7 +51845,7 @@ function replyToCommentInList(comments, parentId, text4, authorName) {
51692
51845
  }
51693
51846
  const reply = {
51694
51847
  id: generateCommentId(),
51695
- text: trimmed,
51848
+ ...body,
51696
51849
  author: authorName,
51697
51850
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
51698
51851
  threadId: parentId,
@@ -51914,110 +52067,6 @@ function runReviewCommentCommand(id, host2, activeId) {
51914
52067
  }
51915
52068
  }
51916
52069
 
51917
- // src/pptx/render/comment-mentions.ts
51918
- var COMMENT_MENTION_ATTRIBUTE = "data-pptx-comment-mention";
51919
- var COMMENT_MENTION_CLASS = "pptx-comment-mention";
51920
- var usableMentions = (body, mentions) => (mentions ?? []).filter(
51921
- (mention) => Number.isFinite(mention.startIndex) && Number.isFinite(mention.length) && mention.length > 0 && mention.startIndex >= 0 && mention.startIndex + mention.length <= body.length
51922
- ).sort((a, b) => a.startIndex - b.startIndex);
51923
- function commentTextSegments(text4, mentions) {
51924
- const body = String(text4 ?? "");
51925
- if (body.length === 0) {
51926
- return [];
51927
- }
51928
- const segments = [];
51929
- let cursor = 0;
51930
- for (const mention of usableMentions(body, mentions)) {
51931
- if (mention.startIndex < cursor) {
51932
- continue;
51933
- }
51934
- if (mention.startIndex > cursor) {
51935
- segments.push({ kind: "text", text: body.slice(cursor, mention.startIndex) });
51936
- }
51937
- segments.push({
51938
- kind: "mention",
51939
- text: body.slice(mention.startIndex, mention.startIndex + mention.length),
51940
- authorName: mention.authorName,
51941
- personId: mention.personId
51942
- });
51943
- cursor = mention.startIndex + mention.length;
51944
- }
51945
- if (cursor < body.length) {
51946
- segments.push({ kind: "text", text: body.slice(cursor) });
51947
- }
51948
- return segments;
51949
- }
51950
- function hasCommentMentions(text4, mentions) {
51951
- return commentTextSegments(text4, mentions).some((segment) => segment.kind === "mention");
51952
- }
51953
- function commentMentionQuery(text4, caret) {
51954
- const body = String(text4 ?? "");
51955
- const position = Math.max(0, Math.min(caret, body.length));
51956
- for (let index = position - 1; index >= 0; index -= 1) {
51957
- const character = body[index];
51958
- if (character === "@") {
51959
- if (index > 0 && !/\s/u.test(body[index - 1])) {
51960
- return null;
51961
- }
51962
- return { query: body.slice(index + 1, position).toLowerCase(), start: index };
51963
- }
51964
- if (/\s/u.test(character)) {
51965
- return null;
51966
- }
51967
- }
51968
- return null;
51969
- }
51970
- var mentionMatchScore = (author, needle) => {
51971
- if (needle.length === 0) {
51972
- return 1;
51973
- }
51974
- const name = author.name.toLowerCase();
51975
- if (name.startsWith(needle)) {
51976
- return 0;
51977
- }
51978
- if (name.includes(needle) || (author.initials || "").toLowerCase().startsWith(needle)) {
51979
- return 2;
51980
- }
51981
- return -1;
51982
- };
51983
- function matchCommentMentionAuthors(authors, query, limit = 6) {
51984
- const needle = String(query ?? "").trim().toLowerCase();
51985
- const scored = authors.filter((author) => author.id && author.name).map((author) => ({ author, score: mentionMatchScore(author, needle) })).filter((entry6) => entry6.score >= 0);
51986
- scored.sort((a, b) => a.score - b.score || a.author.name.localeCompare(b.author.name));
51987
- return scored.slice(0, limit).map((entry6) => entry6.author);
51988
- }
51989
- function defaultMentionId() {
51990
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
51991
- return `{${crypto.randomUUID().toUpperCase()}}`;
51992
- }
51993
- const hex2 = (length) => Array.from(
51994
- { length },
51995
- () => Math.floor(Math.random() * 16).toString(16).toUpperCase()
51996
- ).join("");
51997
- return `{${hex2(8)}-${hex2(4)}-4${hex2(3)}-8${hex2(3)}-${hex2(12)}}`;
51998
- }
51999
- function insertCommentMention(text4, mentions, caret, author, generateId = defaultMentionId) {
52000
- const body = String(text4 ?? "");
52001
- const active2 = commentMentionQuery(body, caret);
52002
- const start = active2 ? active2.start : Math.max(0, Math.min(caret, body.length));
52003
- const end = active2 ? active2.start + 1 + active2.query.length : start;
52004
- const label3 = `@${author.name}`;
52005
- const nextText = `${body.slice(0, start)}${label3} ${body.slice(end)}`;
52006
- const delta = label3.length + 1 - (end - start);
52007
- const shifted = (mentions ?? []).map(
52008
- (mention) => mention.startIndex >= end ? { ...mention, startIndex: mention.startIndex + delta } : mention
52009
- );
52010
- shifted.push({
52011
- id: generateId(),
52012
- personId: author.id,
52013
- authorName: author.name,
52014
- startIndex: start,
52015
- length: label3.length
52016
- });
52017
- shifted.sort((a, b) => a.startIndex - b.startIndex);
52018
- return { text: nextText, mentions: shifted, caret: start + label3.length + 1 };
52019
- }
52020
-
52021
52070
  // src/pptx/render/comment-markers.ts
52022
52071
  var COMMENT_MARKER_SIZE = 20;
52023
52072
  var COMMENT_MARKER_COLOR = "rgba(255, 165, 0, 0.9)";
@@ -55933,23 +55982,23 @@ function getPasswordStrength(password) {
55933
55982
  if (!password) {
55934
55983
  return 0;
55935
55984
  }
55936
- let score = 0;
55985
+ let score2 = 0;
55937
55986
  if (password.length >= 8) {
55938
- score += 1;
55987
+ score2 += 1;
55939
55988
  }
55940
55989
  if (password.length >= 12) {
55941
- score += 1;
55990
+ score2 += 1;
55942
55991
  }
55943
55992
  if (/[A-Z]/u.test(password) && /[a-z]/u.test(password)) {
55944
- score += 1;
55993
+ score2 += 1;
55945
55994
  }
55946
55995
  if (/\d/u.test(password)) {
55947
- score += 1;
55996
+ score2 += 1;
55948
55997
  }
55949
55998
  if (/[^A-Za-z0-9]/u.test(password)) {
55950
- score += 1;
55999
+ score2 += 1;
55951
56000
  }
55952
- return Math.min(score, 4);
56001
+ return Math.min(score2, 4);
55953
56002
  }
55954
56003
  function validatePasswordPair(password, confirmation) {
55955
56004
  if (!password) {
@@ -56777,6 +56826,18 @@ function applyAutoCorrect(text4, proofing) {
56777
56826
  }
56778
56827
  return result;
56779
56828
  }
56829
+
56830
+ // src/pptx/render/options/external-content-policy.ts
56831
+ var EXTERNAL_CONTENT_SETTING_ID = "trust.allowExternalContent";
56832
+ function resolveAllowExternalContent(host2, options) {
56833
+ return typeof host2 === "boolean" ? host2 : options.trust.allowExternalContent;
56834
+ }
56835
+ function lockExternalContentSetting(locked, host2) {
56836
+ if (typeof host2 !== "boolean") {
56837
+ return locked;
56838
+ }
56839
+ return { ...locked, [EXTERNAL_CONTENT_SETTING_ID]: host2 };
56840
+ }
56780
56841
  var HOST_REGION_ATTRIBUTE = "data-office-region";
56781
56842
  var HostRegionHost = class {
56782
56843
  #container;
@@ -59178,6 +59239,42 @@ function rebaseOptions(options, previousBaseline, nextBaseline, userSaved) {
59178
59239
  }
59179
59240
  return next;
59180
59241
  }
59242
+ function storedValueOf(stored, group, key) {
59243
+ const record = stored?.[group];
59244
+ if (!record || typeof record !== "object" || !Object.hasOwn(record, key)) {
59245
+ return void 0;
59246
+ }
59247
+ const value = record[key];
59248
+ const fallback = DEFAULT_VIEWER_OPTIONS[group][key];
59249
+ return typeof value === typeof fallback ? value : void 0;
59250
+ }
59251
+ function keepStoredLockedValues(diff, stored, locked) {
59252
+ for (const [id] of entriesOf(locked)) {
59253
+ const parsed = parseOptionsSettingId(id);
59254
+ const value = parsed ? storedValueOf(stored, parsed.group, parsed.key) : void 0;
59255
+ if (parsed && value !== void 0) {
59256
+ (diff[parsed.group] ??= {})[parsed.key] = value;
59257
+ }
59258
+ }
59259
+ return diff;
59260
+ }
59261
+ function restoreUnlockedOptions(options, previousLocked, nextLocked, ownValues, stored, previousBaseline) {
59262
+ const lifted = entriesOf(previousLocked).filter(([id]) => !Object.hasOwn(nextLocked ?? {}, id));
59263
+ if (lifted.length === 0) {
59264
+ return options;
59265
+ }
59266
+ const next = cloneOptions(options);
59267
+ for (const [id] of lifted) {
59268
+ const parsed = parseOptionsSettingId(id);
59269
+ if (!parsed) {
59270
+ continue;
59271
+ }
59272
+ const target = next[parsed.group];
59273
+ const base2 = previousBaseline[parsed.group];
59274
+ target[parsed.key] = storedValueOf(stored, parsed.group, parsed.key) ?? ownValues.get(id) ?? base2[parsed.key];
59275
+ }
59276
+ return next;
59277
+ }
59181
59278
 
59182
59279
  // src/pptx/render/options/viewer-options-store.ts
59183
59280
  function createViewerOptionsStore(init) {
@@ -59189,11 +59286,16 @@ function createViewerOptionsStore(init) {
59189
59286
  const options = () => store.getState();
59190
59287
  let constraints = {};
59191
59288
  let baseline = buildOptionsBaseline(void 0);
59289
+ const ownValues = /* @__PURE__ */ new Map();
59192
59290
  function commit(raw) {
59193
59291
  const next = applyLockedOptions(raw, constraints.locked);
59194
59292
  if (persist) {
59195
59293
  writeStoredViewerPrefs({
59196
- options: diffOptionsAgainstBaseline(next, baseline, constraints.locked)
59294
+ options: keepStoredLockedValues(
59295
+ diffOptionsAgainstBaseline(next, baseline, constraints.locked),
59296
+ readStoredViewerPrefs().options,
59297
+ constraints.locked
59298
+ )
59197
59299
  });
59198
59300
  }
59199
59301
  store.setState(next);
@@ -59248,9 +59350,32 @@ function createViewerOptionsStore(init) {
59248
59350
  batch: (write) => store.batch(write),
59249
59351
  setConstraints: (next) => {
59250
59352
  const previousBaseline = baseline;
59353
+ const previousLocked = constraints.locked;
59354
+ for (const id of Object.keys(next.locked ?? {})) {
59355
+ const parsed = parseOptionsSettingId(id);
59356
+ if (parsed && !isOptionLocked(previousLocked, parsed.group, parsed.key)) {
59357
+ const value = options()[parsed.group][parsed.key];
59358
+ if (typeof value === "boolean" || typeof value === "number" || typeof value === "string") {
59359
+ ownValues.set(id, value);
59360
+ }
59361
+ }
59362
+ }
59251
59363
  constraints = { locked: { ...next.locked }, defaults: { ...next.defaults } };
59252
59364
  baseline = buildOptionsBaseline(constraints.defaults);
59253
- commit(rebaseOptions(options(), previousBaseline, baseline, userSaved));
59365
+ const restored = restoreUnlockedOptions(
59366
+ options(),
59367
+ previousLocked,
59368
+ constraints.locked,
59369
+ ownValues,
59370
+ persist ? readStoredViewerPrefs().options : void 0,
59371
+ previousBaseline
59372
+ );
59373
+ for (const id of Object.keys(previousLocked ?? {})) {
59374
+ if (!Object.hasOwn(constraints.locked ?? {}, id)) {
59375
+ ownValues.delete(id);
59376
+ }
59377
+ }
59378
+ commit(rebaseOptions(restored, previousBaseline, baseline, userSaved));
59254
59379
  },
59255
59380
  isLocked: (group, key) => isOptionLocked(constraints.locked, group, key)
59256
59381
  };
@@ -59313,13 +59438,24 @@ function withRecordEntry(record, key, value) {
59313
59438
  }
59314
59439
 
59315
59440
  // src/pptx/render/customization/customization-controller.ts
59316
- function stateOf(customization) {
59317
- return { customization, resolved: resolveCustomization(customization) };
59441
+ function stateOf(customization, allowExternalContent) {
59442
+ const resolved2 = resolveCustomization(customization);
59443
+ return {
59444
+ customization,
59445
+ allowExternalContent,
59446
+ resolved: allowExternalContent === void 0 ? resolved2 : {
59447
+ ...resolved2,
59448
+ lockedSettings: lockExternalContentSetting(
59449
+ resolved2.lockedSettings,
59450
+ allowExternalContent
59451
+ )
59452
+ }
59453
+ };
59318
59454
  }
59319
59455
  function createCustomizationController(initial) {
59320
- const store = createViewerStore(stateOf({ ...initial }));
59456
+ const store = createViewerStore(stateOf({ ...initial }, void 0));
59321
59457
  const current = () => store.getState().customization;
59322
- const set = (next) => store.setState(stateOf(next));
59458
+ const set = (next) => store.setState(stateOf(next, store.getState().allowExternalContent));
59323
59459
  const update = (patch) => set(mergeCustomization(current(), patch));
59324
59460
  const ribbon = (edit) => {
59325
59461
  const next = { ...current().ribbon };
@@ -59404,7 +59540,13 @@ function createCustomizationController(initial) {
59404
59540
  return {
59405
59541
  api,
59406
59542
  getResolved: () => store.getState().resolved,
59407
- subscribe: (listener) => store.subscribe(listener)
59543
+ subscribe: (listener) => store.subscribe(listener),
59544
+ setAllowExternalContent: (allow) => {
59545
+ const next = typeof allow === "boolean" ? allow : void 0;
59546
+ if (next !== store.getState().allowExternalContent) {
59547
+ store.setState(stateOf(current(), next));
59548
+ }
59549
+ }
59408
59550
  };
59409
59551
  }
59410
59552
 
@@ -79468,11 +79610,11 @@ function nextSelectActive(choices3, active2, step2) {
79468
79610
  }
79469
79611
  var SELECT_PAGE_SIZE = 8;
79470
79612
  function pageSelectActive(choices3, active2, direction) {
79471
- const usable = (index) => !choices3[index]?.disabled && !choices3[index]?.hidden;
79613
+ const usable2 = (index) => !choices3[index]?.disabled && !choices3[index]?.hidden;
79472
79614
  const last = choices3.length - 1;
79473
79615
  const target = Math.max(0, Math.min(last, Math.max(active2, 0) + direction * SELECT_PAGE_SIZE));
79474
79616
  for (let index = target; index >= 0 && index <= last; index -= direction)
79475
- if (usable(index)) return index;
79617
+ if (usable2(index)) return index;
79476
79618
  return active2;
79477
79619
  }
79478
79620
 
@@ -82461,7 +82603,7 @@ function definePptxInsertSmartArtDialog(registry2) {
82461
82603
  if (this.#live || this.#draw) {
82462
82604
  return;
82463
82605
  }
82464
- this.#live = import('./smartart-insert-preview-MCDHVWHZ.cjs').then((module) => {
82606
+ this.#live = import('./smartart-insert-preview-OW6RXM7M.cjs').then((module) => {
82465
82607
  if (this.#draw || !this.#picker) {
82466
82608
  return;
82467
82609
  }
@@ -91439,6 +91581,7 @@ exports.EXPANDED_MAX_HEIGHT = EXPANDED_MAX_HEIGHT;
91439
91581
  exports.EXPLOSION_SUPPORTED_TYPES = EXPLOSION_SUPPORTED_TYPES;
91440
91582
  exports.EXPORT_ASSEMBLING_PERCENT = EXPORT_ASSEMBLING_PERCENT;
91441
91583
  exports.EXPORT_DONE_PERCENT = EXPORT_DONE_PERCENT;
91584
+ exports.EXTERNAL_CONTENT_SETTING_ID = EXTERNAL_CONTENT_SETTING_ID;
91442
91585
  exports.EditGeometryPen = EditGeometryPen;
91443
91586
  exports.EditPointsSession = EditPointsSession;
91444
91587
  exports.FEATURE_ENTRY_POINTS = FEATURE_ENTRY_POINTS;
@@ -92612,6 +92755,7 @@ exports.flattenOutline = flattenOutline;
92612
92755
  exports.flattenSlideElements = flattenSlideElements;
92613
92756
  exports.flattenTagCollections = flattenTagCollections;
92614
92757
  exports.flattenViewerOptions = flattenViewerOptions;
92758
+ exports.followCommentEdit = followCommentEdit;
92615
92759
  exports.followingText = followingText;
92616
92760
  exports.fontAlignmentVerticalAlign = fontAlignmentVerticalAlign;
92617
92761
  exports.fontFamilyItems = fontFamilyItems;
@@ -93014,6 +93158,7 @@ exports.isVerticalTextDirection = isVerticalTextDirection;
93014
93158
  exports.isWedgeCalloutPresetShape = isWedgeCalloutPresetShape;
93015
93159
  exports.issueTrackKey = issueTrackKey;
93016
93160
  exports.issueTypeLabel = issueTypeLabel;
93161
+ exports.keepStoredLockedValues = keepStoredLockedValues;
93017
93162
  exports.lastShowSlideIndex = lastShowSlideIndex;
93018
93163
  exports.latexToMathMl = latexToMathMl;
93019
93164
  exports.layoutEnvelopeBlock = layoutEnvelopeBlock;
@@ -93032,6 +93177,7 @@ exports.loadAudienceContent = loadAudienceContent;
93032
93177
  exports.loadPresentationDeck = loadPresentationDeck;
93033
93178
  exports.loadSessionDeck = loadSessionDeck;
93034
93179
  exports.loadedThemeName = loadedThemeName;
93180
+ exports.lockExternalContentSetting = lockExternalContentSetting;
93035
93181
  exports.lockResizeAspect = lockResizeAspect;
93036
93182
  exports.makeCloneId = makeCloneId;
93037
93183
  exports.mapAwarenessCursors = mapAwarenessCursors;
@@ -93399,6 +93545,7 @@ exports.resolveAccentHex = resolveAccentHex;
93399
93545
  exports.resolveActionType = resolveActionType;
93400
93546
  exports.resolveActiveRibbonAddIn = resolveActiveRibbonAddIn;
93401
93547
  exports.resolveActiveRibbonTab = resolveActiveRibbonTab;
93548
+ exports.resolveAllowExternalContent = resolveAllowExternalContent;
93402
93549
  exports.resolveAnimationCss = resolveAnimationCss;
93403
93550
  exports.resolveAnimationEnd = resolveAnimationEnd;
93404
93551
  exports.resolveAnimationStart = resolveAnimationStart;
@@ -93568,6 +93715,7 @@ exports.restoreInlineListBodySelection = restoreInlineListBodySelection;
93568
93715
  exports.restoreParagraphMetadata = restoreParagraphMetadata;
93569
93716
  exports.restoreSegmentSelection = restoreSegmentSelection;
93570
93717
  exports.restoreSessionDeck = restoreSessionDeck;
93718
+ exports.restoreUnlockedOptions = restoreUnlockedOptions;
93571
93719
  exports.resumeAllPersistentAudio = resumeAllPersistentAudio;
93572
93720
  exports.revealComment = revealComment;
93573
93721
  exports.revealedElementStyles = revealedElementStyles;
@@ -93858,6 +94006,7 @@ exports.transitionsLabel = transitionsLabel;
93858
94006
  exports.translateChartFormatText = translateChartFormatText2;
93859
94007
  exports.translateMotionPath = translateMotionPath;
93860
94008
  exports.travelledBox = travelledBox;
94009
+ exports.trimCommentMentions = trimCommentMentions;
93861
94010
  exports.trimmedMediaDurationMs = trimmedMediaDurationMs;
93862
94011
  exports.updateGlowPatch = updateGlowPatch;
93863
94012
  exports.updateGradientStopPatch = updateGradientStopPatch;