@harbour-enterprises/superdoc 1.0.0-next.11 → 1.0.0-next.12

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-BHQAIor9.es.js → PdfViewer-DmfOe_Pf.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-65m-1Mif.cjs → PdfViewer-w6pLbkxf.cjs} +1 -1
  3. package/dist/chunks/{index-_29uRtgq.cjs → index-DCu_3jpz.cjs} +3 -3
  4. package/dist/chunks/{index-DPqUx7-1.es.js → index-DSLlUITa.es.js} +3 -3
  5. package/dist/chunks/{index-C5orVGCQ-CW6wugb7.cjs → index-lMJbwm6b-B4MxvqkR.cjs} +1 -1
  6. package/dist/chunks/{index-C5orVGCQ-DVgjx_eq.es.js → index-lMJbwm6b-l7bjUagi.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-DxgyliBv.cjs → super-editor.es-CYIzx8D9.cjs} +584 -121
  8. package/dist/chunks/{super-editor.es-rK6HtVpO.es.js → super-editor.es-ajKYblrs.es.js} +584 -121
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-DmUVsRfa.js → converter-Bf6IlS43.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-DFJkPgao.js → docx-zipper-16dfai0y.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-BRJH9CNT.js → editor-DJbi9-qr.js} +614 -122
  13. package/dist/super-editor/chunks/{index-C5orVGCQ.js → index-lMJbwm6b.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-DRBey7KI.js → toolbar-DpmycQmV.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +586 -123
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -42428,7 +42428,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42428
42428
  static getStoredSuperdocVersion(docx) {
42429
42429
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42430
42430
  }
42431
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.11") {
42431
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.12") {
42432
42432
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42433
42433
  }
42434
42434
  /**
@@ -53597,7 +53597,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53597
53597
  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);
53598
53598
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
53599
53599
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
53600
- 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, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _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, _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, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _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, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _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, computeExpectedSectionType_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, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_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;
53600
+ 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, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _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, _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, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _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, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, wrapHiddenEditorFocus_fn, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _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, computeExpectedSectionType_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, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_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;
53601
53601
  var GOOD_LEAF_SIZE = 200;
53602
53602
  var RopeSequence = function RopeSequence2() {
53603
53603
  };
@@ -67515,7 +67515,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67515
67515
  const shouldSkipNodeView = (editor) => {
67516
67516
  return isHeadless(editor);
67517
67517
  };
67518
- const summaryVersion = "1.0.0-next.11";
67518
+ const summaryVersion = "1.0.0-next.12";
67519
67519
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67520
67520
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67521
67521
  function mapAttributes(attrs) {
@@ -68304,7 +68304,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68304
68304
  { default: remarkStringify2 },
68305
68305
  { default: remarkGfm2 }
68306
68306
  ] = await Promise.all([
68307
- Promise.resolve().then(() => indexC5orVGCQ),
68307
+ Promise.resolve().then(() => indexLMJbwm6b),
68308
68308
  Promise.resolve().then(() => indexDRCvimau),
68309
68309
  Promise.resolve().then(() => indexC_x_N6Uh),
68310
68310
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68509,7 +68509,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68509
68509
  * Process collaboration migrations
68510
68510
  */
68511
68511
  processCollaborationMigrations() {
68512
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.11");
68512
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.12");
68513
68513
  if (!this.options.ydoc) return;
68514
68514
  const metaMap = this.options.ydoc.getMap("meta");
68515
68515
  let docVersion = metaMap.get("version");
@@ -79508,6 +79508,86 @@ ${l}
79508
79508
  }
79509
79509
  };
79510
79510
  };
79511
+ const DEFAULT_CONFIG = {
79512
+ logLevel: "off",
79513
+ hud: false,
79514
+ dumpRects: false,
79515
+ disableRectDedupe: false
79516
+ };
79517
+ const levelOrder = {
79518
+ error: 0,
79519
+ warn: 1,
79520
+ info: 2,
79521
+ verbose: 3
79522
+ };
79523
+ function getSelectionDebugConfig() {
79524
+ var _a2;
79525
+ if (typeof window === "undefined") {
79526
+ return DEFAULT_CONFIG;
79527
+ }
79528
+ window.superdocDebug ?? (window.superdocDebug = {});
79529
+ (_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
79530
+ const cfg = window.superdocDebug.selection;
79531
+ return {
79532
+ logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
79533
+ hud: cfg.hud ?? DEFAULT_CONFIG.hud,
79534
+ dumpRects: cfg.dumpRects ?? DEFAULT_CONFIG.dumpRects,
79535
+ disableRectDedupe: cfg.disableRectDedupe ?? DEFAULT_CONFIG.disableRectDedupe
79536
+ };
79537
+ }
79538
+ function debugLog(level, message, data) {
79539
+ const cfg = getSelectionDebugConfig();
79540
+ if (cfg.logLevel === "off") return;
79541
+ if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
79542
+ const prefix2 = "[Selection]";
79543
+ if (data) {
79544
+ console.log(prefix2, message, data);
79545
+ } else {
79546
+ console.log(prefix2, message);
79547
+ }
79548
+ }
79549
+ const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
79550
+ function updateSelectionDebugHud(host, state2) {
79551
+ const cfg = getSelectionDebugConfig();
79552
+ const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
79553
+ if (!doc2) return;
79554
+ const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
79555
+ if (!cfg.hud) {
79556
+ existing?.remove();
79557
+ return;
79558
+ }
79559
+ const hud = existing ?? doc2.createElement("div");
79560
+ hud.setAttribute(HUD_DATA_ATTR, "true");
79561
+ hud.style.position = "absolute";
79562
+ hud.style.top = "8px";
79563
+ hud.style.left = "8px";
79564
+ hud.style.zIndex = "9999";
79565
+ hud.style.maxWidth = "420px";
79566
+ hud.style.padding = "6px 8px";
79567
+ hud.style.borderRadius = "6px";
79568
+ hud.style.background = "rgba(0, 0, 0, 0.72)";
79569
+ hud.style.color = "white";
79570
+ hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
79571
+ hud.style.fontSize = "12px";
79572
+ hud.style.lineHeight = "1.3";
79573
+ hud.style.pointerEvents = "none";
79574
+ hud.style.whiteSpace = "pre";
79575
+ const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
79576
+ const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
79577
+ const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
79578
+ state2.lastPointer.y
79579
+ )}` : "null";
79580
+ const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
79581
+ hud.textContent = [
79582
+ `docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
79583
+ `selection=${selectionText}`,
79584
+ `pointer=${pointerText}`,
79585
+ `hit=${hitText}`
79586
+ ].join("\n");
79587
+ if (!existing) {
79588
+ host.appendChild(hud);
79589
+ }
79590
+ }
79511
79591
  class DomPositionIndex {
79512
79592
  constructor() {
79513
79593
  __privateAdd$1(this, _entries, []);
@@ -79564,6 +79644,7 @@ ${l}
79564
79644
  }
79565
79645
  for (const node2 of pmNodes) {
79566
79646
  if (node2.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER)) continue;
79647
+ if (node2.closest(".superdoc-page-header, .superdoc-page-footer")) continue;
79567
79648
  if (leafOnly && nonLeaf.has(node2)) continue;
79568
79649
  const pmStart = Number(node2.dataset.pmStart ?? "NaN");
79569
79650
  const pmEnd = Number(node2.dataset.pmEnd ?? "NaN");
@@ -79573,6 +79654,60 @@ ${l}
79573
79654
  }
