superdoc 2.28.0 → 2.29.0-next.2

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 (68) hide show
  1. package/dist/chunks/{PdfViewer-JHXZQZ9x.es.js → PdfViewer-D4lVeOJu.es.js} +3 -2
  2. package/dist/chunks/{PdfViewer-Cg072l5d.cjs → PdfViewer-boENOZdF.cjs} +3 -2
  3. package/dist/chunks/{create-super-doc-ui-BfgYblyI.cjs → create-super-doc-ui-BAGOnYGM.cjs} +201 -23
  4. package/dist/chunks/{create-super-doc-ui-BbjHD1ul.es.js → create-super-doc-ui-BFt8agAI.es.js} +180 -20
  5. package/dist/chunks/is-finite-number-BEXgTRgc.cjs +11 -0
  6. package/dist/chunks/is-finite-number-BpL4F38c.es.js +6 -0
  7. package/dist/collaboration-upgrade-engine.cjs +1 -1
  8. package/dist/collaboration-upgrade-engine.es.js +1 -1
  9. package/dist/document-api/src/capabilities/html-markdown-support.d.ts +3 -3
  10. package/dist/document-api/src/contract/metadata-types.d.ts +1 -1
  11. package/dist/document-api/src/contract/operation-definitions.d.ts +1 -1
  12. package/dist/document-api/src/index.d.ts +1 -1
  13. package/dist/document-api/src/lists/lists.d.ts +79 -79
  14. package/dist/document-api/src/tables/tables.d.ts +2 -1
  15. package/dist/document-api/src/types/table-operations.types.d.ts +1 -0
  16. package/dist/document-api/src/write/write.d.ts +10 -9
  17. package/dist/layout-engine/contracts/src/index.d.ts +1 -1
  18. package/dist/layout-engine/contracts/src/paragraph-visible-text.d.ts +3 -1
  19. package/dist/layout-engine/painters/dom/src/page-content.d.ts +1 -1
  20. package/dist/layout-engine/painters/dom/src/persistent-page-surface.d.ts +2 -0
  21. package/dist/public/ui-react.cjs +1 -1
  22. package/dist/public/ui-react.es.js +1 -1
  23. package/dist/public/ui-vue.cjs +1 -1
  24. package/dist/public/ui-vue.es.js +1 -1
  25. package/dist/public/ui.cjs +1 -1
  26. package/dist/public/ui.es.js +1 -1
  27. package/dist/style.css +1 -1
  28. package/dist/style.layered.css +1 -1
  29. package/dist/superdoc/src/SuperDoc.vue.d.ts +5 -3
  30. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +2365 -48
  31. package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +108 -23
  32. package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +689 -14
  33. package/dist/superdoc/src/components/CommentsLayer/CommentsDropdown.vue.d.ts +55 -20
  34. package/dist/superdoc/src/components/CommentsLayer/FloatingComments.vue.d.ts +21 -8
  35. package/dist/superdoc/src/components/CommentsLayer/InternalDropdown.vue.d.ts +24 -8
  36. package/dist/superdoc/src/components/CommentsLayer/PdfCommentsLayer.vue.d.ts +5 -3
  37. package/dist/superdoc/src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue.d.ts +60 -12
  38. package/dist/superdoc/src/components/CommentsLayer/commentsList/commentsList.vue.d.ts +20 -6
  39. package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +1 -0
  40. package/dist/superdoc/src/components/general/Avatar.vue.d.ts +14 -0
  41. package/dist/superdoc/src/components/surfaces/SurfaceDialog.vue.d.ts +27 -9
  42. package/dist/superdoc/src/components/surfaces/SurfaceExternalMount.vue.d.ts +53 -16
  43. package/dist/superdoc/src/composables/use-link-popover.d.ts +3 -3
  44. package/dist/superdoc/src/composables/use-superdoc-instance.d.ts +4 -1
  45. package/dist/superdoc/src/core/SuperDoc.d.ts +1 -1
  46. package/dist/superdoc/src/core/collaboration/permissions.d.ts +2 -1
  47. package/dist/superdoc/src/core/types/index.d.ts +9 -4
  48. package/dist/superdoc/src/helpers/is-finite-number.d.ts +1 -0
  49. package/dist/superdoc/src/internal/diagnostics/diagnostic-dedupe.d.ts +2 -2
  50. package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +2 -2
  51. package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +181 -36
  52. package/dist/superdoc/src/internal/toolbar/built-in/LinkedStyle.vue.d.ts +39 -10
  53. package/dist/superdoc/src/internal/toolbar/built-in/PageNumberMenu.vue.d.ts +133 -22
  54. package/dist/superdoc/src/internal/toolbar/built-in/SdTooltip.vue.d.ts +62 -23
  55. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +101 -16
  56. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButtonIcon.vue.d.ts +31 -10
  57. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +82 -11
  58. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +122 -33
  59. package/dist/superdoc/src/internal/toolbar/built-in/use-toolbar-item.d.ts +0 -1
  60. package/dist/superdoc/src/stores/comments-store.d.ts +151 -28
  61. package/dist/superdoc/src/stores/superdoc-store.d.ts +454 -85
  62. package/dist/superdoc.cjs +396 -443
  63. package/dist/superdoc.es.js +329 -378
  64. package/dist-cdn/style.layered.css +1 -1
  65. package/dist-cdn/superdoc.min.css +1 -1
  66. package/dist-cdn/superdoc.min.js +42 -42
  67. package/package.json +2 -2
  68. package/dist/superdoc/src/internal/toolbar/built-in/OverflowMenu.vue.d.ts +0 -104
@@ -1,10 +1,11 @@
1
1
  import { i as __toESM$2 } from "./chunks/rolldown-runtime-0pSA04fp.es.js";
2
2
  import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
3
- import { S as recordInteraction, _ as DOM_CLASS_NAMES, a as registerFirstPartyCommandMutation, b as getWorkflowRecording, c as getCommandDescriptor, d as mutationCommittedEventChangedDocument, f as createImageFilePicker, g as isSyntheticTrackedChangeCommentLaneItem, h as isPlainObject$1, i as readFirstPartyPageNumbers, l as applyV2CommentInvalidationFromMutation, n as executeFirstPartyCommandAsync, o as isRecord, p as resolveImageSrc, r as executeFirstPartyShortcutAsync, t as createSuperDocUI, u as getV2TrackedChangeMutationImpact, v as closeInteractionHistory, x as isWorkflowRecordingEnabled, y as createInteractionHistory } from "./chunks/create-super-doc-ui-BbjHD1ul.es.js";
3
+ import { C as getWorkflowRecording, S as createInteractionHistory, T as recordInteraction, _ as isAllowed, a as registerFirstPartyCommandMutation, b as DOM_CLASS_NAMES, c as getCommandDescriptor, d as mutationCommittedEventChangedDocument, f as createImageFilePicker, g as createTrackedChangePermissionResolver, h as PERMISSIONS, i as readFirstPartyPageNumbers, l as applyV2CommentInvalidationFromMutation, n as executeFirstPartyCommandAsync, o as isRecord, p as resolveImageSrc, r as executeFirstPartyShortcutAsync, t as createSuperDocUI, u as getV2TrackedChangeMutationImpact, v as isPlainObject$1, w as isWorkflowRecordingEnabled, x as closeInteractionHistory, y as isSyntheticTrackedChangeCommentLaneItem } from "./chunks/create-super-doc-ui-BFt8agAI.es.js";
4
4
  import { t as import_eventemitter3 } from "./chunks/eventemitter3-DEIiXiH2.es.js";
5
5
  import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
6
6
  import { $ as vModelSelect, A as onActivated, B as renderList, C as isRef$1, D as normalizeClass, E as nextTick, F as openBlock, G as toDisplayString, H as resolveDirective, I as provide$1, J as toRefs, K as toRaw$2, L as reactive, M as onDeactivated, N as onMounted, O as normalizeProps, P as onScopeDispose$1, Q as vModelCheckbox, R as readonly, S as isReactive$1, T as mergeProps, U as resolveDynamicComponent, V as renderSlot, W as shallowRef$1, X as useAttrs, Y as unref, Z as useSlots, _ as getCurrentInstance, a as computed$1, at as withModifiers, b as hasInjectionContext, c as createCommentVNode, d as createStaticVNode, et as vModelText, f as createTextVNode, g as effectScope, h as defineComponent, i as Transition, it as withKeys, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, m as defineAsyncComponent, n as Fragment, nt as withCtx, o as createApp, p as createVNode, q as toRef, r as Teleport, rt as withDirectives, s as createBlock, t as _plugin_vue_export_helper_default, tt as watch$1, u as createElementVNode, v as getCurrentScope, w as markRaw, x as inject$1, y as h, z as ref } from "./chunks/_plugin-vue_export-helper-CsJQtMvr.es.js";
7
7
  import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-BzJ3CyxR.es.js";
8
+ import { t as isFiniteNumber } from "./chunks/is-finite-number-BpL4F38c.es.js";
8
9
  import { t as PDF_TO_CSS_UNITS } from "./chunks/constants-B6VBlmKp.es.js";
9
10
  import * as Vue from "vue";
10
11
  import { Map as Map$1 } from "yjs";
@@ -257,7 +258,7 @@ var v_click_outside_default = {
257
258
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
258
259
  function getSuperdocVersion() {
259
260
  try {
260
- return "2.28.0";
261
+ return "2.29.0-next.2";
261
262
  } catch {
262
263
  return "unknown";
263
264
  }
@@ -5396,7 +5397,7 @@ function normalizeRoomMode(value) {
5396
5397
  }
5397
5398
  function normalizeSyncTimeoutMs(value) {
5398
5399
  if (value === void 0) return void 0;
5399
- return typeof value === "number" && Number.isFinite(value) && value > 0 && value <= 2147483647 ? value : null;
5400
+ return isFiniteNumber(value) && value > 0 && value <= 2147483647 ? value : null;
5400
5401
  }
5401
5402
  function withSyncTimeout(resolution, syncTimeoutMs) {
5402
5403
  if (!resolution.ok || syncTimeoutMs === void 0) return resolution;
@@ -6583,7 +6584,7 @@ var useSuperdocStore = defineStore("superdoc", () => {
6583
6584
  currentConfig.value = config;
6584
6585
  if (config.zoom?.initial !== void 0) {
6585
6586
  const initialZoom = config.zoom.initial;
6586
- if (typeof initialZoom === "number" && Number.isFinite(initialZoom) && initialZoom > 0) activeZoom.value = initialZoom;
6587
+ if (isFiniteNumber(initialZoom) && initialZoom > 0) activeZoom.value = initialZoom;
6587
6588
  else console.warn("[SuperDoc] zoom.initial expects a positive number representing percentage");
6588
6589
  }
6589
6590
  if (config.zoom?.mode !== void 0) {
@@ -7448,8 +7449,8 @@ var normalizeTrackedChangeImagePreview = (preview) => {
7448
7449
  if (!src || !src.startsWith("data:image/")) return null;
7449
7450
  const contentType = typeof preview.contentType === "string" && preview.contentType.startsWith("image/") ? preview.contentType : null;
7450
7451
  const role = typeof preview.role === "string" ? preview.role : null;
7451
- const width = typeof preview.width === "number" && Number.isFinite(preview.width) && preview.width > 0 ? preview.width : null;
7452
- const height = typeof preview.height === "number" && Number.isFinite(preview.height) && preview.height > 0 ? preview.height : null;
7452
+ const width = isFiniteNumber(preview.width) && preview.width > 0 ? preview.width : null;
7453
+ const height = isFiniteNumber(preview.height) && preview.height > 0 ? preview.height : null;
7453
7454
  const alt = typeof preview.alt === "string" && preview.alt.length > 0 ? preview.alt : "Tracked image preview";
7454
7455
  return {
7455
7456
  src,
@@ -8477,10 +8478,10 @@ var useCommentsStore = defineStore("comments", () => {
8477
8478
  * Get a new pending comment
8478
8479
  *
8479
8480
  * @param {Object} param0
8480
- * @param {Object} param0.selection The selection object
8481
- * @param {String} param0.documentId The document ID
8482
- * @param {String} param0.parentCommentId The parent comment
8483
- * @returns {Object} The new comment object
8481
+ * @param {Object} [param0.selection] The selection object
8482
+ * @param {string | null} [param0.documentId] The document ID
8483
+ * @param {string | null} [param0.parentCommentId] The parent comment
8484
+ * @returns {ReturnType<typeof useComment>} The new comment object
8484
8485
  */
8485
8486
  const getPendingComment = ({ selection, documentId, parentCommentId, ...options }) => {
8486
8487
  return _getNewcomment({
@@ -8552,7 +8553,11 @@ var useCommentsStore = defineStore("comments", () => {
8552
8553
  *
8553
8554
  * @param {Object} param0
8554
8555
  * @param {Object} param0.superdoc The SuperDoc instance
8555
- * @returns {void}
8556
+ * @param {ReturnType<typeof useComment>} param0.comment The comment to add
8557
+ * @param {boolean} [param0.skipEditorUpdate] Skip writing the comment into the editor
8558
+ * @param {boolean} [param0.broadcastChanges] Emit and sync the change
8559
+ * @param {boolean} [param0.isHydration] The comment comes from import or collaboration
8560
+ * @returns {{ ok: boolean, reason?: string, detail?: string, code?: string } | Promise<{ ok: boolean, reason?: string, detail?: string, code?: string }>} The mutation outcome
8556
8561
  */
8557
8562
  const addCommentInternal = ({ superdoc, comment, skipEditorUpdate = false, broadcastChanges = true, isHydration = false }) => {
8558
8563
  if (commentsAreReadOnly() && !isHydration) return readOnlyMutationOutcome();
@@ -9133,6 +9138,13 @@ var useCommentsStore = defineStore("comments", () => {
9133
9138
  * - successful mutation refreshes from v2 list and reconciles
9134
9139
  * - rejection preserves rows and emits a rejected `comments-update` event
9135
9140
  * - committed-but-refresh-failed surfaces honestly (no reconcile with `[]`)
9141
+ *
9142
+ * @param {Object} [param0]
9143
+ * @param {Object} [param0.superdoc] The SuperDoc instance.
9144
+ * @param {string | null} [param0.parentCommentId] The comment or tracked-change row being replied to.
9145
+ * @param {string} [param0.text] The reply text.
9146
+ * @param {Array<{ name?: string | null, email?: string | null }>} [param0.mentions] Users mentioned in the reply.
9147
+ * @param {{ kind: 'trackedChange', trackedChangeId: string, story?: unknown, side?: 'source' | 'destination' }} [param0.trackedChangeTarget] The tracked change a first reply anchors to.
9136
9148
  */
9137
9149
  const replyCommentV2 = async ({ superdoc, parentCommentId, text, mentions = [], trackedChangeTarget } = {}) => {
9138
9150
  if (commentsAreReadOnly()) return readOnlyMutationOutcome();
@@ -10403,15 +10415,13 @@ var useCommentsStore = defineStore("comments", () => {
10403
10415
  } catch {}
10404
10416
  };
10405
10417
  /**
10406
- * Rebuild tracked-change comments from the current editor state.
10407
- *
10408
- * Useful after bulk document transforms (like diff replay) where tracked-change
10409
- * marks may be remapped and incremental tracked-change events are not emitted.
10418
+ * Accept or reject the tracked change behind a sidebar row.
10410
10419
  *
10411
10420
  * @param {Object} param0
10412
10421
  * @param {Object} param0.superdoc The SuperDoc instance.
10413
- * @param {Object} param0.editor The active Super Editor instance.
10414
- * @returns {void}
10422
+ * @param {Object} param0.comment The tracked-change row.
10423
+ * @param {string} param0.decision `'accept'` or `'reject'`.
10424
+ * @returns {{ ok: boolean, success?: boolean, reason?: string } | Promise<{ ok: boolean, success?: boolean, reason?: string }>} The decision outcome.
10415
10425
  */
10416
10426
  const decideTrackedChangeFromSidebar = ({ superdoc, comment, decision }) => {
10417
10427
  const disabledReason = trackedChangeDecisionDisabledReason(superdoc);
@@ -10939,6 +10949,18 @@ var useCommentsStore = defineStore("comments", () => {
10939
10949
  };
10940
10950
  });
10941
10951
  //#endregion
10952
+ //#region src/composables/use-superdoc-instance.ts
10953
+ function useSuperDocInstance() {
10954
+ const instance = getCurrentInstance();
10955
+ if (!instance?.proxy) throw new Error("useSuperDocInstance() must be called during a component setup function.");
10956
+ const superdoc = instance.appContext.config.globalProperties.$superdoc;
10957
+ if (!superdoc) throw new Error("useSuperDocInstance() found no SuperDoc registered at app.config.globalProperties.$superdoc.");
10958
+ return {
10959
+ proxy: instance.proxy,
10960
+ superdoc
10961
+ };
10962
+ }
10963
+ //#endregion
10942
10964
  //#region ../../shared/common/icons/comment-solid.svg?raw
10943
10965
  var comment_solid_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d=\"M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4c0 0 0 0 0 0s0 0 0 0s0 0 0 0c0 0 0 0 0 0l.3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z\"/></svg>";
10944
10966
  //#endregion
@@ -11070,7 +11092,7 @@ function useUiFontFamily() {
11070
11092
  }) };
11071
11093
  }
11072
11094
  //#endregion
11073
- //#region src/components/CommentsLayer/CommentsDropdown.vue
11095
+ //#region src/components/CommentsLayer/CommentsDropdown.vue?vue&type=script&setup=true&lang.ts
11074
11096
  var _hoisted_1$31 = { class: "comments-dropdown" };
11075
11097
  var _hoisted_2$24 = ["onClick"];
11076
11098
  var _hoisted_3$21 = {
@@ -11079,7 +11101,9 @@ var _hoisted_3$21 = {
11079
11101
  };
11080
11102
  var _hoisted_4$15 = ["innerHTML"];
11081
11103
  var _hoisted_5$11 = { class: "comments-dropdown__option-label" };
11082
- var CommentsDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11104
+ //#endregion
11105
+ //#region src/components/CommentsLayer/CommentsDropdown.vue
11106
+ var CommentsDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11083
11107
  __name: "CommentsDropdown",
11084
11108
  props: {
11085
11109
  options: {
@@ -11228,14 +11252,16 @@ var CommentsDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11228
11252
  }), 128))], 4)) : createCommentVNode("", true)]))]);
11229
11253
  };
11230
11254
  }
11231
- }, [["__scopeId", "data-v-7eced80a"]]);
11255
+ }), [["__scopeId", "data-v-70674ffd"]]);
11232
11256
  //#endregion
