superdoc 2.25.0-next.3 → 2.25.0-next.5

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 (45) hide show
  1. package/dist/chunks/{create-super-doc-ui-D8ss5E0J.cjs → create-super-doc-ui-B-A8sK47.cjs} +36 -0
  2. package/dist/chunks/{create-super-doc-ui-3habU4hL.es.js → create-super-doc-ui-CrH79xw6.es.js} +36 -0
  3. package/dist/collaboration-upgrade-engine.cjs +1 -1
  4. package/dist/collaboration-upgrade-engine.es.js +1 -1
  5. package/dist/document-api/src/contract/operation-definitions.d.ts +1 -1
  6. package/dist/document-api/src/index.d.ts +1 -0
  7. package/dist/document-api/src/permission-ranges/permission-ranges.d.ts +9 -1
  8. package/dist/document-api/src/permission-ranges/permission-ranges.types.d.ts +17 -0
  9. package/dist/document-api/src/protection/protection.types.d.ts +2 -2
  10. package/dist/layout-engine/contracts/src/incremental-dependency.d.ts +2 -2
  11. package/dist/layout-engine/contracts/src/index.d.ts +4 -0
  12. package/dist/layout-engine/layout-bridge/src/font-metrics-cache.d.ts +2 -23
  13. package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +11 -4
  14. package/dist/layout-engine/layout-bridge/src/index.d.ts +3 -3
  15. package/dist/layout-engine/layout-bridge/src/measurement-environment.d.ts +12 -0
  16. package/dist/layout-engine/layout-bridge/src/resolveLiveCrossReferences.d.ts +1 -1
  17. package/dist/layout-engine/layout-bridge/src/text-measurement.d.ts +8 -0
  18. package/dist/layout-engine/painters/dom/src/index.d.ts +4 -0
  19. package/dist/layout-engine/painters/dom/src/runs/text-run.d.ts +2 -17
  20. package/dist/layout-engine/painters/dom/src/runs/text-style-facts.d.ts +9 -0
  21. package/dist/layout-engine/painters/dom/src/runs/tracked-changes.d.ts +6 -9
  22. package/dist/layout-engine/painters/dom/src/styles.d.ts +21 -0
  23. package/dist/public/ui-react.cjs +1 -1
  24. package/dist/public/ui-react.es.js +1 -1
  25. package/dist/public/ui-vue.cjs +1 -1
  26. package/dist/public/ui-vue.es.js +1 -1
  27. package/dist/public/ui.cjs +1 -1
  28. package/dist/public/ui.es.js +1 -1
  29. package/dist/shared/font-system/src/registry.d.ts +5 -1
  30. package/dist/shared/font-system/src/resolver.d.ts +2 -0
  31. package/dist/style.css +1 -4239
  32. package/dist/style.layered.css +1 -4239
  33. package/dist/superdoc/src/core/types/index.d.ts +1 -1
  34. package/dist/superdoc/src/index.d.cts +2 -0
  35. package/dist/superdoc/src/index.d.ts +1 -0
  36. package/dist/superdoc/src/public/index.d.cts +8 -0
  37. package/dist/superdoc/src/public/index.d.ts +2 -0
  38. package/dist/superdoc/src/stores/comments-store.d.ts +7 -4
  39. package/dist/superdoc/src/stores/superdoc-store.d.ts +21 -12
  40. package/dist/superdoc.cjs +184 -17
  41. package/dist/superdoc.es.js +183 -18
  42. package/dist-cdn/style.layered.css +1 -1
  43. package/dist-cdn/superdoc.min.css +1 -1
  44. package/dist-cdn/superdoc.min.js +41 -41
  45. package/package.json +2 -2
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./chunks/rolldown-runtime-74VwNCz7.cjs");
3
3
  const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
4
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-D8ss5E0J.cjs");
4
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-B-A8sK47.cjs");
5
5
  const require_eventemitter3 = require("./chunks/eventemitter3-C_TAnXOl.cjs");
6
6
  const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