79574
79655
  entries.sort((a2, b2) => a2.pmStart - b2.pmStart !== 0 ? a2.pmStart - b2.pmStart : a2.pmEnd - b2.pmEnd);
79575
79656
  __privateSet(this, _entries, entries);
79657
+ const isVerbose = getSelectionDebugConfig().logLevel === "verbose";
79658
+ if (isVerbose) {
79659
+ const counts = { total: entries.length, body: 0, header: 0, footer: 0 };
79660
+ const bodySamples = [];
79661
+ const headerSamples = [];
79662
+ const footerSamples = [];
79663
+ for (const entry of entries) {
79664
+ const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
79665
+ const pageIndex = pageEl?.dataset.pageIndex ?? null;
79666
+ const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
79667
+ if (section === "header") {
79668
+ counts.header += 1;
79669
+ if (headerSamples.length < 10) {
79670
+ headerSamples.push({
79671
+ pmStart: entry.pmStart,
79672
+ pmEnd: entry.pmEnd,
79673
+ pageIndex,
79674
+ text: (entry.el.textContent ?? "").slice(0, 40)
79675
+ });
79676
+ }
79677
+ continue;
79678
+ }
79679
+ if (section === "footer") {
79680
+ counts.footer += 1;
79681
+ if (footerSamples.length < 10) {
79682
+ footerSamples.push({
79683
+ pmStart: entry.pmStart,
79684
+ pmEnd: entry.pmEnd,
79685
+ pageIndex,
79686
+ text: (entry.el.textContent ?? "").slice(0, 40)
79687
+ });
79688
+ }
79689
+ continue;
79690
+ }
79691
+ counts.body += 1;
79692
+ if (bodySamples.length < 10) {
79693
+ bodySamples.push({
79694
+ pmStart: entry.pmStart,
79695
+ pmEnd: entry.pmEnd,
79696
+ pageIndex,
79697
+ text: (entry.el.textContent ?? "").slice(0, 40)
79698
+ });
79699
+ }
79700
+ }
79701
+ debugLog(
79702
+ "verbose",
79703
+ `DomPositionIndex: rebuild summary ${JSON.stringify({
79704
+ counts,
79705
+ bodySamples,
79706
+ headerSamples,
79707
+ footerSamples
79708
+ })}`
79709
+ );
79710
+ }
79576
79711
  }
79577
79712
  /**
79578
79713
  * Finds the index entry whose position range contains the given position.
@@ -79822,82 +79957,6 @@ ${l}
79822
79957
  _observer = /* @__PURE__ */ new WeakMap();
79823
79958
  _rebuildScheduled = /* @__PURE__ */ new WeakMap();
79824
79959
  _rebuildRafId = /* @__PURE__ */ new WeakMap();