11233
- //#region src/components/CommentsLayer/InternalDropdown.vue
11257
+ //#region src/components/CommentsLayer/InternalDropdown.vue?vue&type=script&setup=true&lang.ts
11234
11258
  var _hoisted_1$30 = { class: "sd-comment-option" };
11235
11259
  var _hoisted_2$23 = ["innerHTML"];
11236
11260
  var _hoisted_3$20 = { class: "sd-option-state" };
11237
11261
  var _hoisted_4$14 = ["innerHTML"];
11238
- var InternalDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11262
+ //#endregion
11263
+ //#region src/components/CommentsLayer/InternalDropdown.vue
11264
+ var InternalDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11239
11265
  __name: "InternalDropdown",
11240
11266
  props: {
11241
11267
  state: {
@@ -11317,7 +11343,7 @@ var InternalDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11317
11343
  }, 8, ["disabled", "content-style"])], 4);
11318
11344
  };
11319
11345
  }
11320
- }, [["__scopeId", "data-v-138d641e"]]);
11346
+ }), [["__scopeId", "data-v-026f5d66"]]);
11321
11347
  //#endregion
11322
11348
  //#region src/components/CommentsLayer/helpers.js
11323
11349
  /**
@@ -11350,130 +11376,16 @@ function formatDate(timestamp) {
11350
11376
  return `${`${formattedHours}:${minutes.toString().padStart(2, "0")}${meridiem}`} ${month} ${day}`;
11351
11377
  }
11352
11378
  //#endregion
11353
- //#region src/core/collaboration/permissions.js
11354
- var PERMISSIONS = Object.freeze({
11355
- RESOLVE_OWN: "RESOLVE_OWN",
11356
- RESOLVE_OTHER: "RESOLVE_OTHER",
11357
- REJECT_OWN: "REJECT_OWN",
11358
- REJECT_OTHER: "REJECT_OTHER",
11359
- COMMENTS_OVERFLOW_OWN: "COMMENTS_OVERFLOW",
11360
- COMMENTS_OVERFLOW_OTHER: "COMMENTS_OVERFLOW_OTHER",
11361
- COMMENTS_DELETE_OWN: "COMMENTS_DELETE_OWN",
11362
- COMMENTS_DELETE_OTHER: "COMMENTS_DELETE_OTHER",
11363
- UPLOAD_VERSION: "UPLOAD_VERSION",
11364
- VERSION_HISTORY: "VERSION_HISTORY"
11365
- });
11366
- var ROLES = Object.freeze({
11367
- EDITOR: "editor",
11368
- SUGGESTER: "suggester",
11369
- VIEWER: "viewer"
11370
- });
11371
- var PERMISSION_MATRIX = Object.freeze({
11372
- [PERMISSIONS.RESOLVE_OWN]: {
11373
- internal: [ROLES.EDITOR],
11374
- external: [ROLES.EDITOR]
11375
- },
11376
- [PERMISSIONS.RESOLVE_OTHER]: {
11377
- internal: [ROLES.EDITOR],
11378
- external: [ROLES.EDITOR]
11379
- },
11380
- [PERMISSIONS.REJECT_OWN]: {
11381
- internal: [ROLES.EDITOR, ROLES.SUGGESTER],
11382
- external: [ROLES.EDITOR, ROLES.SUGGESTER]
11383
- },
11384
- [PERMISSIONS.REJECT_OTHER]: {
11385
- internal: [ROLES.EDITOR],
11386
- external: [ROLES.EDITOR]
11387
- },
11388
- [PERMISSIONS.COMMENTS_OVERFLOW_OWN]: {
11389
- internal: [ROLES.EDITOR, ROLES.SUGGESTER],
11390
- external: [ROLES.EDITOR, ROLES.SUGGESTER]
11391
- },
11392
- [PERMISSIONS.COMMENTS_OVERFLOW_OTHER]: {
11393
- internal: [ROLES.EDITOR],
11394
- external: [ROLES.EDITOR]
11395
- },
11396
- [PERMISSIONS.COMMENTS_DELETE_OWN]: {
11397
- internal: [ROLES.EDITOR, ROLES.SUGGESTER],
11398
- external: [ROLES.EDITOR, ROLES.SUGGESTER]
11399
- },
11400
- [PERMISSIONS.COMMENTS_DELETE_OTHER]: {
11401
- internal: [ROLES.EDITOR],
11402
- external: [ROLES.EDITOR]
11403
- },
11404
- [PERMISSIONS.UPLOAD_VERSION]: {
11405
- internal: [ROLES.EDITOR],
11406
- external: []
11407
- },
11408
- [PERMISSIONS.VERSION_HISTORY]: {
11409
- internal: [ROLES.EDITOR],
11410
- external: []
11411
- }
11412
- });
11413
- var pickResolver = (context = {}) => {
11414
- if (typeof context.permissionResolver === "function") return context.permissionResolver;
11415
- if (typeof context.superdoc?.config?.permissionResolver === "function") return context.superdoc.config.permissionResolver;
11416
- const deprecatedResolver = context.superdoc?.config?.modules?.comments?.permissionResolver;
11417
- if (typeof deprecatedResolver === "function") return deprecatedResolver;
11418
- return null;
11419
- };
11420
- var BUILT_IN_PERMISSION_METHOD = Symbol.for("superdoc.internal.permission-method.builtin");
11421
- var BUILT_IN_PERMISSION_RESOLVER = Symbol.for("superdoc.internal.permission-resolver.builtin");
11422
- /** Create the shell's internal, live tracked-change permission shim. */
11423
- var createTrackedChangePermissionResolver = (superdoc) => {
11424
- const isBuiltInPolicy = () => superdoc.canPerformPermission?.[BUILT_IN_PERMISSION_METHOD] === true && pickResolver({ superdoc }) === null;
11425
- const resolver = (payload = {}) => isBuiltInPolicy() ? defaultDecisionFor(payload.permission, superdoc.config.role, superdoc.config.isInternal) : superdoc.canPerformPermission({
11426
- ...payload,
11427
- role: superdoc.config.role,
11428
- isInternal: superdoc.config.isInternal
11429
- });
11430
- Object.defineProperty(resolver, BUILT_IN_PERMISSION_RESOLVER, { value: isBuiltInPolicy });
11431
- return resolver;
11432
- };
11433
- var defaultDecisionFor = (permission, role, isInternal) => {
11434
- const internalExternal = isInternal ? "internal" : "external";
11435
- return PERMISSION_MATRIX[permission]?.[internalExternal]?.includes(role) ?? false;
11436
- };
11437
- /**
11438
- * Resolve a client-side permission through the built-in matrix and optional
11439
- * resolver.
11440
- *
11441
- * @param {string} permission The permission to check
11442
- * @param {string} role The role to check
11443
- * @param {boolean} isInternal The internal/external flag
11444
- * @param {object} [context] Context passed to the permission resolver
11445
- * @param {object | null} [context.comment] The comment/tracked change being evaluated
11446
- * @param {object | null} [context.superdoc] The SuperDoc instance
11447
- * @param {object | null} [context.currentUser] The active user object performing the action
11448
- * @param {Function} [context.permissionResolver] Explicit resolver override
11449
- * @param {object | null} [context.trackedChange] Tracked change metadata (for tracked-change permissions)
11450
- * @returns {boolean} Whether the permission is allowed
11451
- */
11452
- var isAllowed = (permission, role, isInternal, context = {}) => {
11453
- const defaultDecision = defaultDecisionFor(permission, role, isInternal);
11454
- const resolver = pickResolver(context);
11455
- if (typeof resolver !== "function") return defaultDecision;
11456
- const decision = resolver({
11457
- permission,
11458
- role,
11459
- isInternal,
11460
- defaultDecision,
11461
- comment: context.comment ?? null,
11462
- currentUser: context.currentUser ?? context.superdoc?.config?.user ?? null,
11463
- superdoc: context.superdoc ?? null,
11464
- trackedChange: context.trackedChange ?? null
11465
- });
11466
- return typeof decision === "boolean" ? decision : defaultDecision;
11467
- };
11468
- //#endregion
11469
- //#region src/components/general/Avatar.vue
11379
+ //#region src/components/general/Avatar.vue?vue&type=script&setup=true&lang.ts
11470
11380
  var _hoisted_1$29 = { class: "user-container" };
11471
11381
  var _hoisted_2$22 = ["src"];
11472
11382
  var _hoisted_3$19 = {
11473
11383
  key: 1,
11474
11384
  class: "user-bg"
11475
11385
  };
11476
- var Avatar_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11386
+ //#endregion
11387
+ //#region src/components/general/Avatar.vue
11388
+ var Avatar_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11477
11389
  __name: "Avatar",
11478
11390
  props: { user: {
11479
11391
  type: Object,
@@ -11497,9 +11409,9 @@ var Avatar_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11497
11409
  }, null, 8, _hoisted_2$22)) : (openBlock(), createElementBlock("span", _hoisted_3$19, toDisplayString(getInitials(__props.user.name, __props.user.email)), 1))]);
11498
11410
  };
11499
11411
  }
11500
- }, [["__scopeId", "data-v-c95b2073"]]);
11412
+ }), [["__scopeId", "data-v-0b3a0868"]]);
11501
11413
  //#endregion
11502
- //#region src/components/CommentsLayer/CommentHeader.vue
11414
+ //#region src/components/CommentsLayer/CommentHeader.vue?vue&type=script&setup=true&lang.ts
11503
11415
  var _hoisted_1$28 = { class: "card-section comment-header" };
11504
11416
  var _hoisted_2$21 = { class: "comment-header-left" };
11505
11417
  var _hoisted_3$18 = { class: "user-info" };
@@ -11529,7 +11441,9 @@ var _hoisted_9$4 = [
11529
11441
  ];
11530
11442
  var _hoisted_10$4 = { class: "overflow-menu__icon" };
11531
11443
  var _hoisted_11$4 = ["innerHTML"];
11532
- var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11444
+ //#endregion
11445
+ //#region src/components/CommentsLayer/CommentHeader.vue
11446
+ var CommentHeader_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11533
11447
  __name: "CommentHeader",
11534
11448
  props: {
11535
11449
  timestamp: {
@@ -11542,7 +11456,7 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11542
11456
  },
11543
11457
  comment: {
11544
11458
  type: Object,
11545
- required: false
11459
+ required: true
11546
11460
  },
11547
11461
  isPendingInput: {
11548
11462
  type: Boolean,
@@ -11584,9 +11498,9 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11584
11498
  const emit = __emit;
11585
11499
  const commentsStore = useCommentsStore();
11586
11500
  const props = __props;
11587
- const { proxy } = getCurrentInstance();
11588
- const role = proxy.$superdoc.config.role;
11589
- const isInternal = proxy.$superdoc.config.isInternal;
11501
+ const { proxy, superdoc } = useSuperDocInstance();
11502
+ const role = superdoc.config.role;
11503
+ const isInternal = superdoc.config.isInternal;
11590
11504
  const isCommentOwnedByCurrentUser = (comment) => {
11591
11505
  const currentUser = proxy.$superdoc.config.user;
11592
11506
  const otherUser = {
@@ -11650,11 +11564,12 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11650
11564
  if (props.isPendingInput) return false;
11651
11565
  return true;
11652
11566
  });
11567
+ const resolveIsDisabled = () => props.config.allowResolve === false;
11653
11568
  const allowResolve = computed$1(() => {
11654
11569
  if (!generallyAllowed.value) return false;
11655
11570
  if (props.comment.trackedChange) {
11656
11571
  if (!trackedChangeDecisionsVisible.value) return false;
11657
- } else if (!commentMutationsVisible.value || props.config.allowResolve === false) return false;
11572
+ } else if (!commentMutationsVisible.value || resolveIsDisabled()) return false;
11658
11573
  if (props.comment.parentCommentId) return false;
11659
11574
  if (trackedChangeThreadParentId.value) return false;
11660
11575
  const context = {
@@ -11679,7 +11594,7 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11679
11594
  });
11680
11595
  const allowReopen = computed$1(() => {
11681
11596
  if (!commentMutationsVisible.value) return false;
11682
- if (props.config.allowResolve === false) return false;
11597
+ if (resolveIsDisabled()) return false;
11683
11598
  if (!props.reopenSupported) return false;
11684
11599
  if (!props.comment) return false;
11685
11600
  if (!props.comment.resolvedTime) return false;
@@ -11724,7 +11639,7 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11724
11639
  const handleResolve = () => {
11725
11640
  if (props.comment?.trackedChange) {
11726
11641
  if (!trackedChangeDecisionsVisible.value) return;
11727
- } else if (!commentMutationsVisible.value || props.config.allowResolve === false) return;
11642
+ } else if (!commentMutationsVisible.value || resolveIsDisabled()) return;
11728
11643
  if (props.resolveDisabledReason) return;
11729
11644
  emit("resolve");
11730
11645
  };
@@ -11734,7 +11649,7 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11734
11649
  emit("reject");
11735
11650
  };
11736
11651
  const handleReopen = () => {
11737
- if (!commentMutationsVisible.value || props.config.allowResolve === false) return;
11652
+ if (!commentMutationsVisible.value || resolveIsDisabled()) return;
11738
11653
  if (props.reopenDisabledReason) return;
11739
11654
  emit("reopen");
11740
11655
  };
@@ -11808,9 +11723,9 @@ var CommentHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11808
11723
  ], 2)]);
11809
11724
  };
11810
11725
  }
11811
- }, [["__scopeId", "data-v-b2a33943"]]);
11726
+ }), [["__scopeId", "data-v-33950cc9"]]);
11812
11727
  //#endregion
11813
- //#region src/components/CommentsLayer/CommentInput.vue
11728
+ //#region src/components/CommentsLayer/CommentInput.vue?vue&type=script&setup=true&lang.ts
11814
11729
  var _hoisted_1$27 = { class: "input-section" };