7
7
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-BUdjGKyl.cjs");
@@ -304,7 +304,7 @@ var awarenessStatesToArray = (context, states) => {
304
304
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
305
305
  function getSuperdocVersion() {
306
306
  try {
307
- return "2.25.0-next.3";
307
+ return "2.25.0-next.5";
308
308
  } catch {
309
309
  return "unknown";
310
310
  }
@@ -7847,6 +7847,7 @@ var useCommentsStore = defineStore("comments", () => {
7847
7847
  const editorCommentPositions = require__plugin_vue_export_helper.ref({});
7848
7848
  const isCommentHighlighted = require__plugin_vue_export_helper.ref(false);
7849
7849
  const floatingCommentsOffset = require__plugin_vue_export_helper.ref(0);
7850
+ const committedReviewPresentations = require__plugin_vue_export_helper.shallowRef({});
7850
7851
  const sortedConversations = require__plugin_vue_export_helper.ref([]);
7851
7852
  const visibleConversations = require__plugin_vue_export_helper.ref([]);
7852
7853
  const skipSelectionUpdate = require__plugin_vue_export_helper.ref(false);
@@ -8862,7 +8863,17 @@ var useCommentsStore = defineStore("comments", () => {
8862
8863
  resolvedComments: resolvedComments.sort(sorter)
8863
8864
  };
8864
8865
  };
8865
- const buildGroupedComments = (sorter) => buildGroupedCommentsFrom(commentsList.value, sorter);
8866
+ const buildGroupedComments = (sorter) => {
8867
+ const presentations = committedReviewPresentations.value;
8868
+ if (!Object.keys(presentations).length) return buildGroupedCommentsFrom(commentsList.value, sorter);
8869
+ const rows = new Map(commentsList.value.map((row) => [JSON.stringify([String(row.fileId), String(row.commentId)]), row]));
8870
+ const legacy = buildGroupedCommentsFrom(commentsList.value.filter((row) => !presentations[String(row.fileId)]), sorter);
8871
+ for (const [documentId, presentation] of Object.entries(presentations)) {
8872
+ legacy.parentComments.push(...presentation.groupOrder.open.map((id) => rows.get(JSON.stringify([documentId, String(id)]))).filter((row) => row && isThreadVisible(row)));
8873
+ legacy.resolvedComments.push(...presentation.groupOrder.resolved.map((id) => rows.get(JSON.stringify([documentId, String(id)]))).filter((row) => row && isThreadVisible(row)));
8874
+ }
8875
+ return legacy;
8876
+ };
8866
8877
  /** @type {import('vue').ComputedRef<{parentComments: Array, resolvedComments: Array}>} Comments grouped and sorted by creation time */
8867
8878
  const getGroupedComments = require__plugin_vue_export_helper.computed(() => buildGroupedComments(compareByCreatedTime));
8868
8879
  const getGroupedReviewDirectory = require__plugin_vue_export_helper.computed(() => buildGroupedCommentsFrom(reviewDirectoryList.value, compareByCreatedTime));
@@ -9835,7 +9846,7 @@ var useCommentsStore = defineStore("comments", () => {
9835
9846
  * wraps this action in one Pinia `$patch`; all fallible mapping completes
9836
9847
  * before either row family mutates.
9837
9848
  */
9838
- const applyReviewWindowFromV2 = ({ superdoc, commentsAdapter, trackedChangesAdapter, documentId, commentItems, trackedChangeItems, requestedCommentIds, requestedTrackedChangeIds, unresolvedCommentIds, trackedList, sourceCoverageRevision, evaluatedRevision, patch } = {}) => withInteractionSpan("store.reviewWindow.apply", "store-reconciliation", {
9849
+ const applyReviewWindowFromV2 = ({ superdoc, commentsAdapter, trackedChangesAdapter, documentId, commentItems, trackedChangeItems, preparedReview, requestedCommentIds, requestedTrackedChangeIds, unresolvedCommentIds, trackedList, sourceCoverageRevision, evaluatedRevision, patch } = {}) => withInteractionSpan("store.reviewWindow.apply", "store-reconciliation", {
9839
9850
  commentItemCount: Array.isArray(commentItems) ? commentItems.length : null,
9840
9851
  trackedItemCount: Array.isArray(trackedChangeItems) ? trackedChangeItems.length : null
9841
9852
  }, () => {
@@ -9861,6 +9872,10 @@ var useCommentsStore = defineStore("comments", () => {
9861
9872
  ok: false,
9862
9873
  reason: "document-mismatch"
9863
9874
  };
9875
+ if (preparedReview && (!Array.isArray(preparedReview.comments) || !Array.isArray(preparedReview.trackedChanges) || preparedReview.comments.length > 4096 || preparedReview.trackedChanges.length > 4096)) return {
9876
+ ok: false,
9877
+ reason: "items-invalid"
9878
+ };
9864
9879
  if (!Array.isArray(commentItems) || !Array.isArray(trackedChangeItems)) return {
9865
9880
  ok: false,
9866
9881
  reason: "items-invalid"
@@ -9874,7 +9889,7 @@ var useCommentsStore = defineStore("comments", () => {
9874
9889
  reason: "adapter-mapper-missing"
9875
9890
  };
9876
9891
  let effectiveCommentItems = commentItems;
9877
- if (typeof commentsAdapter.seedReviewCatalog === "function") {
9892
+ if (!preparedReview && typeof commentsAdapter.seedReviewCatalog === "function") {
9878
9893
  const seeded = commentsAdapter.seedReviewCatalog(commentItems, {
9879
9894
  sourceCoverageRevision,
9880
9895
  evaluatedRevision
@@ -9890,11 +9905,22 @@ var useCommentsStore = defineStore("comments", () => {
9890
9905
  let preparedInputs;
9891
9906
  let preparedParams;
9892
9907
  try {
9893
- preparedInputs = effectiveCommentItems.filter((item) => !isSyntheticTrackedChangeCommentLaneItem(item)).map((item) => commentsAdapter.mapV2CommentToUseCommentInput(item, {
9908
+ preparedInputs = preparedReview ? preparedReview.comments.map((input) => ({
9909
+ ...input,
9910
+ fileId: normalizedDocumentId,
9911
+ fileType,
9912
+ selection: {
9913
+ ...input.selection,
9914
+ documentId: normalizedDocumentId
9915
+ }
9916
+ })) : effectiveCommentItems.filter((item) => !isSyntheticTrackedChangeCommentLaneItem(item)).map((item) => commentsAdapter.mapV2CommentToUseCommentInput(item, {
9894
9917
  fileId: normalizedDocumentId,
9895
9918
  fileType
9896
9919
  })).filter(Boolean);
9897
- preparedParams = trackedChangeItems.map((item) => trackedChangesAdapter.mapV2TrackedChangeToCommentParams(item)).filter(Boolean);
9920
+ preparedParams = preparedReview ? preparedReview.trackedChanges.map((params) => ({
9921
+ ...params,
9922
+ documentId: normalizedDocumentId
9923
+ })) : trackedChangeItems.map((item) => trackedChangesAdapter.mapV2TrackedChangeToCommentParams(item)).filter(Boolean);
9898
9924
  } catch (error) {
9899
9925
  return {
9900
9926
  ok: false,
@@ -9929,6 +9955,10 @@ var useCommentsStore = defineStore("comments", () => {
9929
9955
  ])
9930
9956
  ].map((value) => normalizeCommentId(value)).filter(Boolean));
9931
9957
  patch(() => {
9958
+ if (preparedReview?.presentation) committedReviewPresentations.value = {
9959
+ ...committedReviewPresentations.value,
9960
+ [normalizedDocumentId]: preparedReview.presentation
9961
+ };
9932
9962
  reconcileTrackedChangesFromV2({
9933
9963
  superdoc,
9934
9964
  adapter: trackedChangesAdapter,
@@ -10331,6 +10361,11 @@ var useCommentsStore = defineStore("comments", () => {
10331
10361
  function removeCommentsForDocument(documentId) {
10332
10362
  const activeDocumentId = documentId != null ? String(documentId) : null;
10333
10363
  if (!activeDocumentId) return;
10364
+ if (committedReviewPresentations.value[activeDocumentId]) {
10365
+ const next = { ...committedReviewPresentations.value };
10366
+ delete next[activeDocumentId];
10367
+ committedReviewPresentations.value = next;
10368
+ }
10334
10369
  cancelImportedTrackedChangeBootstrap(activeDocumentId);
10335
10370
  const removedComments = commentsList.value.filter((comment) => belongsToDocument(comment, activeDocumentId, { allowSingleDocumentMismatch: true }));
10336
10371
  if (!removedComments.length) return;
@@ -11990,6 +12025,7 @@ var useCommentsStore = defineStore("comments", () => {
11990
12025
  hasInitializedLocations,
11991
12026
  isCommentHighlighted,
11992
12027
  floatingCommentsOffset,
12028
+ committedReviewPresentations,
11993
12029
  sortedConversations,
11994
12030
  visibleConversations,
11995
12031
  skipSelectionUpdate,
@@ -15258,6 +15294,50 @@ var composeAuthorColorResolver = (config) => {
15258
15294
  };
15259
15295
  };
15260
15296
  //#endregion
15297
+ //#region ../document-api/src/permission-ranges/permission-ranges.ts
15298
+ function editorKey(editor) {
15299
+ return editor.id?.trim() ? editor.id : editor.email?.trim() || void 0;
15300
+ }
15301
+ function editorMatches(editor, id) {
15302
+ return Boolean(id.trim()) && (editor.id === id || Boolean(editor.email?.trim() && editor.email.trim().toLowerCase() === id.toLowerCase()));
15303
+ }
15304
+ /**
15305
+ * Resolve a host ID or imported Word email against an explicitly supplied roster.
15306
+ * Word receives the email when available; opaque IDs remain host-specific.
15307
+ * Duplicate IDs/emails are ambiguous. This does not authenticate a user.
15308
+ */
15309
+ function resolvePermissionRangeEditor(editors, id) {
15310
+ const matches = editors.filter((editor) => editorMatches(editor, id));
15311
+ if (matches.length === 0) return {
15312
+ status: "unknown",
15313
+ id
15314
+ };
15315
+ if (matches.length !== 1) return {
15316
+ status: "ambiguous",
15317
+ id
15318
+ };
15319
+ const editor = matches[0];
15320
+ const wordId = editor.email?.trim() || editor.id;
15321
+ if (editors.filter((candidate) => editorMatches(candidate, wordId)).length !== 1) return {
15322
+ status: "ambiguous",
15323
+ id
15324
+ };
15325
+ return {
15326
+ status: "resolved",
15327
+ id,
15328
+ editor: { ...editor },
15329
+ principal: {
15330
+ kind: "editor",
15331
+ id: wordId
15332
+ }
15333
+ };
15334
+ }
15335
+ /** Enumerate the host roster for an editor picker, including ambiguous entries. */
15336
+ function listPermissionRangeEditors(editors) {
15337
+ const ids = new Set(editors.map(editorKey).filter((id) => id !== void 0));
15338
+ return Array.from(ids, (id) => resolvePermissionRangeEditor(editors, id));
15339
+ }
15340
+ //#endregion
15261
15341
  //#region src/core/superdoc-ui-owner.js
15262
15342
  var ownerIds = /* @__PURE__ */ new WeakMap();
15263
15343
  function getSuperDocUiOwnerId(superdoc) {
@@ -15379,7 +15459,22 @@ var _sfc_main$31 = {
15379
15459
  const { clearInstantSidebarAlignment } = commentsStore;
15380
15460
  const { activeComment, activeFloatingCommentInstanceId, editorCommentPositions, pendingComment, editingCommentId, instantSidebarAlignmentTargetY, instantSidebarAlignmentThreadId, instantSidebarAlignmentInstanceId } = storeToRefs(commentsStore);
15381
15461
  const { activeZoom } = storeToRefs(superdocStore);
15462
+ const committedPresentation = require__plugin_vue_export_helper.computed(() => commentsStore.committedReviewPresentations?.[String(props.currentDocument?.id)] ?? null);
15463
+ const committedInstances = require__plugin_vue_export_helper.computed(() => {
15464
+ const presentation = committedPresentation.value;
15465
+ if (!presentation) return null;
15466
+ const rows = new Map(commentsStore.commentsList.filter((row) => String(row.fileId) === String(props.currentDocument?.id)).map((row) => [String(row.commentId), row]));
15467
+ return presentation.instances.flatMap((instance) => {
15468
+ const comment = instance.rowId === "pending" ? pendingComment.value : rows.get(instance.rowId);
15469
+ return comment ? [{
15470
+ ...instance,
15471
+ comment,
15472
+ rowVersion: presentation.rowVersions[instance.rowId] ?? 0
15473
+ }] : [];
15474
+ });
15475
+ });
15382
15476
  const floatingCommentInstances = require__plugin_vue_export_helper.computed(() => {
15477
+ if (committedInstances.value) return committedInstances.value.filter((instance) => instance.rowId !== "pending");
15383
15478
  const currentFloatingCommentInstances = commentsStore.getFloatingCommentInstances;
15384
15479
  if (!Array.isArray(currentFloatingCommentInstances)) return [];
15385
15480
  const documentId = props.currentDocument?.id;
@@ -15497,7 +15592,7 @@ var _sfc_main$31 = {
15497
15592
  const shouldRenderDialog = (position) => {
15498
15593
  return shouldMountFloatingCommentDialog({
15499
15594
  id: position?.id,
15500
- visibleIds: visibleIds.value,
15595
+ visibleIds: committedPresentation.value ? new Set(allPositions.value.filter((item) => item.instanceRef?.mount).map((item) => item.id)) : visibleIds.value,
15501
15596
  activeCommentInstanceId: activeCommentInstanceId.value,
15502
15597
  comment: position?.commentRef
15503
15598
  });
@@ -15543,6 +15638,19 @@ var _sfc_main$31 = {
15543
15638
  });
15544
15639
  const allPositions = require__plugin_vue_export_helper.computed(() => {
15545
15640
  viewportRevision.value;
15641
+ if (committedInstances.value) return committedInstances.value.map((instance) => ({
15642
+ id: instance.id,
15643
+ threadId: instance.threadId,
15644
+ pageIndex: instance.pageIndex,
15645
+ anchorTop: instance.anchorTop,
15646
+ anchorBottom: instance.anchorBottom,
15647
+ top: instance.top,
15648
+ height: instance.height,
15649
+ hasAnchorGeometry: instance.positionEntry != null || instance.rowId === "pending",
15650
+ isOffscreenReviewCard: instance.isOffscreenReviewCard,
15651
+ commentRef: instance.comment,
15652
+ instanceRef: instance
15653
+ }));
15546
15654
  const positionedInstances = geometryBearingInstances.value;
15547
15655
  const hasPending = pendingComment.value && pendingComment.value.fileId === props.currentDocument.id;
15548
15656
  if (!positionedInstances.length && !floatingCommentInstances.value.length && !hasPending) return [];
@@ -15641,6 +15749,43 @@ var _sfc_main$31 = {
15641
15749
  resolveCollisions(collisionPositions, activeIndex, 15);
15642
15750
  return positions;
15643
15751
  });
15752
+ require__plugin_vue_export_helper.watch(() => {
15753
+ const presentation = committedPresentation.value, container = floatingCommentsContainer.value;
15754
+ if (!presentation || !container) return null;
15755
+ viewportRevision.value;
15756
+ const viewport = getFloatingViewportRange();
15757
+ if (!viewport) return null;
15758
+ const rail = container.getBoundingClientRect(), stage = props.parent?.getBoundingClientRect?.();
15759
+ const instances = committedInstances.value ?? [];
15760
+ return {
15761
+ activeThreadId: activeComment.value == null ? null : String(activeComment.value),
15762
+ activeInstanceId: activeCommentInstanceId.value == null ? null : String(activeCommentInstanceId.value),
15763
+ editingRowId: editingCommentId.value == null ? null : String(editingCommentId.value),
15764
+ retainedThreadIds: [],
15765
+ visibility: {
15766
+ comments: commentsStore.viewingVisibility?.documentMode !== "viewing" || commentsStore.viewingVisibility?.commentsVisible === true,
15767
+ trackedChanges: commentsStore.viewingVisibility?.documentMode !== "viewing" || commentsStore.viewingVisibility?.trackChangesVisible === true
15768
+ },
15769
+ viewport: {
15770
+ ...viewport,
15771
+ width: Math.max(1, rail.width),
15772
+ scale: 1,
15773
+ stageOffsetX: (stage?.left ?? rail.left) - rail.left,
15774
+ stageOffsetY: (stage?.top ?? rail.top) - rail.top
15775
+ },
15776
+ pending: pendingComment.value?.fileId === props.currentDocument.id && getPendingAnchorTop() != null ? {
15777
+ anchorTop: getPendingAnchorTop(),
15778
+ height: measuredHeights.value.pending || ESTIMATED_HEIGHT
15779
+ } : null,
15780
+ measurements: instances.filter((instance) => measuredHeights.value[instance.id] > 0).map((instance) => ({
15781
+ instanceId: instance.id,
15782
+ rowVersion: instance.rowVersion,
15783
+ height: measuredHeights.value[instance.id]
15784
+ }))
15785
+ };
15786
+ }, (input) => {
15787
+ if (input) committedPresentation.value?.updateContext(input);
15788
+ }, { immediate: true });
15644
15789
  const wrapperMinHeight = require__plugin_vue_export_helper.computed(() => {
15645
15790
  viewportRevision.value;
15646
15791
  return Math.max(0, props.parent?.clientHeight || 0, props.parent?.scrollHeight || 0);
@@ -16156,7 +16301,7 @@ var _sfc_main$31 = {
16156
16301
  }, [require__plugin_vue_export_helper.createElementVNode("div", {
16157
16302
  class: "sidebar-container",
16158
16303
  style: require__plugin_vue_export_helper.normalizeStyle({
16159
- transform: `translateY(${sidebarOffsetY.value}px)`,
16304
+ transform: `translateY(${committedPresentation.value ? 0 : sidebarOffsetY.value}px)`,
16160
16305
  transition: disableInstantLayoutTransitions.value ? "none" : void 0
16161
16306
  })
16162
16307
  }, [(require__plugin_vue_export_helper.openBlock(true), require__plugin_vue_export_helper.createElementBlock(require__plugin_vue_export_helper.Fragment, null, require__plugin_vue_export_helper.renderList(allPositions.value, (pos) => {
@@ -16199,7 +16344,7 @@ var _sfc_main$31 = {
16199
16344
  };
16200
16345
  }
16201
16346
  };
16202
- var FloatingComments_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$31, [["__scopeId", "data-v-15b59a51"]]);
16347
+ var FloatingComments_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$31, [["__scopeId", "data-v-f0b1fd79"]]);
16203
16348
  //#endregion
16204
16349
  //#region src/components/CommentsLayer/PdfCommentsLayer.vue
16205
16350
  var _hoisted_1$23 = {
@@ -22587,6 +22732,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
22587
22732
  documentId: ctx?.documentId,
22588
22733
  commentItems: result?.comments?.items,
22589
22734
  trackedChangeItems: result?.trackedChanges?.items,
22735
+ preparedReview: result?.preparedReview,
22590
22736
  requestedCommentIds: result?.comments?.requestedIds,
22591
22737
  requestedTrackedChangeIds: result?.trackedChanges?.requestedIds,
22592
22738
  unresolvedCommentIds: result?.comments?.unresolvedCommentIds,
@@ -23705,7 +23851,6 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
23705
23851
  const onFontsResolvedFn = proxy.$superdoc.listeners?.("fonts-resolved")?.length > 0 ? proxy.$superdoc.listeners("fonts-resolved")[0] : null;
23706
23852
  const useLayoutEngine = proxy.$superdoc.config.useLayoutEngine !== false;
23707
23853
  const isNewFile = doc.isNewFile;
23708
- const benchmarkExecutionMode = proxy.$superdoc.config?.benchmarkExecutionMode;
23709
23854
  const benchmarkTraceEnabled = proxy.$superdoc.config?.benchmarkTraceEnabled === true;
23710
23855
  const collaborationResolution = resolveDocumentV2Collaboration(doc);
23711
23856
  const v2Collaboration = collaborationResolution.state === "valid" ? collaborationResolution.config : null;
@@ -23722,7 +23867,6 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
23722
23867
  html: doc.html,
23723
23868
  markdown: doc.markdown,
23724
23869
  documentMode: proxy.$superdoc.config.documentMode,
23725
- ...benchmarkExecutionMode ? { benchmarkExecutionMode } : {},
23726
23870
  ...benchmarkTraceEnabled ? { benchmarkTraceEnabled: true } : {},
23727
23871
  allowSelectionInViewMode: proxy.$superdoc.config.allowSelectionInViewMode,
23728
23872
  rulers: doc.rulers,
@@ -24834,7 +24978,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
24834
24978
  ], 46, _hoisted_1$17);
24835
24979
  };
24836
24980
  }
24837
- }, [["__scopeId", "data-v-e8f59dd7"]]);
24981
+ }, [["__scopeId", "data-v-c57da6ae"]]);
24838
24982
  //#endregion
24839
24983
  //#region src/core/create-app.js
24840
24984
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -46424,6 +46568,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46424
46568
  return this.#surfacesConfig;
46425
46569
  }
46426
46570
  #surfaceManager;
46571
+ #sourceLifecycleReady;
46572
+ #pendingSourceLifecycle;
46427
46573
  /**
46428
46574
  * SuperDoc-owned editor runtime registry. This is the internal place to ask
46429
46575
  * which mounted editor runtime is active and which runtime owns a DOM event
@@ -46496,6 +46642,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46496
46642
  this.whiteboard = null;
46497
46643
  this.colors = [];
46498
46644
  this.readyEditors = 0;
46645
+ this.#sourceLifecycleReady = false;
46646
+ this.#pendingSourceLifecycle = [];
46499
46647
  this.#editorRuntimeRegistry = new EditorRuntimeRegistry();
46500
46648
  this.#editorRuntimeRegistryUnsub = null;
46501
46649
  this.#applyingRuntimeActiveChange = false;
@@ -46649,7 +46797,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46649
46797
  }
46650
46798
  this.userColorMap = /* @__PURE__ */ new Map();
46651
46799
  this.colorIndex = 0;
46652
- this.version = "2.25.0-next.3";
46800
+ this.version = "2.25.0-next.5";
46653
46801
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46654
46802
  this.superdocId = config.superdocId || require_uuid.v4();
46655
46803
  this.colors = this.config.colors ?? [];
@@ -46686,6 +46834,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46686
46834
  * Mount the Vue app, stores, and editor runtime.
46687
46835
  */
46688
46836
  #startRuntime() {
46837
+ this.#sourceLifecycleReady = false;
46838
+ this.#pendingSourceLifecycle = [];
46689
46839
  this.#initVueApp();
46690
46840
  this.readyEditors = 0;
46691
46841
  if (!this.app) throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");
@@ -47721,7 +47871,13 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
47721
47871
  * Triggered when the superdoc is ready
47722
47872
  */
47723
47873
  broadcastReady() {
47724
- if (this.readyEditors === this.requiredNumberOfEditors) this.emit("ready", { superdoc: this });
47874
+ if (this.#destroyed) return;
47875
+ if (this.readyEditors === this.requiredNumberOfEditors) {
47876
+ this.emit("ready", { superdoc: this });
47877
+ if (this.#destroyed) return;
47878
+ this.#sourceLifecycleReady = true;
47879
+ for (const type of this.#pendingSourceLifecycle.splice(0)) this.emit(type);
47880
+ }
47725
47881
  }
47726
47882
  /**
47727
47883
  * Triggered before an editor is created
@@ -47740,11 +47896,19 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
47740
47896
  this.#wireFontsChangedRelay(editor);
47741
47897
  this.emit("editorCreate", { editor: createDeprecatedEditorProxy(editor) });
47742
47898
  }
47899
+ #broadcastSourceLifecycle(type) {
47900
+ if (this.#destroyed) return;
47901
+ if (!this.#sourceLifecycleReady) {
47902
+ this.#pendingSourceLifecycle.push(type);
47903
+ return;
47904
+ }
47905
+ this.emit(type);
47906
+ }
47743
47907
  broadcastSourceComplete() {
47744
- this.emit("source:complete");
47908
+ this.#broadcastSourceLifecycle("source:complete");
47745
47909
  }
47746
47910
  broadcastSourceSignalsComplete() {
47747
- this.emit("source:signals-complete");
47911
+ this.#broadcastSourceLifecycle("source:signals-complete");
47748
47912
  }
47749
47913
  /** Editors whose `fonts-changed` we already relay, so a repeated create wires once. */
47750
47914
  #fontsRelayEditors;
@@ -49006,6 +49170,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
49006
49170
  destroy() {
49007
49171
  require_create_super_doc_ui.closeInteractionHistory(this);
49008
49172
  this.#destroyed = true;
49173
+ this.#pendingSourceLifecycle = [];
49009
49174
  this.#contentControlClickRoot?.removeEventListener("click", this.#handleContentControlClick, true);
49010
49175
  this.#contentControlClickRoot?.removeEventListener("pointerdown", this.#handleContentControlPointerDown, true);
49011
49176
  this.#contentControlClickRoot?.ownerDocument.removeEventListener("pointerup", this.#handleContentControlPointerEnd, true);
@@ -49243,3 +49408,5 @@ exports.compareVersions = compareVersions;
49243
49408
  exports.createTheme = createTheme;
49244
49409
  exports.defineSuperDocExtension = defineSuperDocExtension;
49245
49410
  exports.getFileObject = getFileObject;
49411
+ exports.listPermissionRangeEditors = listPermissionRangeEditors;
49412
+ exports.resolvePermissionRangeEditor = resolvePermissionRangeEditor;