79825
- const DEFAULT_CONFIG = {
79826
- logLevel: "off",
79827
- hud: false
79828
- };
79829
- const levelOrder = {
79830
- error: 0,
79831
- warn: 1,
79832
- info: 2,
79833
- verbose: 3
79834
- };
79835
- function getSelectionDebugConfig() {
79836
- var _a2;
79837
- if (typeof window === "undefined") {
79838
- return DEFAULT_CONFIG;
79839
- }
79840
- window.superdocDebug ?? (window.superdocDebug = {});
79841
- (_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
79842
- const cfg = window.superdocDebug.selection;
79843
- return {
79844
- logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
79845
- hud: cfg.hud ?? DEFAULT_CONFIG.hud
79846
- };
79847
- }
79848
- function debugLog(level, message, data) {
79849
- const cfg = getSelectionDebugConfig();
79850
- if (cfg.logLevel === "off") return;
79851
- if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
79852
- const prefix2 = "[Selection]";
79853
- if (data) {
79854
- console.log(prefix2, message, data);
79855
- } else {
79856
- console.log(prefix2, message);
79857
- }
79858
- }
79859
- const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
79860
- function updateSelectionDebugHud(host, state2) {
79861
- const cfg = getSelectionDebugConfig();
79862
- const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
79863
- if (!doc2) return;
79864
- const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
79865
- if (!cfg.hud) {
79866
- existing?.remove();
79867
- return;
79868
- }
79869
- const hud = existing ?? doc2.createElement("div");
79870
- hud.setAttribute(HUD_DATA_ATTR, "true");
79871
- hud.style.position = "absolute";
79872
- hud.style.top = "8px";
79873
- hud.style.left = "8px";
79874
- hud.style.zIndex = "9999";
79875
- hud.style.maxWidth = "420px";
79876
- hud.style.padding = "6px 8px";
79877
- hud.style.borderRadius = "6px";
79878
- hud.style.background = "rgba(0, 0, 0, 0.72)";
79879
- hud.style.color = "white";
79880
- hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
79881
- hud.style.fontSize = "12px";
79882
- hud.style.lineHeight = "1.3";
79883
- hud.style.pointerEvents = "none";
79884
- hud.style.whiteSpace = "pre";
79885
- const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
79886
- const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
79887
- const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
79888
- state2.lastPointer.y
79889
- )}` : "null";
79890
- const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
79891
- hud.textContent = [
79892
- `docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
79893
- `selection=${selectionText}`,
79894
- `pointer=${pointerText}`,
79895
- `hit=${hitText}`
79896
- ].join("\n");
79897
- if (!existing) {
79898
- host.appendChild(hud);
79899
- }
79900
- }
79901
79960
  function computeSelectionRectsFromDom(options, from2, to) {
79902
79961
  const painterHost = options.painterHost;
79903
79962
  if (!painterHost) return null;
@@ -79918,6 +79977,34 @@ ${l}
79918
79977
  );
79919
79978
  const out = [];
79920
79979
  let rebuiltOnce = false;