11815
11730
  var _hoisted_2$20 = { class: "comment-composer" };
11816
11731
  var _hoisted_3$17 = [
@@ -11830,7 +11745,9 @@ var _hoisted_6$7 = {
11830
11745
  class: "comment-mention-option__email"
11831
11746
  };
11832
11747
  var commentInputSequence = 0;
11833
- var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11748
+ //#endregion
11749
+ //#region src/components/CommentsLayer/CommentInput.vue
11750
+ var CommentInput_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
11834
11751
  __name: "CommentInput",
11835
11752
  props: {
11836
11753
  users: {
@@ -11852,7 +11769,7 @@ var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11852
11769
  },
11853
11770
  comment: {
11854
11771
  type: Object,
11855
- required: false
11772
+ required: true
11856
11773
  }
11857
11774
  },
11858
11775
  emits: ["focus"],
@@ -11939,7 +11856,8 @@ var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
11939
11856
  };
11940
11857
  const onInput = (event) => {
11941
11858
  currentCommentMentions.value = currentCommentMentions.value.filter((user) => commentDraft.value.includes(`@${displayName(user)}`));
11942
- updateMentionQuery(event.target.selectionStart ?? commentDraft.value.length);
11859
+ const caret = event.target instanceof HTMLTextAreaElement ? event.target.selectionStart : null;
11860
+ updateMentionQuery(caret ?? commentDraft.value.length);
11943
11861
  syncInputHeight();
11944
11862
  };
11945
11863
  const selectMention = (user) => {
@@ -12028,7 +11946,7 @@ var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12028
11946
  }), 128))])) : createCommentVNode("", true)])], 2)]);
12029
11947
  };
12030
11948
  }
12031
- }, [["__scopeId", "data-v-0720a671"]]);
11949
+ }), [["__scopeId", "data-v-65c31fdc"]]);
12032
11950
  //#endregion
12033
11951
  //#region src/internal/toolbar/built-in/url-safety.js
12034
11952
  /**
@@ -12138,7 +12056,7 @@ function renderCommentHtml(value) {
12138
12056
  return template.innerHTML;
12139
12057
  }
12140
12058
  //#endregion
12141
- //#region src/components/CommentsLayer/CommentDialog.vue
12059
+ //#region src/components/CommentsLayer/CommentDialog.vue?vue&type=script&setup=true&lang.ts
12142
12060
  var _hoisted_1$26 = [
12143
12061
  "aria-label",
12144
12062
  "data-comment-instance-id",
@@ -12227,34 +12145,35 @@ var _hoisted_42 = {
12227
12145
  };
12228
12146
  var _hoisted_43 = { class: "reply-input-wrapper" };
12229
12147
  var _hoisted_44 = { class: "reply-actions" };
12230
- var _hoisted_45 = ["onClick"];
12231
- var _hoisted_46 = [
12148
+ var _hoisted_45 = [
12232
12149
  "onClick",
12233
12150
  "disabled",
12234
12151
  "data-disabled-reason"
12235
12152
  ];
12236
- var _hoisted_47 = { class: "collapsed-avatars" };
12237
- var _hoisted_48 = {
12153
+ var _hoisted_46 = { class: "collapsed-avatars" };
12154
+ var _hoisted_47 = {
12238
12155
  key: 3,
12239
12156
  class: "comment-separator"
12240
12157
  };
12241
- var _hoisted_49 = {
12158
+ var _hoisted_48 = {
12242
12159
  key: 3,
12243
12160
  class: "tracked-change-decision-alert",
12244
12161
  role: "alert"
12245
12162
  };
12246
- var _hoisted_50 = { class: "tracked-change-decision-alert__message" };
12247
- var _hoisted_51 = ["disabled", "data-disabled-reason"];
12248
- var _hoisted_52 = {
12163
+ var _hoisted_49 = { class: "tracked-change-decision-alert__message" };
12164
+ var _hoisted_50 = ["disabled", "data-disabled-reason"];
12165
+ var _hoisted_51 = {
12249
12166
  key: 1,
12250
12167
  class: "reply-expanded"
12251
12168
  };
12252
- var _hoisted_53 = { class: "reply-input-wrapper" };
12253
- var _hoisted_54 = { class: "reply-actions" };
12254
- var _hoisted_55 = ["disabled", "data-disabled-reason"];
12169
+ var _hoisted_52 = { class: "reply-input-wrapper" };
12170
+ var _hoisted_53 = { class: "reply-actions" };
12171
+ var _hoisted_54 = ["disabled", "data-disabled-reason"];
12255
12172
  var commentEditSessions = /* @__PURE__ */ new WeakMap();
12256
12173
  var commentReplySessions = /* @__PURE__ */ new WeakMap();
12257
- var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12174
+ //#endregion
12175
+ //#region src/components/CommentsLayer/CommentDialog.vue
12176
+ var CommentDialog_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
12258
12177
  __name: "CommentDialog",
