@harbour-enterprises/superdoc 1.0.0-beta.32 → 1.0.0-beta.34

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 (28) hide show
  1. package/dist/chunks/{PdfViewer-CTKbqDWv.cjs → PdfViewer-CMVOK_jD.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-edjIRb_p.es.js → PdfViewer-DSx1zQC5.es.js} +1 -1
  3. package/dist/chunks/{index-Pwv0a9G5.es.js → index-8_ijaxSz.es.js} +57 -32
  4. package/dist/chunks/{index-Cajp7-Xa.cjs → index-BqXrnRP8.cjs} +57 -32
  5. package/dist/chunks/{index-SGV4U12y-Dh5jaROA.cjs → index-CQeXM6oB-BAx-uLYb.cjs} +1 -1
  6. package/dist/chunks/{index-SGV4U12y-BPGxOtvI.es.js → index-CQeXM6oB-DjCz53Th.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-BbbbKgEs.cjs → super-editor.es-CgTVSX1p.cjs} +433 -124
  8. package/dist/chunks/{super-editor.es-CdGsYGU1.es.js → super-editor.es-TkKngzld.es.js} +433 -124
  9. package/dist/style.css +33 -33
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-CpuOoAUa.js → converter-Hv-kNdxI.js} +1 -1
  12. package/dist/super-editor/chunks/{docx-zipper-Dk99r397.js → docx-zipper-C6nUdlsw.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-CFv-RJI-.js → editor-uvvccWc5.js} +487 -117
  14. package/dist/super-editor/chunks/{index-SGV4U12y.js → index-CQeXM6oB.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-CQr3Xnx9.js → toolbar-BCWRHtW5.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +10 -9
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +489 -155
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -18281,9 +18281,9 @@
18281
18281
  const areAttrsEqual = (attrsA = {}, attrsB = {}) => {
18282
18282
  return objectIncludes(attrsA, attrsB);
18283
18283
  };
18284
- const TrackInsertMarkName = "trackInsert";
18285
- const TrackDeleteMarkName = "trackDelete";
18286
- const TrackFormatMarkName = "trackFormat";
18284
+ const TrackInsertMarkName$1 = "trackInsert";
18285
+ const TrackDeleteMarkName$1 = "trackDelete";
18286
+ const TrackFormatMarkName$1 = "trackFormat";
18287
18287
  const generateV2HandlerEntity = (handlerName, translator2) => ({
18288
18288
  handlerName,
18289
18289
  handler: (params2) => {
@@ -20049,7 +20049,7 @@
20049
20049
  const runProperties = translator$1N.encode({ ...params2, nodes: [rPr] });
20050
20050
  submarks = encodeMarksFromRPr(runProperties, params2?.docx);
20051
20051
  }
20052
- return [{ type: TrackFormatMarkName, attrs: { ...mappedAttributes, before: submarks, after: [...currentMarks] } }];
20052
+ return [{ type: TrackFormatMarkName$1, attrs: { ...mappedAttributes, before: submarks, after: [...currentMarks] } }];
20053
20053
  }
20054
20054
  function handleStyleChangeMarks(rPr, currentMarks) {
20055
20055
  const styleChangeMark = rPr.elements?.find((el) => el.name === "w:rPrChange");
@@ -20064,7 +20064,7 @@
20064
20064
  authorEmail: attributes["w:authorEmail"]
20065
20065
  };
20066
20066
  const submarks = parseMarks(styleChangeMark);
20067
- return [{ type: TrackFormatMarkName, attrs: { ...mappedAttributes, before: submarks, after: [...currentMarks] } }];
20067
+ return [{ type: TrackFormatMarkName$1, attrs: { ...mappedAttributes, before: submarks, after: [...currentMarks] } }];
20068
20068
  }
20069
20069
  function createImportMarks(marks) {
20070
20070
  const textStyleMarksToCombine = marks.filter((mark2) => mark2.type === "textStyle");
@@ -20502,7 +20502,7 @@
20502
20502
  const prepareRunTrackingContext = (node2 = {}) => {
20503
20503
  const marks = Array.isArray(node2.marks) ? node2.marks : [];
20504
20504
  const trackingMarks = marks.filter(
20505
- (mark2) => mark2?.type === TrackInsertMarkName || mark2?.type === TrackDeleteMarkName
20505
+ (mark2) => mark2?.type === TrackInsertMarkName$1 || mark2?.type === TrackDeleteMarkName$1
20506
20506
  );
20507
20507
  if (!trackingMarks.length) {
20508
20508
  return { runNode: node2, trackingMarksByType: /* @__PURE__ */ new Map() };
@@ -20511,7 +20511,7 @@
20511
20511
  trackingMarks.forEach((mark2) => {
20512
20512
  if (mark2?.type) trackingMarksByType.set(mark2.type, cloneMark(mark2));
20513
20513
  });
20514
- const preservedMarks = marks.filter((mark2) => mark2?.type !== TrackInsertMarkName && mark2?.type !== TrackDeleteMarkName).map((mark2) => cloneMark(mark2));
20514
+ const preservedMarks = marks.filter((mark2) => mark2?.type !== TrackInsertMarkName$1 && mark2?.type !== TrackDeleteMarkName$1).map((mark2) => cloneMark(mark2));
20515
20515
  const clonedContent = Array.isArray(node2.content) ? node2.content.map((child) => {
20516
20516
  const childClone = cloneNode(child);
20517
20517
  const childMarks = Array.isArray(childClone.marks) ? childClone.marks.slice() : [];
@@ -20550,8 +20550,8 @@
20550
20550
  return runs2;
20551
20551
  }
20552
20552
  if (!trackingMarksByType.size) return runs2;
20553
- if (trackingMarksByType.has(TrackInsertMarkName)) {
20554
- const mark2 = trackingMarksByType.get(TrackInsertMarkName);
20553
+ if (trackingMarksByType.has(TrackInsertMarkName$1)) {
20554
+ const mark2 = trackingMarksByType.get(TrackInsertMarkName$1);
20555
20555
  const clonedRuns = cloneRuns(runs2);
20556
20556
  const wrapper = {
20557
20557
  name: "w:ins",
@@ -20568,8 +20568,8 @@
20568
20568
  };
20569
20569
  return [wrapper];
20570
20570
  }
20571
- if (trackingMarksByType.has(TrackDeleteMarkName)) {
20572
- const mark2 = trackingMarksByType.get(TrackDeleteMarkName);
20571
+ if (trackingMarksByType.has(TrackDeleteMarkName$1)) {
20572
+ const mark2 = trackingMarksByType.get(TrackDeleteMarkName$1);
20573
20573
  const clonedRuns = cloneRuns(runs2);
20574
20574
  clonedRuns.forEach(renameTextElementsForDeletion);
20575
20575
  const wrapper = {
@@ -41859,7 +41859,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41859
41859
  static getStoredSuperdocVersion(docx) {
41860
41860
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
41861
41861
  }
41862
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.32") {
41862
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.34") {
41863
41863
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
41864
41864
  }
41865
41865
  /**
@@ -53022,7 +53022,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53022
53022
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
53023
53023
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
53024
53024
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
53025
- var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
53025
+ var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
53026
53026
  var GOOD_LEAF_SIZE = 200;
53027
53027
  var RopeSequence = function RopeSequence2() {
53028
53028
  };
@@ -63874,13 +63874,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63874
63874
  return markFound;
63875
63875
  };
63876
63876
  const markInsertion = ({ tr, from: from2, to, user, date }) => {
63877
- tr.removeMark(from2, to, tr.doc.type.schema.marks[TrackDeleteMarkName]);
63878
- tr.removeMark(from2, to, tr.doc.type.schema.marks[TrackInsertMarkName]);
63877
+ tr.removeMark(from2, to, tr.doc.type.schema.marks[TrackDeleteMarkName$1]);
63878
+ tr.removeMark(from2, to, tr.doc.type.schema.marks[TrackInsertMarkName$1]);
63879
63879
  let trackedMark = findTrackedMarkBetween({
63880
63880
  tr,
63881
63881
  from: from2,
63882
63882
  to,
63883
- markName: TrackInsertMarkName,
63883
+ markName: TrackInsertMarkName$1,
63884
63884
  attrs: { authorEmail: user.email }
63885
63885
  });
63886
63886
  let id;
@@ -63889,7 +63889,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63889
63889
  } else {
63890
63890
  id = v4$1();
63891
63891
  }
63892
- const insertionMark = tr.doc.type.schema.marks[TrackInsertMarkName].create({
63892
+ const insertionMark = tr.doc.type.schema.marks[TrackInsertMarkName$1].create({
63893
63893
  id,
63894
63894
  author: user.name,
63895
63895
  authorEmail: user.email,
@@ -63915,7 +63915,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63915
63915
  tr,
63916
63916
  from: from2,
63917
63917
  to,
63918
- markName: TrackDeleteMarkName,
63918
+ markName: TrackDeleteMarkName$1,
63919
63919
  attrs: { authorEmail: user.email }
63920
63920
  });
63921
63921
  let id;
@@ -63926,7 +63926,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63926
63926
  } else {
63927
63927
  id = v4$1();
63928
63928
  }
63929
- const deletionMark = tr.doc.type.schema.marks[TrackDeleteMarkName].create({
63929
+ const deletionMark = tr.doc.type.schema.marks[TrackDeleteMarkName$1].create({
63930
63930
  id,
63931
63931
  author: user.name,
63932
63932
  authorEmail: user.email,
@@ -63939,7 +63939,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63939
63939
  if (node2.type.name.includes("table")) {
63940
63940
  return;
63941
63941
  }
63942
- if (node2.isInline && node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName && mark2.attrs.authorEmail === user.email)) {
63942
+ if (node2.isInline && node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName$1 && mark2.attrs.authorEmail === user.email)) {
63943
63943
  const removeStep = new ReplaceStep(
63944
63944
  deletionMap.map(Math.max(from2, pos)),
63945
63945
  deletionMap.map(Math.min(to, pos + node2.nodeSize)),
@@ -63948,14 +63948,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63948
63948
  if (!tr.maybeStep(removeStep).failed) {
63949
63949
  deletionMap.appendMap(removeStep.getMap());
63950
63950
  }
63951
- } else if (node2.isInline && !node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName)) {
63951
+ } else if (node2.isInline && !node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName$1)) {
63952
63952
  nodes.push(node2);
63953
63953
  tr.addMark(
63954
63954
  deletionMap.map(Math.max(from2, pos)),
63955
63955
  deletionMap.map(Math.min(to, pos + node2.nodeSize)),
63956
63956
  deletionMark
63957
63957
  );
63958
- } else if (node2.attrs.track && !node2.attrs.track.find((trackAttr) => trackAttr.type === TrackDeleteMarkName) && !["bulletList", "orderedList"].includes(node2.type.name)) ;
63958
+ } else if (node2.attrs.track && !node2.attrs.track.find((trackAttr) => trackAttr.type === TrackDeleteMarkName$1) && !["bulletList", "orderedList"].includes(node2.type.name)) ;
63959
63959
  });
63960
63960
  return { deletionMark, deletionMap, nodes };
63961
63961
  };
@@ -64022,7 +64022,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64022
64022
  }
64023
64023
  allInlineNodes.forEach(({ node: node2, pos }) => {
64024
64024
  const { marks } = node2;
64025
- const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName];
64025
+ const trackedMarks = [TrackInsertMarkName$1, TrackDeleteMarkName$1, TrackFormatMarkName$1];
64026
64026
  if (marks.length > 0) {
64027
64027
  marks.forEach((mark2) => {
64028
64028
  if (trackedMarks.includes(mark2.type.name)) {
@@ -64135,7 +64135,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64135
64135
  return DecorationSet.empty;
64136
64136
  }
64137
64137
  trackedChanges.forEach(({ mark: mark2, from: from2, to }) => {
64138
- if (mark2.type.name === TrackInsertMarkName) {
64138
+ if (mark2.type.name === TrackInsertMarkName$1) {
64139
64139
  if (onlyOriginalShown) {
64140
64140
  const decoration = Decoration.inline(from2, to, {
64141
64141
  class: "track-insert-dec hidden"
@@ -64153,7 +64153,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64153
64153
  decorations.push(decoration);
64154
64154
  }
64155
64155
  }
64156
- if (mark2.type.name === TrackDeleteMarkName) {
64156
+ if (mark2.type.name === TrackDeleteMarkName$1) {
64157
64157
  if (onlyOriginalShown) {
64158
64158
  const decoration = Decoration.inline(from2, to, {
64159
64159
  class: "track-delete-dec normal"
@@ -64185,7 +64185,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64185
64185
  decorations.push(decorationWidget);
64186
64186
  }
64187
64187
  }
64188
- if (mark2.type.name === TrackFormatMarkName) {
64188
+ if (mark2.type.name === TrackFormatMarkName$1) {
64189
64189
  if (onlyOriginalShown) {
64190
64190
  const decoration = Decoration.inline(from2, to, {
64191
64191
  class: "track-format-dec before"
@@ -64206,7 +64206,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64206
64206
  });
64207
64207
  return DecorationSet.create(state2.doc, decorations);
64208
64208
  };
64209
- const CommentMarkName = "commentMark";
64209
+ const CommentMarkName$1 = "commentMark";
64210
64210
  const resolveCommentMeta = ({ converter, importedId }) => {
64211
64211
  const comments = converter?.comments || [];
64212
64212
  const matchingImportedComment = comments.find((c2) => c2.importedId == importedId);
@@ -64237,7 +64237,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64237
64237
  const removeCommentsById = ({ commentId, state: state2, tr, dispatch }) => {
64238
64238
  const positions = getCommentPositionsById(commentId, state2.doc);
64239
64239
  positions.forEach(({ from: from2, to }) => {
64240
- tr.removeMark(from2, to, state2.schema.marks[CommentMarkName]);
64240
+ tr.removeMark(from2, to, state2.schema.marks[CommentMarkName$1]);
64241
64241
  });
64242
64242
  dispatch(tr);
64243
64243
  };
@@ -64245,7 +64245,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64245
64245
  const positions = [];
64246
64246
  doc2.descendants((node2, pos) => {
64247
64247
  const { marks } = node2;
64248
- const commentMark = marks.find((mark2) => mark2.type.name === CommentMarkName);
64248
+ const commentMark = marks.find((mark2) => mark2.type.name === CommentMarkName$1);
64249
64249
  if (commentMark) {
64250
64250
  const { attrs } = commentMark;
64251
64251
  const { commentId: currentCommentId } = attrs;
@@ -64265,7 +64265,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64265
64265
  const endNodes = [];
64266
64266
  const seen = /* @__PURE__ */ new Set();
64267
64267
  doc2.descendants((node2, pos) => {
64268
- const commentMarks = node2.marks?.filter((mark2) => mark2.type.name === CommentMarkName) || [];
64268
+ const commentMarks = node2.marks?.filter((mark2) => mark2.type.name === CommentMarkName$1) || [];
64269
64269
  commentMarks.forEach((commentMark) => {
64270
64270
  const { attrs = {} } = commentMark;
64271
64271
  const { commentId } = attrs;
@@ -64393,7 +64393,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64393
64393
  importedId,
64394
64394
  internal: itemToMark.internal
64395
64395
  };
64396
- tr.addMark(start2, pos + 1, schema.marks[CommentMarkName].create(markAttrs));
64396
+ tr.addMark(start2, pos + 1, schema.marks[CommentMarkName$1].create(markAttrs));
64397
64397
  toDelete.push({ start: pos, end: pos + 1 });
64398
64398
  } else if (type2.name === "commentReference") {
64399
64399
  toDelete.push({ start: pos, end: pos + 1 });
@@ -64511,7 +64511,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64511
64511
  existing.bounds.bottom = Math.max(existing.bounds.bottom, currentBounds.bottom);
64512
64512
  }
64513
64513
  };
64514
- const TRACK_CHANGE_MARKS = [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName];
64514
+ const TRACK_CHANGE_MARKS = [TrackInsertMarkName$1, TrackDeleteMarkName$1, TrackFormatMarkName$1];
64515
64515
  const CommentsPluginKey = new PluginKey("comments");
64516
64516
  const CommentsPlugin = Extension.create({
64517
64517
  name: "comments",
@@ -64527,7 +64527,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64527
64527
  tr.addMark(
64528
64528
  $from.pos,
64529
64529
  $to.pos,
64530
- this.editor.schema.marks[CommentMarkName].create({
64530
+ this.editor.schema.marks[CommentMarkName$1].create({
64531
64531
  commentId: resolvedCommentId,
64532
64532
  internal: resolvedInternal
64533
64533
  })
@@ -64567,7 +64567,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64567
64567
  doc2.descendants((node2, pos) => {
64568
64568
  if (foundStartNode) return;
64569
64569
  const { marks = [] } = node2;
64570
- const commentMark = marks.find((mark2) => mark2.type.name === CommentMarkName);
64570
+ const commentMark = marks.find((mark2) => mark2.type.name === CommentMarkName$1);
64571
64571
  if (commentMark) {
64572
64572
  const { attrs } = commentMark;
64573
64573
  const wid = attrs.commentId;
@@ -64581,7 +64581,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64581
64581
  tr.addMark(
64582
64582
  foundPos,
64583
64583
  foundPos + foundStartNode.nodeSize,
64584
- this.editor.schema.marks[CommentMarkName].create({
64584
+ this.editor.schema.marks[CommentMarkName$1].create({
64585
64585
  commentId,
64586
64586
  internal: isInternal
64587
64587
  })
@@ -64710,10 +64710,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64710
64710
  prevDoc = doc2;
64711
64711
  shouldUpdate = false;
64712
64712
  const decorations = [];
64713
- const allCommentPositions = onlyActiveThreadChanged ? prevAllCommentPositions : {};
64713
+ const allCommentPositions = {};
64714
64714
  doc2.descendants((node2, pos) => {
64715
64715
  const { marks = [] } = node2;
64716
- const commentMarks = marks.filter((mark2) => mark2.type.name === CommentMarkName);
64716
+ const commentMarks = marks.filter((mark2) => mark2.type.name === CommentMarkName$1);
64717
64717
  let hasActive = false;
64718
64718
  commentMarks.forEach((commentMark) => {
64719
64719
  const { attrs } = commentMark;
@@ -64839,7 +64839,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64839
64839
  return;
64840
64840
  }
64841
64841
  const { marks = [] } = node2;
64842
- const commentMark = marks.find((mark2) => mark2.type.name === CommentMarkName);
64842
+ const commentMark = marks.find((mark2) => mark2.type.name === CommentMarkName$1);
64843
64843
  if (commentMark) {
64844
64844
  overlaps.push({
64845
64845
  node: node2,
@@ -64862,7 +64862,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64862
64862
  }
64863
64863
  });
64864
64864
  const { marks: closestMarks = [] } = closestCommentRangeStart || {};
64865
- const closestCommentMark = closestMarks.find((mark2) => mark2.type.name === CommentMarkName);
64865
+ const closestCommentMark = closestMarks.find((mark2) => mark2.type.name === CommentMarkName$1);
64866
64866
  return closestCommentMark?.attrs?.commentId || closestCommentMark?.attrs?.importedId;
64867
64867
  };
64868
64868
  const findTrackedMark = ({
@@ -64912,7 +64912,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64912
64912
  let nodes = step?.slice?.content?.content || [];
64913
64913
  if (!nodes.length) {
64914
64914
  newEditorState.doc.descendants((node2) => {
64915
- const hasFormatMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName);
64915
+ const hasFormatMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName$1);
64916
64916
  if (hasFormatMark) {
64917
64917
  nodes = [node2];
64918
64918
  return false;
@@ -64937,19 +64937,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64937
64937
  const getTrackedChangeText = ({ nodes, mark: mark2, trackedChangeType, isDeletionInsertion }) => {
64938
64938
  let trackedChangeText = "";
64939
64939
  let deletionText = "";
64940
- if (trackedChangeType === TrackInsertMarkName) {
64940
+ if (trackedChangeType === TrackInsertMarkName$1) {
64941
64941
  trackedChangeText = nodes.reduce((acc, node2) => {
64942
64942
  if (!node2.marks.find((nodeMark) => nodeMark.type.name === mark2.type.name)) return acc;
64943
64943
  acc += node2?.text || node2?.textContent || "";
64944
64944
  return acc;
64945
64945
  }, "");
64946
64946
  }
64947
- if (trackedChangeType === TrackFormatMarkName) {
64947
+ if (trackedChangeType === TrackFormatMarkName$1) {
64948
64948
  trackedChangeText = translateFormatChangesToEnglish(mark2.attrs);
64949
64949
  }
64950
- if (trackedChangeType === TrackDeleteMarkName || isDeletionInsertion) {
64950
+ if (trackedChangeType === TrackDeleteMarkName$1 || isDeletionInsertion) {
64951
64951
  deletionText = nodes.reduce((acc, node2) => {
64952
- if (!node2.marks.find((nodeMark) => nodeMark.type.name === TrackDeleteMarkName)) return acc;
64952
+ if (!node2.marks.find((nodeMark) => nodeMark.type.name === TrackDeleteMarkName$1)) return acc;
64953
64953
  acc += node2?.text || node2?.textContent || "";
64954
64954
  return acc;
64955
64955
  }, "");
@@ -65015,7 +65015,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65015
65015
  if (to === null || pos + node2.nodeSize > to) to = pos + node2.nodeSize;
65016
65016
  }
65017
65017
  const commentMark = node2.marks.find(
65018
- (m2) => m2.type.name === CommentMarkName && (m2.attrs.commentId === id || m2.attrs.importedId === id)
65018
+ (m2) => m2.type.name === CommentMarkName$1 && (m2.attrs.commentId === id || m2.attrs.importedId === id)
65019
65019
  );
65020
65020
  if (commentMark) {
65021
65021
  if (from2 === null || pos < from2) from2 = pos;
@@ -65025,7 +65025,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65025
65025
  return from2 !== null && to !== null ? { from: from2, to } : null;
65026
65026
  }
65027
65027
  const replaceStep = ({ state: state2, tr, step, newTr, map: map2, user, date, originalStep, originalStepIndex }) => {
65028
- const deletionMarkSchema = state2.schema.marks[TrackDeleteMarkName];
65028
+ const deletionMarkSchema = state2.schema.marks[TrackDeleteMarkName$1];
65029
65029
  const deletionMark = findMark(state2, deletionMarkSchema, false);
65030
65030
  const positionTo = deletionMark ? deletionMark.to : step.to;
65031
65031
  const newStep = new ReplaceStep(
@@ -65089,17 +65089,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65089
65089
  if (!node2.isInline) {
65090
65090
  return;
65091
65091
  }
65092
- if (node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName)) {
65092
+ if (node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName$1)) {
65093
65093
  return false;
65094
65094
  }
65095
65095
  const existingChangeMark = node2.marks.find(
65096
- (mark2) => [TrackDeleteMarkName, TrackFormatMarkName].includes(mark2.type.name)
65096
+ (mark2) => [TrackDeleteMarkName$1, TrackFormatMarkName$1].includes(mark2.type.name)
65097
65097
  );
65098
65098
  const wid = existingChangeMark ? existingChangeMark.attrs.id : v4$1();
65099
65099
  newTr.addMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), step.mark);
65100
65100
  const allowedMarks = ["bold", "italic", "strike", "underline", "textStyle"];
65101
65101
  if (allowedMarks.includes(step.mark.type.name) && !node2.marks.find((mark2) => mark2.type === step.mark.type)) {
65102
- const formatChangeMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName);
65102
+ const formatChangeMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName$1);
65103
65103
  let after = [];
65104
65104
  let before = [];
65105
65105
  if (formatChangeMark) {
@@ -65135,7 +65135,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65135
65135
  ];
65136
65136
  }
65137
65137
  if (after.length || before.length) {
65138
- const newFormatMark = state2.schema.marks[TrackFormatMarkName].create({
65138
+ const newFormatMark = state2.schema.marks[TrackFormatMarkName$1].create({
65139
65139
  id: wid,
65140
65140
  author: user.name,
65141
65141
  authorEmail: user.email,
@@ -65167,13 +65167,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65167
65167
  if (!node2.isInline) {
65168
65168
  return true;
65169
65169
  }
65170
- if (node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName)) {
65170
+ if (node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName$1)) {
65171
65171
  return false;
65172
65172
  }
65173
65173
  newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), step.mark);
65174
65174
  const allowedMarks = ["bold", "italic", "strike", "underline", "textStyle"];
65175
65175
  if (allowedMarks.includes(step.mark.type.name) && node2.marks.find((mark2) => mark2.type === step.mark.type)) {
65176
- const formatChangeMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName);
65176
+ const formatChangeMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName$1);
65177
65177
  let after = [];
65178
65178
  let before = [];
65179
65179
  if (formatChangeMark) {
@@ -65201,7 +65201,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65201
65201
  ];
65202
65202
  }
65203
65203
  if (after.length || before.length) {
65204
- const newFormatMark = state2.schema.marks[TrackFormatMarkName].create({
65204
+ const newFormatMark = state2.schema.marks[TrackFormatMarkName$1].create({
65205
65205
  id: v4$1(),
65206
65206
  author: user.name,
65207
65207
  authorEmail: user.email,
@@ -65282,7 +65282,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65282
65282
  newTr.setMeta("addToHistory", tr.getMeta("addToHistory"));
65283
65283
  }
65284
65284
  if (tr.selectionSet) {
65285
- const deletionMarkSchema = state2.schema.marks[TrackDeleteMarkName];
65285
+ const deletionMarkSchema = state2.schema.marks[TrackDeleteMarkName$1];
65286
65286
  const deletionMark = findMark(state2, deletionMarkSchema, false);
65287
65287
  if (tr.selection instanceof TextSelection$1 && (tr.selection.from < state2.selection.from || tr.getMeta("inputType") === "deleteContentBackward")) {
65288
65288
  const caretPos = map2.map(tr.selection.from, -1);
@@ -66889,7 +66889,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66889
66889
  const shouldSkipNodeView = (editor) => {
66890
66890
  return isHeadless(editor);
66891
66891
  };
66892
- const summaryVersion = "1.0.0-beta.32";
66892
+ const summaryVersion = "1.0.0-beta.34";
66893
66893
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
66894
66894
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
66895
66895
  function mapAttributes(attrs) {
@@ -67678,7 +67678,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67678
67678
  { default: remarkStringify2 },
67679
67679
  { default: remarkGfm2 }
67680
67680
  ] = await Promise.all([
67681
- Promise.resolve().then(() => indexSGV4U12y),
67681
+ Promise.resolve().then(() => indexCQeXM6oB),
67682
67682
  Promise.resolve().then(() => indexDRCvimau),
67683
67683
  Promise.resolve().then(() => indexC_x_N6Uh),
67684
67684
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -67883,7 +67883,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67883
67883
  * Process collaboration migrations
67884
67884
  */
67885
67885
  processCollaborationMigrations() {
67886
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.32");
67886
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.34");
67887
67887
  if (!this.options.ydoc) return;
67888
67888
  const metaMap = this.options.ydoc.getMap("meta");
67889
67889
  let docVersion = metaMap.get("version");
@@ -80680,7 +80680,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
80680
80680
  });
80681
80681
  for (const fragment of fragments) {
80682
80682
  if (fragment.kind !== "para") continue;
80683
- const blockIndex = blocks2.findIndex((block2) => block2.id === fragment.blockId);
80683
+ const blockIndex = findBlockIndexByFragmentId(blocks2, fragment.blockId);
80684
80684
  if (blockIndex === -1) continue;
80685
80685
  const block = blocks2[blockIndex];
80686
80686
  const measure = measures[blockIndex];
@@ -80707,7 +80707,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
80707
80707
  const withinX = point2.x >= fragment.x && point2.x <= fragment.x + fragment.width;
80708
80708
  const withinY = point2.y >= fragment.y && point2.y <= fragment.y + fragment.height;
80709
80709
  if (!withinX || !withinY) continue;
80710
- const blockIndex = blocks2.findIndex((block2) => block2.id === fragment.blockId);
80710
+ const blockIndex = findBlockIndexByFragmentId(blocks2, fragment.blockId);
80711
80711
  if (blockIndex === -1) continue;
80712
80712
  const block = blocks2[blockIndex];
80713
80713
  const measure = measures[blockIndex];
@@ -80846,7 +80846,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
80846
80846
  blockId = fragment.blockId;
80847
80847
  pageIndex = pi;
80848
80848
  column = determineColumn(layout, fragment.x);
80849
- const blockIndex = blocks2.findIndex((b2) => b2.id === fragment.blockId);
80849
+ const blockIndex = findBlockIndexByFragmentId(blocks2, fragment.blockId);
80850
80850
  if (blockIndex !== -1) {
80851
80851
  const measure = measures[blockIndex];
80852
80852
  if (measure && measure.kind === "paragraph") {
@@ -80996,6 +80996,44 @@ Please report this to https://github.com/markedjs/marked.`, e) {
80996
80996
  });
80997
80997
  return null;
80998
80998
  }
80999
+ function findBlockIndexByFragmentId(blocks2, fragmentBlockId, targetPmRange) {
81000
+ const index2 = blocks2.findIndex(
81001
+ (block) => block.id === fragmentBlockId && block.kind !== "pageBreak" && block.kind !== "sectionBreak"
81002
+ );
81003
+ if (index2 !== -1) {
81004
+ return index2;
81005
+ }
81006
+ const baseBlockId = fragmentBlockId.replace(/-\d+$/, "");
81007
+ if (baseBlockId === fragmentBlockId) {
81008
+ return -1;
81009
+ }
81010
+ const matchingIndices = [];
81011
+ blocks2.forEach((block, idx) => {
81012
+ if (block.id === baseBlockId && block.kind === "paragraph") {
81013
+ matchingIndices.push(idx);
81014
+ }
81015
+ });
81016
+ if (matchingIndices.length === 0) {
81017
+ return -1;
81018
+ }
81019
+ if (matchingIndices.length === 1) {
81020
+ return matchingIndices[0];
81021
+ }
81022
+ if (targetPmRange) {
81023
+ for (const idx of matchingIndices) {
81024
+ const block = blocks2[idx];
81025
+ if (block.kind !== "paragraph") continue;
81026
+ const hasOverlap = block.runs.some((run2) => {
81027
+ if (run2.pmStart == null || run2.pmEnd == null) return false;
81028
+ return run2.pmEnd > targetPmRange.from && run2.pmStart < targetPmRange.to;
81029
+ });
81030
+ if (hasOverlap) {
81031
+ return idx;
81032
+ }
81033
+ }
81034
+ }
81035
+ return matchingIndices[0];
81036
+ }
80999
81037
  function selectionToRects(layout, blocks2, measures, from2, to) {
81000
81038
  if (from2 === to) {
81001
81039
  return [];
@@ -81004,8 +81042,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81004
81042
  layout.pages.forEach((page, pageIndex) => {
81005
81043
  page.fragments.forEach((fragment) => {
81006
81044
  if (fragment.kind === "para") {
81007
- const blockIndex = blocks2.findIndex((block2) => block2.id === fragment.blockId);
81008
- if (blockIndex === -1) return;
81045
+ const blockIndex = findBlockIndexByFragmentId(blocks2, fragment.blockId, { from: from2, to });
81046
+ if (blockIndex === -1) {
81047
+ return;
81048
+ }
81009
81049
  const block = blocks2[blockIndex];
81010
81050
  const measure = measures[blockIndex];
81011
81051
  if (!block || block.kind !== "paragraph" || measure?.kind !== "paragraph") {
@@ -81041,7 +81081,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81041
81081
  return;
81042
81082
  }
81043
81083
  if (isAtomicFragment(fragment)) {
81044
- const blockIndex = blocks2.findIndex((block2) => block2.id === fragment.blockId);
81084
+ const blockIndex = findBlockIndexByFragmentId(blocks2, fragment.blockId, { from: from2, to });
81045
81085
  if (blockIndex === -1) return;
81046
81086
  const block = blocks2[blockIndex];
81047
81087
  const pmRange = getAtomicPmRange(fragment, block);
@@ -81062,7 +81102,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81062
81102
  for (let pageIndex = 0; pageIndex < layout.pages.length; pageIndex += 1) {
81063
81103
  const page = layout.pages[pageIndex];
81064
81104
  for (const fragment of page.fragments) {
81065
- const blockIndex = blocks2.findIndex((block2) => block2.id === fragment.blockId);
81105
+ const blockIndex = findBlockIndexByFragmentId(blocks2, fragment.blockId);
81066
81106
  if (blockIndex === -1) {
81067
81107
  continue;
81068
81108
  }
@@ -90540,6 +90580,10 @@ ${l}
90540
90580
  }
90541
90581
  return false;
90542
90582
  }
90583
+ const CommentMarkName = "commentMark";
90584
+ const TrackInsertMarkName = "trackInsert";
90585
+ const TrackDeleteMarkName = "trackDelete";
90586
+ const TrackFormatMarkName = "trackFormat";
90543
90587
  function isValidFieldAnnotationAttributes(attrs) {
90544
90588
  if (!attrs || typeof attrs !== "object") return false;
90545
90589
  const a2 = attrs;
@@ -90552,7 +90596,7 @@ ${l}
90552
90596
  const MULTI_CLICK_TIME_THRESHOLD_MS = 400;
90553
90597
  const MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5;
90554
90598
  const HEADER_FOOTER_INIT_BUDGET_MS = 200;
90555
- const SCROLL_DEBOUNCE_MS = 100;
90599
+ const SCROLL_DEBOUNCE_MS = 32;
90556
90600
  const MAX_ZOOM_WARNING_THRESHOLD = 10;
90557
90601
  const MAX_SELECTION_RECTS_PER_USER = 100;
90558
90602
  const DEFAULT_STALE_TIMEOUT_MS = 5 * 60 * 1e3;
@@ -90569,7 +90613,7 @@ ${l}
90569
90613
  __privateAdd$1(this, _selectionOverlay2);
90570
90614
  __privateAdd$1(this, _hiddenHost);
90571
90615
  __privateAdd$1(this, _layoutOptions);
90572
- __privateAdd$1(this, _layoutState, { blocks: [], measures: [], layout: null });
90616
+ __privateAdd$1(this, _layoutState, { blocks: [], measures: [], layout: null, bookmarks: /* @__PURE__ */ new Map() });
90573
90617
  __privateAdd$1(this, _domPainter, null);
90574
90618
  __privateAdd$1(this, _dragHandlerCleanup, null);
90575
90619
  __privateAdd$1(this, _layoutError, null);
@@ -90619,18 +90663,31 @@ ${l}
90619
90663
  __privateAdd$1(this, _isDragging, false);
90620
90664
  __privateAdd$1(this, _dragExtensionMode, "char");
90621
90665
  __privateAdd$1(this, _remoteCursorState, /* @__PURE__ */ new Map());
90666
+ __privateAdd$1(this, _remoteCursorElements, /* @__PURE__ */ new Map());
90622
90667
  __privateAdd$1(this, _remoteCursorDirty, false);
90623
90668
  __privateAdd$1(this, _remoteCursorOverlay, null);
90624
90669
  __privateAdd$1(this, _localSelectionLayer, null);
90625
90670
  __privateAdd$1(this, _awarenessCleanup, null);
90626
90671
  __privateAdd$1(this, _scrollCleanup, null);
90627
- __privateAdd$1(this, _remoteCursorRafHandle, null);
90628
90672
  __privateAdd$1(this, _scrollTimeout);
90673
+ __privateAdd$1(this, _lastRemoteCursorRenderTime, 0);
90674
+ __privateAdd$1(this, _remoteCursorThrottleTimeout, null);
90629
90675
  __privateAdd$1(this, _handlePointerDown, (event) => {
90630
90676
  if (event.button !== 0) {
90631
90677
  return;
90632
90678
  }
90633
90679
  const target = event.target;
90680
+ const linkEl = target?.closest?.("a.superdoc-link");
90681
+ if (linkEl) {
90682
+ const href = linkEl.getAttribute("href") ?? "";
90683
+ const isAnchorLink = href.startsWith("#") && href.length > 1;
90684
+ if (isAnchorLink) {
90685
+ event.preventDefault();
90686
+ event.stopPropagation();
90687
+ this.goToAnchor(href);
90688
+ return;
90689
+ }
90690
+ }
90634
90691
  const isDraggableAnnotation = target?.closest?.('[data-draggable="true"]') != null;
90635
90692
  if (!__privateGet$1(this, _layoutState).layout) {
90636
90693
  if (!isDraggableAnnotation) {
@@ -91890,12 +91947,11 @@ ${l}
91890
91947
  __privateSet(this, _rafHandle, null);
91891
91948
  }, "Layout RAF");
91892
91949
  }
91893
- if (__privateGet$1(this, _remoteCursorRafHandle) !== null) {
91950
+ if (__privateGet$1(this, _remoteCursorThrottleTimeout) !== null) {
91894
91951
  __privateMethod$1(this, _PresentationEditor_instances, safeCleanup_fn).call(this, () => {
91895
- const win = __privateGet$1(this, _visibleHost)?.ownerDocument?.defaultView ?? window;
91896
- win.cancelAnimationFrame(__privateGet$1(this, _remoteCursorRafHandle));
91897
- __privateSet(this, _remoteCursorRafHandle, null);
91898
- }, "Remote cursor RAF");
91952
+ clearTimeout(__privateGet$1(this, _remoteCursorThrottleTimeout));
91953
+ __privateSet(this, _remoteCursorThrottleTimeout, null);
91954
+ }, "Remote cursor throttle");
91899
91955
  }
91900
91956
  __privateGet$1(this, _editorListeners).forEach(({ event, handler: handler2 }) => __privateGet$1(this, _editor3)?.off(event, handler2));
91901
91957
  __privateSet(this, _editorListeners, []);
@@ -91919,6 +91975,7 @@ ${l}
91919
91975
  __privateSet(this, _scrollCleanup, null);
91920
91976
  }
91921
91977
  __privateGet$1(this, _remoteCursorState).clear();
91978
+ __privateGet$1(this, _remoteCursorElements).clear();
91922
91979
  __privateSet(this, _remoteCursorOverlay, null);
91923
91980
  if (__privateGet$1(this, _options)?.documentId) {
91924
91981
  __privateGet$1(_PresentationEditor2, _instances).delete(__privateGet$1(this, _options).documentId);
@@ -91961,6 +92018,94 @@ ${l}
91961
92018
  __privateGet$1(this, _editor3).destroy();
91962
92019
  }
91963
92020
  }
92021
+ /**
92022
+ * Navigate to a bookmark/anchor in the current document (e.g., TOC links).
92023
+ *
92024
+ * This method performs asynchronous navigation to support virtualized page rendering:
92025
+ * 1. Normalizes the anchor by removing leading '#' if present
92026
+ * 2. Looks up the bookmark in the document's bookmark registry
92027
+ * 3. Determines which page contains the target position
92028
+ * 4. Scrolls the page into view (may be virtualized)
92029
+ * 5. Waits up to 2000ms for the page to mount in the DOM
92030
+ * 6. Moves the editor caret to the bookmark position
92031
+ *
92032
+ * @param anchor - Bookmark name or fragment identifier (with or without leading '#')
92033
+ * @returns Promise resolving to true if navigation succeeded, false otherwise
92034
+ *
92035
+ * @remarks
92036
+ * Navigation fails and returns false if:
92037
+ * - The anchor parameter is empty or becomes empty after normalization
92038
+ * - No layout has been computed yet
92039
+ * - The bookmark does not exist in the document
92040
+ * - The bookmark's page cannot be determined
92041
+ * - The page fails to mount within the timeout period (2000ms)
92042
+ *
92043
+ * Note: This method does not throw errors. All failures are logged and result in
92044
+ * a false return value. An 'error' event is emitted for unhandled exceptions.
92045
+ *
92046
+ * @throws Never throws directly - errors are caught, logged, and emitted as events
92047
+ */
92048
+ async goToAnchor(anchor) {
92049
+ try {
92050
+ if (!anchor) return false;
92051
+ const layout = __privateGet$1(this, _layoutState).layout;
92052
+ if (!layout) return false;
92053
+ const normalized = anchor.startsWith("#") ? anchor.slice(1) : anchor;
92054
+ if (!normalized) return false;
92055
+ const pmPos = __privateGet$1(this, _layoutState).bookmarks.get(normalized);
92056
+ if (pmPos == null) return false;
92057
+ const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, pmPos, pmPos + 1) ?? [];
92058
+ const rect = rects[0];
92059
+ let pageIndex = rect?.pageIndex ?? null;
92060
+ if (pageIndex == null) {
92061
+ let nextFragmentPage = null;
92062
+ let nextFragmentStart = null;
92063
+ for (const page of layout.pages) {
92064
+ for (const fragment of page.fragments) {
92065
+ if (fragment.kind !== "para") continue;
92066
+ const fragStart = fragment.pmStart;
92067
+ const fragEnd = fragment.pmEnd;
92068
+ if (fragStart == null || fragEnd == null) continue;
92069
+ if (pmPos >= fragStart && pmPos < fragEnd) {
92070
+ pageIndex = page.number - 1;
92071
+ break;
92072
+ }
92073
+ if (fragStart > pmPos && (nextFragmentStart === null || fragStart < nextFragmentStart)) {
92074
+ nextFragmentPage = page.number - 1;
92075
+ nextFragmentStart = fragStart;
92076
+ }
92077
+ }
92078
+ if (pageIndex != null) break;
92079
+ }
92080
+ if (pageIndex == null && nextFragmentPage != null) {
92081
+ pageIndex = nextFragmentPage;
92082
+ }
92083
+ }
92084
+ if (pageIndex == null) return false;
92085
+ __privateMethod$1(this, _PresentationEditor_instances, scrollPageIntoView_fn).call(this, pageIndex);
92086
+ await __privateMethod$1(this, _PresentationEditor_instances, waitForPageMount_fn).call(this, pageIndex, { timeout: _PresentationEditor2.ANCHOR_NAV_TIMEOUT_MS });
92087
+ const pageEl = __privateGet$1(this, _painterHost)?.querySelector(`[data-page-index="${pageIndex}"]`);
92088
+ if (pageEl) {
92089
+ pageEl.scrollIntoView({ behavior: "instant", block: "start" });
92090
+ }
92091
+ const activeEditor = this.getActiveEditor();
92092
+ if (activeEditor?.commands?.setTextSelection) {
92093
+ activeEditor.commands.setTextSelection({ from: pmPos, to: pmPos });
92094
+ } else {
92095
+ console.warn(
92096
+ "[PresentationEditor] goToAnchor: Navigation succeeded but could not move caret (editor commands unavailable)"
92097
+ );
92098
+ }
92099
+ return true;
92100
+ } catch (error) {
92101
+ console.error("[PresentationEditor] goToAnchor failed:", error);
92102
+ this.emit("error", {
92103
+ error,
92104
+ context: "goToAnchor"
92105
+ });
92106
+ return false;
92107
+ }
92108
+ }
91964
92109
  };
91965
92110
  _instances = /* @__PURE__ */ new WeakMap();
91966
92111
  _options = /* @__PURE__ */ new WeakMap();
@@ -92021,14 +92166,43 @@ ${l}
92021
92166
  _isDragging = /* @__PURE__ */ new WeakMap();
92022
92167
  _dragExtensionMode = /* @__PURE__ */ new WeakMap();
92023
92168
  _remoteCursorState = /* @__PURE__ */ new WeakMap();
92169
+ _remoteCursorElements = /* @__PURE__ */ new WeakMap();
92024
92170
  _remoteCursorDirty = /* @__PURE__ */ new WeakMap();
92025
92171
  _remoteCursorOverlay = /* @__PURE__ */ new WeakMap();
92026
92172
  _localSelectionLayer = /* @__PURE__ */ new WeakMap();
92027
92173
  _awarenessCleanup = /* @__PURE__ */ new WeakMap();
92028
92174
  _scrollCleanup = /* @__PURE__ */ new WeakMap();
92029
- _remoteCursorRafHandle = /* @__PURE__ */ new WeakMap();
92030
92175
  _scrollTimeout = /* @__PURE__ */ new WeakMap();
92176
+ _lastRemoteCursorRenderTime = /* @__PURE__ */ new WeakMap();
92177
+ _remoteCursorThrottleTimeout = /* @__PURE__ */ new WeakMap();
92031
92178
  _PresentationEditor_instances = /* @__PURE__ */ new WeakSet();
92179
+ collectCommentPositions_fn = function() {
92180
+ const editorState = __privateGet$1(this, _editor3)?.state;
92181
+ if (!editorState) return {};
92182
+ const doc2 = editorState.doc;
92183
+ const trackChangeMarks = [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName];
92184
+ const pmPositions = {};
92185
+ doc2.descendants((node2, pos) => {
92186
+ const marks = node2.marks || [];
92187
+ for (const mark2 of marks) {
92188
+ let threadId;
92189
+ if (mark2.type.name === CommentMarkName) {
92190
+ threadId = mark2.attrs.commentId || mark2.attrs.importedId;
92191
+ } else if (trackChangeMarks.includes(mark2.type.name)) {
92192
+ threadId = mark2.attrs.id;
92193
+ }
92194
+ if (!threadId) continue;
92195
+ const nodeEnd = pos + node2.nodeSize;
92196
+ if (!pmPositions[threadId]) {
92197
+ pmPositions[threadId] = { threadId, start: pos, end: nodeEnd };
92198
+ } else {
92199
+ pmPositions[threadId].start = Math.min(pmPositions[threadId].start, pos);
92200
+ pmPositions[threadId].end = Math.max(pmPositions[threadId].end, nodeEnd);
92201
+ }
92202
+ }
92203
+ });
92204
+ return pmPositions;
92205
+ };
92032
92206
  aggregateLayoutBounds_fn = function(rects) {
92033
92207
  if (!rects.length) return null;
92034
92208
  const top2 = Math.min(...rects.map((rect) => rect.top));
@@ -92061,9 +92235,13 @@ ${l}
92061
92235
  __privateSet(this, _pendingDocChange, true);
92062
92236
  __privateMethod$1(this, _PresentationEditor_instances, scheduleRerender_fn).call(this);
92063
92237
  }
92238
+ if (transaction?.docChanged) {
92239
+ __privateMethod$1(this, _PresentationEditor_instances, updateLocalAwarenessCursor_fn).call(this);
92240
+ }
92064
92241
  };
92065
92242
  const handleSelection = () => {
92066
92243
  __privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
92244
+ __privateMethod$1(this, _PresentationEditor_instances, updateLocalAwarenessCursor_fn).call(this);
92067
92245
  };
92068
92246
  __privateGet$1(this, _editor3).on("update", handleUpdate);
92069
92247
  __privateGet$1(this, _editor3).on("selectionUpdate", handleSelection);
@@ -92133,6 +92311,29 @@ ${l}
92133
92311
  });
92134
92312
  handleAwarenessChange();
92135
92313
  };
92314
+ updateLocalAwarenessCursor_fn = function() {
92315
+ const provider2 = __privateGet$1(this, _options).collaborationProvider;
92316
+ if (!provider2?.awareness) return;
92317
+ if (typeof provider2.awareness.setLocalStateField !== "function") {
92318
+ return;
92319
+ }
92320
+ const ystate = ySyncPluginKey.getState(__privateGet$1(this, _editor3).state);
92321
+ if (!ystate?.binding?.mapping) return;
92322
+ const { selection } = __privateGet$1(this, _editor3).state;
92323
+ const { anchor, head } = selection;
92324
+ try {
92325
+ const relAnchor = absolutePositionToRelativePosition(anchor, ystate.type, ystate.binding.mapping);
92326
+ const relHead = absolutePositionToRelativePosition(head, ystate.type, ystate.binding.mapping);
92327
+ if (relAnchor && relHead) {
92328
+ const cursorData = {
92329
+ anchor: relAnchor,
92330
+ head: relHead
92331
+ };
92332
+ provider2.awareness.setLocalStateField("cursor", cursorData);
92333
+ }
92334
+ } catch {
92335
+ }
92336
+ };
92136
92337
  normalizeAwarenessStates_fn = function() {
92137
92338
  const provider2 = __privateGet$1(this, _options).collaborationProvider;
92138
92339
  if (!provider2?.awareness) return /* @__PURE__ */ new Map();
@@ -92200,27 +92401,45 @@ ${l}
92200
92401
  if (__privateGet$1(this, _layoutOptions).presence?.enabled === false) return;
92201
92402
  if (__privateGet$1(this, _remoteCursorUpdateScheduled)) return;
92202
92403
  __privateSet(this, _remoteCursorUpdateScheduled, true);
92203
- const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
92204
- __privateSet(this, _remoteCursorRafHandle, win.requestAnimationFrame(() => {
92205
- __privateSet(this, _remoteCursorUpdateScheduled, false);
92206
- __privateSet(this, _remoteCursorRafHandle, null);
92207
- __privateMethod$1(this, _PresentationEditor_instances, updateRemoteCursors_fn).call(this);
92208
- }));
92404
+ queueMicrotask(() => {
92405
+ if (!__privateGet$1(this, _remoteCursorUpdateScheduled)) return;
92406
+ const now = performance.now();
92407
+ const elapsed = now - __privateGet$1(this, _lastRemoteCursorRenderTime);
92408
+ const THROTTLE_MS = 16;
92409
+ if (elapsed >= THROTTLE_MS) {
92410
+ if (__privateGet$1(this, _remoteCursorThrottleTimeout) !== null) {
92411
+ clearTimeout(__privateGet$1(this, _remoteCursorThrottleTimeout));
92412
+ __privateSet(this, _remoteCursorThrottleTimeout, null);
92413
+ }
92414
+ __privateSet(this, _remoteCursorUpdateScheduled, false);
92415
+ __privateSet(this, _lastRemoteCursorRenderTime, now);
92416
+ __privateMethod$1(this, _PresentationEditor_instances, updateRemoteCursors_fn).call(this);
92417
+ return;
92418
+ }
92419
+ const remaining = THROTTLE_MS - elapsed;
92420
+ __privateSet(this, _remoteCursorThrottleTimeout, window.setTimeout(() => {
92421
+ __privateSet(this, _remoteCursorUpdateScheduled, false);
92422
+ __privateSet(this, _remoteCursorThrottleTimeout, null);
92423
+ __privateSet(this, _lastRemoteCursorRenderTime, performance.now());
92424
+ __privateMethod$1(this, _PresentationEditor_instances, updateRemoteCursors_fn).call(this);
92425
+ }, remaining));
92426
+ });
92209
92427
  };
92210
92428
  scheduleRemoteCursorReRender_fn = function() {
92211
92429
  if (__privateGet$1(this, _layoutOptions).presence?.enabled === false) return;
92212
92430
  if (__privateGet$1(this, _remoteCursorUpdateScheduled)) return;
92213
92431
  __privateSet(this, _remoteCursorUpdateScheduled, true);
92214
92432
  const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
92215
- __privateSet(this, _remoteCursorRafHandle, win.requestAnimationFrame(() => {
92433
+ win.requestAnimationFrame(() => {
92216
92434
  __privateSet(this, _remoteCursorUpdateScheduled, false);
92217
- __privateSet(this, _remoteCursorRafHandle, null);
92435
+ __privateSet(this, _lastRemoteCursorRenderTime, performance.now());
92218
92436
  __privateMethod$1(this, _PresentationEditor_instances, renderRemoteCursors_fn).call(this);
92219
- }));
92437
+ });
92220
92438
  };
92221
92439
  updateRemoteCursors_fn = function() {
92222
92440
  if (__privateGet$1(this, _layoutOptions).presence?.enabled === false) {
92223
92441
  __privateGet$1(this, _remoteCursorState).clear();
92442
+ __privateGet$1(this, _remoteCursorElements).clear();
92224
92443
  if (__privateGet$1(this, _remoteCursorOverlay)) {
92225
92444
  __privateGet$1(this, _remoteCursorOverlay).innerHTML = "";
92226
92445
  }
@@ -92249,9 +92468,6 @@ ${l}
92249
92468
  }
92250
92469
  };
92251
92470
  renderRemoteCursors_fn = function() {
92252
- if (__privateGet$1(this, _remoteCursorOverlay)) {
92253
- __privateGet$1(this, _remoteCursorOverlay).innerHTML = "";
92254
- }
92255
92471
  const layout = __privateGet$1(this, _layoutState)?.layout;
92256
92472
  const blocks2 = __privateGet$1(this, _layoutState)?.blocks;
92257
92473
  const measures = __privateGet$1(this, _layoutState)?.measures;
@@ -92260,37 +92476,63 @@ ${l}
92260
92476
  }
92261
92477
  const maxVisible = __privateGet$1(this, _layoutOptions).presence?.maxVisible ?? 20;
92262
92478
  const sortedCursors = Array.from(__privateGet$1(this, _remoteCursorState).values()).sort((a2, b2) => b2.updatedAt - a2.updatedAt).slice(0, maxVisible);
92479
+ const visibleClientIds = /* @__PURE__ */ new Set();
92263
92480
  sortedCursors.forEach((cursor) => {
92481
+ visibleClientIds.add(cursor.clientId);
92264
92482
  if (cursor.anchor === cursor.head) {
92265
92483
  __privateMethod$1(this, _PresentationEditor_instances, renderRemoteCaret_fn).call(this, cursor);
92266
92484
  } else {
92267
92485
  __privateMethod$1(this, _PresentationEditor_instances, renderRemoteSelection_fn).call(this, cursor);
92268
92486
  }
92269
92487
  });
92488
+ __privateGet$1(this, _remoteCursorElements).forEach((element2, clientId) => {
92489
+ if (!visibleClientIds.has(clientId)) {
92490
+ element2.remove();
92491
+ __privateGet$1(this, _remoteCursorElements).delete(clientId);
92492
+ }
92493
+ });
92270
92494
  };
92271
92495
  renderRemoteCaret_fn = function(cursor) {
92272
92496
  const caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, cursor.head);
92273
- if (!caretLayout) return;
92274
- const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, caretLayout.pageIndex, caretLayout.x, caretLayout.y);
92275
- if (!coords) return;
92276
92497
  const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
92277
92498
  const doc2 = __privateGet$1(this, _visibleHost).ownerDocument ?? document;
92278
92499
  const color2 = __privateMethod$1(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
92279
- const caretEl = doc2.createElement("div");
92280
- caretEl.className = "presentation-editor__remote-caret";
92281
- caretEl.style.position = "absolute";
92282
- caretEl.style.left = `${coords.x}px`;
92283
- caretEl.style.top = `${coords.y}px`;
92284
- caretEl.style.width = `${_PresentationEditor.CURSOR_STYLES.CARET_WIDTH}px`;
92500
+ let caretEl = __privateGet$1(this, _remoteCursorElements).get(cursor.clientId);
92501
+ const isNewElement = !caretEl;
92502
+ if (isNewElement) {
92503
+ caretEl = doc2.createElement("div");
92504
+ caretEl.className = "presentation-editor__remote-caret";
92505
+ caretEl.style.position = "absolute";
92506
+ caretEl.style.width = `${_PresentationEditor.CURSOR_STYLES.CARET_WIDTH}px`;
92507
+ caretEl.style.borderLeft = `${_PresentationEditor.CURSOR_STYLES.CARET_WIDTH}px solid ${color2}`;
92508
+ caretEl.style.pointerEvents = "none";
92509
+ caretEl.style.transition = "transform 50ms ease-out, height 50ms ease-out, opacity 100ms ease-out";
92510
+ caretEl.style.willChange = "transform";
92511
+ caretEl.setAttribute("data-client-id", cursor.clientId.toString());
92512
+ caretEl.setAttribute("aria-hidden", "true");
92513
+ if (__privateGet$1(this, _layoutOptions).presence?.showLabels !== false) {
92514
+ __privateMethod$1(this, _PresentationEditor_instances, renderRemoteCursorLabel_fn).call(this, caretEl, cursor);
92515
+ }
92516
+ __privateGet$1(this, _remoteCursorElements).set(cursor.clientId, caretEl);
92517
+ __privateGet$1(this, _remoteCursorOverlay)?.appendChild(caretEl);
92518
+ }
92519
+ if (!caretLayout) {
92520
+ caretEl.style.opacity = "0";
92521
+ return;
92522
+ }
92523
+ const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, caretLayout.pageIndex, caretLayout.x, caretLayout.y);
92524
+ if (!coords) {
92525
+ caretEl.style.opacity = "0";
92526
+ return;
92527
+ }
92528
+ caretEl.style.opacity = "1";
92529
+ caretEl.style.transform = `translate(${coords.x}px, ${coords.y}px)`;
92285
92530
  caretEl.style.height = `${Math.max(1, caretLayout.height * zoom)}px`;
92286
- caretEl.style.borderLeft = `${_PresentationEditor.CURSOR_STYLES.CARET_WIDTH}px solid ${color2}`;
92287
- caretEl.style.pointerEvents = "none";
92288
- caretEl.setAttribute("data-client-id", cursor.clientId.toString());
92289
- caretEl.setAttribute("aria-hidden", "true");
92290
- if (__privateGet$1(this, _layoutOptions).presence?.showLabels !== false) {
92291
- __privateMethod$1(this, _PresentationEditor_instances, renderRemoteCursorLabel_fn).call(this, caretEl, cursor);
92531
+ caretEl.style.borderLeftColor = color2;
92532
+ const labelEl = caretEl.querySelector(".presentation-editor__remote-label");
92533
+ if (labelEl) {
92534
+ labelEl.style.backgroundColor = color2;
92292
92535
  }
92293
- __privateGet$1(this, _remoteCursorOverlay)?.appendChild(caretEl);
92294
92536
  };
92295
92537
  renderRemoteCursorLabel_fn = function(caretEl, cursor) {
92296
92538
  const labelFormatter = __privateGet$1(this, _layoutOptions).presence?.labelFormatter;
@@ -92725,6 +92967,7 @@ ${l}
92725
92967
  }
92726
92968
  const sectionMetadata = [];
92727
92969
  let blocks2;
92970
+ let bookmarks = /* @__PURE__ */ new Map();
92728
92971
  try {
92729
92972
  const converter2 = __privateGet$1(this, _editor3).converter;
92730
92973
  const converterContext = converter2 ? {
@@ -92743,6 +92986,7 @@ ${l}
92743
92986
  converterContext
92744
92987
  });
92745
92988
  blocks2 = result.blocks;
92989
+ bookmarks = result.bookmarks ?? /* @__PURE__ */ new Map();
92746
92990
  } catch (error) {
92747
92991
  __privateMethod$1(this, _PresentationEditor_instances, handleLayoutError_fn).call(this, "render", __privateMethod$1(this, _PresentationEditor_instances, decorateError_fn).call(this, error, "toFlowBlocks"));
92748
92992
  return;
@@ -92790,7 +93034,8 @@ ${l}
92790
93034
  __privateSet(this, _sectionMetadata, sectionMetadata);
92791
93035
  const converter = __privateGet$1(this, _editor3).converter;
92792
93036
  __privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
92793
- __privateSet(this, _layoutState, { blocks: blocks2, measures, layout });
93037
+ const anchorMap = __privateMethod$1(this, _PresentationEditor_instances, computeAnchorMap_fn).call(this, bookmarks, layout);
93038
+ __privateSet(this, _layoutState, { blocks: blocks2, measures, layout, bookmarks, anchorMap });
92794
93039
  __privateSet(this, _headerLayoutResults, headerLayouts ?? null);
92795
93040
  __privateSet(this, _footerLayoutResults, footerLayouts ?? null);
92796
93041
  await __privateMethod$1(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
@@ -92839,6 +93084,11 @@ ${l}
92839
93084
  const payload = { layout, blocks: blocks2, measures, metrics };
92840
93085
  this.emit("layoutUpdated", payload);
92841
93086
  this.emit("paginationUpdate", payload);
93087
+ const commentPositions = __privateMethod$1(this, _PresentationEditor_instances, collectCommentPositions_fn).call(this);
93088
+ const positionKeys = Object.keys(commentPositions);
93089
+ if (positionKeys.length > 0) {
93090
+ this.emit("commentPositions", { positions: commentPositions });
93091
+ }
92842
93092
  if (__privateGet$1(this, _telemetryEmitter) && metrics) {
92843
93093
  __privateGet$1(this, _telemetryEmitter).call(this, { type: "layout", data: { layout, blocks: blocks2, measures, metrics } });
92844
93094
  }
@@ -93444,9 +93694,9 @@ ${l}
93444
93694
  __privateMethod$1(this, _PresentationEditor_instances, announce_fn).call(this, __privateGet$1(this, _session).mode === "body" ? "Exited header/footer edit mode." : `Editing ${__privateGet$1(this, _session).kind === "header" ? "Header" : "Footer"} (${__privateGet$1(this, _session).sectionType ?? "default"})`);
93445
93695
  };
93446
93696
  updateAwarenessSession_fn = function() {
93447
- const provider2 = __privateGet$1(this, _editor3).options?.collaborationProvider;
93697
+ const provider2 = __privateGet$1(this, _options).collaborationProvider;
93448
93698
  const awareness = provider2?.awareness;
93449
- if (!awareness?.setLocalStateField) {
93699
+ if (!awareness || typeof awareness.setLocalStateField !== "function") {
93450
93700
  return;
93451
93701
  }
93452
93702
  if (__privateGet$1(this, _session).mode === "body") {
@@ -93555,6 +93805,62 @@ ${l}
93555
93805
  __privateGet$1(this, _visibleHost).scrollTop = yPosition;
93556
93806
  }
93557
93807
  };
93808
+ computeAnchorMap_fn = function(bookmarks, layout) {
93809
+ const anchorMap = /* @__PURE__ */ new Map();
93810
+ const blockPmRanges = /* @__PURE__ */ new Map();
93811
+ const computeBlockRange = (blockId) => {
93812
+ if (blockPmRanges.has(blockId)) {
93813
+ const cached = blockPmRanges.get(blockId);
93814
+ return { pmStart: cached.pmStart, pmEnd: cached.pmEnd };
93815
+ }
93816
+ const block = __privateGet$1(this, _layoutState).blocks.find((b2) => b2.id === blockId);
93817
+ if (!block || block.kind !== "paragraph") {
93818
+ blockPmRanges.set(blockId, { pmStart: null, pmEnd: null, hasFragmentPositions: false });
93819
+ return { pmStart: null, pmEnd: null };
93820
+ }
93821
+ let pmStart = null;
93822
+ let pmEnd = null;
93823
+ for (const run2 of block.runs) {
93824
+ if (run2.pmStart != null) {
93825
+ pmStart = pmStart == null ? run2.pmStart : Math.min(pmStart, run2.pmStart);
93826
+ }
93827
+ if (run2.pmEnd != null) {
93828
+ pmEnd = pmEnd == null ? run2.pmEnd : Math.max(pmEnd, run2.pmEnd);
93829
+ }
93830
+ }
93831
+ blockPmRanges.set(blockId, { pmStart, pmEnd, hasFragmentPositions: false });
93832
+ return { pmStart, pmEnd };
93833
+ };
93834
+ bookmarks.forEach((pmPosition, bookmarkName) => {
93835
+ for (const page of layout.pages) {
93836
+ for (const fragment of page.fragments) {
93837
+ if (fragment.kind !== "para") continue;
93838
+ let fragStart = fragment.pmStart;
93839
+ let fragEnd = fragment.pmEnd;
93840
+ if (fragStart == null || fragEnd == null) {
93841
+ const range2 = computeBlockRange(fragment.blockId);
93842
+ if (range2.pmStart != null && range2.pmEnd != null) {
93843
+ fragStart = range2.pmStart;
93844
+ fragEnd = range2.pmEnd;
93845
+ }
93846
+ } else {
93847
+ const cached = blockPmRanges.get(fragment.blockId);
93848
+ blockPmRanges.set(fragment.blockId, {
93849
+ pmStart: cached?.pmStart ?? fragStart,
93850
+ pmEnd: cached?.pmEnd ?? fragEnd,
93851
+ hasFragmentPositions: true
93852
+ });
93853
+ }
93854
+ if (fragStart == null || fragEnd == null) continue;
93855
+ if (pmPosition >= fragStart && pmPosition < fragEnd) {
93856
+ anchorMap.set(bookmarkName, page.number);
93857
+ return;
93858
+ }
93859
+ }
93860
+ }
93861
+ });
93862
+ return anchorMap;
93863
+ };
93558
93864
  waitForPageMount_fn = async function(pageIndex, options = {}) {
93559
93865
  const timeout2 = options.timeout ?? 2e3;
93560
93866
  const startTime = performance.now();
@@ -94174,6 +94480,7 @@ ${l}
94174
94480
  SELECTION_BORDER_RADIUS: "2px",
94175
94481
  MAX_LABEL_LENGTH: 30
94176
94482
  };
94483
+ _PresentationEditor.ANCHOR_NAV_TIMEOUT_MS = 2e3;
94177
94484
  let PresentationEditor = _PresentationEditor;
94178
94485
  class PresentationInputBridge {
94179
94486
  /**
@@ -98305,6 +98612,7 @@ ${l}
98305
98612
  return ["p", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
98306
98613
  },
98307
98614
  addNodeView() {
98615
+ if (this.editor.options?.mode !== "docx" || !this.editor.converter) return null;
98308
98616
  if (shouldSkipNodeView(this.editor)) return null;
98309
98617
  return ({ node: node2, editor, getPos, decorations, extensionAttrs }) => {
98310
98618
  return new ParagraphNodeView(node2, editor, getPos, decorations, extensionAttrs);
@@ -98547,7 +98855,7 @@ ${l}
98547
98855
  }
98548
98856
  });
98549
98857
  const CommentsMark = Mark.create({
98550
- name: CommentMarkName,
98858
+ name: CommentMarkName$1,
98551
98859
  group: "comments",
98552
98860
  excludes: "",
98553
98861
  addOptions() {
@@ -98566,10 +98874,10 @@ ${l}
98566
98874
  };
98567
98875
  },
98568
98876
  parseDOM() {
98569
- return [{ tag: CommentMarkName }];
98877
+ return [{ tag: CommentMarkName$1 }];
98570
98878
  },
98571
98879
  renderDOM({ htmlAttributes }) {
98572
- return [CommentMarkName, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
98880
+ return [CommentMarkName$1, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
98573
98881
  }
98574
98882
  });
98575
98883
  let cache$2 = /* @__PURE__ */ new WeakMap();
@@ -108753,7 +109061,7 @@ ${l}
108753
109061
  }
108754
109062
  const trackInsertClass = "track-insert";
108755
109063
  const TrackInsert = Mark.create({
108756
- name: TrackInsertMarkName,
109064
+ name: TrackInsertMarkName$1,
108757
109065
  group: "track",
108758
109066
  inclusive: false,
108759
109067
  addOptions() {
@@ -108830,7 +109138,7 @@ ${l}
108830
109138
  });
108831
109139
  const trackDeleteClass = "track-delete";
108832
109140
  const TrackDelete = Mark.create({
108833
- name: TrackDeleteMarkName,
109141
+ name: TrackDeleteMarkName$1,
108834
109142
  group: "track",
108835
109143
  inclusive: false,
108836
109144
  addOptions() {
@@ -108939,7 +109247,7 @@ ${l}
108939
109247
  }, Symbol.toStringTag, { value: "Module" }));
108940
109248
  const trackFormatClass = "track-format";
108941
109249
  const TrackFormat = Mark.create({
108942
- name: TrackFormatMarkName,
109250
+ name: TrackFormatMarkName$1,
108943
109251
  group: "track",
108944
109252
  inclusive: false,
108945
109253
  addOptions() {
@@ -109153,7 +109461,7 @@ ${l}
109153
109461
  tr.setMeta("inputType", "acceptReject");
109154
109462
  const map2 = new Mapping();
109155
109463
  doc2.nodesBetween(from2, to, (node2, pos) => {
109156
- if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName)) {
109464
+ if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName$1)) {
109157
109465
  const deletionStep = new ReplaceStep(
109158
109466
  map2.map(Math.max(pos, from2)),
109159
109467
  map2.map(Math.min(pos + node2.nodeSize, to)),
@@ -109161,8 +109469,8 @@ ${l}
109161
109469
  );
109162
109470
  tr.step(deletionStep);
109163
109471
  map2.appendMap(deletionStep.getMap());
109164
- } else if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName)) {
109165
- const insertionMark = node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName);
109472
+ } else if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName$1)) {
109473
+ const insertionMark = node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName$1);
109166
109474
  tr.step(
109167
109475
  new RemoveMarkStep(
109168
109476
  map2.map(Math.max(pos, from2)),
@@ -109170,8 +109478,8 @@ ${l}
109170
109478
  insertionMark
109171
109479
  )
109172
109480
  );
109173
- } else if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName)) {
109174
- const formatChangeMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName);
109481
+ } else if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName$1)) {
109482
+ const formatChangeMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName$1);
109175
109483
  tr.step(
109176
109484
  new RemoveMarkStep(
109177
109485
  map2.map(Math.max(pos, from2)),
@@ -109193,8 +109501,8 @@ ${l}
109193
109501
  tr.setMeta("inputType", "acceptReject");
109194
109502
  const map2 = new Mapping();
109195
109503
  doc2.nodesBetween(from2, to, (node2, pos) => {
109196
- if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName)) {
109197
- const deletionMark = node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName);
109504
+ if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName$1)) {
109505
+ const deletionMark = node2.marks.find((mark2) => mark2.type.name === TrackDeleteMarkName$1);
109198
109506
  tr.step(
109199
109507
  new RemoveMarkStep(
109200
109508
  map2.map(Math.max(pos, from2)),
@@ -109202,7 +109510,7 @@ ${l}
109202
109510
  deletionMark
109203
109511
  )
109204
109512
  );
109205
- } else if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName)) {
109513
+ } else if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName$1)) {
109206
109514
  const deletionStep = new ReplaceStep(
109207
109515
  map2.map(Math.max(pos, from2)),
109208
109516
  map2.map(Math.min(pos + node2.nodeSize, to)),
@@ -109210,8 +109518,8 @@ ${l}
109210
109518
  );
109211
109519
  tr.step(deletionStep);
109212
109520
  map2.appendMap(deletionStep.getMap());
109213
- } else if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName)) {
109214
- const formatChangeMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName);
109521
+ } else if (node2.marks && node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName$1)) {
109522
+ const formatChangeMark = node2.marks.find((mark2) => mark2.type.name === TrackFormatMarkName$1);
109215
109523
  formatChangeMark.attrs.before.forEach((oldMark) => {
109216
109524
  tr.step(
109217
109525
  new AddMarkStep(
@@ -109387,7 +109695,7 @@ ${l}
109387
109695
  const hasContentBetween = state2.doc.textBetween(left2.from, right2.to, "\n").length > getSegmentSize(left2) + getSegmentSize(right2);
109388
109696
  return !hasContentBetween;
109389
109697
  };
109390
- const isComplementaryPair = (firstType, secondType) => firstType === TrackDeleteMarkName && secondType === TrackInsertMarkName || firstType === TrackInsertMarkName && secondType === TrackDeleteMarkName;
109698
+ const isComplementaryPair = (firstType, secondType) => firstType === TrackDeleteMarkName$1 && secondType === TrackInsertMarkName$1 || firstType === TrackInsertMarkName$1 && secondType === TrackDeleteMarkName$1;
109391
109699
  const linkedBefore = [];
109392
109700
  const linkedAfter = [];
109393
109701
  const collectDirection = (direction, collection) => {
@@ -129726,7 +130034,8 @@ ${style2}
129726
130034
  if (!surface) {
129727
130035
  return;
129728
130036
  }
129729
- moveCursorToMouseEvent(event.detail, props.editor);
130037
+ const detail = event?.detail ?? {};
130038
+ moveCursorToMouseEvent(detail, props.editor);
129730
130039
  setTimeout(() => {
129731
130040
  const currentState = props.editor.state;
129732
130041
  const hasLink = selectionHasNodeOrMark(currentState, "link", { requireEnds: true });
@@ -129741,8 +130050,8 @@ ${style2}
129741
130050
  closePopover: props.closePopover
129742
130051
  },
129743
130052
  {
129744
- left: `${event.detail.clientX - surfaceRect.left}px`,
129745
- top: `${event.detail.clientY - surfaceRect.top + 15}px`
130053
+ left: `${detail.clientX - surfaceRect.left}px`,
130054
+ top: `${detail.clientY - surfaceRect.top + 15}px`
129746
130055
  }
129747
130056
  );
129748
130057
  }
@@ -145782,26 +146091,14 @@ ${style2}
145782
146091
  const firstGroupRendered = ref(false);
145783
146092
  const verticalOffset = ref(0);
145784
146093
  const commentsRenderKey = ref(0);
146094
+ const measurementTimeoutId = ref(null);
145785
146095
  const getCommentPosition = computed(() => (comment2) => {
145786
146096
  if (!floatingCommentsContainer.value) return { top: "0px" };
145787
- floatingCommentsContainer.value.getBoundingClientRect();
145788
146097
  if (typeof comment2.top !== "number" || isNaN(comment2.top)) {
145789
146098
  return { display: "none" };
145790
146099
  }
145791
146100
  return { top: `${comment2.top}px` };
145792
146101
  });
145793
- const findScrollParent = (element2) => {
145794
- if (!element2) return window;
145795
- let parent = element2.parentNode;
145796
- while (parent && parent !== document) {
145797
- const style2 = getComputedStyle(parent);
145798
- if (/(auto|scroll|overlay)/.test(style2.overflow + style2.overflowY + style2.overflowX)) {
145799
- return parent;
145800
- }
145801
- parent = parent.parentNode;
145802
- }
145803
- return window;
145804
- };
145805
146102
  const handleDialog = (dialog) => {
145806
146103
  if (!dialog) return;
145807
146104
  const { elementRef, commentId } = dialog;
@@ -145809,44 +146106,68 @@ ${style2}
145809
146106
  nextTick(() => {
145810
146107
  const id = commentId;
145811
146108
  if (renderedSizes.value.some((item) => item.id == id)) return;
145812
- const editorBounds = props.parent.getBoundingClientRect();
145813
146109
  const comment2 = getFloatingComments.value.find((c2) => c2.commentId === id || c2.importedId == id);
145814
146110
  const positionKey = id || comment2?.importedId;
145815
- let position2 = editorCommentPositions.value[positionKey]?.bounds || {};
146111
+ const positionEntry = editorCommentPositions.value[positionKey];
146112
+ const position2 = positionEntry?.bounds || {};
145816
146113
  if (props.currentDocument.type === "application/pdf") {
145817
146114
  Object.entries(comment2.selection?.selectionBounds).forEach(([key2, value]) => {
145818
146115
  position2[key2] = Number(value);
145819
146116
  });
145820
- position2.top += editorBounds.top;
145821
146117
  }
145822
146118
  if (!position2) return;
145823
- const scrollParent = findScrollParent(props.parent);
145824
- scrollParent === window ? window.scrollY : scrollParent.scrollTop;
145825
146119
  const bounds = elementRef.value?.getBoundingClientRect();
146120
+ const top2 = Number(position2.top);
146121
+ if (!Number.isFinite(top2)) return;
145826
146122
  const placement = {
145827
146123
  id,
145828
- top: position2.top - editorBounds.top,
146124
+ top: top2,
145829
146125
  height: bounds.height,
145830
146126
  commentRef: comment2,
145831
- elementRef
146127
+ elementRef,
146128
+ pageIndex: positionEntry?.pageIndex ?? 0
145832
146129
  };
145833
146130
  renderedSizes.value.push(placement);
145834
146131
  });
145835
146132
  };
145836
146133
  const processLocations = async () => {
145837
- let currentBottom = 0;
145838
- renderedSizes.value.sort((a2, b2) => a2.top - b2.top).forEach((comment2) => {
145839
- if (comment2.top <= currentBottom + 15) {
145840
- comment2.top = currentBottom + 15;
145841
- }
145842
- currentBottom = comment2.top + comment2.height;
146134
+ const groupedByPage = renderedSizes.value.reduce((acc, comment2) => {
146135
+ const key2 = comment2.pageIndex ?? 0;
146136
+ if (!acc[key2]) acc[key2] = [];
146137
+ acc[key2].push(comment2);
146138
+ return acc;
146139
+ }, {});
146140
+ Object.values(groupedByPage).forEach((comments) => {
146141
+ comments.sort((a2, b2) => a2.top - b2.top).forEach((comment2, idx, arr) => {
146142
+ if (idx === 0) return;
146143
+ const prev = arr[idx - 1];
146144
+ const minTop = prev.top + prev.height + 15;
146145
+ if (comment2.top < minTop) {
146146
+ comment2.top = minTop;
146147
+ }
146148
+ });
145843
146149
  });
145844
146150
  await nextTick();
145845
146151
  firstGroupRendered.value = true;
145846
146152
  };
145847
146153
  watchEffect(() => {
145848
- if (renderedSizes.value.length === getFloatingComments.value.length) {
146154
+ if (measurementTimeoutId.value) {
146155
+ clearTimeout(measurementTimeoutId.value);
146156
+ measurementTimeoutId.value = null;
146157
+ }
146158
+ const totalComments = getFloatingComments.value.length;
146159
+ const measuredComments = renderedSizes.value.length;
146160
+ if (totalComments === 0) {
146161
+ return;
146162
+ }
146163
+ if (measuredComments === totalComments) {
145849
146164
  nextTick(processLocations);
146165
+ } else if (measuredComments > 0 && !firstGroupRendered.value) {
146166
+ measurementTimeoutId.value = setTimeout(() => {
146167
+ if (!firstGroupRendered.value && renderedSizes.value.length > 0) {
146168
+ processLocations();
146169
+ }
146170
+ }, 100);
145850
146171
  }
145851
146172
  });
145852
146173
  watch(activeComment, (newVal, oldVal) => {
@@ -145869,6 +146190,12 @@ ${style2}
145869
146190
  }, 200);
145870
146191
  });
145871
146192
  });
146193
+ onBeforeUnmount(() => {
146194
+ if (measurementTimeoutId.value) {
146195
+ clearTimeout(measurementTimeoutId.value);
146196
+ measurementTimeoutId.value = null;
146197
+ }
146198
+ });
145872
146199
  return (_ctx, _cache) => {
145873
146200
  return openBlock(), createElementBlock("div", {
145874
146201
  class: "section-wrapper",
@@ -145919,7 +146246,7 @@ ${style2}
145919
146246
  };
145920
146247
  }
145921
146248
  };
145922
- const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-91de2350"]]);
146249
+ const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-eab6fbfa"]]);
145923
146250
  const _sfc_main$9 = {
145924
146251
  __name: "TextField",
145925
146252
  props: {
@@ -146674,6 +147001,13 @@ ${style2}
146674
147001
  presentationEditor.onTelemetry((telemetryPayload) => {
146675
147002
  proxy.$superdoc.captureLayoutPipelineEvent(telemetryPayload);
146676
147003
  });
147004
+ presentationEditor.on("commentPositions", ({ positions }) => {
147005
+ const commentsConfig = proxy.$superdoc.config.modules?.comments;
147006
+ if (!commentsConfig || commentsConfig === false) return;
147007
+ if (!positions || Object.keys(positions).length === 0) return;
147008
+ const mappedPositions = presentationEditor.getCommentBounds(positions, layers.value);
147009
+ handleEditorLocationsUpdate(mappedPositions);
147010
+ });
146677
147011
  };
146678
147012
  const onEditorDestroy = () => {
146679
147013
  proxy.$superdoc.broadcastEditorDestroy();
@@ -147220,7 +147554,7 @@ ${style2}
147220
147554
  };
147221
147555
  }
147222
147556
  };
147223
- const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-3fafc837"]]);
147557
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-3c3356b6"]]);
147224
147558
  const createSuperdocVueApp = () => {
147225
147559
  const app = createApp(App);
147226
147560
  const pinia = createPinia();
@@ -147400,7 +147734,7 @@ ${style2}
147400
147734
  this.config.colors = shuffleArray(this.config.colors);
147401
147735
  this.userColorMap = /* @__PURE__ */ new Map();
147402
147736
  this.colorIndex = 0;
147403
- this.version = "1.0.0-beta.32";
147737
+ this.version = "1.0.0-beta.34";
147404
147738
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
147405
147739
  this.superdocId = config2.superdocId || v4();
147406
147740
  this.colors = this.config.colors;
@@ -149844,7 +150178,7 @@ ${style2}
149844
150178
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
149845
150179
  );
149846
150180
  }
149847
- const indexSGV4U12y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
150181
+ const indexCQeXM6oB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
149848
150182
  __proto__: null,
149849
150183
  unified
149850
150184
  }, Symbol.toStringTag, { value: "Module" }));