79980
+ const debugConfig = getSelectionDebugConfig();
79981
+ const isVerbose = debugConfig.logLevel === "verbose";
79982
+ const dumpRects = isVerbose && debugConfig.dumpRects;
79983
+ const disableRectDedupe = debugConfig.disableRectDedupe;
79984
+ const entryDebugInfo = (entry) => {
79985
+ const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
79986
+ const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
79987
+ return {
79988
+ pmStart: entry.pmStart,
79989
+ pmEnd: entry.pmEnd,
79990
+ pageIndex: pageEl?.dataset.pageIndex ?? null,
79991
+ section,
79992
+ connected: entry.el.isConnected,
79993
+ layoutEpoch: entry.el.dataset.layoutEpoch ?? null,
79994
+ pageEpoch: pageEl?.dataset.layoutEpoch ?? null,
79995
+ text: (entry.el.textContent ?? "").slice(0, 80)
79996
+ };
79997
+ };
79998
+ const rectDebugInfo = (rect) => ({
79999
+ x: rect.x,
80000
+ y: rect.y,
80001
+ width: rect.width,
80002
+ height: rect.height,
80003
+ top: rect.top,
80004
+ left: rect.left,
80005
+ right: rect.right,
80006
+ bottom: rect.bottom
80007
+ });
79921
80008
  for (const pageEl of pageEls) {
79922
80009
  const pageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
79923
80010
  if (!Number.isFinite(pageIndex)) continue;
@@ -79941,9 +80028,47 @@ ${l}
79941
80028
  if (sliceEntries.length === 0) {
79942
80029
  continue;
79943
80030
  }
80031
+ if (isVerbose) {
80032
+ debugLog(
80033
+ "verbose",
80034
+ `DOM selection rects: slice entries ${JSON.stringify({
80035
+ pageIndex,
80036
+ sliceFrom,
80037
+ sliceTo,
80038
+ entriesCount: sliceEntries.length,
80039
+ entriesPreview: sliceEntries.slice(0, 20).map(entryDebugInfo)
80040
+ })}`
80041
+ );
80042
+ }
79944
80043
  let startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
79945
80044
  let endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
79946
- if (!pageEl.contains(startEntry.el) || !pageEl.contains(endEntry.el)) {
80045
+ if (isVerbose) {
80046
+ debugLog(
80047
+ "verbose",
80048
+ `DOM selection rects: boundaries ${JSON.stringify({
80049
+ pageIndex,
80050
+ sliceFrom,
80051
+ sliceTo,
80052
+ start: entryDebugInfo(startEntry),
80053
+ end: entryDebugInfo(endEntry)
80054
+ })}`
80055
+ );
80056
+ }
80057
+ let startContained = pageEl.contains(startEntry.el);
80058
+ let endContained = pageEl.contains(endEntry.el);
80059
+ if (!startContained || !endContained) {
80060
+ if (isVerbose) {
80061
+ debugLog(
80062
+ "verbose",
80063
+ `DOM selection rects: boundary containment ${JSON.stringify({
80064
+ pageIndex,
80065
+ sliceFrom,
80066
+ sliceTo,
80067
+ startContained,
80068
+ endContained
80069
+ })}`
80070
+ );
80071
+ }
79947
80072
  if (!rebuiltOnce) {
79948
80073
  options.rebuildDomPositionIndex();
79949
80074
  rebuiltOnce = true;
@@ -79951,9 +80076,34 @@ ${l}
79951
80076
  if (sliceEntries.length === 0) continue;
79952
80077
  startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
79953
80078
  endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
80079
+ startContained = pageEl.contains(startEntry.el);
80080
+ endContained = pageEl.contains(endEntry.el);
80081
+ if (isVerbose) {
80082
+ debugLog(
80083
+ "verbose",
80084
+ `DOM selection rects: boundary containment after rebuild ${JSON.stringify({
80085
+ pageIndex,
80086
+ sliceFrom,
80087
+ sliceTo,
80088
+ startContained,
80089
+ endContained,
80090
+ start: entryDebugInfo(startEntry),
80091
+ end: entryDebugInfo(endEntry)
80092
+ })}`
80093
+ );
80094
+ }
79954
80095
  }
79955
- if (!pageEl.contains(startEntry.el) || !pageEl.contains(endEntry.el)) {
79956
- debugLog("warn", "DOM selection rects: stale index after rebuild", { pageIndex, sliceFrom, sliceTo });
80096
+ if (!startContained || !endContained) {
80097
+ debugLog(
80098
+ "warn",
80099
+ `DOM selection rects: stale index after rebuild ${JSON.stringify({
80100
+ pageIndex,
80101
+ sliceFrom,
80102
+ sliceTo,
80103
+ start: entryDebugInfo(startEntry),
80104
+ end: entryDebugInfo(endEntry)
80105
+ })}`
80106
+ );
79957
80107
  return null;
79958
80108
  }
79959
80109
  }
@@ -79968,8 +80118,83 @@ ${l}
79968
80118
  }
79969
80119
  let clientRects = [];
79970
80120
  try {
79971
- const rawRects = Array.from(range2.getClientRects());
79972
- clientRects = deduplicateOverlappingRects(rawRects);
80121
+ let rawRects = Array.from(range2.getClientRects());
80122
+ if (dumpRects) {
80123
+ debugLog(
80124
+ "verbose",
80125
+ `DOM selection rects: raw rects ${JSON.stringify({
80126
+ pageIndex,
80127
+ sliceFrom,
80128
+ sliceTo,
80129
+ rects: rawRects.map(rectDebugInfo)
80130
+ })}`
80131
+ );
80132
+ }
80133
+ let missingEntries = null;
80134
+ if (typeof range2.intersectsNode === "function") {
80135
+ for (const entry of sliceEntries) {
80136
+ try {
80137
+ if (!range2.intersectsNode(entry.el)) {
80138
+ missingEntries ?? (missingEntries = []);
80139
+ missingEntries.push(entry);
80140
+ }
80141
+ } catch {
80142
+ }
80143
+ }
80144
+ }
80145
+ if (missingEntries && missingEntries.length > 0) {
80146
+ if (isVerbose) {
80147
+ debugLog(
80148
+ "verbose",
80149
+ `DOM selection rects: range missing entries ${JSON.stringify({
80150
+ pageIndex,
80151
+ sliceFrom,
80152
+ sliceTo,
80153
+ missingCount: missingEntries.length,
80154
+ missingPreview: missingEntries.slice(0, 20).map(entryDebugInfo)
80155
+ })}`
80156
+ );
80157
+ }
80158
+ rawRects = collectClientRectsByLine(doc2, sliceEntries, sliceFrom, sliceTo);
80159
+ if (dumpRects) {
80160
+ debugLog(
80161
+ "verbose",
80162
+ `DOM selection rects: fallback raw rects ${JSON.stringify({
80163
+ pageIndex,
80164
+ sliceFrom,
80165
+ sliceTo,
80166
+ rects: rawRects.map(rectDebugInfo)
80167
+ })}`
80168
+ );
80169
+ }
80170
+ }
80171
+ clientRects = disableRectDedupe ? rawRects : deduplicateOverlappingRects(rawRects);
80172
+ if (dumpRects) {
80173
+ debugLog(
80174
+ "verbose",
80175
+ `DOM selection rects: final rects ${JSON.stringify({
80176
+ pageIndex,
80177
+ sliceFrom,
80178
+ sliceTo,
80179
+ dedupeDisabled: disableRectDedupe,
80180
+ rects: clientRects.map(rectDebugInfo)
80181
+ })}`
80182
+ );
80183
+ const nonPositive = clientRects.filter(
80184
+ (rect) => !Number.isFinite(rect.width) || !Number.isFinite(rect.height) || rect.width <= 0 || rect.height <= 0
80185
+ );
80186
+ if (nonPositive.length > 0) {
80187
+ debugLog(
80188
+ "verbose",
80189
+ `DOM selection rects: non-positive rects ${JSON.stringify({
80190
+ pageIndex,
80191
+ sliceFrom,
80192
+ sliceTo,
80193
+ rects: nonPositive.map(rectDebugInfo)
80194
+ })}`
80195
+ );
80196
+ }
80197
+ }
79973
80198
  } catch (error) {
79974
80199
  debugLog("warn", "DOM selection rects: getClientRects failed", { error: String(error) });
79975
80200
  return null;
@@ -79993,6 +80218,57 @@ ${l}
79993
80218
  }
79994
80219
  return out;
79995
80220
  }
80221
+ function collectClientRectsByLine(doc2, entries, sliceFrom, sliceTo) {
80222
+ const rects = [];
80223
+ const lineMap = /* @__PURE__ */ new Map();
80224
+ const looseEntries = [];
80225
+ for (const entry of entries) {
80226
+ const lineEl = entry.el.closest(".superdoc-line");
80227
+ if (!lineEl) {
80228
+ looseEntries.push(entry);
80229
+ continue;
80230
+ }
80231
+ const list2 = lineMap.get(lineEl);
80232
+ if (list2) {
80233
+ list2.push(entry);
80234
+ } else {
80235
+ lineMap.set(lineEl, [entry]);
80236
+ }
80237
+ }
80238
+ for (const [, lineEntries] of lineMap) {
80239
+ lineEntries.sort((a2, b2) => a2.pmStart - b2.pmStart !== 0 ? a2.pmStart - b2.pmStart : a2.pmEnd - b2.pmEnd);
80240
+ const linePmStart = lineEntries[0]?.pmStart ?? Infinity;
80241
+ const linePmEnd = lineEntries[lineEntries.length - 1]?.pmEnd ?? -Infinity;
80242
+ if (!Number.isFinite(linePmStart) || !Number.isFinite(linePmEnd) || linePmEnd <= linePmStart) continue;
80243
+ const lineFrom = Math.max(sliceFrom, linePmStart);
80244
+ const lineTo = Math.min(sliceTo, linePmEnd);
80245
+ if (lineFrom >= lineTo) continue;
80246
+ const startEntry = lineEntries.find((entry) => lineFrom >= entry.pmStart && lineFrom <= entry.pmEnd) ?? lineEntries[0];
80247
+ const endEntry = lineEntries.find((entry) => lineTo >= entry.pmStart && lineTo <= entry.pmEnd) ?? lineEntries[lineEntries.length - 1];
80248
+ const range2 = doc2.createRange();
80249
+ try {
80250
+ if (!setDomRangeStart(range2, startEntry, lineFrom)) continue;
80251
+ if (!setDomRangeEnd(range2, endEntry, lineTo)) continue;
80252
+ } catch {
80253
+ continue;
80254
+ }
80255
+ rects.push(...Array.from(range2.getClientRects()));
80256
+ }
80257
+ for (const entry of looseEntries) {
80258
+ const entryFrom = Math.max(sliceFrom, entry.pmStart);
80259
+ const entryTo = Math.min(sliceTo, entry.pmEnd);
80260
+ if (entryFrom >= entryTo) continue;
80261
+ const range2 = doc2.createRange();
80262
+ try {
80263
+ if (!setDomRangeStart(range2, entry, entryFrom)) continue;
80264
+ if (!setDomRangeEnd(range2, entry, entryTo)) continue;
80265
+ } catch {
80266
+ continue;
80267
+ }
80268
+ rects.push(...Array.from(range2.getClientRects()));
80269
+ }
80270
+ return rects;
80271
+ }
79996
80272
  function setDomRangeStart(range2, entry, pos) {
79997
80273
  const el = entry.el;
79998
80274
  const pmStart = entry.pmStart;
@@ -80102,31 +80378,69 @@ ${l}
80102
80378
  return a2.x - b2.x;
80103
80379
  });