12259
12178
  props: {
12260
12179
  comment: {
@@ -12299,9 +12218,10 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12299
12218
  setup(__props, { emit: __emit }) {
12300
12219
  const emit = __emit;
12301
12220
  const props = __props;
12302
- const { proxy } = getCurrentInstance();
12221
+ const proxy = useSuperDocInstance().proxy;
12303
12222
  const superdocStore = useSuperdocStore();
12304
- const commentsStore = useCommentsStore();
12223
+ const piniaCommentsStore = useCommentsStore();
12224
+ const commentsStore = piniaCommentsStore;
12305
12225
  const editSessionOwner = {};
12306
12226
  const replySessionOwner = {};
12307
12227
  const retireOwnEditSession = () => {
@@ -12311,7 +12231,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12311
12231
  if (commentReplySessions.get(commentsStore)?.owner === replySessionOwner) commentReplySessions.delete(commentsStore);
12312
12232
  };
12313
12233
  const { addComment, cancelComment, deleteComment, getCommentAliasIds, removePendingComment, getCommentDocumentId, requestInstantSidebarAlignment, resolveCommentPositionEntry, clearInstantSidebarAlignment, setActiveFloatingCommentInstance } = commentsStore;
12314
- const { suppressInternalExternal, getConfig, activeComment, activeFloatingCommentInstanceId, floatingCommentsOffset, pendingComment, currentCommentText, currentCommentMentions, isDebugging, editingCommentId, editorCommentPositions, isCommentHighlighted } = storeToRefs(commentsStore);
12234
+ const { suppressInternalExternal, getConfig, activeComment, activeFloatingCommentInstanceId, floatingCommentsOffset, pendingComment, currentCommentText, currentCommentMentions, isDebugging, editingCommentId, editorCommentPositions, isCommentHighlighted } = storeToRefs(piniaCommentsStore);
12315
12235
  const isInternal = ref(true);
12316
12236
  const commentInput = ref(null);
12317
12237
  const editCommentInputs = ref(/* @__PURE__ */ new Map());
@@ -12326,8 +12246,8 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12326
12246
  ];
12327
12247
  const TRACKED_CHANGE_PREVIEW_MAX_PX = 90;
12328
12248
  const trackedChangeImagePreviewStyle = (preview) => {
12329
- const width = typeof preview?.width === "number" && Number.isFinite(preview.width) ? preview.width : null;
12330
- const height = typeof preview?.height === "number" && Number.isFinite(preview.height) ? preview.height : null;
12249
+ const width = isFiniteNumber(preview?.width) ? preview.width : null;
12250
+ const height = isFiniteNumber(preview?.height) ? preview.height : null;
12331
12251
  if (!width || !height || width <= 0 || height <= 0) return {};
12332
12252
  const scale = Math.min(TRACKED_CHANGE_PREVIEW_MAX_PX / width, TRACKED_CHANGE_PREVIEW_MAX_PX / height, 1);
12333
12253
  return {
@@ -12379,13 +12299,14 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12379
12299
  const findIgnoredElementByGeometry = (clientX, clientY) => {
12380
12300
  if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) return null;
12381
12301
  const ignoredElements = document.querySelectorAll(CLICK_OUTSIDE_IGNORED_SELECTORS);
12382
- for (const element of ignoredElements) if (element instanceof HTMLElement && elementContainsClickPoint(element, clientX, clientY)) return element;
12302
+ for (const element of Array.from(ignoredElements)) if (element instanceof HTMLElement && elementContainsClickPoint(element, clientX, clientY)) return element;
12383
12303
  return null;
12384
12304
  };
12385
12305
  const focusEditInput = (commentId) => {
12386
12306
  editCommentInputs.value.get(commentId)?.focus?.();
12387
12307
  };
12388
12308
  const commentDialogElement = ref(null);
12309
+ const trackedChangeStoryType = (story) => typeof story === "object" ? story?.storyType : void 0;
12389
12310
  const getCommentFocusThreadId = (comment) => {
12390
12311
  if (comment.resolvedTime) return comment.commentId;
12391
12312
  return comment.importedId || comment.commentId;
@@ -12411,7 +12332,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12411
12332
  };
12412
12333
  const getEntryBoundsCoordinate = (entry, coordinate) => {
12413
12334
  const value = entry?.bounds?.[coordinate];
12414
- return Number.isFinite(value) ? value : null;
12335
+ return isFiniteNumber(value) ? value : null;
12415
12336
  };
12416
12337
  const entriesShareLine = (entry, candidateEntry) => {
12417
12338
  if (!entry || !candidateEntry) return false;
@@ -12425,12 +12346,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12425
12346
  const candidateLeft = getEntryBoundsCoordinate(candidateEntry, "left");
12426
12347
  const entryRight = getEntryBoundsCoordinate(entry, "right");
12427
12348
  const candidateRight = getEntryBoundsCoordinate(candidateEntry, "right");
12428
- if ([
12429
- entryLeft,
12430
- candidateLeft,
12431
- entryRight,
12432
- candidateRight
12433
- ].some((value) => value == null)) return false;
12349
+ if (entryLeft == null || candidateLeft == null || entryRight == null || candidateRight == null) return false;
12434
12350
  return candidateLeft < entryRight && entryLeft < candidateRight;
12435
12351
  };
12436
12352
  const entriesOverlapRange = (entry, candidateEntry) => {
@@ -12438,12 +12354,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12438
12354
  const entryEnd = entry?.end;
12439
12355
  const candidateStart = candidateEntry?.start;
12440
12356
  const candidateEnd = candidateEntry?.end;
12441
- if (![
12442
- entryStart,
12443
- entryEnd,
12444
- candidateStart,
12445
- candidateEnd
12446
- ].every(Number.isFinite)) return false;
12357
+ if (!isFiniteNumber(entryStart) || !isFiniteNumber(entryEnd) || !isFiniteNumber(candidateStart) || !isFiniteNumber(candidateEnd)) return false;
12447
12358
  return candidateStart <= entryEnd && entryStart <= candidateEnd;
12448
12359
  };
12449
12360
  const shouldIncludeThreadAlias = (entry, candidateEntry) => {
@@ -12464,7 +12375,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12464
12375
  return [...lookupIds];
12465
12376
  };
12466
12377
  const isDialogAlreadyAlignedWithTarget = (dialogElement, targetClientY, tolerancePx = 24) => {
12467
- if (!Number.isFinite(targetClientY) || typeof dialogElement?.getBoundingClientRect !== "function") return false;
12378
+ if (!isFiniteNumber(targetClientY) || typeof dialogElement?.getBoundingClientRect !== "function") return false;
12468
12379
  const dialogTop = dialogElement.getBoundingClientRect().top;
12469
12380
  return Number.isFinite(dialogTop) && Math.abs(dialogTop - targetClientY) <= tolerancePx;
12470
12381
  };
@@ -12490,14 +12401,19 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12490
12401
  if (showInputSection.value && index === visible.length - 1) return true;
12491
12402
  return visible.length > 1 && index !== visible.length - 1;
12492
12403
  });
12404
+ const commentsAreReadOnly = () => getConfig.value?.readOnly === true;
12405
+ const resolveIsDisabled = () => getConfig.value?.allowResolve === false;
12493
12406
  const showInputSection = computed$1(() => {
12494
- return !getConfig.readOnly && isDialogActive.value && !props.comment.resolvedTime && !isEditingAnyComment.value;
12407
+ return !commentsAreReadOnly() && isDialogActive.value && !props.comment.resolvedTime && !isEditingAnyComment.value;
12495
12408
  });
12496
12409
  const readOnlyMutationOutcome = () => ({
12497
12410
  ok: false,
12498
12411
  reason: "read-only-document"
12499
12412
  });
12500
- const commentsAreReadOnly = () => getConfig.value?.readOnly === true;
12413
+ const resolveDisabledOutcome = () => ({
12414
+ ok: false,
12415
+ reason: "resolve-disabled"
12416
+ });
12501
12417
  const trackedChangeDecisionsAreDisabled = () => {
12502
12418
  const allowDecisions = proxy.$superdoc?.interactionConfig?.trackedChanges?.allowDecisions;
12503
12419
  if (typeof allowDecisions === "boolean") return !allowDecisions;
@@ -12575,7 +12491,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12575
12491
  nextTick(() => emit("resize"));
12576
12492
  };
12577
12493
  const setParentBodyRef = (el) => {
12578
- parentBodyRef.value = el ?? null;
12494
+ parentBodyRef.value = el;
12579
12495
  };
12580
12496
  const checkOverflow = () => {
12581
12497
  if (textExpanded.value) return;
@@ -12658,7 +12574,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12658
12574
  };
12659
12575
  const isInternalDropdownDisabled = computed$1(() => {
12660
12576
  if (props.comment.resolvedTime) return true;
12661
- return getConfig.value.readOnly;
12577
+ return commentsAreReadOnly();
12662
12578
  });
12663
12579
  const isEditingThisComment = computed$1(() => (comment) => {
12664
12580
  return isDialogActive.value && editingCommentId.value === comment.commentId;
@@ -12668,7 +12584,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12668
12584
  return comments.value.some((c) => c.commentId === editingCommentId.value);
12669
12585
  });
12670
12586
  const shouldShowInternalExternal = computed$1(() => {
12671
- if (getConfig.value.readOnly) return false;
12587
+ if (commentsAreReadOnly()) return false;
12672
12588
  if (!proxy.$superdoc.config.isInternal) return false;
12673
12589
  if (isV2Mode.value) return false;
12674
12590
  return !suppressInternalExternal.value && !props.comment.trackedChange;
@@ -12712,7 +12628,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12712
12628
  if (editor) {
12713
12629
  const { entry: resolvedFocusEntry } = resolveCommentPositionEntry(props.comment);
12714
12630
  const focusEntry = props.floatingPositionEntry ?? resolvedFocusEntry;
12715
- const usePageScopedAnchorOnly = Number.isFinite(props.floatingPageIndex) && props.comment?.trackedChangeStory?.storyType === "headerFooterPart";
12631
+ const usePageScopedAnchorOnly = Number.isFinite(props.floatingPageIndex) && trackedChangeStoryType(props.comment?.trackedChangeStory) === "headerFooterPart";
12716
12632
  const visibleAnchorTargetY = getVisibleThreadAnchorClientY(props.parent, focusEntry);
12717
12633
  const visibleHighlightTargetY = usePageScopedAnchorOnly ? null : getVisibleThreadHighlightClientY(getThreadHighlightLookupIds(props.comment));
12718
12634
  const visibleThreadTargetY = Number.isFinite(visibleHighlightTargetY) ? visibleHighlightTargetY : visibleAnchorTargetY;
@@ -12930,7 +12846,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
12930
12846
  const getReopenDisabledReason = () => {
12931
12847
  if (!isV2Mode.value) return null;
12932
12848
  if (!v2CommentsAdapter.value) return "v2-comments-adapter-missing";
12933
- if (getConfig.value?.readOnly) return "read-only-document";
12849
+ if (commentsAreReadOnly()) return "read-only-document";
12934
12850
  if (isV2WriteDisabled.value) return v2WriteCapability.value?.reason ?? "v2-write-unavailable";
12935
12851
  return null;
12936
12852
  };
@@ -13033,10 +12949,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13033
12949
  if (trackedChangeDecisionsAreDisabled()) return trackedChangeDecisionDisabledOutcome();
13034
12950
  } else {
13035
12951
  if (commentsAreReadOnly()) return readOnlyMutationOutcome();
13036
- if (getConfig.value?.allowResolve === false) return {
13037
- ok: false,
13038
- reason: "resolve-disabled"
13039
- };
12952
+ if (resolveIsDisabled()) return resolveDisabledOutcome();
13040
12953
  }
13041
12954
  const customHandler = proxy.$superdoc.config.onTrackedChangeBubbleAccept;
13042
12955
  if (props.comment.trackedChange && isV2Mode.value) {
@@ -13101,10 +13014,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13101
13014
  };
13102
13015
  const handleReopen = async () => {
13103
13016
  if (commentsAreReadOnly()) return readOnlyMutationOutcome();
13104
- if (getConfig.value?.allowResolve === false) return {
13105
- ok: false,
13106
- reason: "resolve-disabled"
13107
- };
13017
+ if (resolveIsDisabled()) return resolveDisabledOutcome();
13108
13018
  if (!isV2Mode.value || !v2CommentsAdapter.value) return;
13109
13019
  const outcome = await commentsStore.reopenCommentV2({
13110
13020
  superdoc: proxy.$superdoc,
@@ -13129,7 +13039,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13129
13039
  owner: editSessionOwner,
13130
13040
  submission: null
13131
13041
  });
13132
- currentCommentText.value = comment?.commentText?.value ?? comment?.commentText ?? "";
13042
+ currentCommentText.value = comment?.commentText ?? "";
13133
13043
  currentCommentMentions.value = Array.isArray(comment?.mentions) ? [...comment.mentions] : [];
13134
13044
  activeComment.value = props.comment.commentId;
13135
13045
  if (props.floatingInstanceId) setActiveFloatingCommentInstance(props.floatingInstanceId);
@@ -13201,7 +13111,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13201
13111
  const getProcessedDate = (timestamp) => {
13202
13112
  return typeof timestamp === "string" ? new Date(timestamp).getTime() : timestamp;
13203
13113
  };
13204
- const handleCancel = (comment) => {
13114
+ const handleCancel = () => {
13205
13115
  commentSaveFailure.value = "";
13206
13116
  retireOwnEditSession();
13207
13117
  retireOwnReplySession();
@@ -13211,7 +13121,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13211
13121
  };
13212
13122
  const usersFiltered = computed$1(() => {
13213
13123
  const users = proxy.$superdoc.users;
13214
- if (props.comment.isInternal === true) return users.filter((user) => user.access === "internal" || user.access?.role === "internal");
13124
+ if (props.comment.isInternal === true) return users.filter((user) => user.access === "internal" || typeof user.access === "object" && user.access?.role === "internal");
13215
13125
  return users;
13216
13126
  });
13217
13127
  onMounted(() => {
@@ -13248,7 +13158,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13248
13158
  focusEditInput(commentId);
13249
13159
  });
13250
13160
  });
13251
- watch$1(() => getConfig.value?.readOnly === true, (readOnly) => {
13161
+ watch$1(commentsAreReadOnly, (readOnly) => {
13252
13162
  if (!readOnly) return;
13253
13163
  isReplying.value = false;
13254
13164
  if (comments.value.some((comment) => comment.commentId === editingCommentId.value)) editingCommentId.value = null;
@@ -13336,11 +13246,11 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13336
13246
  timestamp: getProcessedDate(comment.createdTime),
13337
13247
  comment,
13338
13248
  "is-active": isDialogActive.value,
13339
- "resolve-disabled-reason": getResolveDisabledReason(comment),
13340
- "reject-disabled-reason": getRejectDisabledReason(comment),
13249
+ "resolve-disabled-reason": getResolveDisabledReason(comment) ?? void 0,
13250
+ "reject-disabled-reason": getRejectDisabledReason(comment) ?? void 0,
13341
13251
  "reopen-supported": isV2Mode.value && Boolean(v2CommentsAdapter.value),
13342
- "reopen-disabled-reason": getReopenDisabledReason(),
13343
- "write-disabled-reason": v2OverflowWriteDisabledReason.value,
13252
+ "reopen-disabled-reason": getReopenDisabledReason() ?? void 0,
13253
+ "write-disabled-reason": v2OverflowWriteDisabledReason.value ?? void 0,
13344
13254
  onResolve: handleResolve,
13345
13255
  onReject: handleReject,
13346
13256
  onReopen: handleReopen,
@@ -13407,7 +13317,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13407
13317
  ref_for: true,
13408
13318
  ref: index === 0 ? setParentBodyRef : void 0,
13409
13319
  innerHTML: renderedCommentTexts.value.get(comment.commentId)
13410
- }, null, 10, _hoisted_40)) : unref(isDebugging) && !isEditingThisComment.value(comment) ? (openBlock(), createElementBlock("div", _hoisted_41, toDisplayString(unref(editorCommentPositions)[comment.importedId !== void 0 ? comment.importedId : comment.commentId]?.bounds), 1)) : (openBlock(), createElementBlock("div", _hoisted_42, [createElementVNode("div", _hoisted_43, [createVNode(CommentInput_default, {
13320
+ }, null, 10, _hoisted_40)) : unref(isDebugging) && !isEditingThisComment.value(comment) ? (openBlock(), createElementBlock("div", _hoisted_41, toDisplayString(unref(editorCommentPositions)[String(comment.importedId !== void 0 ? comment.importedId : comment.commentId)]?.bounds), 1)) : (openBlock(), createElementBlock("div", _hoisted_42, [createElementVNode("div", _hoisted_43, [createVNode(CommentInput_default, {
13411
13321
  ref_for: true,
13412
13322
  ref: setEditCommentInputRef(comment.commentId),
13413
13323
  users: [],
@@ -13416,13 +13326,13 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13416
13326
  comment
13417
13327
  }, null, 8, ["config", "comment"])]), createElementVNode("div", _hoisted_44, [createElementVNode("button", {
13418
13328
  class: "sd-button reply-btn-cancel",
13419
- onClick: withModifiers(($event) => handleCancel(comment), ["stop", "prevent"])
13420
- }, "Cancel", 8, _hoisted_45), createElementVNode("button", {
13329
+ onClick: withModifiers(handleCancel, ["stop", "prevent"])
13330
+ }, "Cancel"), createElementVNode("button", {
13421
13331
  class: normalizeClass(["sd-button primary reply-btn-primary", { "sd-is-disabled": !hasTextContent.value || isV2WriteDisabled.value }]),
13422
13332
  onClick: withModifiers(($event) => handleCommentUpdate(comment), ["stop", "prevent"]),
13423
13333
  disabled: !hasTextContent.value || isV2WriteDisabled.value,
13424
13334
  "data-disabled-reason": isV2WriteDisabled.value ? v2WriteCapability.value?.reason ?? null : null
13425
- }, " Update ", 10, _hoisted_46)])])),
13335
+ }, " Update ", 10, _hoisted_45)])])),
13426
13336
  shouldTruncate.value && isTextOverflowing.value && index === 0 && !isEditingThisComment.value(comment) ? (openBlock(), createElementBlock("div", {
13427
13337
  key: 3,
13428
13338
  class: "show-more-toggle",
@@ -13437,29 +13347,29 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13437
13347
  shouldCollapseThread.value && index === 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [_cache[14] || (_cache[14] = createElementVNode("div", { class: "comment-separator" }, null, -1)), createElementVNode("div", {
13438
13348
  class: "collapsed-replies",
13439
13349
  onClick: withModifiers(expandThread, ["stop", "prevent"])
13440
- }, [createElementVNode("div", _hoisted_47, [(openBlock(true), createElementBlock(Fragment, null, renderList(collapsedReplyAuthors.value, (author) => {
13350
+ }, [createElementVNode("div", _hoisted_46, [(openBlock(true), createElementBlock(Fragment, null, renderList(collapsedReplyAuthors.value, (author) => {
13441
13351
  return openBlock(), createBlock(Avatar_default, {
13442
- key: author.email || author.name,
13352
+ key: (author.email || author.name) ?? void 0,
13443
13353
  user: author,
13444
13354
  class: "mini-avatar"
13445
13355
  }, null, 8, ["user"]);
13446
13356
  }), 128))]), createElementVNode("span", null, toDisplayString(collapsedReplyCount.value) + " more " + toDisplayString(collapsedReplyCount.value === 1 ? "reply" : "replies"), 1)])], 64)) : createCommentVNode("", true),
13447
- showSeparator.value(index) ? (openBlock(), createElementBlock("div", _hoisted_48)) : createCommentVNode("", true)
13357
+ showSeparator.value(index) ? (openBlock(), createElementBlock("div", _hoisted_47)) : createCommentVNode("", true)
13448
13358
  ]);
13449
13359
  }), 128)),
13450
- trackedChangeDecisionFailure.value ? (openBlock(), createElementBlock("div", _hoisted_49, [createElementVNode("span", _hoisted_50, toDisplayString(trackedChangeDecisionFailureMessage.value), 1), createElementVNode("button", {
13360
+ trackedChangeDecisionFailure.value ? (openBlock(), createElementBlock("div", _hoisted_48, [createElementVNode("span", _hoisted_49, toDisplayString(trackedChangeDecisionFailureMessage.value), 1), createElementVNode("button", {
13451
13361
  type: "button",
13452
13362
  class: "sd-button tracked-change-decision-alert__retry",
13453
13363
  onClick: withModifiers(retryTrackedChangeDecision, ["stop", "prevent"])
13454
13364
  }, " Retry ")])) : createCommentVNode("", true),
13455
- showInputSection.value && !unref(getConfig).readOnly ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [!isReplying.value ? (openBlock(), createElementBlock("button", {
13365
+ showInputSection.value ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [!isReplying.value ? (openBlock(), createElementBlock("button", {
13456
13366
  key: 0,
13457
13367
  type: "button",
13458
13368
  class: normalizeClass(["reply-pill", { "sd-is-disabled": isV2WriteDisabled.value }]),
13459
13369
  onClick: withModifiers(startReply, ["stop", "prevent"]),
13460
13370
  disabled: isV2WriteDisabled.value,
13461
13371
  "data-disabled-reason": isV2WriteDisabled.value ? v2WriteCapability.value?.reason ?? null : null
13462
- }, " Reply or add others with @ ", 10, _hoisted_51)) : (openBlock(), createElementBlock("div", _hoisted_52, [createElementVNode("div", _hoisted_53, [createVNode(CommentInput_default, {
13372
+ }, " Reply or add others with @ ", 10, _hoisted_50)) : (openBlock(), createElementBlock("div", _hoisted_51, [createElementVNode("div", _hoisted_52, [createVNode(CommentInput_default, {
13463
13373
  ref_key: "commentInput",
13464
13374
  ref: commentInput,
13465
13375
  users: usersFiltered.value,
@@ -13470,7 +13380,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13470
13380
  "users",
13471
13381
  "config",
13472
13382
  "comment"
13473
- ])]), createElementVNode("div", _hoisted_54, [createElementVNode("button", {
13383
+ ])]), createElementVNode("div", _hoisted_53, [createElementVNode("button", {
13474
13384
  class: "sd-button reply-btn-cancel",
13475
13385
  onClick: withModifiers(handleCancel, ["stop", "prevent"])
13476
13386
  }, "Cancel"), createElementVNode("button", {
@@ -13478,13 +13388,13 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13478
13388
  onClick: withModifiers(handleAddComment, ["stop", "prevent"]),
13479
13389
  disabled: !hasTextContent.value || isV2WriteDisabled.value || isSubmittingReply.value,
13480
13390
  "data-disabled-reason": v2ReplyDisabledReason.value
13481
- }, " Reply ", 10, _hoisted_55)])]))], 64)) : createCommentVNode("", true)
13391
+ }, " Reply ", 10, _hoisted_54)])]))], 64)) : createCommentVNode("", true)
13482
13392
  ], 64))], 14, _hoisted_1$26)), [[_directive_click_outside, handleClickOutside]]);
13483
13393
  };
13484
13394
  }
13485
- }, [["__scopeId", "data-v-239e0310"]]);
13395
+ }), [["__scopeId", "data-v-752d9e0b"]]);
13486
13396
  //#endregion
13487
- //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
13397
+ //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue?vue&type=script&setup=true&lang.ts
13488
13398
  var _hoisted_1$25 = [
13489
13399
  "tabindex",
13490
13400
  "aria-posinset",
@@ -13496,7 +13406,9 @@ var _hoisted_1$25 = [
13496
13406
  "data-comment-page-index",
13497
13407
  "data-review-directory-index"
13498
13408
  ];
13499
- var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13409
+ //#endregion
13410
+ //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
13411
+ var ReviewDirectoryListItem_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
13500
13412
  __name: "ReviewDirectoryListItem",
13501
13413
  props: {
13502
13414
  item: {
@@ -13545,12 +13457,15 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13545
13457
  });
13546
13458
  const measure = () => {
13547
13459
  const height = shell.value?.getBoundingClientRect?.().height;
13548
- if (Number.isFinite(height) && height > 0) measuredHeight.value = height;
13460
+ if (isFiniteNumber(height) && height > 0) measuredHeight.value = height;
13549
13461
  };
13550
13462
  const onFocusIn = () => {
13551
13463
  containsFocus.value = true;
13552
13464
  emit("focus-item", props.index);
13553
13465
  };
13466
+ const onFocusOut = (event) => {
13467
+ containsFocus.value = event.relatedTarget instanceof Node && shell.value?.contains(event.relatedTarget) === true;
13468
+ };
13554
13469
  const onKeydown = (event) => {
13555
13470
  if (![
13556
13471
  "ArrowDown",
@@ -13558,7 +13473,7 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13558
13473
  "Home",
13559
13474
  "End"
13560
13475
  ].includes(event.key)) return;
13561
- if (event.target?.closest?.("input, textarea, select, button, [contenteditable=\"true\"]")) return;
13476
+ if (event.target instanceof Element && event.target.closest("input, textarea, select, button, [contenteditable=\"true\"]")) return;
13562
13477
  event.preventDefault();
13563
13478
  emit("navigate", {
13564
13479
  index: props.index,
@@ -13566,6 +13481,8 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13566
13481
  });
13567
13482
  };
13568
13483
  onMounted(() => {
13484
+ const element = shell.value;
13485
+ if (!element) return;
13569
13486
  if (typeof IntersectionObserver !== "undefined") {
13570
13487
  intersectionObserver = new IntersectionObserver((entries) => {
13571
13488
  const entry = entries[0];
@@ -13576,11 +13493,11 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13576
13493
  root: null,
13577
13494
  rootMargin: "600px 0px"
13578
13495
  });
13579
- intersectionObserver.observe(shell.value);
13496
+ intersectionObserver.observe(element);
13580
13497
  }
13581
13498
  if (typeof ResizeObserver !== "undefined") {
13582
13499
  resizeObserver = new ResizeObserver(measure);
13583
- resizeObserver.observe(shell.value);
13500
+ resizeObserver.observe(element);
13584
13501
  }
13585
13502
  nextTick(measure);
13586
13503
  });
@@ -13605,7 +13522,7 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13605
13522
  "data-comment-page-index": Number.isFinite(__props.item.floatingPageIndex) ? __props.item.floatingPageIndex : "",
13606
13523
  "data-review-directory-index": __props.index,
13607
13524
  onFocusin: onFocusIn,
13608
- onFocusout: _cache[0] || (_cache[0] = ($event) => containsFocus.value = shell.value?.contains?.($event.relatedTarget) === true),
13525
+ onFocusout: onFocusOut,
13609
13526
  onKeydown
13610
13527
  }, [materialized.value ? (openBlock(), createBlock(CommentDialog_default, {
13611
13528
  key: 0,
@@ -13626,14 +13543,16 @@ var ReviewDirectoryListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_de
13626
13543
  ])) : createCommentVNode("", true)], 44, _hoisted_1$25);
13627
13544
  };
13628
13545
  }
13629
- }, [["__scopeId", "data-v-29650a06"]]);
13546
+ }), [["__scopeId", "data-v-db6ccae8"]]);
13630
13547
  //#endregion
13631
- //#region src/components/CommentsLayer/commentsList/commentsList.vue
13548
+ //#region src/components/CommentsLayer/commentsList/commentsList.vue?vue&type=script&setup=true&lang.ts
13632
13549
  var _hoisted_1$24 = ["aria-busy"];
