ooxml-ui 1.28.0 → 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.
@@ -4,3 +4,4 @@ import type { ChartFormatThreeDView } from './format-pane-view.js';
4
4
  export declare const CHART_BEVEL_TYPES: readonly ['circle', 'relaxedInset', 'cross', 'coolSlant', 'angle', 'softRound', 'convex', 'slope', 'divot', 'riblet', 'hardEdge', 'artDeco'];
5
5
  /** The 3-D Format section for an element with `threeD` as its current 3-D settings. */
6
6
  export declare function threeDSection(threeD: ChartFormatThreeDView): ChartFormatSection;
7
+ //# sourceMappingURL=format-pane-3d.d.ts.map
@@ -0,0 +1,63 @@
1
+ /** One mention: `length` characters of the text from `start`, the `@` included. */
2
+ export interface OfficeCommentMention {
3
+ start: number;
4
+ length: number;
5
+ /** The mentioned person's id in the product's people list. */
6
+ id?: string;
7
+ /** The mentioned person's display name. */
8
+ name?: string;
9
+ }
10
+ /** A person the typeahead offers. */
11
+ export interface OfficeMentionCandidate {
12
+ id: string;
13
+ name: string;
14
+ initials?: string;
15
+ }
16
+ /** One run of a comment's text: plain text or a mention. */
17
+ export interface OfficeCommentSegment {
18
+ kind: 'text' | 'mention';
19
+ text: string;
20
+ id?: string;
21
+ name?: string;
22
+ }
23
+ /**
24
+ * The text split into plain runs and mentions. Spans out of range, empty or overlapping an earlier
25
+ * one are ignored (the offsets can come from a file another program edited).
26
+ */
27
+ export declare function commentSegments(text: string, mentions?: readonly OfficeCommentMention[]): OfficeCommentSegment[];
28
+ /** The `@` token being typed: the text after the `@`, lower-cased, and where the `@` is. */
29
+ export interface OfficeMentionQuery {
30
+ query: string;
31
+ start: number;
32
+ }
33
+ /**
34
+ * The `@` token just left of `caret`, or `null`. The `@` must start the text or follow whitespace and
35
+ * the token holds no whitespace, so an e-mail address does not open the typeahead.
36
+ */
37
+ export declare function mentionQueryAt(text: string, caret: number): OfficeMentionQuery | null;
38
+ /** The candidates a query matches, best first: name prefixes, then names or initials containing it. */
39
+ export declare function matchMentionCandidates<C extends OfficeMentionCandidate>(candidates: readonly C[], query: string, limit?: number): C[];
40
+ /** The text, mentions and caret after a pick from the typeahead. */
41
+ export interface OfficeMentionInsertion {
42
+ text: string;
43
+ mentions: OfficeCommentMention[];
44
+ caret: number;
45
+ }
46
+ /**
47
+ * The `@` token at `caret` (or the caret itself) replaced by `@<name>` and a space, with the new span
48
+ * (the `@` included, as Office records it) and the spans after it shifted. A span the token overlaps
49
+ * (a pick made inside an existing mention) is dropped, so the text is never claimed twice.
50
+ */
51
+ export declare function insertMention(text: string, mentions: readonly OfficeCommentMention[] | undefined, caret: number, candidate: OfficeMentionCandidate): OfficeMentionInsertion;
52
+ /** What a box posts: its text without the surrounding whitespace, and the spans moved with it. */
53
+ export declare function trimMentionText(text: string, mentions: readonly OfficeCommentMention[] | undefined): {
54
+ text: string;
55
+ mentions: OfficeCommentMention[];
56
+ };
57
+ /**
58
+ * The spans after the text changed from `before` to `after` by one edit (typing, deleting or a
59
+ * paste): spans before the changed part stay, spans after it move by the length change, and a span
60
+ * the edit touches is dropped. The same array when the text did not change.
61
+ */
62
+ export declare function followTextEdit(before: string, after: string, mentions: readonly OfficeCommentMention[]): readonly OfficeCommentMention[];
63
+ //# sourceMappingURL=mentions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mentions.d.ts","sourceRoot":"","sources":["../../src/comments/mentions.ts"],"names":[],"mappings":"AAKA,mFAAmF;AACnF,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,qCAAqC;AACrC,MAAM,WAAW,sBAAsB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAcD;;;GAGG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,SAAS,oBAAoB,EAAE,GACxC,oBAAoB,EAAE,CAkBxB;AAED,4FAA4F;AAC5F,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAYrF;AAWD,uGAAuG;AACvG,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,sBAAsB,EACtE,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,KAAK,EAAE,MAAM,EACb,KAAK,SAAI,GACP,CAAC,EAAE,CAWL;AAED,oEAAoE;AACpE,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,EACrD,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,sBAAsB,GAC/B,sBAAsB,CAmBxB;AAED,kGAAkG;AAClG,wBAAgB,eAAe,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,GACnD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAA;CAAE,CAUpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS,oBAAoB,EAAE,GACvC,SAAS,oBAAoB,EAAE,CAmBjC"}
@@ -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) {
@@ -79561,11 +79610,11 @@ function nextSelectActive(choices3, active2, step2) {
79561
79610
  }
79562
79611
  var SELECT_PAGE_SIZE = 8;
79563
79612
  function pageSelectActive(choices3, active2, direction) {
79564
- const usable = (index) => !choices3[index]?.disabled && !choices3[index]?.hidden;
79613
+ const usable2 = (index) => !choices3[index]?.disabled && !choices3[index]?.hidden;
79565
79614
  const last = choices3.length - 1;
79566
79615
  const target = Math.max(0, Math.min(last, Math.max(active2, 0) + direction * SELECT_PAGE_SIZE));
79567
79616
  for (let index = target; index >= 0 && index <= last; index -= direction)
79568
- if (usable(index)) return index;
79617
+ if (usable2(index)) return index;
79569
79618
  return active2;
79570
79619
  }
79571
79620
 
@@ -82554,7 +82603,7 @@ function definePptxInsertSmartArtDialog(registry2) {
82554
82603
  if (this.#live || this.#draw) {
82555
82604
  return;
82556
82605
  }
82557
- this.#live = import('./smartart-insert-preview-3BY6HNZL.cjs').then((module) => {
82606
+ this.#live = import('./smartart-insert-preview-OW6RXM7M.cjs').then((module) => {
82558
82607
  if (this.#draw || !this.#picker) {
82559
82608
  return;
82560
82609
  }
@@ -92706,6 +92755,7 @@ exports.flattenOutline = flattenOutline;
92706
92755
  exports.flattenSlideElements = flattenSlideElements;
92707
92756
  exports.flattenTagCollections = flattenTagCollections;
92708
92757
  exports.flattenViewerOptions = flattenViewerOptions;
92758
+ exports.followCommentEdit = followCommentEdit;
92709
92759
  exports.followingText = followingText;
92710
92760
  exports.fontAlignmentVerticalAlign = fontAlignmentVerticalAlign;
92711
92761
  exports.fontFamilyItems = fontFamilyItems;
@@ -93956,6 +94006,7 @@ exports.transitionsLabel = transitionsLabel;
93956
94006
  exports.translateChartFormatText = translateChartFormatText2;
93957
94007
  exports.translateMotionPath = translateMotionPath;
93958
94008
  exports.travelledBox = travelledBox;
94009
+ exports.trimCommentMentions = trimCommentMentions;
93959
94010
  exports.trimmedMediaDurationMs = trimmedMediaDurationMs;
93960
94011
  exports.updateGlowPatch = updateGlowPatch;
93961
94012
  exports.updateGradientStopPatch = updateGradientStopPatch;