80104
80380
  const result = [];
80105
- let i2 = 0;
80106
- while (i2 < sorted.length) {
80107
- const current = sorted[i2];
80108
- let best = current;
80109
- let j2 = i2 + 1;
80110
- while (j2 < sorted.length) {
80111
- const next2 = sorted[j2];
80112
- const yOverlap = Math.abs(next2.y - current.y) < Y_SAME_LINE_THRESHOLD_PX;
80113
- const xOverlapStart = Math.max(current.x, next2.x);
80114
- const xOverlapEnd = Math.min(current.x + current.width, next2.x + next2.width);
80115
- const hasHorizontalOverlap = xOverlapEnd > xOverlapStart;
80116
- const overlapWidth = Math.max(0, xOverlapEnd - xOverlapStart);
80117
- const minWidth = Math.min(current.width, next2.width);
80118
- const significantOverlap = minWidth > 0 && overlapWidth / minWidth > HORIZONTAL_OVERLAP_THRESHOLD;
80119
- if (yOverlap && hasHorizontalOverlap && significantOverlap) {
80120
- if (next2.height < best.height) {
80121
- best = next2;
80122
- }
80123
- j2++;
80124
- } else {
80125
- break;
80381
+ const groups = [];
80382
+ let currentGroup = [];
80383
+ for (const rect of sorted) {
80384
+ if (currentGroup.length === 0) {
80385
+ currentGroup.push(rect);
80386
+ continue;
80387
+ }
80388
+ const groupY = currentGroup[0].y;
80389
+ if (Math.abs(rect.y - groupY) <= Y_SAME_LINE_THRESHOLD_PX) {
80390
+ currentGroup.push(rect);
80391
+ } else {
80392
+ groups.push(currentGroup);
80393
+ currentGroup = [rect];
80394
+ }
80395
+ }
80396
+ if (currentGroup.length > 0) {
80397
+ groups.push(currentGroup);
80398
+ }
80399
+ const SIZE_EPS_PX = 0.5;
80400
+ const X_DUPLICATE_EPS_PX = 1;
80401
+ const hasSignificantOverlap = (a2, b2) => {
80402
+ const xOverlapStart = Math.max(a2.x, b2.x);
80403
+ const xOverlapEnd = Math.min(a2.x + a2.width, b2.x + b2.width);
80404
+ const hasHorizontalOverlap = xOverlapEnd > xOverlapStart;
80405
+ if (!hasHorizontalOverlap) return false;
80406
+ const overlapWidth = Math.max(0, xOverlapEnd - xOverlapStart);
80407
+ const minWidth = Math.min(a2.width, b2.width);
80408
+ return minWidth > 0 && overlapWidth / minWidth > HORIZONTAL_OVERLAP_THRESHOLD;
80409
+ };
80410
+ const isLargerRect = (a2, b2) => {
80411
+ return a2.width > b2.width + SIZE_EPS_PX || a2.height > b2.height + SIZE_EPS_PX;
80412
+ };
80413
+ for (const group of groups) {
80414
+ const unique2 = [];
80415
+ for (const rect of group) {
80416
+ const isDuplicate = unique2.some((existing) => {
80417
+ const xClose = Math.abs(existing.x - rect.x) <= X_DUPLICATE_EPS_PX;
80418
+ const yClose = Math.abs(existing.y - rect.y) <= Y_SAME_LINE_THRESHOLD_PX;
80419
+ const widthClose = Math.abs(existing.width - rect.width) <= SIZE_EPS_PX;
80420
+ const heightClose = Math.abs(existing.height - rect.height) <= SIZE_EPS_PX;
80421
+ return xClose && yClose && widthClose && heightClose;
80422
+ });
80423
+ if (!isDuplicate) {
80424
+ unique2.push(rect);
80126
80425
  }
80127
80426
  }
80128
- result.push(best);
80129
- i2 = j2;
80427
+ if (unique2.length <= 1) {
80428
+ result.push(...unique2);
80429
+ continue;
80430
+ }
80431
+ const containers = /* @__PURE__ */ new Set();
80432
+ for (const rect of unique2) {
80433
+ for (const other of unique2) {
80434
+ if (rect === other) continue;
80435
+ if (!hasSignificantOverlap(rect, other)) continue;
80436
+ if (isLargerRect(rect, other)) {
80437
+ containers.add(rect);
80438
+ break;
80439
+ }
80440
+ }
80441
+ }
80442
+ const filtered = unique2.filter((rect) => !containers.has(rect));
80443
+ result.push(...filtered.length > 0 ? filtered : unique2);
80130
80444
  }
80131
80445
  return result;
80132
80446
  }
@@ -80250,10 +80564,11 @@ ${l}
80250
80564
  function createHiddenHost(doc2, widthPx) {
80251
80565
  const host = doc2.createElement("div");
80252
80566
  host.className = "presentation-editor__hidden-host";
80253
- host.style.position = "absolute";
80567
+ host.style.position = "fixed";
80254
80568
  host.style.left = "-9999px";
80255
80569
  host.style.top = "0";
80256
80570
  host.style.width = `${widthPx}px`;
80571
+ host.style.setProperty("overflow-anchor", "none");
80257
80572
  host.style.pointerEvents = "none";
80258
80573
  host.style.opacity = "0";
80259
80574
  host.style.zIndex = "-1";
@@ -80727,7 +81042,8 @@ ${l}
80727
81042
  });
80728
81043
  let hitChain = [];
80729
81044
  const doc2 = document;
80730
- if (typeof doc2.elementsFromPoint === "function") {
81045
+ const hasElementsFromPoint = typeof doc2.elementsFromPoint === "function";
81046
+ if (hasElementsFromPoint) {
80731
81047
  try {
80732
81048
  hitChain = doc2.elementsFromPoint(viewX, viewY) ?? [];
80733
81049
  } catch {
@@ -80773,11 +81089,14 @@ ${l}
80773
81089
  log("All fragments on page:", JSON.stringify(fragmentData, null, 2));
80774
81090
  const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.fragment));
80775
81091
  if (!fragmentEl) {
81092
+ if (hasElementsFromPoint) {
81093
+ return null;
81094
+ }
80776
81095
  const fallbackFragment = pageEl.querySelector(`.${CLASS_NAMES.fragment}`);
80777
81096
  if (!fallbackFragment) {
80778
81097
  return null;
80779
81098
  }
80780
- log("Using fallback fragment:", {
81099
+ log("Using fallback fragment (no elementsFromPoint):", {
80781
81100
  blockId: fallbackFragment.dataset.blockId,
80782
81101
  pmStart: fallbackFragment.dataset.pmStart,
80783
81102
  pmEnd: fallbackFragment.dataset.pmEnd
@@ -99584,7 +99903,7 @@ ${l}
99584
99903
  }
99585
99904
  }
99586
99905
  }
99587
- editorDom2.focus({ preventScroll: true });
99906
+ editorDom2.focus();
99588
99907
  __privateGet$1(this, _editor3).view?.focus();
99589
99908
  __privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
99590
99909
  return;
@@ -99651,7 +99970,7 @@ ${l}
99651
99970
  }
99652
99971
  }
99653
99972
  }
99654
- editorDom2.focus({ preventScroll: true });
99973
+ editorDom2.focus();
99655
99974
  __privateGet$1(this, _editor3).view?.focus();
99656
99975
  __privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
99657
99976
  }