13633
13550
  var _hoisted_2$18 = { key: 0 };
13634
13551
  var _hoisted_3$15 = { key: 1 };
13635
13552
  var REPEATED_HEADER_FOOTER_STORY_TYPE = "headerFooterPart";
13636
- var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13553
+ //#endregion
13554
+ //#region src/components/CommentsLayer/commentsList/commentsList.vue
13555
+ var commentsList_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
13637
13556
  __name: "commentsList",
13638
13557
  props: {
13639
13558
  showMainComments: {
@@ -13647,12 +13566,13 @@ var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13647
13566
  },
13648
13567
  setup(__props) {
13649
13568
  const props = __props;
13650
- const commentsStore = useCommentsStore();
13569
+ const piniaCommentsStore = useCommentsStore();
13570
+ const commentsStore = piniaCommentsStore;
13651
13571
  const listRoot = ref(null);
13652
13572
  const rovingIndex = ref(0);
13653
13573
  const isCommentsListVisible = toRef(commentsStore, "isCommentsListVisible");
13654
13574
  const floatingCommentInstances = computed$1(() => commentsStore.getFloatingCommentInstances);
13655
- const { activeComment, activeFloatingCommentInstanceId, commentsList, reviewDirectoryList, isReviewDirectoryActive, isReviewDirectoryLoading } = storeToRefs(commentsStore);
13575
+ const { activeComment, activeFloatingCommentInstanceId, commentsList, reviewDirectoryList, isReviewDirectoryActive, isReviewDirectoryLoading } = storeToRefs(piniaCommentsStore);
13656
13576
  const groupedComments = computed$1(() => isReviewDirectoryActive.value ? commentsStore.getGroupedReviewDirectory : commentsStore.getGroupedComments);
13657
13577
  const reviewRows = computed$1(() => isReviewDirectoryActive.value ? reviewDirectoryList.value : commentsList.value);
13658
13578
  const commentAliases = (comment) => [
@@ -13683,11 +13603,15 @@ var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13683
13603
  }
13684
13604
  return [parentComment];
13685
13605
  };
13606
+ const getStoryType = (comment) => {
13607
+ const story = comment?.trackedChangeStory;
13608
+ return typeof story === "object" && story !== null ? story.storyType : void 0;
13609
+ };
13686
13610
  const getRepeatedHeaderFooterInstances = (comment) => {
13687
13611
  const matchingInstances = floatingCommentInstances.value.filter((instance) => instance?.comment?.commentId === comment?.commentId);
13688
13612
  if (matchingInstances.length < 2) return [];
13689
13613
  if (!comment?.trackedChange) return [];
13690
- if (comment?.trackedChangeStory?.storyType !== REPEATED_HEADER_FOOTER_STORY_TYPE) return [];
13614
+ if (getStoryType(comment) !== REPEATED_HEADER_FOOTER_STORY_TYPE) return [];
13691
13615
  return matchingInstances;
13692
13616
  };
13693
13617
  const isRepeatedInstanceActive = (instance) => {
@@ -13744,8 +13668,9 @@ var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13744
13668
  rovingIndex.value = nextIndex;
13745
13669
  await nextTick();
13746
13670
  const target = listRoot.value?.querySelector?.(`[data-review-directory-index="${nextIndex}"]`);
13747
- target?.scrollIntoView?.({ block: "nearest" });
13748
- target?.focus?.({ preventScroll: true });
13671
+ if (!(target instanceof HTMLElement)) return;
13672
+ target.scrollIntoView?.({ block: "nearest" });
13673
+ target.focus?.({ preventScroll: true });
13749
13674
  };
13750
13675
  onMounted(() => {
13751
13676
  isCommentsListVisible.value = true;
@@ -13793,7 +13718,7 @@ var commentsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13793
13718
  }), 128))])) : createCommentVNode("", true)], 8, _hoisted_1$24);
13794
13719
  };
13795
13720
  }
13796
- }, [["__scopeId", "data-v-89244745"]]);
13721
+ }), [["__scopeId", "data-v-8eca48e1"]]);
13797
13722
  //#endregion
13798
13723
  //#region src/components/CommentsLayer/commentsList/super-comments-list.js
13799
13724
  /**
@@ -13930,10 +13855,10 @@ var FIT_WIDTH_DEFAULTS = Object.freeze({
13930
13855
  });
13931
13856
  var resolveFitWidthOptions = (rawFitConfig) => {
13932
13857
  const raw = rawFitConfig && typeof rawFitConfig === "object" ? rawFitConfig : {};
13933
- const positiveOr = (value, fallback) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
13858
+ const positiveOr = (value, fallback) => isFiniteNumber(value) && value > 0 ? value : fallback;
13934
13859
  const min = positiveOr(raw.min, FIT_WIDTH_DEFAULTS.min);
13935
13860
  const max = positiveOr(raw.max, FIT_WIDTH_DEFAULTS.max);
13936
- const padding = typeof raw.padding === "number" && Number.isFinite(raw.padding) && raw.padding >= 0 ? raw.padding : FIT_WIDTH_DEFAULTS.padding;
13861
+ const padding = isFiniteNumber(raw.padding) && raw.padding >= 0 ? raw.padding : FIT_WIDTH_DEFAULTS.padding;
13937
13862
  return {
13938
13863
  min: Math.min(min, max),
13939
13864
  max: Math.max(min, max),
@@ -13957,12 +13882,12 @@ var normalizePdfPageMeasurement = (measured, scaleFactor, zoomFactor) => {
13957
13882
  var resolveV2WidestPageWidth = (snapshot) => {
13958
13883
  if (!snapshot || typeof snapshot !== "object") return 0;
13959
13884
  const published = snapshot.widestPageWidthPx;
13960
- if (typeof published === "number" && Number.isFinite(published)) return published;
13885
+ if (isFiniteNumber(published)) return published;
13961
13886
  let widestPage = 0;
13962
13887
  const pages = snapshot.pages;
13963
13888
  if (Array.isArray(pages)) for (const page of pages) {
13964
13889
  const width = page?.base?.widthPx;
13965
- if (typeof width === "number" && Number.isFinite(width) && width > widestPage) widestPage = width;
13890
+ if (isFiniteNumber(width) && width > widestPage) widestPage = width;
13966
13891
  }
13967
13892
  return widestPage;
13968
13893
  };
@@ -13979,7 +13904,7 @@ var resolveEditorPageWidth = (editor) => {
13979
13904
  const pages = editor.getPages?.();
13980
13905
  if (Array.isArray(pages)) for (const page of pages) {
13981
13906
  const width = page?.size?.w;
13982
- if (typeof width === "number" && Number.isFinite(width) && width > widestPage) widestPage = width;
13907
+ if (isFiniteNumber(width) && width > widestPage) widestPage = width;
13983
13908
  }
13984
13909
  } catch {
13985
13910
  widestPage = 0;
@@ -13992,7 +13917,7 @@ var resolveEditorPageWidth = (editor) => {
13992
13917
  pageStyles = null;
13993
13918
  }
13994
13919
  const pageWidthInches = pageStyles?.pageSize?.width;
13995
- if (typeof pageWidthInches === "number" && Number.isFinite(pageWidthInches) && pageWidthInches > 0) return pageWidthInches * CSS_PX_PER_INCH;
13920
+ if (isFiniteNumber(pageWidthInches) && pageWidthInches > 0) return pageWidthInches * CSS_PX_PER_INCH;
13996
13921
  return null;
13997
13922
  };
13998
13923
  /**
@@ -14143,12 +14068,14 @@ function createHighContrastMode() {
14143
14068
  }
14144
14069
  };
14145
14070
  }
14146
- var HIGH_CONTRAST_OFF = {
14147
- isHighContrastMode: readonly(ref(false)),
14148
- setHighContrastMode: () => {}
14149
- };
14071
+ function createHighContrastOff() {
14072
+ return {
14073
+ isHighContrastMode: readonly(ref(false)),
14074
+ setHighContrastMode: () => {}
14075
+ };
14076
+ }
14150
14077
  function useHighContrastMode() {
14151
- return inject$1(HIGH_CONTRAST_MODE_KEY, HIGH_CONTRAST_OFF);
14078
+ return inject$1(HIGH_CONTRAST_MODE_KEY, createHighContrastOff, true);
14152
14079
  }
14153
14080
  //#endregion
14154
14081
  //#region ../layout-engine/contracts/src/author-colors.ts
@@ -14407,7 +14334,7 @@ var resolveRemovedReviewCardContinuityTarget = ({ previousIds, currentIds, remov
14407
14334
  return null;
14408
14335
  };
14409
14336
  //#endregion
14410
- //#region src/components/CommentsLayer/FloatingComments.vue
14337
+ //#region src/components/CommentsLayer/FloatingComments.vue?vue&type=script&setup=true&lang.ts
14411
14338
  var _hoisted_1$23 = [
14412
14339
  "data-comment-id",
14413
14340
  "data-comment-instance-id",
@@ -14416,7 +14343,9 @@ var _hoisted_1$23 = [
14416
14343
  "data-comment-page-index"
14417
14344
  ];
14418
14345
  var _heightsCache = {};
14419
- var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14346
+ //#endregion
14347
+ //#region src/components/CommentsLayer/FloatingComments.vue
14348
+ var FloatingComments_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
14420
14349
  __name: "FloatingComments",
14421
14350
  props: {
14422
14351
  currentDocument: {
@@ -14459,9 +14388,10 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14459
14388
  };
14460
14389
  const props = __props;
14461
14390
  const superdocStore = useSuperdocStore();
14462
- const commentsStore = useCommentsStore();
14391
+ const piniaCommentsStore = useCommentsStore();
14392
+ const commentsStore = piniaCommentsStore;
14463
14393
  const { clearInstantSidebarAlignment } = commentsStore;
14464
- const { activeComment, activeFloatingCommentInstanceId, editorCommentPositions, pendingComment, editingCommentId, instantSidebarAlignmentTargetY, instantSidebarAlignmentThreadId, instantSidebarAlignmentInstanceId } = storeToRefs(commentsStore);
14394
+ const { activeComment, activeFloatingCommentInstanceId, editorCommentPositions, pendingComment, editingCommentId, instantSidebarAlignmentTargetY, instantSidebarAlignmentThreadId, instantSidebarAlignmentInstanceId } = storeToRefs(piniaCommentsStore);
14465
14395
  const { activeZoom } = storeToRefs(superdocStore);
14466
14396
  const committedPresentation = computed$1(() => commentsStore.committedReviewPresentations?.[String(props.currentDocument?.id)] ?? null);
14467
14397
  const committedInstances = computed$1(() => {
@@ -14568,7 +14498,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14568
14498
  return bottom != null ? bottom * zoom : anchorTop;
14569
14499
  }
14570
14500
  const bottom = instance?.positionEntry?.bounds?.bottom;
14571
- return Number.isFinite(bottom) ? bottom : anchorTop;
14501
+ return isFiniteNumber(bottom) ? bottom : anchorTop;
14572
14502
  };
14573
14503
  const geometryBearingInstances = computed$1(() => {
14574
14504
  const positioned = [];
@@ -14576,8 +14506,8 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14576
14506
  const id = instance?.id;
14577
14507
  const threadId = getThreadId(instance?.comment);
14578
14508
  const anchorTop = getAnchorTop(instance);
14579
- if (id == null || threadId == null || !Number.isFinite(anchorTop)) continue;
14580
- const top = normalizeFloatingAnchorTop(anchorTop, instance.comment);
14509
+ if (id == null || threadId == null || !isFiniteNumber(anchorTop)) continue;
14510
+ const top = normalizeFloatingAnchorTop(anchorTop);
14581
14511
  positioned.push({
14582
14512
  id,
14583
14513
  threadId,
@@ -14599,8 +14529,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14599
14529
  return shouldMountFloatingCommentDialog({
14600
14530
  id: position?.id,
14601
14531
  visibleIds: committedPresentation.value ? new Set(allPositions.value.filter((item) => item.instanceRef?.mount).map((item) => item.id)) : visibleIds.value,
14602
- activeCommentInstanceId: activeCommentInstanceId.value,
14603
- comment: position?.commentRef
14532
+ activeCommentInstanceId: activeCommentInstanceId.value
14604
14533
  });
14605
14534
  };
14606
14535
  const getFloatingViewportRange = () => {
@@ -14956,14 +14885,14 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14956
14885
  if (!directDecisionContinuity) return;
14957
14886
  const actionElement = (event?.target instanceof Element ? event.target : null)?.closest?.("[data-comment-action]");
14958
14887
  const action = actionElement?.getAttribute?.("data-comment-action");
14959
- if (!((action === "resolve" || action === "reject") && floatingCommentsContainer.value?.contains?.(actionElement))) releaseDirectDecisionContinuity();
14888
+ if (!((action === "resolve" || action === "reject") && floatingCommentsContainer.value?.contains?.(actionElement ?? null))) releaseDirectDecisionContinuity();
14960
14889
  };
14961
14890
  const clearDeferredRemeasureTimers = () => {
14962
14891
  remeasureTimers.forEach(clearTimeout);
14963
14892
  remeasureTimers = [];
14964
14893
  };
14965
14894
  const remeasureCommentKeys = (keys) => {
14966
- for (const key of keys.filter(Boolean)) {
14895
+ for (const key of keys.filter((candidate) => Boolean(candidate))) {
14967
14896
  const el = placeholderRefs.value[key];
14968
14897
  if (!el) continue;
14969
14898
  const dialog = el.querySelector(".comments-dialog");
@@ -15084,7 +15013,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15084
15013
  removedId: removedKey
15085
15014
  });
15086
15015
  const targetClientY = (targetKey ? placeholderRefs.value[targetKey] : null)?.getBoundingClientRect?.().top;
15087
- if (!targetKey || !Number.isFinite(targetClientY)) {
15016
+ if (!targetKey || !isFiniteNumber(targetClientY)) {
15088
15017
  clearSidebarContinuityAnchor();
15089
15018
  return false;
15090
15019
  }
@@ -15097,9 +15026,9 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15097
15026
  return true;
15098
15027
  };
15099
15028
  const prepareSidebarContinuityForDirectDecision = (event) => {
15100
- const actionElement = event?.target?.closest?.("[data-comment-action]");
15029
+ const actionElement = (event?.target instanceof Element ? event.target : null)?.closest?.("[data-comment-action]");
15101
15030
  const action = actionElement?.getAttribute?.("data-comment-action");
15102
- if (action !== "resolve" && action !== "reject") return;
15031
+ if (!actionElement || action !== "resolve" && action !== "reject") return;
15103
15032
  releaseDirectDecisionContinuity();
15104
15033
  if (actionElement.getAttribute?.("aria-disabled") === "true") return;
15105
15034
  const removedKey = (actionElement.closest?.("[data-comment-id]"))?.getAttribute?.("data-comment-id");
@@ -15115,7 +15044,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15115
15044
  removedId: removedKey
15116
15045
  });
15117
15046
  const targetClientY = (targetKey ? placeholderRefs.value[targetKey] : null)?.getBoundingClientRect?.().top;
15118
- if (!targetKey || !Number.isFinite(targetClientY)) return;
15047
+ if (!targetKey || !isFiniteNumber(targetClientY)) return;
15119
15048
  directDecisionContinuity = {
15120
15049
  removedKey,
15121
15050
  targetKey,
@@ -15175,7 +15104,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15175
15104
  instantAlignmentInstanceKey,
15176
15105
  instantSidebarAlignmentTargetY
15177
15106
  ], ([activeKey, requestKey, targetY]) => {
15178
- if (!activeKey || !requestKey || activeKey !== requestKey || !Number.isFinite(targetY)) return;
15107
+ if (!activeKey || !requestKey || activeKey !== requestKey || !isFiniteNumber(targetY)) return;
15179
15108
  applyInstantSidebarAlignment(activeKey, targetY);
15180
15109
  });
15181
15110
  watch$1(editingCommentId, () => {
@@ -15232,10 +15161,10 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15232
15161
  let prevActiveLayoutTop = null;
15233
15162
  watch$1(allPositions, (positions) => {
15234
15163
  const activePosition = activeCommentInstanceId.value ? positions.find((position) => position.id === activeCommentInstanceId.value) : null;
15235
- const activeAnchorTop = typeof activePosition?.anchorTop === "number" && Number.isFinite(activePosition.anchorTop) ? activePosition.anchorTop : null;
15164
+ const activeAnchorTop = isFiniteNumber(activePosition?.anchorTop) ? activePosition.anchorTop : null;
15236
15165
  const sameActiveInstance = activeCommentInstanceId.value === prevActiveInstanceId;
15237
15166
  const activeAnchorMoved = sameActiveInstance && activeAnchorTop != null && prevActiveAnchorTop != null && Math.abs(activeAnchorTop - prevActiveAnchorTop) > 1;
15238
- const activeLayoutTop = typeof activePosition?.top === "number" && Number.isFinite(activePosition.top) ? activePosition.top : null;
15167
+ const activeLayoutTop = isFiniteNumber(activePosition?.top) ? activePosition.top : null;
15239
15168
  const activeLayoutMoved = sameActiveInstance && activeLayoutTop != null && prevActiveLayoutTop != null && Math.abs(activeLayoutTop - prevActiveLayoutTop) > 1;
15240
15169
  if (activeAnchorMoved && sidebarOffsetY.value !== 0 && !Number.isFinite(instantSidebarAlignmentTargetY.value)) {
15241
15170
  sidebarOffsetY.value = 0;
@@ -15399,8 +15328,8 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15399
15328
  parent: __props.parent,
15400
15329
  comment: pos.commentRef,
15401
15330
  "floating-instance-id": pos.id,
15402
- "floating-page-index": pos.pageIndex,
15403
- "floating-position-entry": pos.instanceRef?.positionEntry ?? null,
15331
+ "floating-page-index": pos.pageIndex ?? void 0,
15332
+ "floating-position-entry": pos.instanceRef?.positionEntry ?? void 0,
15404
15333
  "is-floating-instance-active": pos.id === activeCommentInstanceId.value
15405
15334
  }, null, 8, [
15406
15335
  "onResize",
@@ -15414,9 +15343,9 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15414
15343
  }), 128))], 4)], 36);
15415
15344
  };
15416
15345
  }
15417
- }, [["__scopeId", "data-v-145f83db"]]);
15346
+ }), [["__scopeId", "data-v-e74251e0"]]);
15418
15347
  //#endregion
15419
- //#region src/components/CommentsLayer/PdfCommentsLayer.vue
15348
+ //#region src/components/CommentsLayer/PdfCommentsLayer.vue?vue&type=script&setup=true&lang.ts
15420
15349
  var _hoisted_1$22 = {
15421
15350
  class: "superdoc__pdf-comments-layer pdf-comments-layer",
15422
15351
  "aria-hidden": "false"
@@ -15431,7 +15360,9 @@ var _hoisted_2$17 = [
15431
15360
  var PDF_SELECTION_SOURCE = "pdf";
15432
15361
  var INTERNAL_HIGHLIGHT_COLOR = "#078383";
15433
15362
  var EXTERNAL_HIGHLIGHT_COLOR = "#B1124B";
15434
- var PdfCommentsLayer_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15363
+ //#endregion
15364
+ //#region src/components/CommentsLayer/PdfCommentsLayer.vue
15365
+ var PdfCommentsLayer_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
15435
15366
  __name: "PdfCommentsLayer",
15436
15367
  emits: ["anchor-activate"],
15437
15368
  setup(__props, { emit: __emit }) {
@@ -15450,11 +15381,12 @@ var PdfCommentsLayer_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15450
15381
  * on-document DOCX comment markers.
15451
15382
  */
