superdoc 2.6.0-next.8 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/superdoc.cjs CHANGED
@@ -2547,9 +2547,9 @@ function isReactive$1(value) {
2547
2547
  function isRef$1(r) {
2548
2548
  return !!(r && r.__v_isRef === true);
2549
2549
  }
2550
- function toRaw$3(observed) {
2550
+ function toRaw$4(observed) {
2551
2551
  const raw = observed && observed["__v_raw"];
2552
- return raw ? toRaw$3(raw) : observed;
2552
+ return raw ? toRaw$4(raw) : observed;
2553
2553
  }
2554
2554
  var StateEditor = class {
2555
2555
  constructor() {
@@ -2594,14 +2594,14 @@ var StateEditor = class {
2594
2594
  createDefaultSetCallback(state) {
2595
2595
  return (object, field, value) => {
2596
2596
  if (state.remove || state.newKey) if (Array.isArray(object)) object.splice(field, 1);
2597
- else if (toRaw$3(object) instanceof Map) object.delete(field);
2598
- else if (toRaw$3(object) instanceof Set) object.delete(Array.from(object.values())[field]);
2597
+ else if (toRaw$4(object) instanceof Map) object.delete(field);
2598
+ else if (toRaw$4(object) instanceof Set) object.delete(Array.from(object.values())[field]);
2599
2599
  else Reflect.deleteProperty(object, field);
2600
2600
  if (!state.remove) {
2601
2601
  const target21 = object[state.newKey || field];
2602
2602
  if (this.refEditor.isRef(target21)) this.refEditor.set(target21, value);
2603
- else if (toRaw$3(object) instanceof Map) object.set(state.newKey || field, value);
2604
- else if (toRaw$3(object) instanceof Set) object.add(value);
2603
+ else if (toRaw$4(object) instanceof Map) object.set(state.newKey || field, value);
2604
+ else if (toRaw$4(object) instanceof Set) object.add(value);
2605
2605
  else object[state.newKey || field] = value;
2606
2606
  }
2607
2607
  };
@@ -5690,6 +5690,7 @@ function useComment(params) {
5690
5690
  let parentCommentId = params.parentCommentId;
5691
5691
  let trackedChangeParentId = params.trackedChangeParentId;
5692
5692
  const trackedChangeThreadParentId = (0, vue.ref)(params.trackedChangeThreadParentId);
5693
+ const trackedChangeSide = (0, vue.ref)(params.trackedChangeSide);
5693
5694
  const fileId = params.fileId;
5694
5695
  const fileType = params.fileType;
5695
5696
  const createdAtVersionNumber = params.createdAtVersionNumber;
@@ -5940,6 +5941,7 @@ function useComment(params) {
5940
5941
  parentCommentId,
5941
5942
  trackedChangeParentId,
5942
5943
  trackedChangeThreadParentId: trackedChangeThreadParentId.value,
5944
+ trackedChangeSide: trackedChangeSide.value,
5943
5945
  fileId,
5944
5946
  fileType,
5945
5947
  mentions: mentions.value.map((u) => {
@@ -5995,6 +5997,7 @@ function useComment(params) {
5995
5997
  parentCommentId,
5996
5998
  trackedChangeParentId,
5997
5999
  trackedChangeThreadParentId,
6000
+ trackedChangeSide,
5998
6001
  fileId,
5999
6002
  fileType,
6000
6003
  mentions,
@@ -6914,6 +6917,78 @@ var trackedChangeThreadParentIdForComment = (comment) => {
6914
6917
  //#endregion
6915
6918
  //#region src/stores/helpers/tracked-change-thread-index.js
6916
6919
  /**
6920
+ * @param {string|null|undefined} side
6921
+ * @returns {'source'|'destination'|null}
6922
+ */
6923
+ var trackedChangeSideGroup = (side) => {
6924
+ if (side === "source" || side === "deleted") return "source";
6925
+ if (side === "destination" || side === "inserted") return "destination";
6926
+ return null;
6927
+ };
6928
+ /**
6929
+ * @param {{ semanticColorKey?: string|null }} comment
6930
+ * @returns {'source'|'destination'|null}
6931
+ */
6932
+ var trackedChangeRowSideGroup = (comment) => {
6933
+ if (comment?.semanticColorKey === "move-from") return "source";
6934
+ if (comment?.semanticColorKey === "move-to") return "destination";
6935
+ return null;
6936
+ };
6937
+ /**
6938
+ * Resolve explicit conversation provenance to the visible tracked-change row.
6939
+ * Canonical move ids are shared, so their persisted side selects the source or
6940
+ * destination card. Other ambiguous canonical ids remain unresolved.
6941
+ *
6942
+ * @template {{ commentId: string|number, trackedChange?: boolean, trackedChangeCanonicalId?: string|number|null, trackedChangeSide?: string|null, semanticColorKey?: string|null, parentCommentId?: string|number|null, threadingParentCommentId?: string|number|null, trackedChangeParentId?: string|number|null, trackedChangeThreadParentId?: string|number|null }} Comment
6943
+ * @param {ReadonlyArray<Comment>} allComments
6944
+ * @returns {Map<Comment, Comment>}
6945
+ */
6946
+ var buildTrackedChangeThreadOwnerIndex = (allComments) => {
6947
+ /** @type {Map<string, Comment[]>} */
6948
+ const trackedRowsById = /* @__PURE__ */ new Map();
6949
+ /** @type {Map<string, Comment[]>} */
6950
+ const trackedRowsByCanonicalId = /* @__PURE__ */ new Map();
6951
+ /**
6952
+ * @template Key, Value
6953
+ * @param {Map<Key, Value[]>} map
6954
+ * @param {Key} key
6955
+ * @param {Value} value
6956
+ */
6957
+ const append = (map, key, value) => {
6958
+ const existing = map.get(key);
6959
+ if (existing) existing.push(value);
6960
+ else map.set(key, [value]);
6961
+ };
6962
+ for (const comment of allComments) {
6963
+ if (comment?.trackedChange !== true) continue;
6964
+ if (typeof comment.commentId === "string") append(trackedRowsById, comment.commentId, comment);
6965
+ if (comment.trackedChangeCanonicalId != null) append(trackedRowsByCanonicalId, String(comment.trackedChangeCanonicalId), comment);
6966
+ }
6967
+ /** @type {Map<Comment, Comment>} */
6968
+ const ownerByComment = /* @__PURE__ */ new Map();
6969
+ for (const comment of allComments) {
6970
+ if (comment?.trackedChange === true) continue;
6971
+ const aliases = new Set([comment.threadingParentCommentId, trackedChangeThreadParentIdForComment(comment)].filter((id) => id != null).map((id) => String(id)));
6972
+ if (aliases.size === 0) continue;
6973
+ const directOwners = new Set([...aliases].flatMap((alias) => trackedRowsById.get(alias) ?? []));
6974
+ if (directOwners.size === 1) {
6975
+ ownerByComment.set(comment, [...directOwners][0]);
6976
+ continue;
6977
+ }
6978
+ if (directOwners.size > 1) continue;
6979
+ const canonicalOwners = new Set([...aliases].flatMap((alias) => trackedRowsByCanonicalId.get(alias) ?? []));
6980
+ if (canonicalOwners.size === 1) {
6981
+ ownerByComment.set(comment, [...canonicalOwners][0]);
6982
+ continue;
6983
+ }
6984
+ const sideGroup = trackedChangeSideGroup(comment.trackedChangeSide);
6985
+ if (!sideGroup) continue;
6986
+ const sideOwners = [...canonicalOwners].filter((owner) => trackedChangeRowSideGroup(owner) === sideGroup);
6987
+ if (sideOwners.length === 1) ownerByComment.set(comment, sideOwners[0]);
6988
+ }
6989
+ return ownerByComment;
6990
+ };
6991
+ /**
6917
6992
  * Build every tracked-change conversation in one graph pass.
6918
6993
  *
6919
6994
  * `CommentDialog` instances are intentionally mounted for every tracked-change
@@ -6928,7 +7003,7 @@ var trackedChangeThreadParentIdForComment = (comment) => {
6928
7003
  * asymmetry here so numeric tracked-change row ids do not acquire new thread
6929
7004
  * membership.
6930
7005
  *
6931
- * @template {{ commentId: string|number, trackedChange?: boolean, createdTime?: number, parentCommentId?: string|number|null, threadingParentCommentId?: string|number|null, trackedChangeParentId?: string|number|null }} Comment
7006
+ * @template {{ commentId: string|number, trackedChange?: boolean, trackedChangeCanonicalId?: string|number|null, trackedChangeSide?: string|null, semanticColorKey?: string|null, createdTime?: number, parentCommentId?: string|number|null, threadingParentCommentId?: string|number|null, trackedChangeParentId?: string|number|null }} Comment
6932
7007
  * @param {ReadonlyArray<Comment>} allComments
6933
7008
  * @param {ReadonlyMap<string|number, ReadonlyArray<Comment>>} [previous]
6934
7009
  * @returns {Map<string|number, ReadonlyArray<Comment>>}
@@ -6936,12 +7011,13 @@ var trackedChangeThreadParentIdForComment = (comment) => {
6936
7011
  var buildTrackedChangeThreadIndex = (allComments, previous = /* @__PURE__ */ new Map()) => {
6937
7012
  /** @type {Map<string, Comment[]>} Parent links are normalized exactly as in the legacy collector. */
6938
7013
  const childrenByParentId = /* @__PURE__ */ new Map();
6939
- /** @type {Map<string, Comment[]>} Explicit tracked-change conversation roots, normalized like the legacy collector. */
6940
- const anchoredRootsByTrackedChangeId = /* @__PURE__ */ new Map();
7014
+ /** @type {Map<string, Comment[]>} Explicit conversation members keyed by their visible tracked-change row. */
7015
+ const anchoredCommentsByTrackedChangeId = /* @__PURE__ */ new Map();
6941
7016
  /** @type {Map<string|number, Comment[]>} */
6942
7017
  const commentsById = /* @__PURE__ */ new Map();
6943
7018
  /** @type {Map<Comment, number>} */
6944
7019
  const sourceIndex = /* @__PURE__ */ new Map();
7020
+ const trackedChangeOwnerByComment = buildTrackedChangeThreadOwnerIndex(allComments);
6945
7021
  /**
6946
7022
  * @template Key, Value
6947
7023
  * @param {Map<Key, Value[]>} map
@@ -6957,8 +7033,8 @@ var buildTrackedChangeThreadIndex = (allComments, previous = /* @__PURE__ */ new
6957
7033
  sourceIndex.set(comment, index);
6958
7034
  append(commentsById, comment.commentId, comment);
6959
7035
  new Set([comment.parentCommentId, comment.threadingParentCommentId].filter((id) => id != null).map((id) => String(id))).forEach((parentId) => append(childrenByParentId, parentId, comment));
6960
- const trackedChangeThreadParentId = isV2SyntheticTrackedChangeRow(comment) ? null : trackedChangeThreadParentIdForComment(comment);
6961
- if (trackedChangeThreadParentId != null && !comment.parentCommentId) append(anchoredRootsByTrackedChangeId, String(trackedChangeThreadParentId), comment);
7036
+ const owner = trackedChangeOwnerByComment.get(comment);
7037
+ if (owner?.commentId != null) append(anchoredCommentsByTrackedChangeId, String(owner.commentId), comment);
6962
7038
  });
6963
7039
  /** @type {Map<string|number, ReadonlyArray<Comment>>} */
6964
7040
  const next = /* @__PURE__ */ new Map();
@@ -6968,7 +7044,10 @@ var buildTrackedChangeThreadIndex = (allComments, previous = /* @__PURE__ */ new
6968
7044
  const threadIds = /* @__PURE__ */ new Set([trackedChangeId]);
6969
7045
  /** @type {Array<string|number>} */
6970
7046
  const queue = [];
6971
- const seed = typeof trackedChangeId === "string" ? [...childrenByParentId.get(trackedChangeId) ?? [], ...anchoredRootsByTrackedChangeId.get(trackedChangeId) ?? []] : [];
7047
+ /** @type {string[]} */
7048
+ const threadParentIds = [];
7049
+ if (typeof trackedChangeId === "string") threadParentIds.push(trackedChangeId);
7050
+ const seed = threadParentIds.flatMap((parentId) => [...childrenByParentId.get(parentId) ?? [], ...anchoredCommentsByTrackedChangeId.get(parentId) ?? []]);
6972
7051
  for (const comment of seed) {
6973
7052
  const id = comment.commentId;
6974
7053
  if (id === trackedChangeId || threadIds.has(id)) continue;
@@ -7145,6 +7224,14 @@ var normalizeV2CommentDraftText = (value) => {
7145
7224
  if (!html || html === "<p></p>") return "";
7146
7225
  return decodeCommentDraftEntities(html.replace(COMMENT_DRAFT_BR_TAG, "\n").replace(COMMENT_DRAFT_BLOCK_CLOSE_TAG, "\n").replace(COMMENT_DRAFT_BLOCK_OPEN_TAG, "").replace(COMMENT_DRAFT_ANY_TAG, "")).replace(/\n{3,}/g, "\n\n").replace(/^\n+/, "").replace(/\n+$/, "");
7147
7226
  };
7227
+ var cloneV2TrackedChangeStory = (story) => {
7228
+ if (!story || typeof story !== "object") return null;
7229
+ const rawStory = (0, vue.toRaw)(story);
7230
+ return {
7231
+ ...rawStory,
7232
+ ...rawStory.section && typeof rawStory.section === "object" ? { section: { ...(0, vue.toRaw)(rawStory.section) } } : {}
7233
+ };
7234
+ };
7148
7235
  var useCommentsStore = defineStore("comments", () => {
7149
7236
  const BODY_TRACKED_CHANGE_STORY = {
7150
7237
  kind: "story",
@@ -7458,12 +7545,6 @@ var useCommentsStore = defineStore("comments", () => {
7458
7545
  if (isV2SyntheticTrackedChangeRow(comment) && comment?.trackedChange === true) return null;
7459
7546
  return trackedChangeThreadParentIdForComment(comment);
7460
7547
  };
7461
- const shouldThreadWithTrackedChange = (comment) => {
7462
- const trackedChangeParentId = trackedChangeThreadParentIdForComment$1(comment);
7463
- if (!trackedChangeParentId) return false;
7464
- const trackedChange = getComment(trackedChangeParentId);
7465
- return Boolean(trackedChange?.trackedChange);
7466
- };
7467
7548
  /**
7468
7549
  * Extract the position lookup key from a comment or comment ID.
7469
7550
  * Prefers whichever key currently exists in editorCommentPositions.
@@ -8248,9 +8329,10 @@ var useCommentsStore = defineStore("comments", () => {
8248
8329
  const parentComments = [];
8249
8330
  const resolvedComments = [];
8250
8331
  const childCommentMap = /* @__PURE__ */ new Map();
8332
+ const trackedChangeThreadOwnerIndex = buildTrackedChangeThreadOwnerIndex(source);
8251
8333
  source.forEach((comment) => {
8252
8334
  if (!isThreadVisible(comment)) return;
8253
- const trackedChangeThreadParentId = shouldThreadWithTrackedChange(comment) ? trackedChangeThreadParentIdForComment$1(comment) : null;
8335
+ const trackedChangeThreadParentId = trackedChangeThreadOwnerIndex.get(comment)?.commentId ?? null;
8254
8336
  const parentId = comment.trackedChange ? null : comment.parentCommentId || trackedChangeThreadParentId;
8255
8337
  if (comment.resolvedTime) resolvedComments.push(comment);
8256
8338
  else if (!parentId && !comment.resolvedTime) parentComments.push({ ...comment });
@@ -8821,16 +8903,18 @@ var useCommentsStore = defineStore("comments", () => {
8821
8903
  };
8822
8904
  };
8823
8905
  /**
8824
- * Reply to an existing comment through the v2 adapter.
8906
+ * Reply to an existing comment or tracked-change review row through the v2 adapter.
8825
8907
  *
8826
8908
  * Plan §4.1 rules:
8827
8909
  * - empty text rejects before mutation with `comment-text-empty`
8828
8910
  * - missing parent rejects before mutation with `parent-comment-id-missing`
8829
- * - successful reply refreshes from v2 list and reconciles
8911
+ * - a tracked-change row creates its first anchored root only after a
8912
+ * canonical-id reply reports `TARGET_NOT_FOUND`
8913
+ * - successful mutation refreshes from v2 list and reconciles
8830
8914
  * - rejection preserves rows and emits a rejected `comments-update` event
8831
8915
  * - committed-but-refresh-failed surfaces honestly (no reconcile with `[]`)
8832
8916
  */
8833
- const replyCommentV2 = async ({ superdoc, parentCommentId, text, mentions = [] } = {}) => {
8917
+ const replyCommentV2 = async ({ superdoc, parentCommentId, text, mentions = [], trackedChangeTarget } = {}) => {
8834
8918
  if (commentsAreReadOnly()) return readOnlyMutationOutcome();
8835
8919
  const v2Adapter = getV2CommentsAdapter(superdoc);
8836
8920
  if (!v2Adapter) return {
@@ -8847,17 +8931,44 @@ var useCommentsStore = defineStore("comments", () => {
8847
8931
  ok: false,
8848
8932
  reason: "comment-text-empty"
8849
8933
  };
8850
- const parent = commentsList.value.find((c) => String(c.commentId) === normalizedParent);
8934
+ let normalizedTrackedChangeTarget = null;
8935
+ if (trackedChangeTarget != null) {
8936
+ const trackedChangeId = trackedChangeTarget?.trackedChangeId != null ? String(trackedChangeTarget.trackedChangeId) : null;
8937
+ if (!trackedChangeId) return {
8938
+ ok: false,
8939
+ reason: "tracked-change-id-missing"
8940
+ };
8941
+ if (trackedChangeId !== normalizedParent) return {
8942
+ ok: false,
8943
+ reason: "tracked-change-target-mismatch"
8944
+ };
8945
+ const story = cloneV2TrackedChangeStory(trackedChangeTarget.story);
8946
+ normalizedTrackedChangeTarget = {
8947
+ kind: "trackedChange",
8948
+ trackedChangeId,
8949
+ ...trackedChangeTarget.side != null ? { side: trackedChangeTarget.side } : {},
8950
+ ...story ? { story } : {}
8951
+ };
8952
+ }
8953
+ const parent = commentsList.value.find((c) => String(c.commentId) === normalizedParent || c.trackedChange === true && String(c.trackedChangeCanonicalId) === normalizedParent);
8851
8954
  const fileId = parent?.fileId ?? v2Adapter.documentId ?? null;
8852
8955
  return runV2CommentMutation({
8853
8956
  superdoc,
8854
8957
  adapter: v2Adapter,
8855
8958
  fileId,
8856
- operation: () => v2Adapter.reply({
8857
- parentCommentId: normalizedParent,
8858
- text: plainText,
8859
- ...mentions.length ? { mentions } : {}
8860
- }),
8959
+ operation: async () => {
8960
+ const replyOutcome = await v2Adapter.reply({
8961
+ parentCommentId: normalizedParent,
8962
+ text: plainText,
8963
+ ...mentions.length ? { mentions } : {}
8964
+ });
8965
+ if (replyOutcome?.ok || replyOutcome?.code !== "TARGET_NOT_FOUND" || !normalizedTrackedChangeTarget) return replyOutcome;
8966
+ return v2Adapter.commitPendingComment({
8967
+ text: plainText,
8968
+ target: normalizedTrackedChangeTarget,
8969
+ ...mentions.length ? { mentions } : {}
8970
+ });
8971
+ },
8861
8972
  eventType: COMMENT_EVENTS.ADD,
8862
8973
  rejectionFallbackReason: "v2-reply-failed",
8863
8974
  rejectionEventExtras: parent ? { comment: getCommentEventPayload(parent) } : {},
@@ -9330,7 +9441,7 @@ var useCommentsStore = defineStore("comments", () => {
9330
9441
  if (input.trackedChangeThreadParentId !== void 0) existing.trackedChangeThreadParentId = input.trackedChangeThreadParentId;
9331
9442
  else existing.trackedChangeThreadParentId = void 0;
9332
9443
  if (input.trackedChangeSide !== void 0) existing.trackedChangeSide = input.trackedChangeSide;
9333
- else delete existing.trackedChangeSide;
9444
+ else existing.trackedChangeSide = void 0;
9334
9445
  if (input.threadingParentCommentId !== void 0) existing.threadingParentCommentId = input.threadingParentCommentId;
9335
9446
  else delete existing.threadingParentCommentId;
9336
9447
  };
@@ -10072,7 +10183,7 @@ var useCommentsStore = defineStore("comments", () => {
10072
10183
  if (!(trackedChangeParentId && trackedChangeIds.has(trackedChangeParentId) || trackedChangeThreadParentId && trackedChangeIds.has(trackedChangeThreadParentId) || threadingParentCommentId && trackedChangeIds.has(threadingParentCommentId) || parentCommentId && trackedChangeIds.has(parentCommentId))) return;
10073
10184
  delete linkedComment.trackedChangeParentId;
10074
10185
  linkedComment.trackedChangeThreadParentId = void 0;
10075
- delete linkedComment.trackedChangeSide;
10186
+ linkedComment.trackedChangeSide = void 0;
10076
10187
  delete linkedComment.threadingParentCommentId;
10077
10188
  if (parentCommentId && trackedChangeIds.has(parentCommentId)) delete linkedComment.parentCommentId;
10078
10189
  detachedCount += 1;
@@ -12516,10 +12627,23 @@ var _sfc_main$33 = {
12516
12627
  };
12517
12628
  const getV2ExistingReplyParentId = (comment) => {
12518
12629
  if (!comment) return null;
12519
- if (comment.trackedChange && comment.importedId != null) return String(comment.importedId);
12630
+ if (comment.trackedChange && comment.trackedChangeCanonicalId != null) return String(comment.trackedChangeCanonicalId);
12520
12631
  if (comment.commentId != null) return String(comment.commentId);
12521
12632
  return null;
12522
12633
  };
12634
+ const getV2TrackedChangeCommentTarget = (comment) => {
12635
+ if (!comment?.trackedChange) return null;
12636
+ const trackedChangeId = getV2ExistingReplyParentId(comment);
12637
+ if (!trackedChangeId) return null;
12638
+ const target = {
12639
+ kind: "trackedChange",
12640
+ trackedChangeId
12641
+ };
12642
+ if (comment.trackedChangeStory) target.story = comment.trackedChangeStory;
12643
+ if (comment.semanticColorKey === "move-from") target.side = "source";
12644
+ if (comment.semanticColorKey === "move-to") target.side = "destination";
12645
+ return target;
12646
+ };
12523
12647
  const getEntryBoundsCoordinate = (entry, coordinate) => {
12524
12648
  const value = entry?.bounds?.[coordinate];
12525
12649
  return Number.isFinite(value) ? value : null;
@@ -12860,11 +12984,13 @@ var _sfc_main$33 = {
12860
12984
  isSubmittingReply.value = true;
12861
12985
  try {
12862
12986
  const parentCommentId = getV2ExistingReplyParentId(props.comment);
12987
+ const trackedChangeTarget = getV2TrackedChangeCommentTarget(props.comment);
12863
12988
  const outcome = await commentsStore.replyCommentV2({
12864
12989
  superdoc: proxy.$superdoc,
12865
12990
  parentCommentId,
12866
12991
  text: currentCommentText.value,
12867
- ...currentCommentMentions.value.length ? { mentions: currentCommentMentions.value } : {}
12992
+ ...currentCommentMentions.value.length ? { mentions: currentCommentMentions.value } : {},
12993
+ ...trackedChangeTarget ? { trackedChangeTarget } : {}
12868
12994
  });
12869
12995
  if (!outcome?.ok) {
12870
12996
  (0, vue.nextTick)(() => emit("resize"));
@@ -13468,7 +13594,7 @@ var _sfc_main$33 = {
13468
13594
  };
13469
13595
  }
13470
13596
  };
13471
- var CommentDialog_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$33, [["__scopeId", "data-v-f4c743f2"]]);
13597
+ var CommentDialog_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$33, [["__scopeId", "data-v-50d8ea52"]]);
13472
13598
  //#endregion
13473
13599
  //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
13474
13600
  var _hoisted_1$25 = [
@@ -17978,7 +18104,9 @@ function scrollToElement(targetElement, options = {
17978
18104
  if (!targetElement) return;
17979
18105
  const container = getScrollableParent(targetElement);
17980
18106
  const containerRect = container.getBoundingClientRect();
17981
- const offsetTop = targetElement.getBoundingClientRect().top - containerRect.top + container.scrollTop;
18107
+ const targetRect = targetElement.getBoundingClientRect();
18108
+ const containerTop = container === (document.scrollingElement || document.documentElement) ? 0 : containerRect.top;
18109
+ const offsetTop = targetRect.top - containerTop + container.scrollTop;
17982
18110
  const scrollPaddingTopValue = window.getComputedStyle(container).scrollPaddingTop?.trim();
17983
18111
  const resolvedScrollPaddingTop = scrollPaddingTopValue?.endsWith("px") ? Number(scrollPaddingTopValue.slice(0, -2)) : 0;
17984
18112
  const scrollPaddingTop = Number.isFinite(resolvedScrollPaddingTop) && resolvedScrollPaddingTop >= 0 ? resolvedScrollPaddingTop : 0;
@@ -43477,7 +43605,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43477
43605
  this.config.colors = shuffleArray(this.config.colors);
43478
43606
  this.userColorMap = /* @__PURE__ */ new Map();
43479
43607
  this.colorIndex = 0;
43480
- this.version = "2.6.0-next.8";
43608
+ this.version = "2.6.0";
43481
43609
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43482
43610
  this.superdocId = config.superdocId || require_uuid.v4();
43483
43611
  this.colors = this.config.colors ?? [];