@@ -99774,7 +100093,7 @@ ${l}
99774
100093
  }
99775
100094
  const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
99776
100095
  if (editorDom2) {
99777
- editorDom2.focus({ preventScroll: true });
100096
+ editorDom2.focus();
99778
100097
  __privateGet$1(this, _editor3).view?.focus();
99779
100098
  }
99780
100099
  return;
@@ -99807,6 +100126,25 @@ ${l}
99807
100126
  } else {
99808
100127
  __privateSet(this, _dragExtensionMode, "char");
99809
100128
  }
100129
+ debugLog(
100130
+ "verbose",
100131
+ `Drag selection start ${JSON.stringify({
100132
+ pointer: { clientX: event.clientX, clientY: event.clientY, x: x2, y: y2 },
100133
+ clickDepth,
100134
+ extensionMode: __privateGet$1(this, _dragExtensionMode),
100135
+ anchor: __privateGet$1(this, _dragAnchor),
100136
+ anchorPageIndex: __privateGet$1(this, _dragAnchorPageIndex),
100137
+ rawHit: rawHit ? {
100138
+ pos: rawHit.pos,
100139
+ pageIndex: rawHit.pageIndex,
100140
+ blockId: rawHit.blockId,
100141
+ lineIndex: rawHit.lineIndex,
100142
+ layoutEpoch: rawHit.layoutEpoch
100143
+ } : null,
100144
+ mapped: mapped ? mapped.ok ? { ok: true, pos: mapped.pos, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : { ok: false, reason: mapped.reason, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : null,
100145
+ hit: hit ? { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch } : null
100146
+ })}`
100147
+ );
99810
100148
  if (typeof __privateGet$1(this, _viewportHost).setPointerCapture === "function") {
99811
100149
  __privateGet$1(this, _viewportHost).setPointerCapture(event.pointerId);
99812
100150
  }