15452
15383
  const emit = __emit;
15453
- const commentsStore = useCommentsStore();
15384
+ const piniaCommentsStore = useCommentsStore();
15385
+ const commentsStore = piniaCommentsStore;
15454
15386
  const superdocStore = useSuperdocStore();
15455
- const { activeComment } = storeToRefs(commentsStore);
15387
+ const { activeComment } = storeToRefs(piniaCommentsStore);
15456
15388
  const { documents, activeZoom } = storeToRefs(superdocStore);
15457
- const { proxy } = getCurrentInstance();
15389
+ const { proxy } = useSuperDocInstance();
15458
15390
  const isFiniteNumber = (value) => {
15459
15391
  if (typeof value === "number") return Number.isFinite(value);
15460
15392
  if (typeof value === "string" && value.trim() !== "") return Number.isFinite(Number(value));
@@ -15493,15 +15425,20 @@ var PdfCommentsLayer_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15493
15425
  const pdfCommentAnchors = computed$1(() => {
15494
15426
  const parentComments = commentsStore.getFloatingComments;
15495
15427
  if (!Array.isArray(parentComments)) return [];
15496
- return parentComments.filter((comment) => comment?.selection?.source === PDF_SELECTION_SOURCE).filter((comment) => !comment.resolvedTime).filter((comment) => getAnchorCommentId(comment) !== null).filter((comment) => hasFiniteBounds(comment.selection?.selectionBounds)).filter((comment) => belongsToOpenPdfDocument(comment)).map((comment) => {
15428
+ return parentComments.flatMap((comment) => {
15429
+ if (comment?.selection?.source !== PDF_SELECTION_SOURCE) return [];
15430
+ if (comment.resolvedTime) return [];
15497
15431
  const commentId = getAnchorCommentId(comment);
15498
- const bounds = normalizeBounds(comment.selection.selectionBounds);
15499
- return {
15432
+ if (commentId === null) return [];
15433
+ const selectionBounds = comment.selection.selectionBounds;
15434
+ if (!hasFiniteBounds(selectionBounds)) return [];
15435
+ if (!belongsToOpenPdfDocument(comment)) return [];
15436
+ return [{
15500
15437
  commentId,
15501
- page: comment.selection?.page ?? null,
15438
+ page: comment.selection.page ?? null,
15502
15439
  isInternal: comment.isInternal !== false,
15503
- bounds
15504
- };
15440
+ bounds: normalizeBounds(selectionBounds)
15441
+ }];
15505
15442
  });
15506
15443
  });
15507
15444
  const getAnchorStyle = (anchor) => {
@@ -15539,7 +15476,7 @@ var PdfCommentsLayer_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15539
15476
  }), 128))]);
15540
15477
  };
15541
15478
  }
15542
- }, [["__scopeId", "data-v-b5ad4c58"]]);
15479
+ }), [["__scopeId", "data-v-86166837"]]);
15543
15480
  //#endregion
15544
15481
  //#region src/components/Whiteboard/use-whiteboard.js
15545
15482
  var useWhiteboard = ({ proxy, layers, documents, modules }) => {
@@ -15939,18 +15876,6 @@ var collectRemovedCommentIds = (comments, targetIds, isInScope = () => true) =>
15939
15876
  }
15940
15877
  return removedIds;
15941
15878
  };
15942
- //#endregion
15943
- //#region src/composables/use-superdoc-instance.ts
15944
- function useSuperDocInstance() {
15945
- const instance = getCurrentInstance();
15946
- if (!instance?.proxy) throw new Error("useSuperDocInstance() must be called during a component setup function.");
15947
- const superdoc = instance.appContext.config.globalProperties.$superdoc;
15948
- if (!superdoc) throw new Error("useSuperDocInstance() found no SuperDoc registered at app.config.globalProperties.$superdoc.");
15949
- return {
15950
- proxy: instance.proxy,
15951
- superdoc
15952
- };
15953
- }
15954
15879
  var VALID_COMMENTS_LAYOUTS = /* @__PURE__ */ new Set([
15955
15880
  "auto",
15956
15881
  "sidebar",
@@ -15989,13 +15914,13 @@ function normalizeCommentsUiConfig(commentsConfig) {
15989
15914
  if (deprecatedTarget === void 0) delete normalized.compactMeasurementSelector;
15990
15915
  else normalized.compactMeasurementSelector = deprecatedTarget;
15991
15916
  const deprecatedBreakpoint = commentsConfig.compactBreakpointPx;
15992
- if (!(typeof deprecatedBreakpoint === "number" && Number.isFinite(deprecatedBreakpoint) && deprecatedBreakpoint >= 0)) delete normalized.compactBreakpointPx;
15917
+ if (!(isFiniteNumber(deprecatedBreakpoint) && deprecatedBreakpoint >= 0)) delete normalized.compactBreakpointPx;
15993
15918
  delete normalized.layout;
15994
15919
  delete normalized.responsive;
15995
15920
  if (isCommentsLayout(layout)) normalized.layout = layout;
15996
15921
  const normalizedResponsive = {};
15997
15922
  if (target !== void 0) normalizedResponsive.target = target;
15998
- if (typeof breakpoint === "number" && Number.isFinite(breakpoint) && breakpoint >= 0) normalizedResponsive.breakpoint = breakpoint;
15923
+ if (isFiniteNumber(breakpoint) && breakpoint >= 0) normalizedResponsive.breakpoint = breakpoint;
15999
15924
  if (Object.keys(normalizedResponsive).length > 0) normalized.responsive = normalizedResponsive;
16000
15925
  return normalized;
16001
15926
  }
@@ -16003,7 +15928,7 @@ function normalizeCommentsUiConfig(commentsConfig) {
16003
15928
  //#region src/composables/use-comment-small-screen.js
16004
15929
  var SUPERDOC_DOCUMENT_SELECTOR = ".superdoc__document";
16005
15930
  var isValidCompactBreakpoint = (value) => {
16006
- return typeof value === "number" && Number.isFinite(value) && value >= 0;
15931
+ return isFiniteNumber(value) && value >= 0;
16007
15932
  };
16008
15933
  var getRequiredSidebarWidth = (documentWidth) => {
16009
15934
  return documentWidth + 320 + 24;
@@ -16150,7 +16075,6 @@ var COMMENT_HIGHLIGHT_DATA_ATTR = "data-comment-ids";
16150
16075
  var PDF_COMMENT_ANCHOR_SELECTOR = ".sd-comment-anchor";
16151
16076
  var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
16152
16077
  var toNumber = (value) => Number(value);
16153
- var isFiniteNumber = (value) => Number.isFinite(value);
16154
16078
  var getCommentAnchorId = (comment) => comment?.commentId ?? comment?.importedId ?? null;
16155
16079
  var parseCommentIds = (value) => String(value || "").split(",").map((s) => s.trim()).filter(Boolean);
16156
16080
  var resolveInteractionAnchor = (lastClickAnchor) => {
@@ -17979,7 +17903,7 @@ var toolbarIcons = {
17979
17903
  formattingMarks: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><text x=\"12\" y=\"18\" text-anchor=\"middle\" font-family=\"Arial, Helvetica, sans-serif\" font-size=\"20\" font-weight=\"700\" fill=\"currentColor\">¶</text></svg>\n"
17980
17904
  };
17981
17905
  //#endregion
17982
- //#region src/internal/toolbar/built-in/LinkInput.vue
17906
+ //#region src/internal/toolbar/built-in/LinkInput.vue?vue&type=script&setup=true&lang.ts
17983
17907
  var _hoisted_1$20 = {
17984
17908
  key: 0,
17985
17909
  class: "link-title"
@@ -18027,7 +17951,9 @@ var _hoisted_18$1 = {
18027
17951
  role: "status",
18028
17952
  class: "sd-error"
18029
17953
  };
18030
- var LinkInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
17954
+ //#endregion
17955
+ //#region src/internal/toolbar/built-in/LinkInput.vue
17956
+ var LinkInput_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
18031
17957
  __name: "LinkInput",
18032
17958
  props: {
18033
17959
  showInput: {
@@ -18178,7 +18104,7 @@ var LinkInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
18178
18104
  commandError.value = "";
18179
18105
  try {
18180
18106
  const result = await runLinkCommand(payload);
18181
- if (result === false || result == null || typeof result === "object" && (result.success === false || result.status === "rejected")) {
18107
+ if (result === false || result == null || typeof result === "object" && result.success === false) {
18182
18108
  commandError.value = "Could not apply link. Check the selection and try again.";
18183
18109
  return;
18184
18110
  }
@@ -18288,7 +18214,7 @@ var LinkInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
18288
18214
  ], 2);
18289
18215
  };
18290
18216
  }
18291
- }, [["__scopeId", "data-v-360db842"]]);
18217
+ }), [["__scopeId", "data-v-172107e4"]]);
18292
18218
  //#endregion
18293
18219
  //#region src/internal/toolbar/built-in/scroll-helpers.js
18294
18220
  function getScrollableParent(element) {
@@ -20205,7 +20131,7 @@ function translateExportDiagnostic(error, ctx = {}) {
20205
20131
  * event only fires on success, fires AFTER the diagnostics events on the
20206
20132
  * success path, and never fires at all for a failed attempt.
20207
20133
  *
20208
- * @param {{generation?: unknown}} [payload]
20134
+ * @param {{generation?: unknown} | null} [payload]
20209
20135
  * @returns {number}
20210
20136
  */
20211
20137
  function getV2DiagnosticGeneration(payload) {
@@ -20277,7 +20203,9 @@ function createV2DiagnosticDedupe() {
20277
20203
  function isBootDiagnosticRedundant(bootDiagnostic, reason, translatedRecords) {
20278
20204
  return Boolean(bootDiagnostic) && bootDiagnostic.internalCode === reason && translatedRecords.length > 0;
20279
20205
  }
20280
- var SurfaceExternalMount_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20206
+ //#endregion
20207
+ //#region src/components/surfaces/SurfaceExternalMount.vue
20208
+ var SurfaceExternalMount_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20281
20209
  __name: "SurfaceExternalMount",
20282
20210
  props: {
20283
20211
  surfaceId: {
@@ -20339,7 +20267,7 @@ var SurfaceExternalMount_default = /*#__PURE__*/ _plugin_vue_export_helper_defau
20339
20267
  }, null, 512);
20340
20268
  };
20341
20269
  }
20342
- }, [["__scopeId", "data-v-b2412c5d"]]);
20270
+ }), [["__scopeId", "data-v-d1081bc8"]]);
20343
20271
  //#endregion
20344
20272
  //#region src/components/surfaces/focusable-selector.js
