@harbour-enterprises/superdoc 1.0.0-beta.30 → 1.0.0-beta.31

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-BADCvUNL.cjs → PdfViewer-C8iiBtQt.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-C2nY5qD8.es.js → PdfViewer-jGctuklH.es.js} +1 -1
  3. package/dist/chunks/{index-DmelLGEj.es.js → index-Bu5UUj9S.es.js} +3 -3
  4. package/dist/chunks/{index-DTgPk1zO.cjs → index-ELjoBC86.cjs} +3 -3
  5. package/dist/chunks/{index-DUzV7kkk-CM3uwGCb.cjs → index-eG-VYUeN-CG3M1n5T.cjs} +1 -1
  6. package/dist/chunks/{index-DUzV7kkk-BvBMF_lo.es.js → index-eG-VYUeN-CIuOnW8W.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-Be9785LD.es.js → super-editor.es-BAKZgAuj.es.js} +424 -52
  8. package/dist/chunks/{super-editor.es-463G9jKM.cjs → super-editor.es-DatOA_vA.cjs} +424 -52
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-U59bT3FO.js → converter-CRKt1TG_.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-DSnoGkju.js → docx-zipper-CgVw58T-.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-DRHVtMIR.js → editor-COQCS1pn.js} +423 -37
  13. package/dist/super-editor/chunks/{index-DUzV7kkk.js → index-eG-VYUeN.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-DbBLxo6N.js → toolbar-B3CSV2yT.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 +410 -38
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -9340,14 +9340,14 @@ function requireSax() {
9340
9340
  var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
9341
9341
  var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
9342
9342
  var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
9343
- function isWhitespace(c2) {
9343
+ function isWhitespace2(c2) {
9344
9344
  return c2 === " " || c2 === "\n" || c2 === "\r" || c2 === " ";
9345
9345
  }
9346
9346
  function isQuote(c2) {
9347
9347
  return c2 === '"' || c2 === "'";
9348
9348
  }
9349
9349
  function isAttribEnd(c2) {
9350
- return c2 === ">" || isWhitespace(c2);
9350
+ return c2 === ">" || isWhitespace2(c2);
9351
9351
  }
9352
9352
  function isMatch(regex, c2) {
9353
9353
  return regex.test(c2);
@@ -9972,7 +9972,7 @@ function requireSax() {
9972
9972
  if (c2 === "<") {
9973
9973
  parser.state = S2.OPEN_WAKA;
9974
9974
  parser.startTagPosition = parser.position;
9975
- } else if (!isWhitespace(c2)) {
9975
+ } else if (!isWhitespace2(c2)) {
9976
9976
  strictFail(parser, "Non-whitespace before first tag.");
9977
9977
  parser.textNode = c2;
9978
9978
  parser.state = S2.TEXT;
@@ -10051,7 +10051,7 @@ function requireSax() {
10051
10051
  parser.state = S2.OPEN_WAKA;
10052
10052
  parser.startTagPosition = parser.position;
10053
10053
  } else {
10054
- if (!isWhitespace(c2) && (!parser.sawRoot || parser.closedRoot)) {
10054
+ if (!isWhitespace2(c2) && (!parser.sawRoot || parser.closedRoot)) {
10055
10055
  strictFail(parser, "Text data outside of root node.");
10056
10056
  }
10057
10057
  if (c2 === "&") {
@@ -10080,7 +10080,7 @@ function requireSax() {
10080
10080
  if (c2 === "!") {
10081
10081
  parser.state = S2.SGML_DECL;
10082
10082
  parser.sgmlDecl = "";
10083
- } else if (isWhitespace(c2)) ;
10083
+ } else if (isWhitespace2(c2)) ;
10084
10084
  else if (isMatch(nameStart, c2)) {
10085
10085
  parser.state = S2.OPEN_TAG;
10086
10086
  parser.tagName = c2;
@@ -10264,14 +10264,14 @@ function requireSax() {
10264
10264
  case S2.PROC_INST:
10265
10265
  if (c2 === "?") {
10266
10266
  parser.state = S2.PROC_INST_ENDING;
10267
- } else if (isWhitespace(c2)) {
10267
+ } else if (isWhitespace2(c2)) {
10268
10268
  parser.state = S2.PROC_INST_BODY;
10269
10269
  } else {
10270
10270
  parser.procInstName += c2;
10271
10271
  }
10272
10272
  continue;
10273
10273
  case S2.PROC_INST_BODY:
10274
- if (!parser.procInstBody && isWhitespace(c2)) {
10274
+ if (!parser.procInstBody && isWhitespace2(c2)) {
10275
10275
  continue;
10276
10276
  } else if (c2 === "?") {
10277
10277
  parser.state = S2.PROC_INST_ENDING;
@@ -10302,7 +10302,7 @@ function requireSax() {
10302
10302
  } else if (c2 === "/") {
10303
10303
  parser.state = S2.OPEN_TAG_SLASH;
10304
10304
  } else {
10305
- if (!isWhitespace(c2)) {
10305
+ if (!isWhitespace2(c2)) {
10306
10306
  strictFail(parser, "Invalid character in tag name");
10307
10307
  }
10308
10308
  parser.state = S2.ATTRIB;
@@ -10322,7 +10322,7 @@ function requireSax() {
10322
10322
  }
10323
10323
  continue;
10324
10324
  case S2.ATTRIB:
10325
- if (isWhitespace(c2)) {
10325
+ if (isWhitespace2(c2)) {
10326
10326
  continue;
10327
10327
  } else if (c2 === ">") {
10328
10328
  openTag(parser);
@@ -10344,7 +10344,7 @@ function requireSax() {
10344
10344
  parser.attribValue = parser.attribName;
10345
10345
  attrib(parser);
10346
10346
  openTag(parser);
10347
- } else if (isWhitespace(c2)) {
10347
+ } else if (isWhitespace2(c2)) {
10348
10348
  parser.state = S2.ATTRIB_NAME_SAW_WHITE;
10349
10349
  } else if (isMatch(nameBody, c2)) {
10350
10350
  parser.attribName += c2;
@@ -10355,7 +10355,7 @@ function requireSax() {
10355
10355
  case S2.ATTRIB_NAME_SAW_WHITE:
10356
10356
  if (c2 === "=") {
10357
10357
  parser.state = S2.ATTRIB_VALUE;
10358
- } else if (isWhitespace(c2)) {
10358
+ } else if (isWhitespace2(c2)) {
10359
10359
  continue;
10360
10360
  } else {
10361
10361
  strictFail(parser, "Attribute without value");
@@ -10378,7 +10378,7 @@ function requireSax() {
10378
10378
  }
10379
10379
  continue;
10380
10380
  case S2.ATTRIB_VALUE:
10381
- if (isWhitespace(c2)) {
10381
+ if (isWhitespace2(c2)) {
10382
10382
  continue;
10383
10383
  } else if (isQuote(c2)) {
10384
10384
  parser.q = c2;
@@ -10405,7 +10405,7 @@ function requireSax() {
10405
10405
  parser.state = S2.ATTRIB_VALUE_CLOSED;
10406
10406
  continue;
10407
10407
  case S2.ATTRIB_VALUE_CLOSED:
10408
- if (isWhitespace(c2)) {
10408
+ if (isWhitespace2(c2)) {
10409
10409
  parser.state = S2.ATTRIB;
10410
10410
  } else if (c2 === ">") {
10411
10411
  openTag(parser);
@@ -10438,7 +10438,7 @@ function requireSax() {
10438
10438
  continue;
10439
10439
  case S2.CLOSE_TAG:
10440
10440
  if (!parser.tagName) {
10441
- if (isWhitespace(c2)) {
10441
+ if (isWhitespace2(c2)) {
10442
10442
  continue;
10443
10443
  } else if (notMatch(nameStart, c2)) {
10444
10444
  if (parser.script) {
@@ -10459,14 +10459,14 @@ function requireSax() {
10459
10459
  parser.tagName = "";
10460
10460
  parser.state = S2.SCRIPT;
10461
10461
  } else {
10462
- if (!isWhitespace(c2)) {
10462
+ if (!isWhitespace2(c2)) {
10463
10463
  strictFail(parser, "Invalid tagname in closing tag");
10464
10464
  }
10465
10465
  parser.state = S2.CLOSE_TAG_SAW_WHITE;
10466
10466
  }
10467
10467
  continue;
10468
10468
  case S2.CLOSE_TAG_SAW_WHITE:
10469
- if (isWhitespace(c2)) {
10469
+ if (isWhitespace2(c2)) {
10470
10470
  continue;
10471
10471
  }
10472
10472
  if (c2 === ">") {
@@ -41858,7 +41858,7 @@ const _SuperConverter = class _SuperConverter2 {
41858
41858
  static getStoredSuperdocVersion(docx) {
41859
41859
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
41860
41860
  }
41861
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.30") {
41861
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.31") {
41862
41862
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
41863
41863
  }
41864
41864
  /**
@@ -45164,7 +45164,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
45164
45164
  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);
45165
45165
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
45166
45166
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
45167
- 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, _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, _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, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _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;
45167
+ 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, _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, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _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;
45168
45168
  var GOOD_LEAF_SIZE = 200;
45169
45169
  var RopeSequence = function RopeSequence2() {
45170
45170
  };
@@ -59031,7 +59031,7 @@ const isHeadless = (editor) => {
59031
59031
  const shouldSkipNodeView = (editor) => {
59032
59032
  return isHeadless(editor);
59033
59033
  };
59034
- const summaryVersion = "1.0.0-beta.30";
59034
+ const summaryVersion = "1.0.0-beta.31";
59035
59035
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59036
59036
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59037
59037
  function mapAttributes(attrs) {
@@ -59820,7 +59820,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
59820
59820
  { default: remarkStringify },
59821
59821
  { default: remarkGfm }
59822
59822
  ] = await Promise.all([
59823
- Promise.resolve().then(() => require("./index-DUzV7kkk-CM3uwGCb.cjs")),
59823
+ Promise.resolve().then(() => require("./index-eG-VYUeN-CG3M1n5T.cjs")),
59824
59824
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
59825
59825
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
59826
59826
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60025,7 +60025,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60025
60025
  * Process collaboration migrations
60026
60026
  */
60027
60027
  processCollaborationMigrations() {
60028
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.30");
60028
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.31");
60029
60029
  if (!this.options.ydoc) return;
60030
60030
  const metaMap = this.options.ydoc.getMap("meta");
60031
60031
  let docVersion = metaMap.get("version");
@@ -62062,9 +62062,11 @@ const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG
62062
62062
  case TRACK_INSERT_MARK:
62063
62063
  case TRACK_DELETE_MARK:
62064
62064
  case TRACK_FORMAT_MARK: {
62065
- const tracked = buildTrackedChangeMetaFromMark(mark);
62066
- if (tracked) {
62067
- run2.trackedChange = selectTrackedChangeMeta(run2.trackedChange, tracked);
62065
+ if (!isTabRun2) {
62066
+ const tracked = buildTrackedChangeMetaFromMark(mark);
62067
+ if (tracked) {
62068
+ run2.trackedChange = selectTrackedChangeMeta(run2.trackedChange, tracked);
62069
+ }
62068
62070
  }
62069
62071
  break;
62070
62072
  }
@@ -67604,6 +67606,38 @@ function measureCharacterXSegmentBased(block, line, charOffset, ctx2) {
67604
67606
  }
67605
67607
  return line.width;
67606
67608
  }
67609
+ function charOffsetToPm(block, line, charOffset, fallbackPmStart) {
67610
+ if (!Number.isFinite(charOffset) || !Number.isFinite(fallbackPmStart)) {
67611
+ console.warn("[charOffsetToPm] Invalid input:", { charOffset, fallbackPmStart });
67612
+ return fallbackPmStart;
67613
+ }
67614
+ const safeCharOffset = Math.max(0, charOffset);
67615
+ if (block.kind !== "paragraph") {
67616
+ return fallbackPmStart + safeCharOffset;
67617
+ }
67618
+ const runs = sliceRunsForLine$1(block, line);
67619
+ let cursor = 0;
67620
+ let lastPm = fallbackPmStart;
67621
+ for (const run2 of runs) {
67622
+ const isTab = isTabRun$1(run2);
67623
+ const text = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text ?? "";
67624
+ const runLength = isTab ? TAB_CHAR_LENGTH : text.length;
67625
+ const runPmStart = typeof run2.pmStart === "number" ? run2.pmStart : null;
67626
+ const runPmEnd = typeof run2.pmEnd === "number" ? run2.pmEnd : runPmStart != null ? runPmStart + runLength : null;
67627
+ if (runPmStart != null) {
67628
+ lastPm = runPmStart;
67629
+ }
67630
+ if (safeCharOffset <= cursor + runLength) {
67631
+ const offsetInRun = Math.max(0, safeCharOffset - cursor);
67632
+ return runPmStart != null ? runPmStart + Math.min(offsetInRun, runLength) : fallbackPmStart + safeCharOffset;
67633
+ }
67634
+ if (runPmEnd != null) {
67635
+ lastPm = runPmEnd;
67636
+ }
67637
+ cursor += runLength;
67638
+ }
67639
+ return lastPm;
67640
+ }
67607
67641
  function findCharacterAtX(block, line, x2, pmStart) {
67608
67642
  const ctx2 = getMeasurementContext();
67609
67643
  if (!ctx2) {
@@ -67618,9 +67652,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67618
67652
  );
67619
67653
  const ratio = Math.max(0, Math.min(1, x2 / line.width));
67620
67654
  const charOffset = Math.round(ratio * charsInLine);
67655
+ const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
67621
67656
  return {
67622
67657
  charOffset,
67623
- pmPosition: pmStart + charOffset
67658
+ pmPosition: pmPosition2
67624
67659
  };
67625
67660
  }
67626
67661
  const runs = sliceRunsForLine$1(block, line);
@@ -67636,11 +67671,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67636
67671
  const midpoint = startX + tabWidth / 2;
67637
67672
  const offsetInRun = safeX < midpoint ? 0 : TAB_CHAR_LENGTH;
67638
67673
  const charOffset = currentCharOffset + offsetInRun;
67639
- const pmBase = run2.pmStart ?? pmStart + currentCharOffset;
67640
- const pmPosition = pmBase + offsetInRun;
67674
+ const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
67641
67675
  return {
67642
67676
  charOffset,
67643
- pmPosition
67677
+ pmPosition: pmPosition2
67644
67678
  };
67645
67679
  }
67646
67680
  currentX = endX;
@@ -67657,9 +67691,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67657
67691
  const charX = currentX + measured2.width + computeLetterSpacingWidth(run2, i, runLength);
67658
67692
  if (charX >= safeX) {
67659
67693
  if (i === 0) {
67694
+ const pmPosition3 = charOffsetToPm(block, line, currentCharOffset, pmStart);
67660
67695
  return {
67661
67696
  charOffset: currentCharOffset,
67662
- pmPosition: pmStart + currentCharOffset
67697
+ pmPosition: pmPosition3
67663
67698
  };
67664
67699
  }
67665
67700
  const prevText = text.slice(0, i - 1);
@@ -67668,9 +67703,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67668
67703
  const distToPrev = Math.abs(safeX - prevX);
67669
67704
  const distToCurrent = Math.abs(safeX - charX);
67670
67705
  const charOffset = distToPrev < distToCurrent ? currentCharOffset + i - 1 : currentCharOffset + i;
67706
+ const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
67671
67707
  return {
67672
67708
  charOffset,
67673
- pmPosition: pmStart + charOffset
67709
+ pmPosition: pmPosition2
67674
67710
  };
67675
67711
  }
67676
67712
  }
@@ -67678,9 +67714,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67678
67714
  currentX += measured.width + computeLetterSpacingWidth(run2, runLength, runLength);
67679
67715
  currentCharOffset += runLength;
67680
67716
  }
67717
+ const pmPosition = charOffsetToPm(block, line, currentCharOffset, pmStart);
67681
67718
  return {
67682
67719
  charOffset: currentCharOffset,
67683
- pmPosition: pmStart + currentCharOffset
67720
+ pmPosition
67684
67721
  };
67685
67722
  }
67686
67723
  const computeLetterSpacingWidth = (run2, precedingChars, runLength) => {
@@ -67886,7 +67923,9 @@ function processFragment(fragmentEl, viewX, viewY) {
67886
67923
  pmEnd: spanEnd,
67887
67924
  text: targetEl.textContent?.substring(0, 30),
67888
67925
  visibility: targetEl.style.visibility,
67889
- rect: { left: targetRect.left, right: targetRect.right, width: targetRect.width }
67926
+ rect: { left: targetRect.left, right: targetRect.right, width: targetRect.width },
67927
+ pageX: viewX,
67928
+ pageY: viewY
67890
67929
  });
67891
67930
  if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd)) {
67892
67931
  return null;
@@ -71452,6 +71491,88 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
71452
71491
  }
71453
71492
  return result;
71454
71493
  }
71494
+ function findWordBoundaries(blocks, pos) {
71495
+ const blockInfo = findBlockAtPosition(blocks, pos);
71496
+ if (!blockInfo) return null;
71497
+ const { block, localPos } = blockInfo;
71498
+ if (block.kind !== "paragraph") return null;
71499
+ const { text, pmStart } = extractBlockText(block);
71500
+ if (text.length === 0) return null;
71501
+ const clampedPos = Math.max(0, Math.min(localPos, text.length));
71502
+ let wordStart = clampedPos;
71503
+ while (wordStart > 0 && isWordChar(text[wordStart - 1])) {
71504
+ wordStart--;
71505
+ }
71506
+ let wordEnd = clampedPos;
71507
+ while (wordEnd < text.length && isWordChar(text[wordEnd])) {
71508
+ wordEnd++;
71509
+ }
71510
+ if (wordStart === wordEnd) {
71511
+ while (wordStart > 0 && isWhitespace(text[wordStart - 1])) {
71512
+ wordStart--;
71513
+ }
71514
+ while (wordEnd < text.length && isWhitespace(text[wordEnd])) {
71515
+ wordEnd++;
71516
+ }
71517
+ if (wordStart === wordEnd) {
71518
+ return null;
71519
+ }
71520
+ }
71521
+ return {
71522
+ from: pmStart + wordStart,
71523
+ to: pmStart + wordEnd
71524
+ };
71525
+ }
71526
+ function findParagraphBoundaries(blocks, pos) {
71527
+ const blockInfo = findBlockAtPosition(blocks, pos);
71528
+ if (!blockInfo) return null;
71529
+ const { block } = blockInfo;
71530
+ if (block.kind === "paragraph") {
71531
+ const { pmStart, pmEnd } = extractBlockText(block);
71532
+ return { from: pmStart, to: pmEnd };
71533
+ }
71534
+ if (block.kind === "image") {
71535
+ return { from: pos, to: pos + 1 };
71536
+ }
71537
+ return null;
71538
+ }
71539
+ function extractBlockText(block) {
71540
+ if (block.kind !== "paragraph") {
71541
+ return { text: "", pmStart: 0, pmEnd: 0 };
71542
+ }
71543
+ let text = "";
71544
+ let pmStart = Infinity;
71545
+ let pmEnd = 0;
71546
+ for (const run2 of block.runs) {
71547
+ text += "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text;
71548
+ if (run2.pmStart !== void 0) {
71549
+ pmStart = Math.min(pmStart, run2.pmStart);
71550
+ }
71551
+ if (run2.pmEnd !== void 0) {
71552
+ pmEnd = Math.max(pmEnd, run2.pmEnd);
71553
+ }
71554
+ }
71555
+ if (pmStart === Infinity) pmStart = 0;
71556
+ if (pmEnd === 0 && text.length > 0) pmEnd = pmStart + text.length;
71557
+ return { text, pmStart, pmEnd };
71558
+ }
71559
+ function findBlockAtPosition(blocks, pos) {
71560
+ for (const block of blocks) {
71561
+ if (block.kind === "paragraph") {
71562
+ const { pmStart, pmEnd } = extractBlockText(block);
71563
+ if (pos >= pmStart && pos <= pmEnd) {
71564
+ return { block, localPos: pos - pmStart };
71565
+ }
71566
+ }
71567
+ }
71568
+ return null;
71569
+ }
71570
+ function isWordChar(char) {
71571
+ return /[\p{L}\p{N}_]/u.test(char);
71572
+ }
71573
+ function isWhitespace(char) {
71574
+ return /\s/.test(char);
71575
+ }
71455
71576
  let canvas = null;
71456
71577
  let ctx$1 = null;
71457
71578
  function getCtx() {
@@ -72245,6 +72366,12 @@ const isAtomicFragment = (fragment) => {
72245
72366
  };
72246
72367
  const logClickStage = (_level, _stage, _payload) => {
72247
72368
  };
72369
+ const logPositionDebug = (payload) => {
72370
+ return;
72371
+ };
72372
+ const logSelectionMapDebug = (payload) => {
72373
+ return;
72374
+ };
72248
72375
  const blockPmRangeFromAttrs = (block) => {
72249
72376
  const attrs = block?.attrs;
72250
72377
  const pmStart = typeof attrs?.pmStart === "number" ? attrs.pmStart : void 0;
@@ -72514,6 +72641,10 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
72514
72641
  return null;
72515
72642
  }
72516
72643
  const column = determineColumn(layout, fragment.x);
72644
+ logPositionDebug({
72645
+ blockId: fragment.blockId,
72646
+ x: pageRelativePoint.x - fragment.x
72647
+ });
72517
72648
  logClickStage("log", "success", {
72518
72649
  blockId: fragment.blockId
72519
72650
  });
@@ -72622,10 +72753,13 @@ function selectionToRects(layout, blocks, measures, from2, to) {
72622
72753
  const sliceFrom = Math.max(range2.pmStart, from2);
72623
72754
  const sliceTo = Math.min(range2.pmEnd, to);
72624
72755
  if (sliceFrom >= sliceTo) return;
72625
- const x1 = mapPmToX(block, line, sliceFrom - range2.pmStart, fragment.width);
72626
- const x2 = mapPmToX(block, line, sliceTo - range2.pmStart, fragment.width);
72627
- const rectX = fragment.x + Math.min(x1, x2);
72628
- const rectWidth = Math.max(1, Math.abs(x2 - x1));
72756
+ const charOffsetFrom = pmPosToCharOffset(block, line, sliceFrom);
72757
+ const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
72758
+ const startX = mapPmToX(block, line, charOffsetFrom, fragment.width);
72759
+ const endX = mapPmToX(block, line, charOffsetTo, fragment.width);
72760
+ const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
72761
+ const rectX = fragment.x + markerWidth + Math.min(startX, endX);
72762
+ const rectWidth = Math.max(1, Math.abs(endX - startX));
72629
72763
  const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
72630
72764
  const rectY = fragment.y + lineOffset;
72631
72765
  rects.push({
@@ -72783,6 +72917,57 @@ function computeLinePmRange$1(block, line) {
72783
72917
  }
72784
72918
  return { pmStart, pmEnd };
72785
72919
  }
72920
+ function pmPosToCharOffset(block, line, pmPos) {
72921
+ if (block.kind !== "paragraph") return 0;
72922
+ let charOffset = 0;
72923
+ for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
72924
+ const run2 = block.runs[runIndex];
72925
+ if (!run2) continue;
72926
+ const text = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text ?? "";
72927
+ const runTextLength = text.length;
72928
+ const runPmStart = run2.pmStart ?? null;
72929
+ const runPmEnd = run2.pmEnd ?? (runPmStart != null ? runPmStart + runTextLength : null);
72930
+ if (runPmStart == null || runPmEnd == null || runTextLength === 0) continue;
72931
+ const isFirstRun = runIndex === line.fromRun;
72932
+ const isLastRun = runIndex === line.toRun;
72933
+ const lineStartChar = isFirstRun ? line.fromChar : 0;
72934
+ const lineEndChar = isLastRun ? line.toChar : runTextLength;
72935
+ const runSliceCharCount = lineEndChar - lineStartChar;
72936
+ const runPmRange = runPmEnd - runPmStart;
72937
+ const runSlicePmStart = runPmStart + lineStartChar / runTextLength * runPmRange;
72938
+ const runSlicePmEnd = runPmStart + lineEndChar / runTextLength * runPmRange;
72939
+ if (pmPos >= runSlicePmStart && pmPos <= runSlicePmEnd) {
72940
+ const runSlicePmRange = runSlicePmEnd - runSlicePmStart;
72941
+ if (runSlicePmRange > 0) {
72942
+ const pmOffsetInSlice = pmPos - runSlicePmStart;
72943
+ const charOffsetInSlice = Math.round(pmOffsetInSlice / runSlicePmRange * runSliceCharCount);
72944
+ const result = charOffset + Math.min(charOffsetInSlice, runSliceCharCount);
72945
+ const runText2 = text;
72946
+ const offsetInRun = result - charOffset - (isFirstRun ? 0 : 0);
72947
+ logSelectionMapDebug({
72948
+ blockId: block.id,
72949
+ lineFromRun: line.fromRun,
72950
+ lineToRun: line.toRun,
72951
+ runTextPreview: runText2.slice(Math.max(0, offsetInRun - 10), Math.min(runText2.length, offsetInRun + 10))
72952
+ });
72953
+ return result;
72954
+ }
72955
+ logSelectionMapDebug({
72956
+ blockId: block.id
72957
+ });
72958
+ return charOffset;
72959
+ }
72960
+ if (pmPos > runSlicePmEnd) {
72961
+ charOffset += runSliceCharCount;
72962
+ }
72963
+ }
72964
+ logSelectionMapDebug({
72965
+ blockId: block.id,
72966
+ lineFromRun: line.fromRun,
72967
+ lineToRun: line.toRun
72968
+ });
72969
+ return charOffset;
72970
+ }
72786
72971
  const determineColumn = (layout, fragmentX) => {
72787
72972
  const columns = layout.columns;
72788
72973
  if (!columns || columns.count <= 1) return 0;
@@ -72827,8 +73012,8 @@ const mapPointToPm = (block, line, x2, isRTL) => {
72827
73012
  if (isRTL) {
72828
73013
  const charOffset = result.charOffset;
72829
73014
  const charsInLine = Math.max(1, line.toChar - line.fromChar);
72830
- const reversedOffset = charsInLine - charOffset;
72831
- return range2.pmStart + reversedOffset;
73015
+ const reversedOffset = Math.max(0, Math.min(charsInLine, charsInLine - charOffset));
73016
+ return charOffsetToPm(block, line, reversedOffset, range2.pmStart);
72832
73017
  }
72833
73018
  return result.pmPosition;
72834
73019
  };
@@ -76685,8 +76870,22 @@ const _DomPainter = class _DomPainter2 {
76685
76870
  const paraIndentRight = paraIndent?.right ?? 0;
76686
76871
  const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
76687
76872
  const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
76873
+ const isListParagraph = !!(fragment.markerWidth && wordLayout?.marker);
76874
+ const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
76875
+ const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
76688
76876
  lines.forEach((line, index2) => {
76689
- const lineEl = this.renderLine(block, line, context);
76877
+ const availableWidthOverride = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
76878
+ const isLastLineOfFragment = index2 === lines.length - 1;
76879
+ const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
76880
+ const shouldSkipJustifyForLastLine = isLastLineOfParagraph && !paragraphEndsWithLineBreak;
76881
+ const lineEl = this.renderLine(
76882
+ block,
76883
+ line,
76884
+ context,
76885
+ availableWidthOverride,
76886
+ fragment.fromLine + index2,
76887
+ isListParagraph || shouldSkipJustifyForLastLine
76888
+ );
76690
76889
  const isListFirstLine = index2 === 0 && !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
76691
76890
  const hasExplicitSegmentPositioning = line.segments?.some((seg) => seg.x !== void 0);
76692
76891
  const isFirstLine = index2 === 0 && !fragment.continuesFromPrev;
@@ -76915,8 +77114,13 @@ const _DomPainter = class _DomPainter2 {
76915
77114
  const lines = itemMeasure.paragraph.lines.slice(fragment.fromLine, fragment.toLine);
76916
77115
  const contentAttrs = wordLayout ? item.paragraph.attrs : stripListIndent(item.paragraph.attrs);
76917
77116
  applyParagraphBlockStyles(contentEl, contentAttrs);
76918
- lines.forEach((line) => {
76919
- const lineEl = this.renderLine(item.paragraph, line, context);
77117
+ contentEl.style.textAlign = "left";
77118
+ const paraForList = {
77119
+ ...item.paragraph,
77120
+ attrs: { ...item.paragraph.attrs || {}, alignment: "left" }
77121
+ };
77122
+ lines.forEach((line, idx) => {
77123
+ const lineEl = this.renderLine(paraForList, line, context, fragment.width, fragment.fromLine + idx, true);
76920
77124
  contentEl.appendChild(lineEl);
76921
77125
  });
76922
77126
  fragmentEl.appendChild(contentEl);
@@ -77438,12 +77642,15 @@ const _DomPainter = class _DomPainter2 {
77438
77642
  const applyFragmentFrameWithSection = (el, frag) => {
77439
77643
  this.applyFragmentFrame(el, frag, context.section);
77440
77644
  };
77645
+ const renderLineForTableCell = (block, line, ctx2) => {
77646
+ return this.renderLine(block, line, ctx2, void 0, void 0, true);
77647
+ };
77441
77648
  return renderTableFragment({
77442
77649
  doc: this.doc,
77443
77650
  fragment,
77444
77651
  context,
77445
77652
  blockLookup: this.blockLookup,
77446
- renderLine: this.renderLine.bind(this),
77653
+ renderLine: renderLineForTableCell,
77447
77654
  applyFragmentFrame: applyFragmentFrameWithSection,
77448
77655
  applySdtDataset: this.applySdtDataset.bind(this),
77449
77656
  applyStyles: applyStyles$2
@@ -77778,7 +77985,18 @@ const _DomPainter = class _DomPainter2 {
77778
77985
  }
77779
77986
  return img;
77780
77987
  }
77781
- renderLine(block, line, context) {
77988
+ /**
77989
+ * Renders a single line of a paragraph block.
77990
+ *
77991
+ * @param block - The paragraph block containing the line
77992
+ * @param line - The line measurement data
77993
+ * @param context - Rendering context with fragment information
77994
+ * @param availableWidthOverride - Optional override for available width used in justification calculations
77995
+ * @param lineIndex - Optional zero-based index of the line within the fragment
77996
+ * @param skipJustify - When true, prevents justification even if alignment is 'justify'
77997
+ * @returns The rendered line element
77998
+ */
77999
+ renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify) {
77782
78000
  if (!this.doc) {
77783
78001
  throw new Error("DomPainter: document is not available");
77784
78002
  }
@@ -77790,8 +78008,10 @@ const _DomPainter = class _DomPainter2 {
77790
78008
  el.setAttribute("styleid", styleId);
77791
78009
  }
77792
78010
  const alignment2 = block.attrs?.alignment;
77793
- if (alignment2 === "center" || alignment2 === "right" || alignment2 === "justify") {
77794
- el.style.textAlign = alignment2 === "justify" ? "justify" : alignment2;
78011
+ if (alignment2 === "center" || alignment2 === "right") {
78012
+ el.style.textAlign = alignment2;
78013
+ } else if (alignment2 === "justify") {
78014
+ el.style.textAlign = "left";
77795
78015
  } else {
77796
78016
  el.style.textAlign = "left";
77797
78017
  }
@@ -77804,6 +78024,7 @@ const _DomPainter = class _DomPainter2 {
77804
78024
  }
77805
78025
  const runsForLine = sliceRunsForLine(block, line);
77806
78026
  const trackedConfig = this.resolveTrackedChangesConfig(block);
78027
+ const textSlices = runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
77807
78028
  if (runsForLine.length === 0) {
77808
78029
  const span = this.doc.createElement("span");
77809
78030
  span.innerHTML = "&nbsp;";
@@ -77850,6 +78071,19 @@ const _DomPainter = class _DomPainter2 {
77850
78071
  });
77851
78072
  }
77852
78073
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
78074
+ const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
78075
+ const shouldJustify = !skipJustify && alignment2 === "justify" && !hasExplicitPositioning;
78076
+ if (shouldJustify) {
78077
+ const spaceCount = textSlices.reduce(
78078
+ (sum, s2) => sum + Array.from(s2).filter((ch) => ch === " " || ch === " ").length,
78079
+ 0
78080
+ );
78081
+ const slack = Math.max(0, availableWidth - line.width);
78082
+ if (spaceCount > 0 && slack > 0) {
78083
+ const extraPerSpace = slack / spaceCount;
78084
+ el.style.wordSpacing = `${extraPerSpace}px`;
78085
+ }
78086
+ }
77853
78087
  if (hasExplicitPositioning && line.segments) {
77854
78088
  let cumulativeX = 0;
77855
78089
  const segmentsByRun = /* @__PURE__ */ new Map();
@@ -78633,6 +78867,23 @@ const applyParagraphShadingStyles = (element, shading) => {
78633
78867
  if (!shading?.fill) return;
78634
78868
  element.style.backgroundColor = shading.fill;
78635
78869
  };
78870
+ const gatherTextSlicesForLine = (block, line) => {
78871
+ const slices = [];
78872
+ const startRun = line.fromRun ?? 0;
78873
+ const endRun = line.toRun ?? startRun;
78874
+ for (let runIndex = startRun; runIndex <= endRun; runIndex += 1) {
78875
+ const run2 = block.runs[runIndex];
78876
+ if (!run2 || run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2) || !run2.text) continue;
78877
+ const isFirst = runIndex === startRun;
78878
+ const isLast = runIndex === endRun;
78879
+ const start2 = isFirst ? line.fromChar ?? 0 : 0;
78880
+ const end2 = isLast ? line.toChar ?? run2.text.length : run2.text.length;
78881
+ if (start2 >= end2) continue;
78882
+ const slice2 = run2.text.slice(start2, end2);
78883
+ if (slice2) slices.push(slice2);
78884
+ }
78885
+ return slices;
78886
+ };
78636
78887
  const sliceRunsForLine = (block, line) => {
78637
78888
  const result = [];
78638
78889
  for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
@@ -81446,6 +81697,9 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
81446
81697
  __privateAdd$1(this, _lastClickTime, 0);
81447
81698
  __privateAdd$1(this, _lastClickPosition, { x: 0, y: 0 });
81448
81699
  __privateAdd$1(this, _lastSelectedImageBlockId, null);
81700
+ __privateAdd$1(this, _dragAnchor, null);
81701
+ __privateAdd$1(this, _isDragging, false);
81702
+ __privateAdd$1(this, _dragExtensionMode, "char");
81449
81703
  __privateAdd$1(this, _remoteCursorState, /* @__PURE__ */ new Map());
81450
81704
  __privateAdd$1(this, _remoteCursorDirty, false);
81451
81705
  __privateAdd$1(this, _remoteCursorOverlay, null);
@@ -81588,13 +81842,56 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
81588
81842
  this.emit("imageDeselected", { blockId: __privateGet$1(this, _lastSelectedImageBlockId) });
81589
81843
  __privateSet(this, _lastSelectedImageBlockId, null);
81590
81844
  }
81845
+ if (event.shiftKey && __privateGet$1(this, _editor3).state.selection.$anchor) {
81846
+ const anchor = __privateGet$1(this, _editor3).state.selection.anchor;
81847
+ const head = hit.pos;
81848
+ const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
81849
+ try {
81850
+ const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
81851
+ __privateGet$1(this, _editor3).view?.dispatch(tr);
81852
+ __privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
81853
+ } catch (error) {
81854
+ console.warn("[SELECTION] Failed to extend selection on shift+click:", {
81855
+ error,
81856
+ anchor,
81857
+ head,
81858
+ selAnchor,
81859
+ selHead,
81860
+ mode: __privateGet$1(this, _dragExtensionMode)
81861
+ });
81862
+ }
81863
+ if (document.activeElement instanceof HTMLElement) {
81864
+ document.activeElement.blur();
81865
+ }
81866
+ const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
81867
+ if (editorDom2) {
81868
+ editorDom2.focus();
81869
+ __privateGet$1(this, _editor3).view?.focus();
81870
+ }
81871
+ return;
81872
+ }
81591
81873
  const clickDepth = __privateMethod$1(this, _PresentationEditor_instances, registerPointerClick_fn).call(this, event);
81874
+ if (clickDepth === 1) {
81875
+ __privateSet(this, _dragAnchor, hit.pos);
81876
+ }
81877
+ __privateSet(this, _isDragging, true);
81878
+ if (clickDepth >= 3) {
81879
+ __privateSet(this, _dragExtensionMode, "para");
81880
+ } else if (clickDepth === 2) {
81881
+ __privateSet(this, _dragExtensionMode, "word");
81882
+ } else {
81883
+ __privateSet(this, _dragExtensionMode, "char");
81884
+ }
81885
+ if (typeof __privateGet$1(this, _viewportHost).setPointerCapture === "function") {
81886
+ __privateGet$1(this, _viewportHost).setPointerCapture(event.pointerId);
81887
+ }
81592
81888
  let handledByDepth = false;
81593
81889
  if (__privateGet$1(this, _session).mode === "body") {
81890
+ const selectionPos = clickDepth >= 2 && __privateGet$1(this, _dragAnchor) !== null ? __privateGet$1(this, _dragAnchor) : hit.pos;
81594
81891
  if (clickDepth >= 3) {
81595
- handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectParagraphAt_fn).call(this, hit.pos);
81892
+ handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectParagraphAt_fn).call(this, selectionPos);
81596
81893
  } else if (clickDepth === 2) {
81597
- handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectWordAt_fn).call(this, hit.pos);
81894
+ handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectWordAt_fn).call(this, selectionPos);
81598
81895
  }
81599
81896
  }
81600
81897
  if (!handledByDepth) {
@@ -81619,6 +81916,36 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
81619
81916
  if (!__privateGet$1(this, _layoutState).layout) return;
81620
81917
  const normalized = __privateMethod$1(this, _PresentationEditor_instances, normalizeClientPoint_fn).call(this, event.clientX, event.clientY);
81621
81918
  if (!normalized) return;
81919
+ if (__privateGet$1(this, _isDragging) && __privateGet$1(this, _dragAnchor) !== null && event.buttons & 1) {
81920
+ const hit = clickToPosition(
81921
+ __privateGet$1(this, _layoutState).layout,
81922
+ __privateGet$1(this, _layoutState).blocks,
81923
+ __privateGet$1(this, _layoutState).measures,
81924
+ { x: normalized.x, y: normalized.y },
81925
+ __privateGet$1(this, _viewportHost),
81926
+ event.clientX,
81927
+ event.clientY
81928
+ );
81929
+ if (!hit) return;
81930
+ const anchor = __privateGet$1(this, _dragAnchor);
81931
+ const head = hit.pos;
81932
+ const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
81933
+ try {
81934
+ const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
81935
+ __privateGet$1(this, _editor3).view?.dispatch(tr);
81936
+ __privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
81937
+ } catch (error) {
81938
+ console.warn("[SELECTION] Failed to extend selection during drag:", {
81939
+ error,
81940
+ anchor,
81941
+ head,
81942
+ selAnchor,
81943
+ selHead,
81944
+ mode: __privateGet$1(this, _dragExtensionMode)
81945
+ });
81946
+ }
81947
+ return;
81948
+ }
81622
81949
  if (__privateGet$1(this, _session).mode !== "body") {
81623
81950
  __privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
81624
81951
  return;
@@ -81637,6 +81964,13 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
81637
81964
  __privateAdd$1(this, _handlePointerLeave, () => {
81638
81965
  __privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
81639
81966
  });
81967
+ __privateAdd$1(this, _handlePointerUp, (event) => {
81968
+ if (!__privateGet$1(this, _isDragging)) return;
81969
+ if (typeof __privateGet$1(this, _viewportHost).hasPointerCapture === "function" && typeof __privateGet$1(this, _viewportHost).releasePointerCapture === "function" && __privateGet$1(this, _viewportHost).hasPointerCapture(event.pointerId)) {
81970
+ __privateGet$1(this, _viewportHost).releasePointerCapture(event.pointerId);
81971
+ }
81972
+ __privateSet(this, _isDragging, false);
81973
+ });
81640
81974
  __privateAdd$1(this, _handleDoubleClick, (event) => {
81641
81975
  if (event.button !== 0) return;
81642
81976
  if (!__privateGet$1(this, _layoutState).layout) return;
@@ -82556,6 +82890,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
82556
82890
  __privateGet$1(this, _viewportHost)?.removeEventListener("pointerdown", __privateGet$1(this, _handlePointerDown));
82557
82891
  __privateGet$1(this, _viewportHost)?.removeEventListener("dblclick", __privateGet$1(this, _handleDoubleClick));
82558
82892
  __privateGet$1(this, _viewportHost)?.removeEventListener("pointermove", __privateGet$1(this, _handlePointerMove));
82893
+ __privateGet$1(this, _viewportHost)?.removeEventListener("pointerup", __privateGet$1(this, _handlePointerUp));
82559
82894
  __privateGet$1(this, _viewportHost)?.removeEventListener("pointerleave", __privateGet$1(this, _handlePointerLeave));
82560
82895
  __privateGet$1(this, _visibleHost)?.removeEventListener("keydown", __privateGet$1(this, _handleKeyDown));
82561
82896
  __privateGet$1(this, _inputBridge)?.notifyTargetChanged();
@@ -82665,6 +83000,9 @@ _clickCount = /* @__PURE__ */ new WeakMap();
82665
83000
  _lastClickTime = /* @__PURE__ */ new WeakMap();
82666
83001
  _lastClickPosition = /* @__PURE__ */ new WeakMap();
82667
83002
  _lastSelectedImageBlockId = /* @__PURE__ */ new WeakMap();
83003
+ _dragAnchor = /* @__PURE__ */ new WeakMap();
83004
+ _isDragging = /* @__PURE__ */ new WeakMap();
83005
+ _dragExtensionMode = /* @__PURE__ */ new WeakMap();
82668
83006
  _remoteCursorState = /* @__PURE__ */ new WeakMap();
82669
83007
  _remoteCursorDirty = /* @__PURE__ */ new WeakMap();
82670
83008
  _remoteCursorOverlay = /* @__PURE__ */ new WeakMap();
@@ -83000,6 +83338,7 @@ setupPointerHandlers_fn = function() {
83000
83338
  __privateGet$1(this, _viewportHost).addEventListener("pointerdown", __privateGet$1(this, _handlePointerDown));
83001
83339
  __privateGet$1(this, _viewportHost).addEventListener("dblclick", __privateGet$1(this, _handleDoubleClick));
83002
83340
  __privateGet$1(this, _viewportHost).addEventListener("pointermove", __privateGet$1(this, _handlePointerMove));
83341
+ __privateGet$1(this, _viewportHost).addEventListener("pointerup", __privateGet$1(this, _handlePointerUp));
83003
83342
  __privateGet$1(this, _viewportHost).addEventListener("pointerleave", __privateGet$1(this, _handlePointerLeave));
83004
83343
  __privateGet$1(this, _visibleHost).addEventListener("keydown", __privateGet$1(this, _handleKeyDown));
83005
83344
  };
@@ -83079,8 +83418,11 @@ getFirstTextPosition_fn = function() {
83079
83418
  registerPointerClick_fn = function(event) {
83080
83419
  const MAX_CLICK_COUNT = 3;
83081
83420
  const time2 = event.timeStamp ?? performance.now();
83082
- const withinTime = time2 - __privateGet$1(this, _lastClickTime) <= MULTI_CLICK_TIME_THRESHOLD_MS;
83083
- const withinDistance = Math.abs(event.clientX - __privateGet$1(this, _lastClickPosition).x) <= MULTI_CLICK_DISTANCE_THRESHOLD_PX && Math.abs(event.clientY - __privateGet$1(this, _lastClickPosition).y) <= MULTI_CLICK_DISTANCE_THRESHOLD_PX;
83421
+ const timeDelta = time2 - __privateGet$1(this, _lastClickTime);
83422
+ const withinTime = timeDelta <= MULTI_CLICK_TIME_THRESHOLD_MS;
83423
+ const distanceX = Math.abs(event.clientX - __privateGet$1(this, _lastClickPosition).x);
83424
+ const distanceY = Math.abs(event.clientY - __privateGet$1(this, _lastClickPosition).y);
83425
+ const withinDistance = distanceX <= MULTI_CLICK_DISTANCE_THRESHOLD_PX && distanceY <= MULTI_CLICK_DISTANCE_THRESHOLD_PX;
83084
83426
  if (withinTime && withinDistance) {
83085
83427
  __privateSet(this, _clickCount, Math.min(__privateGet$1(this, _clickCount) + 1, MAX_CLICK_COUNT));
83086
83428
  } else {
@@ -83095,6 +83437,9 @@ selectWordAt_fn = function(pos) {
83095
83437
  if (!state2?.doc) {
83096
83438
  return false;
83097
83439
  }
83440
+ if (pos < 0 || pos > state2.doc.content.size) {
83441
+ return false;
83442
+ }
83098
83443
  const $pos = state2.doc.resolve(pos);
83099
83444
  let textblockPos = $pos;
83100
83445
  while (textblockPos.depth > 0) {
@@ -83181,6 +83526,30 @@ selectParagraphAt_fn = function(pos) {
83181
83526
  return false;
83182
83527
  }
83183
83528
  };
83529
+ calculateExtendedSelection_fn = function(anchor, head, mode) {
83530
+ if (mode === "word") {
83531
+ const anchorBounds = findWordBoundaries(__privateGet$1(this, _layoutState).blocks, anchor);
83532
+ const headBounds = findWordBoundaries(__privateGet$1(this, _layoutState).blocks, head);
83533
+ if (anchorBounds && headBounds) {
83534
+ if (head >= anchor) {
83535
+ return { selAnchor: anchorBounds.from, selHead: headBounds.to };
83536
+ } else {
83537
+ return { selAnchor: anchorBounds.to, selHead: headBounds.from };
83538
+ }
83539
+ }
83540
+ } else if (mode === "para") {
83541
+ const anchorBounds = findParagraphBoundaries(__privateGet$1(this, _layoutState).blocks, anchor);
83542
+ const headBounds = findParagraphBoundaries(__privateGet$1(this, _layoutState).blocks, head);
83543
+ if (anchorBounds && headBounds) {
83544
+ if (head >= anchor) {
83545
+ return { selAnchor: anchorBounds.from, selHead: headBounds.to };
83546
+ } else {
83547
+ return { selAnchor: anchorBounds.to, selHead: headBounds.from };
83548
+ }
83549
+ }
83550
+ }
83551
+ return { selAnchor: anchor, selHead: head };
83552
+ };
83184
83553
  isWordCharacter_fn = function(char) {
83185
83554
  if (!char) {
83186
83555
  return false;
@@ -83189,6 +83558,7 @@ isWordCharacter_fn = function(char) {
83189
83558
  };
83190
83559
  _handlePointerMove = /* @__PURE__ */ new WeakMap();
83191
83560
  _handlePointerLeave = /* @__PURE__ */ new WeakMap();
83561
+ _handlePointerUp = /* @__PURE__ */ new WeakMap();
83192
83562
  _handleDoubleClick = /* @__PURE__ */ new WeakMap();
83193
83563
  _handleKeyDown = /* @__PURE__ */ new WeakMap();
83194
83564
  focusHeaderFooterShortcut_fn = function(kind) {
@@ -84361,10 +84731,12 @@ convertPageLocalToOverlayCoords_fn = function(pageIndex, pageLocalX, pageLocalY)
84361
84731
  }
84362
84732
  const pageRect = pageEl.getBoundingClientRect();
84363
84733
  const overlayRect = __privateGet$1(this, _selectionOverlay2).getBoundingClientRect();
84364
- const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
84734
+ const layoutPageSize = __privateGet$1(this, _layoutState).layout?.pageSize;
84735
+ const scaleX = layoutPageSize && typeof layoutPageSize.w === "number" && layoutPageSize.w > 0 ? pageRect.width / layoutPageSize.w : 1;
84736
+ const scaleY = layoutPageSize && typeof layoutPageSize.h === "number" && layoutPageSize.h > 0 ? pageRect.height / layoutPageSize.h : 1;
84365
84737
  return {
84366
- x: pageRect.left - overlayRect.left + pageLocalX * zoom,
84367
- y: pageRect.top - overlayRect.top + pageLocalY * zoom
84738
+ x: pageRect.left - overlayRect.left + pageLocalX * scaleX,
84739
+ y: pageRect.top - overlayRect.top + pageLocalY * scaleY
84368
84740
  };
84369
84741
  };
84370
84742
  normalizeClientPoint_fn = function(clientX, clientY) {