@@ -99834,7 +100172,7 @@ ${l}
99834
100172
  if (!editorDom) {
99835
100173
  return;
99836
100174
  }
99837
- editorDom.focus({ preventScroll: true });
100175
+ editorDom.focus();
99838
100176
  __privateGet$1(this, _editor3).view?.focus();
99839
100177
  });
99840
100178
  __privateAdd$1(this, _handlePointerMove, (event) => {
@@ -99843,6 +100181,8 @@ ${l}
99843
100181
  if (!normalized) return;
99844
100182
  if (__privateGet$1(this, _isDragging) && __privateGet$1(this, _dragAnchor) !== null && event.buttons & 1) {
99845
100183
  __privateSet(this, _pendingMarginClick, null);
100184
+ const prevPointer = __privateGet$1(this, _dragLastPointer);
100185
+ const prevRawHit = __privateGet$1(this, _dragLastRawHit);
99846
100186
  __privateSet(this, _dragLastPointer, { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y });
99847
100187
  const rawHit = clickToPosition(
99848
100188
  __privateGet$1(this, _layoutState).layout,
@@ -99854,7 +100194,17 @@ ${l}
99854
100194
  event.clientY,
99855
100195
  __privateGet$1(this, _pageGeometryHelper) ?? void 0
99856
100196
  );
99857
- if (!rawHit) return;
100197
+ if (!rawHit) {
100198
+ debugLog(
100199
+ "verbose",
100200
+ `Drag selection update (no hit) ${JSON.stringify({
100201
+ pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
100202
+ prevPointer,
100203
+ anchor: __privateGet$1(this, _dragAnchor)
100204
+ })}`
100205
+ );
100206
+ return;
100207
+ }
99858
100208
  const doc22 = __privateGet$1(this, _editor3).state?.doc;
99859
100209
  if (!doc22) return;
99860
100210
  __privateSet(this, _dragLastRawHit, rawHit);
@@ -99867,6 +100217,27 @@ ${l}
99867
100217
  const mappedHead = __privateGet$1(this, _epochMapper).mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1);
99868
100218
  if (!mappedHead.ok) {
99869
100219
  debugLog("warn", "drag mapping failed", mappedHead);
100220
+ debugLog(
100221
+ "verbose",
100222
+ `Drag selection update (map failed) ${JSON.stringify({
100223
+ pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
100224
+ prevPointer,
100225
+ anchor: __privateGet$1(this, _dragAnchor),
100226
+ rawHit: {
100227
+ pos: rawHit.pos,
100228
+ pageIndex: rawHit.pageIndex,
100229
+ blockId: rawHit.blockId,
100230
+ lineIndex: rawHit.lineIndex,
100231
+ layoutEpoch: rawHit.layoutEpoch
100232
+ },
100233
+ mapped: {
100234
+ ok: false,
100235
+ reason: mappedHead.reason,
100236
+ fromEpoch: mappedHead.fromEpoch,
100237
+ toEpoch: mappedHead.toEpoch
100238
+ }
100239
+ })}`
100240
+ );
99870
100241
  return;
99871
100242
  }
99872
100243
  const hit = {
@@ -99881,6 +100252,41 @@ ${l}
99881
100252
  mappedPos: hit.pos
99882
100253
  });
99883
100254
  __privateMethod$1(this, _PresentationEditor_instances, updateSelectionDebugHud_fn).call(this);
100255
+ const anchor = __privateGet$1(this, _dragAnchor);
100256
+ const head = hit.pos;
100257
+ const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
100258
+ debugLog(
100259
+ "verbose",
100260
+ `Drag selection update ${JSON.stringify({
100261
+ pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
100262
+ prevPointer,
100263
+ rawHit: {
100264
+ pos: rawHit.pos,
100265
+ pageIndex: rawHit.pageIndex,
100266
+ blockId: rawHit.blockId,
100267
+ lineIndex: rawHit.lineIndex,
100268
+ layoutEpoch: rawHit.layoutEpoch
100269
+ },
100270
+ prevRawHit: prevRawHit ? {
100271
+ pos: prevRawHit.pos,
100272
+ pageIndex: prevRawHit.pageIndex,
100273
+ blockId: prevRawHit.blockId,
100274
+ lineIndex: prevRawHit.lineIndex,
100275
+ layoutEpoch: prevRawHit.layoutEpoch
100276
+ } : null,
100277
+ mappedHead: { pos: mappedHead.pos, fromEpoch: mappedHead.fromEpoch, toEpoch: mappedHead.toEpoch },
100278
+ hit: { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch },
100279
+ anchor,
100280
+ head,
100281
+ selAnchor,
100282
+ selHead,
100283
+ direction: head >= anchor ? "down" : "up",
100284
+ selectionDirection: selHead >= selAnchor ? "down" : "up",
100285
+ extensionMode: __privateGet$1(this, _dragExtensionMode),
100286
+ hitSource: pageMounted ? "dom" : "geometry",
100287
+ pageMounted
100288
+ })}`
100289
+ );
99884
100290
  const currentTableHit = __privateMethod$1(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
99885
100291
  const shouldUseCellSel = __privateMethod$1(this, _PresentationEditor_instances, shouldUseCellSelection_fn).call(this, currentTableHit);
99886
100292
  if (shouldUseCellSel && __privateGet$1(this, _cellAnchor)) {
@@ -99915,9 +100321,6 @@ ${l}
99915
100321
  return;
99916
100322
  }
99917
100323
  }
99918
- const anchor = __privateGet$1(this, _dragAnchor);
99919
- const head = hit.pos;
99920
- const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
99921
100324
  try {
99922
100325
  const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
99923
100326
  __privateGet$1(this, _editor3).view?.dispatch(tr);
@@ -100312,6 +100715,7 @@ ${l}
100312
100715
  editorProps: normalizedEditorProps,
100313
100716
  documentMode: __privateGet$1(this, _documentMode)
100314
100717
  }));