20345
20273
  /**
@@ -20355,11 +20283,13 @@ var FOCUSABLE_SELECTOR = [
20355
20283
  "[tabindex]:not([tabindex=\"-1\"])"
20356
20284
  ].join(", ");
20357
20285
  //#endregion
20358
- //#region src/components/surfaces/SurfaceDialog.vue
20286
+ //#region src/components/surfaces/SurfaceDialog.vue?vue&type=script&setup=true&lang.ts
20359
20287
  var _hoisted_1$19 = ["aria-labelledby", "aria-label"];
20360
20288
  var _hoisted_2$15 = ["id"];
20361
20289
  var _hoisted_3$13 = { class: "sd-surface-dialog__content" };
20362
- var SurfaceDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20290
+ //#endregion
20291
+ //#region src/components/surfaces/SurfaceDialog.vue
20292
+ var SurfaceDialog_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20363
20293
  __name: "SurfaceDialog",
20364
20294
  props: {
20365
20295
  surface: {
@@ -20406,7 +20336,7 @@ var SurfaceDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20406
20336
  if (props.scrollLockTarget) scrollLockTarget = props.scrollLockTarget;
20407
20337
  else {
20408
20338
  const superdocRoot = dialogRef.value?.closest(".superdoc");
20409
- scrollLockTarget = superdocRoot?.querySelector(".superdoc__layers") ?? superdocRoot;
20339
+ scrollLockTarget = superdocRoot?.querySelector(".superdoc__layers") ?? superdocRoot ?? null;
20410
20340
  }
20411
20341
  if (!scrollLockTarget) return;
20412
20342
  originalOverflow = scrollLockTarget.style.overflow;
@@ -20507,7 +20437,7 @@ var SurfaceDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20507
20437
  ])) : __props.surface.component ? (openBlock(), createBlock(resolveDynamicComponent(__props.surface.component), normalizeProps(mergeProps({ key: 1 }, mergedComponentProps.value)), null, 16)) : createCommentVNode("", true)])], 12, _hoisted_1$19)], 32);
20508
20438
  };
20509
20439
  }
20510
- }, [["__scopeId", "data-v-5cee3b11"]]);
20440
+ }), [["__scopeId", "data-v-6ce23dd7"]]);
20511
20441
  //#endregion
20512
20442
  //#region src/components/surfaces/SurfaceFloating.vue
20513
20443
  var _hoisted_1$18 = ["aria-labelledby", "aria-label"];
@@ -20885,7 +20815,7 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20885
20815
  }
20886
20816
  }, [["__scopeId", "data-v-dad99b67"]]);
20887
20817
  //#endregion
20888
- //#region src/SuperDoc.vue
20818
+ //#region src/SuperDoc.vue?vue&type=script&setup=true&lang.ts
20889
20819
  var _hoisted_1$17 = ["data-superdoc-ui-owner"];
20890
20820
  var _hoisted_2$13 = ["innerHTML"];
20891
20821
  var _hoisted_3$11 = { class: "superdoc__document document" };
@@ -20893,11 +20823,13 @@ var _hoisted_4$9 = { class: "floating-comments" };
20893
20823
  var TRACKED_CHANGE_CARRIERS_RESTAMPED_EVENT = "superdoc:v2-tracked-change-carriers-restamped";
20894
20824
  var UNAVAILABLE_COMMAND_RESULT = false;
20895
20825
  var V2_SELECTION_TOOLBAR_SYNC_RETRY_FRAMES = 3;
20896
- var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20826
+ //#endregion
20827
+ //#region src/SuperDoc.vue
20828
+ var SuperDoc_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20897
20829
  __name: "SuperDoc",
20898
20830
  emits: ["selection-update"],
20899
20831
  setup(__props, { emit: __emit }) {
20900
- const PdfViewer = defineAsyncComponent(() => import("./chunks/PdfViewer-JHXZQZ9x.es.js"));
20832
+ const PdfViewer = defineAsyncComponent(() => import("./chunks/PdfViewer-D4lVeOJu.es.js"));
20901
20833
  const getDocumentLoadPassword = (doc) => doc.password ?? proxy.$superdoc.config.password;
20902
20834
  const resolveDocumentV2Collaboration = (doc) => {
20903
20835
  const rawConfig = doc?.v2Collaboration;
@@ -21159,7 +21091,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21159
21091
  if (typeof bindSessionShortcuts !== "function") return;
21160
21092
  const unbind = bindSessionShortcuts({
21161
21093
  routes: createV2SessionShortcutRoutes({
21162
- resolveToolbarElement: () => proxy.$superdoc?.toolbar?.toolbarContainer ?? null,
21094
+ resolveToolbarElement: () => (proxy.$superdoc?.toolbar)?.toolbarContainer ?? null,
21163
21095
  getDocumentApi: () => documentApi ?? null,
21164
21096
  ...firstPartyCommandMutation ? { runReferenceMutation: (memberPath, input) => firstPartyCommandMutation.run(memberPath, [input]) } : {},
21165
21097
  pageNumberCommand: {
@@ -21194,7 +21126,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21194
21126
  if (document && provider?.sendStateless) document.provider = null;
21195
21127
  const entry = v2Runtimes.get(documentId);
21196
21128
  if (!entry) return;
21197
- proxy.$superdoc.unregisterEditorRuntime(entry.runtimeId);
21129
+ proxy.$superdoc["unregisterEditorRuntime"](entry.runtimeId);
21198
21130
  v2Runtimes.delete(documentId);
21199
21131
  const hostRoot = subDocumentRoots.get(documentId);
21200
21132
  if (hostRoot) unmarkRuntimeRoot(hostRoot);
@@ -21214,7 +21146,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21214
21146
  host,
21215
21147
  getLegacyEditorProjection: () => facade,
21216
21148
  onUnregister: (id) => {
21217
- proxy.$superdoc.unregisterEditorRuntime(id);
21149
+ proxy.$superdoc["unregisterEditorRuntime"](id);
21218
21150
  const current = v2Runtimes.get(documentId);
21219
21151
  if (current && current.runtimeId === id) v2Runtimes.delete(documentId);
21220
21152
  const hostRoot = subDocumentRoots.get(documentId);
@@ -21223,12 +21155,12 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21223
21155
  });
21224
21156
  adapter.attachMountHandle(mount ?? null);
21225
21157
  markRuntimeRoot(root, runtimeId);
21226
- proxy.$superdoc.registerEditorRuntime(adapter.runtime);
21158
+ proxy.$superdoc["registerEditorRuntime"](adapter.runtime);
21227
21159
  v2Runtimes.set(documentId, {
21228
21160
  runtimeId,
21229
21161
  adapter
21230
21162
  });
21231
- proxy.$superdoc.setActiveRuntime(runtimeId, "v2-editor-ready");
21163
+ proxy.$superdoc["setActiveRuntime"](runtimeId, "v2-editor-ready");
21232
21164
  return true;
21233
21165
  };
21234
21166
  const v2ReviewWindowController = resolvedEditorIntegration.createReviewWindowController({ applyReviewWindow: (ctx, result) => commentsStore.applyReviewWindowFromV2?.({
@@ -21754,7 +21686,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21754
21686
  if (!isV2Mode.value) return;
21755
21687
  let handles = null;
21756
21688
  try {
21757
- handles = proxy.$superdoc?.activeEditor?.host?.getHandles?.() ?? null;
21689
+ handles = (proxy.$superdoc?.activeEditor)?.host?.getHandles?.() ?? null;
21758
21690
  } catch {
21759
21691
  handles = null;
21760
21692
  }
@@ -21833,7 +21765,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21833
21765
  syncV2SelectionToolbarState();
21834
21766
  };
21835
21767
  const getActiveV2MountContainer = () => {
21836
- return v2GeometryRender.value?.mountContainer ?? proxy.$superdoc?.activeEditor?.mount?.container ?? null;
21768
+ return v2GeometryRender.value?.mountContainer ?? (proxy.$superdoc?.activeEditor)?.mount?.container ?? null;
21837
21769
  };
21838
21770
  const escapeCssIdent = (value) => {
21839
21771
  const raw = String(value);
@@ -22344,7 +22276,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
22344
22276
  }
22345
22277
  };
22346
22278
  const activateRuntimeFromEvent = (event, reason) => {
22347
- proxy.$superdoc?.activateRuntimeFromEventTarget?.(event.target, reason);
22279
+ proxy.$superdoc?.["activateRuntimeFromEventTarget"]?.(event.target, reason);
22348
22280
  };
22349
22281
  const handleRuntimeFocusIn = (event) => activateRuntimeFromEvent(event, "focusin");
22350
22282
  const handleRuntimePointerDown = (event) => activateRuntimeFromEvent(event, "pointerdown");
@@ -22752,8 +22684,8 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
22752
22684
  if (!isCommentsEnabled.value) return false;
22753
22685
  return !getConfig.value?.readOnly && selectionPosition.value;
22754
22686
  });
22755
- watch$1(showCommentsSidebar, (value) => {
22756
- proxy.$superdoc.broadcastSidebarToggle(value);
22687
+ watch$1(() => Boolean(showCommentsSidebar.value), (isOpened) => {
22688
+ proxy.$superdoc.broadcastSidebarToggle(isOpened);
22757
22689
  });
22758
22690
  useViewportFit({
22759
22691
  getSuperdoc: () => proxy.$superdoc,
@@ -22834,7 +22766,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
22834
22766
  const activeElement = document.activeElement;
22835
22767
  if (!(activeElement instanceof Node)) return false;
22836
22768
  if (root?.contains(activeElement)) return true;
22837
- const activeEditorDom = proxy.$superdoc?.activeEditor?.view?.dom;
22769
+ const activeEditorDom = (proxy.$superdoc?.activeEditor?.view)?.dom;
22838
22770
  return activeEditorDom instanceof Node && (activeElement === activeEditorDom || activeEditorDom.contains?.(activeElement));
22839
22771
  }
22840
22772
  /**
@@ -23027,16 +22959,18 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23027
22959
  resetSelection();
23028
22960
  selectionLayer.value.style.pointerEvents = "auto";
23029
22961
  nextTick(() => {
22962
+ const layer = selectionLayer.value;
22963
+ if (!layer) return;
23030
22964
  isDragging.value = true;
23031
- selectionLayer.value.style.pointerEvents = "none";
22965
+ layer.style.pointerEvents = "none";
23032
22966
  const pageNumber = getPdfPageNumberFromEvent(e);
23033
- selectionLayer.value.style.pointerEvents = "auto";
22967
+ layer.style.pointerEvents = "auto";
23034
22968
  if (!pageNumber) {
23035
22969
  isDragging.value = false;
23036
- selectionLayer.value.style.pointerEvents = "none";
22970
+ layer.style.pointerEvents = "none";
23037
22971
  return;
23038
22972
  }
23039
- const layerBounds = selectionLayer.value.getBoundingClientRect();
22973
+ const layerBounds = layer.getBoundingClientRect();
23040
22974
  const zoom = activeZoom.value / 100;
23041
22975
  const x = (e.clientX - layerBounds.left) / zoom;
23042
22976
  const y = (e.clientY - layerBounds.top) / zoom;
@@ -23046,7 +22980,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23046
22980
  page: pageNumber,
23047
22981
  source: "pdf"
23048
22982
  });
23049
- selectionLayer.value.addEventListener("mousemove", handleDragMove);
22983
+ layer.addEventListener("mousemove", handleDragMove);
23050
22984
  });
23051
22985
  };
23052
22986
  const handleDragMove = (e) => {
@@ -23121,7 +23055,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23121
23055
  if (typeof container === "string") return (typeof document !== "undefined" ? document : globalThis.document)?.querySelector(container) ?? null;
23122
23056
  return typeof HTMLElement !== "undefined" && container instanceof HTMLElement ? container : null;
23123
23057
  };
23124
- const getActiveV2DocumentId = () => proxy.$superdoc?.activeEditor?.documentId ?? proxy.$superdoc?.activeEditor?.options?.documentId ?? null;
23058
+ const getActiveV2DocumentId = () => (proxy.$superdoc?.activeEditor)?.documentId ?? proxy.$superdoc?.activeEditor?.options?.documentId ?? null;
23125
23059
  const resolveV2RulerAlignmentContainer = () => {
23126
23060
  if (resolvedRulerContainer.value) return resolveV2RulerContainer();
23127
23061
  const activeDocumentId = getActiveV2DocumentId();
@@ -23512,7 +23446,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23512
23446
  ], 46, _hoisted_1$17);
23513
23447
  };
23514
23448
  }
23515
- }, [["__scopeId", "data-v-ba00d895"]]);
23449
+ }), [["__scopeId", "data-v-da95e5c5"]]);
23516
23450
  //#endregion
23517
23451
  //#region src/core/create-app.js
23518
23452
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -26913,10 +26847,12 @@ var throttle = (func, wait, options) => {
26913
26847
  return throttled;
26914
26848
  };
26915
26849
  //#endregion
26916
- //#region src/internal/toolbar/built-in/ToolbarButtonIcon.vue
26850
+ //#region src/internal/toolbar/built-in/ToolbarButtonIcon.vue?vue&type=script&setup=true&lang.ts
26917
26851
  var _hoisted_1$16 = { class: "sd-toolbar-icon" };
26918
26852
  var _hoisted_2$12 = ["innerHTML"];
26919
- var ToolbarButtonIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
26853
+ //#endregion
26854
+ //#region src/internal/toolbar/built-in/ToolbarButtonIcon.vue
26855
+ var ToolbarButtonIcon_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
26920
26856
  __name: "ToolbarButtonIcon",
26921
26857
  props: {
26922
26858
  name: {
@@ -26952,9 +26888,9 @@ var ToolbarButtonIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
26952
26888
  }, null, 4)) : createCommentVNode("", true)]);
26953
26889
  };
26954
26890
  }
26955
- }, [["__scopeId", "data-v-65ecd5b1"]]);
26891
+ }), [["__scopeId", "data-v-e72eee56"]]);
26956
26892
  //#endregion
26957
- //#region src/internal/toolbar/built-in/ToolbarButton.vue
26893
+ //#region src/internal/toolbar/built-in/ToolbarButton.vue?vue&type=script&setup=true&lang.ts
26958
26894
  var _hoisted_1$15 = [
26959
26895
  "role",
26960
26896
  "aria-label",
@@ -26981,7 +26917,9 @@ var _hoisted_11$1 = {
26981
26917
  "aria-live": "polite",
26982
26918
  class: "sd-visually-hidden"
26983
26919
  };
26984
- var ToolbarButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
26920
+ //#endregion
26921
+ //#region src/internal/toolbar/built-in/ToolbarButton.vue
26922
+ var ToolbarButton_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
26985
26923
  __name: "ToolbarButton",
26986
26924
  props: {
26987
26925
  iconColor: {
@@ -27024,9 +26962,9 @@ var ToolbarButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27024
26962
  ],
27025
26963
  setup(__props, { emit: __emit }) {
27026
26964
  const emit = __emit;
27027
- const { proxy } = getCurrentInstance();
26965
+ const proxy = getCurrentInstance()?.proxy;
27028
26966
  const props = __props;
27029
- const { name, active, icon, label, hideLabel, iconColor, hasCaret, splitButton, disabled, expand, inlineTextInputVisible, hasInlineTextInput, minWidth, style, attributes } = props.toolbarItem;
26967
+ const { name, active, icon, label, hideLabel, iconColor, hasCaret, splitButton, disabled, expand, inlineTextInputVisible, hasInlineTextInput, style, attributes } = props.toolbarItem;
27030
26968
  const isSplit = computed$1(() => Boolean(splitButton?.value) && Boolean(hasCaret?.value));
27031
26969
  const itemName = computed$1(() => name?.value ?? "");
27032
26970
  const inlineTextInput = ref("");
@@ -27138,17 +27076,13 @@ var ToolbarButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27138
27076
  }
27139
27077
  if (itemName.value === "fontSize") nextTick(focusEditorSurface);
27140
27078
  };
27141
- const getStyle = computed$1(() => {
27142
- if (style.value) return style.value;
27143
- return { minWidth: props.minWidth };
27144
- });
27145
27079
  const caretIcon = computed$1(() => {
27146
27080
  return expand?.value ? toolbarIcons.dropdownCaretUp : toolbarIcons.dropdownCaretDown;
27147
27081
  });
27148
27082
  return (_ctx, _cache) => {
27149
27083
  return openBlock(), createElementBlock("div", {
27150
27084
  class: normalizeClass(["sd-toolbar-item", unref(attributes).className]),
27151
- style: normalizeStyle(getStyle.value),
27085
+ style: normalizeStyle(unref(style)),
27152
27086
  role: __props.isOverflowItem ? "menuitem" : "button",
27153
27087
  "aria-label": unref(attributes).ariaLabel,
27154
27088
  "aria-disabled": unref(disabled) ? "true" : void 0,
@@ -27252,7 +27186,7 @@ var ToolbarButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27252
27186
  ], 10, _hoisted_2$11)], 46, _hoisted_1$15);
27253
27187
  };
27254
27188
  }
27255
- }, [["__scopeId", "data-v-96796456"]]);
27189
+ }), [["__scopeId", "data-v-40889353"]]);
27256
27190
  //#endregion
27257
27191
  //#region src/internal/toolbar/built-in/ToolbarSeparator.vue
27258
27192
  var _hoisted_1$14 = {
@@ -27282,7 +27216,7 @@ var ToolbarSeparator_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27282
27216
  }
27283
27217
  }, [["__scopeId", "data-v-cb82253a"]]);
27284
27218
  //#endregion
27285
- //#region src/internal/toolbar/built-in/ToolbarDropdown.vue
27219
+ //#region src/internal/toolbar/built-in/ToolbarDropdown.vue?vue&type=script&setup=true&lang.ts
27286
27220
  var _hoisted_1$13 = { class: "toolbar-dropdown" };
27287
27221
  var _hoisted_2$10 = ["data-superdoc-ui-owner"];
27288
27222
  var _hoisted_3$9 = ["onClick"];
@@ -27292,7 +27226,9 @@ var _hoisted_4$7 = {
27292
27226
  };
27293
27227
  var _hoisted_5$5 = { class: "toolbar-dropdown-option__label" };
27294
27228
  var TRIGGER_FOCUS_SELECTOR = "button, [href], input, select, textarea, [role=\"button\"], [tabindex]:not([tabindex=\"-1\"])";
27295
- var ToolbarDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27229
+ //#endregion
27230
+ //#region src/internal/toolbar/built-in/ToolbarDropdown.vue
27231
+ var ToolbarDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
27296
27232
  __name: "ToolbarDropdown",
27297
27233
  props: {
27298
27234
  options: {
@@ -27449,7 +27385,7 @@ var ToolbarDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27449
27385
  if (!value) return false;
27450
27386
  if (typeof value === "string") return value.split(/\s+/).includes("sd-selected");
27451
27387
  if (Array.isArray(value)) return value.some(classHasSelected);
27452
- if (typeof value === "object") return Boolean(value["sd-selected"]);
27388
+ if (typeof value === "object") return "sd-selected" in value && Boolean(value["sd-selected"]);
27453
27389
  return false;
27454
27390
  };
27455
27391
  const isOptionSelected = (option) => {
@@ -27681,7 +27617,7 @@ var ToolbarDropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27681
27617
  })], 8, ["to"]))]);
27682
27618
  };
27683
27619
  }
27684
- }, [["__scopeId", "data-v-e6f71d76"]]);
27620
+ }), [["__scopeId", "data-v-50758732"]]);
27685
27621
  //#endregion
27686
27622
  //#region src/internal/toolbar/built-in/toolbar-focus-helpers.js
27687
27623
  var preventEditorFocusTransfer = (event) => {
@@ -27902,7 +27838,7 @@ var normalizeCustomFontSize = (value) => {
27902
27838
  return String(Math.min(halfPoint, MAX_FONT_SIZE));
27903
27839
  };
27904
27840
  //#endregion
27905
- //#region src/internal/toolbar/built-in/ToolbarComboBox.vue
27841
+ //#region src/internal/toolbar/built-in/ToolbarComboBox.vue?vue&type=script&setup=true&lang.ts
27906
27842
  var _hoisted_1$12 = ["data-item"];
27907
27843
  var _hoisted_2$9 = [
27908
27844
  "id",
@@ -27937,7 +27873,9 @@ var _hoisted_8$1 = {
27937
27873
  class: "sd-button-label sd-font-combobox__legacy-label",
27938
27874
  "aria-hidden": "true"
27939
27875
  };
27940
- var ToolbarComboBox_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27876
+ //#endregion
27877
+ //#region src/internal/toolbar/built-in/ToolbarComboBox.vue
27878
+ var ToolbarComboBox_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
27941
27879
  __name: "ToolbarComboBox",
27942
27880
  props: {
27943
27881
  item: {
@@ -28423,10 +28361,10 @@ var ToolbarComboBox_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28423
28361
  ], 14, _hoisted_1$12);
28424
28362
  };
28425
28363
  }
28426
- }, [["__scopeId", "data-v-eb442535"]]);
28364
+ }), [["__scopeId", "data-v-e9143b7e"]]);
28427
28365
  //#endregion
28428
28366
  //#region src/internal/toolbar/built-in/FontFamilyCombobox.vue
28429
- var _sfc_main$14 = {
28367
+ var _sfc_main$11 = {
28430
28368
  __name: "FontFamilyCombobox",
28431
28369
  props: {
28432
28370
  item: {
@@ -28467,7 +28405,7 @@ var _sfc_main$14 = {
28467
28405
  };
28468
28406
  //#endregion
28469
28407
  //#region src/internal/toolbar/built-in/FontSizeCombobox.vue
28470
- var _sfc_main$13 = {
28408
+ var _sfc_main$10 = {
28471
28409
  __name: "FontSizeCombobox",
28472
28410
  props: {
28473
28411
  item: {
@@ -28507,9 +28445,12 @@ var _sfc_main$13 = {
28507
28445
  }
28508
28446
  };
28509
28447
  //#endregion
28510
- //#region src/internal/toolbar/built-in/SdTooltip.vue
28448
+ //#region src/internal/toolbar/built-in/SdTooltip.vue?vue&type=script&setup=true&lang.ts
28511
28449
  var AUTO_HIDE_DELAY = 2500;
28512
- var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
28450
+ //#endregion
28451
+ //#region src/internal/toolbar/built-in/SdTooltip.vue
28452
+ var SdTooltip_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
28453
+ inheritAttrs: false,
28513
28454
  __name: "SdTooltip",
28514
28455
  props: {
28515
28456
  trigger: {
@@ -28723,7 +28664,7 @@ var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
28723
28664
  }, 8, ["css"])]))], 64);
28724
28665
  };
28725
28666
  }
28726
- }), [["__scopeId", "data-v-71c6de4c"]]);
28667
+ }), [["__scopeId", "data-v-dfd6f1d1"]]);
28727
28668
  //#endregion
28728
28669
  //#region src/internal/toolbar/built-in/ButtonGroup.vue
28729
28670
  var _hoisted_1$11 = [
@@ -29111,7 +29052,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29111
29052
  disabled: !item.tooltip?.value,
29112
29053
  "content-style": { fontFamily: props.uiFontFamily }
29113
29054
  }, {
29114
- trigger: withCtx(() => [createVNode(_sfc_main$14, {
29055
+ trigger: withCtx(() => [createVNode(_sfc_main$11, {
29115
29056
  item,
29116
29057
  "ui-font-family": props.uiFontFamily,
29117
29058
  class: "sd-toolbar-button sd-editor-toolbar-dropdown",
@@ -29128,7 +29069,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29128
29069
  disabled: !item.tooltip?.value,
29129
29070
  "content-style": { fontFamily: props.uiFontFamily }
29130
29071
  }, {
29131
- trigger: withCtx(() => [createVNode(_sfc_main$13, {
29072
+ trigger: withCtx(() => [createVNode(_sfc_main$10, {
29132
29073
  item,
29133
29074
  "ui-font-family": props.uiFontFamily,
29134
29075
  class: "sd-toolbar-button sd-editor-toolbar-dropdown",
@@ -29633,7 +29574,6 @@ var useToolbarItem = (options) => {
29633
29574
  const style = ref(options.style);
29634
29575
  const isNarrow = ref(options.isNarrow);
29635
29576
  const isWide = ref(options.isWide);
29636
- const minWidth = ref(options.minWidth);
29637
29577
  const layoutWidth = ref(options.layoutWidth);
29638
29578
  const suppressActiveHighlight = ref(options.suppressActiveHighlight || false);
29639
29579
  const argument = ref(options.argument);
@@ -29710,7 +29650,6 @@ var useToolbarItem = (options) => {
29710
29650
  style,
29711
29651
  isNarrow,
29712
29652
  isWide,
29713
- minWidth,
29714
29653
  layoutWidth,
29715
29654
  argument,
29716
29655
  parentItem,
@@ -30071,7 +30010,7 @@ var DocumentMode_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30071
30010
  }
30072
30011
  }, [["__scopeId", "data-v-bee14d7a"]]);
30073
30012
  //#endregion
30074
- //#region src/internal/toolbar/built-in/LinkedStyle.vue
30013
+ //#region src/internal/toolbar/built-in/LinkedStyle.vue?vue&type=script&setup=true&lang.ts
30075
30014
  var _hoisted_1$6 = {
30076
30015
  class: "linked-style-buttons",
30077
30016
  "data-editor-ui-surface": ""
@@ -30087,7 +30026,9 @@ var _hoisted_3$5 = [
30087
30026
  "onClick"
30088
30027
  ];
30089
30028
  var _hoisted_4$3 = ["innerHTML"];
30090
- var LinkedStyle_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30029
+ //#endregion
30030
+ //#region src/internal/toolbar/built-in/LinkedStyle.vue
30031
+ var LinkedStyle_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30091
30032
  __name: "LinkedStyle",
30092
30033
  props: {
30093
30034
  styles: {
@@ -30188,7 +30129,7 @@ var LinkedStyle_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30188
30129
  }), 128))]);
30189
30130
  };
30190
30131
  }
30191
- }, [["__scopeId", "data-v-b5a32523"]]);
30132
+ }), [["__scopeId", "data-v-4e36f956"]]);
30192
30133
  //#endregion
30193
30134
  //#region src/internal/toolbar/built-in/AIWriter.vue
30194
30135
  var _hoisted_1$5 = ["placeholder"];
@@ -30828,7 +30769,7 @@ var TableActions_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30828
30769
  }
30829
30770
  }, [["__scopeId", "data-v-72123aae"]]);
30830
30771
  //#endregion
30831
- //#region src/internal/toolbar/built-in/PageNumberMenu.vue
30772
+ //#region src/internal/toolbar/built-in/PageNumberMenu.vue?vue&type=script&setup=true&lang.ts
30832
30773
  var _hoisted_1 = ["aria-busy"];
30833
30774
  var _hoisted_2 = ["aria-disabled"];
30834
30775
  var _hoisted_3 = {
@@ -30876,7 +30817,9 @@ var _hoisted_20 = ["disabled"];
30876
30817
  var _hoisted_21 = ["disabled"];
30877
30818
  var _hoisted_22 = ["disabled"];
30878
30819
  var _hoisted_23 = { class: "sd-page-number-menu__cursor-text" };
30879
- var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30820
+ //#endregion
30821
+ //#region src/internal/toolbar/built-in/PageNumberMenu.vue
30822
+ var PageNumberMenu_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30880
30823
  __name: "PageNumberMenu",
30881
30824
  props: {
30882
30825
  /** Command state of `page-numbers-apply`, read when the popover opens. */
@@ -31005,7 +30948,7 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31005
30948
  const { isHighContrastMode } = useHighContrastMode();
31006
30949
  const remembered = props.initialChoice ?? {};
31007
30950
  const position = ref(remembered.position === "top" ? "top" : "bottom");
31008
- const alignment = ref(ALIGNMENTS.some((entry) => entry.value === remembered.alignment) ? remembered.alignment : "right");
30951
+ const alignment = ref(isAlignment(remembered.alignment) ? remembered.alignment : "right");
31009
30952
  const showOnFirstPage = ref(remembered.showOnFirstPage !== false);
31010
30953
  const format = ref("decimal");
31011
30954
  const restart = ref(false);
@@ -31040,6 +30983,9 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31040
30983
  const platform = typeof navigator === "undefined" ? "" : navigator.platform || navigator.userAgent || "";
31041
30984
  return /Mac|iPhone|iPad/i.test(platform) ? "⌥⇧⌘P" : "Ctrl+Alt+Shift+P";
31042
30985
  });
30986
+ function isAlignment(value) {
30987
+ return ALIGNMENTS.some((entry) => entry.value === value);
30988
+ }
31043
30989
  function isTileSelected(tile) {
31044
30990
  return tile.position === position.value && tile.alignment === alignment.value;
31045
30991
  }
@@ -31109,8 +31055,12 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31109
31055
  const value = Math.floor(Number(startAt.value));
31110
31056
  return Number.isFinite(value) && value >= 0 ? value : 1;
31111
31057
  }
31058
+ function failureDetails(result) {
31059
+ if (typeof result !== "object" || result === null || result.success) return null;
31060
+ return isPlainObject$1(result.failure?.details) ? result.failure.details : null;
31061
+ }
31112
31062
  function failureMessage(result, action) {
31113
- const details = result?.failure?.details;
31063
+ const details = failureDetails(result);
31114
31064
  if (details?.reason === "page-number-has-content") return `A page number shares its line with other text. Edit the ${details.kind === "header" ? "header" : "footer"} directly to change it.`;
31115
31065
  if (details?.reason === "page-number-exists") return "This section already has page numbers.";
31116
31066
  if (action === "remove") return "Page numbers couldn’t be removed. Try again.";
@@ -31128,7 +31078,7 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31128
31078
  await loaded;
31129
31079
  const { execute, outcome } = prepare();
31130
31080
  const result = await execute();
31131
- if (result === true || result?.success === true) {
31081
+ if (result === true || typeof result === "object" && result !== null && result.success === true) {
31132
31082
  props.close(outcome);
31133
31083
  return;
31134
31084
  }
@@ -31178,8 +31128,9 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31178
31128
  }
31179
31129
  onMounted(() => {
31180
31130
  nextTick(() => tileRefs.value[focusIndex.value]?.focus({ preventScroll: true }));
31181
- if (typeof props.loadCurrent !== "function") return;
31182
- loaded = Promise.resolve().then(() => props.loadCurrent()).then(adoptCurrent, () => adoptCurrent(null)).finally(() => {
31131
+ const loadCurrent = props.loadCurrent;
31132
+ if (typeof loadCurrent !== "function") return;
31133
+ loaded = Promise.resolve().then(() => loadCurrent()).then(adoptCurrent, () => adoptCurrent(null)).finally(() => {
31183
31134
  loading.value = false;
31184
31135
  });
31185
31136
  });
@@ -31218,7 +31169,7 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31218
31169
  onClick: ($event) => selectTile(tile),
31219
31170
  onDblclick: applyPageNumbers,
31220
31171
  onKeydown: onTileKeydown
31221
- }, [(openBlock(), createElementBlock("svg", _hoisted_5, [_cache[4] || (_cache[4] = createStaticVNode("<rect class=\"sd-page-number-menu__sheet\" x=\"0.75\" y=\"0.75\" width=\"34.5\" height=\"44.5\" rx=\"2.5\" data-v-30327fd0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"14\" width=\"22\" height=\"2\" rx=\"1\" data-v-30327fd0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"19\" width=\"18\" height=\"2\" rx=\"1\" data-v-30327fd0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"24\" width=\"22\" height=\"2\" rx=\"1\" data-v-30327fd0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"29\" width=\"14\" height=\"2\" rx=\"1\" data-v-30327fd0></rect>", 5)), createElementVNode("rect", {
31172
+ }, [(openBlock(), createElementBlock("svg", _hoisted_5, [_cache[4] || (_cache[4] = createStaticVNode("<rect class=\"sd-page-number-menu__sheet\" x=\"0.75\" y=\"0.75\" width=\"34.5\" height=\"44.5\" rx=\"2.5\" data-v-a6c124c0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"14\" width=\"22\" height=\"2\" rx=\"1\" data-v-a6c124c0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"19\" width=\"18\" height=\"2\" rx=\"1\" data-v-a6c124c0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"24\" width=\"22\" height=\"2\" rx=\"1\" data-v-a6c124c0></rect><rect class=\"sd-page-number-menu__line\" x=\"7\" y=\"29\" width=\"14\" height=\"2\" rx=\"1\" data-v-a6c124c0></rect>", 5)), createElementVNode("rect", {
31222
31173
  class: "sd-page-number-menu__chip",
31223
31174
  x: CHIP_X[tile.alignment],
31224
31175
  y: CHIP_Y[tile.position],
@@ -31298,7 +31249,7 @@ var PageNumberMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
31298
31249
  ], 10, _hoisted_1);
31299
31250
  };
31300
31251
  }
31301
- }, [["__scopeId", "data-v-30327fd0"]]);
31252
+ }), [["__scopeId", "data-v-a6c124c0"]]);
31302
31253
  //#endregion
31303
31254
  //#region src/internal/toolbar/built-in/page-number-feedback.js
31304
31255
  var FLASH_CLASS = "sd-page-number-flash";
@@ -34131,7 +34082,7 @@ var SuperDoc = class extends import_eventemitter3.default {
34131
34082
  }
34132
34083
  this.userColorMap = /* @__PURE__ */ new Map();
34133
34084
  this.colorIndex = 0;
34134
- this.version = "2.28.0";
34085
+ this.version = "2.29.0-next.2";
34135
34086
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
34136
34087
  this.superdocId = config.superdocId || v4();
34137
34088
  this.colors = this.config.colors ?? [];
@@ -35923,7 +35874,7 @@ var SuperDoc = class extends import_eventemitter3.default {
35923
35874
  * superdoc.setZoom(50); // Set zoom to 50%
35924
35875
  */
35925
35876
  setZoom(percent) {
35926
- if (typeof percent !== "number" || !Number.isFinite(percent) || percent <= 0) {
35877
+ if (!isFiniteNumber(percent) || percent <= 0) {
35927
35878
  console.warn("[SuperDoc] setZoom expects a positive number representing percentage");
35928
35879
  return;
35929
35880
  }