100718
+ __privateMethod$1(this, _PresentationEditor_instances, wrapHiddenEditorFocus_fn).call(this);
100315
100719
  __privateGet$1(this, _editor3).presentationEditor = this;
100316
100720
  __privateGet$1(this, _editor3)._presentationEditor = this;
100317
100721
  __privateMethod$1(this, _PresentationEditor_instances, syncHiddenEditorA11yAttributes_fn).call(this);
@@ -101511,6 +101915,65 @@ ${l}
101511
101915
  _lastRemoteCursorRenderTime = /* @__PURE__ */ new WeakMap();
101512
101916
  _remoteCursorThrottleTimeout = /* @__PURE__ */ new WeakMap();
101513
101917
  _PresentationEditor_instances = /* @__PURE__ */ new WeakSet();
101918
+ wrapHiddenEditorFocus_fn = function() {
101919
+ const view = __privateGet$1(this, _editor3)?.view;
101920
+ if (!view || !view.dom || typeof view.focus !== "function") {
101921
+ return;
101922
+ }
101923
+ const viewWithFlag = view;
101924
+ if (viewWithFlag.__sdPreventScrollFocus) {
101925
+ return;
101926
+ }
101927
+ const focusFn = view.focus;
101928
+ if (focusFn.mock) {
101929
+ return;
101930
+ }
101931
+ viewWithFlag.__sdPreventScrollFocus = true;
101932
+ const originalFocus = view.focus.bind(view);
101933
+ view.focus = () => {
101934
+ const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView;
101935
+ if (!win) {
101936
+ originalFocus();
101937
+ return;
101938
+ }
101939
+ const beforeX = win.scrollX;
101940
+ const beforeY = win.scrollY;
101941
+ let focused = false;
101942
+ try {
101943
+ view.dom.focus({ preventScroll: true });
101944
+ focused = true;
101945
+ } catch (error) {
101946
+ debugLog("warn", "Hidden editor focus: preventScroll failed", {
101947
+ error: String(error),
101948
+ strategy: "preventScroll"
101949
+ });
101950
+ }
101951
+ if (!focused) {
101952
+ try {
101953
+ view.dom.focus();
101954
+ focused = true;
101955
+ } catch (error) {
101956
+ debugLog("warn", "Hidden editor focus: standard focus failed", {
101957
+ error: String(error),
101958
+ strategy: "standard"
101959
+ });
101960
+ }
101961
+ }
101962
+ if (!focused) {
101963
+ try {
101964
+ originalFocus();
101965
+ } catch (error) {
101966
+ debugLog("error", "Hidden editor focus: all strategies failed", {
101967
+ error: String(error),
101968
+ strategy: "original"
101969
+ });
101970
+ }
101971
+ }
101972
+ if (win.scrollX !== beforeX || win.scrollY !== beforeY) {
101973
+ win.scrollTo(beforeX, beforeY);
101974
+ }
101975
+ };
101976
+ };
101514
101977
  collectCommentPositions_fn = function() {
101515
101978
  return collectCommentPositions(__privateGet$1(this, _editor3)?.state?.doc ?? null, {
101516
101979
  commentMarkName: CommentMarkName,
@@ -101912,7 +102375,7 @@ ${l}
101912
102375
  }
101913
102376
  const editorDom = __privateGet$1(this, _editor3).view?.dom;
101914
102377
  if (editorDom) {
101915
- editorDom.focus({ preventScroll: true });
102378
+ editorDom.focus();
101916
102379
  __privateGet$1(this, _editor3).view?.focus();
101917
102380
  }
101918
102381
  };
@@ -155902,7 +156365,7 @@ ${style2}
155902
156365
  this.config.colors = shuffleArray(this.config.colors);
155903
156366
  this.userColorMap = /* @__PURE__ */ new Map();
155904
156367
  this.colorIndex = 0;
155905
- this.version = "1.0.0-next.11";
156368
+ this.version = "1.0.0-next.12";
155906
156369
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
155907
156370
  this.superdocId = config2.superdocId || v4();
155908
156371
  this.colors = this.config.colors;
@@ -158375,7 +158838,7 @@ ${style2}
158375
158838
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
158376
158839
  );
158377
158840
  }
158378
- const indexC5orVGCQ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
158841
+ const indexLMJbwm6b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
158379
158842
  __proto__: null,
158380
158843
  unified
158381
158844
  }, Symbol.toStringTag, { value: "Module" }));