@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
@@ -9323,14 +9323,14 @@ function requireSax() {
9323
9323
  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-]/;
9324
9324
  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]/;
9325
9325
  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-]/;
9326
- function isWhitespace(c2) {
9326
+ function isWhitespace2(c2) {
9327
9327
  return c2 === " " || c2 === "\n" || c2 === "\r" || c2 === " ";
9328
9328
  }
9329
9329
  function isQuote(c2) {
9330
9330
  return c2 === '"' || c2 === "'";
9331
9331
  }
9332
9332
  function isAttribEnd(c2) {
9333
- return c2 === ">" || isWhitespace(c2);
9333
+ return c2 === ">" || isWhitespace2(c2);
9334
9334
  }
9335
9335
  function isMatch(regex, c2) {
9336
9336
  return regex.test(c2);
@@ -9955,7 +9955,7 @@ function requireSax() {
9955
9955
  if (c2 === "<") {
9956
9956
  parser.state = S2.OPEN_WAKA;
9957
9957
  parser.startTagPosition = parser.position;
9958
- } else if (!isWhitespace(c2)) {
9958
+ } else if (!isWhitespace2(c2)) {
9959
9959
  strictFail(parser, "Non-whitespace before first tag.");
9960
9960
  parser.textNode = c2;
9961
9961
  parser.state = S2.TEXT;
@@ -10034,7 +10034,7 @@ function requireSax() {
10034
10034
  parser.state = S2.OPEN_WAKA;
10035
10035
  parser.startTagPosition = parser.position;
10036
10036
  } else {
10037
- if (!isWhitespace(c2) && (!parser.sawRoot || parser.closedRoot)) {
10037
+ if (!isWhitespace2(c2) && (!parser.sawRoot || parser.closedRoot)) {
10038
10038
  strictFail(parser, "Text data outside of root node.");
10039
10039
  }
10040
10040
  if (c2 === "&") {
@@ -10063,7 +10063,7 @@ function requireSax() {
10063
10063
  if (c2 === "!") {
10064
10064
  parser.state = S2.SGML_DECL;
10065
10065
  parser.sgmlDecl = "";
10066
- } else if (isWhitespace(c2)) ;
10066
+ } else if (isWhitespace2(c2)) ;
10067
10067
  else if (isMatch(nameStart, c2)) {
10068
10068
  parser.state = S2.OPEN_TAG;
10069
10069
  parser.tagName = c2;
@@ -10247,14 +10247,14 @@ function requireSax() {
10247
10247
  case S2.PROC_INST:
10248
10248
  if (c2 === "?") {
10249
10249
  parser.state = S2.PROC_INST_ENDING;
10250
- } else if (isWhitespace(c2)) {
10250
+ } else if (isWhitespace2(c2)) {
10251
10251
  parser.state = S2.PROC_INST_BODY;
10252
10252
  } else {
10253
10253
  parser.procInstName += c2;
10254
10254
  }
10255
10255
  continue;
10256
10256
  case S2.PROC_INST_BODY:
10257
- if (!parser.procInstBody && isWhitespace(c2)) {
10257
+ if (!parser.procInstBody && isWhitespace2(c2)) {
10258
10258
  continue;
10259
10259
  } else if (c2 === "?") {
10260
10260
  parser.state = S2.PROC_INST_ENDING;
@@ -10285,7 +10285,7 @@ function requireSax() {
10285
10285
  } else if (c2 === "/") {
10286
10286
  parser.state = S2.OPEN_TAG_SLASH;
10287
10287
  } else {
10288
- if (!isWhitespace(c2)) {
10288
+ if (!isWhitespace2(c2)) {
10289
10289
  strictFail(parser, "Invalid character in tag name");
10290
10290
  }
10291
10291
  parser.state = S2.ATTRIB;
@@ -10305,7 +10305,7 @@ function requireSax() {
10305
10305
  }
10306
10306
  continue;
10307
10307
  case S2.ATTRIB:
10308
- if (isWhitespace(c2)) {
10308
+ if (isWhitespace2(c2)) {
10309
10309
  continue;
10310
10310
  } else if (c2 === ">") {
10311
10311
  openTag(parser);
@@ -10327,7 +10327,7 @@ function requireSax() {
10327
10327
  parser.attribValue = parser.attribName;
10328
10328
  attrib(parser);
10329
10329
  openTag(parser);
10330
- } else if (isWhitespace(c2)) {
10330
+ } else if (isWhitespace2(c2)) {
10331
10331
  parser.state = S2.ATTRIB_NAME_SAW_WHITE;
10332
10332
  } else if (isMatch(nameBody, c2)) {
10333
10333
  parser.attribName += c2;
@@ -10338,7 +10338,7 @@ function requireSax() {
10338
10338
  case S2.ATTRIB_NAME_SAW_WHITE:
10339
10339
  if (c2 === "=") {
10340
10340
  parser.state = S2.ATTRIB_VALUE;
10341
- } else if (isWhitespace(c2)) {
10341
+ } else if (isWhitespace2(c2)) {
10342
10342
  continue;
10343
10343
  } else {
10344
10344
  strictFail(parser, "Attribute without value");
@@ -10361,7 +10361,7 @@ function requireSax() {
10361
10361
  }
10362
10362
  continue;
10363
10363
  case S2.ATTRIB_VALUE:
10364
- if (isWhitespace(c2)) {
10364
+ if (isWhitespace2(c2)) {
10365
10365
  continue;
10366
10366
  } else if (isQuote(c2)) {
10367
10367
  parser.q = c2;
@@ -10388,7 +10388,7 @@ function requireSax() {
10388
10388
  parser.state = S2.ATTRIB_VALUE_CLOSED;
10389
10389
  continue;
10390
10390
  case S2.ATTRIB_VALUE_CLOSED:
10391
- if (isWhitespace(c2)) {
10391
+ if (isWhitespace2(c2)) {
10392
10392
  parser.state = S2.ATTRIB;
10393
10393
  } else if (c2 === ">") {
10394
10394
  openTag(parser);
@@ -10421,7 +10421,7 @@ function requireSax() {
10421
10421
  continue;
10422
10422
  case S2.CLOSE_TAG:
10423
10423
  if (!parser.tagName) {
10424
- if (isWhitespace(c2)) {
10424
+ if (isWhitespace2(c2)) {
10425
10425
  continue;
10426
10426
  } else if (notMatch(nameStart, c2)) {
10427
10427
  if (parser.script) {
@@ -10442,14 +10442,14 @@ function requireSax() {
10442
10442
  parser.tagName = "";
10443
10443
  parser.state = S2.SCRIPT;
10444
10444
  } else {
10445
- if (!isWhitespace(c2)) {
10445
+ if (!isWhitespace2(c2)) {
10446
10446
  strictFail(parser, "Invalid tagname in closing tag");
10447
10447
  }
10448
10448
  parser.state = S2.CLOSE_TAG_SAW_WHITE;
10449
10449
  }
10450
10450
  continue;
10451
10451
  case S2.CLOSE_TAG_SAW_WHITE:
10452
- if (isWhitespace(c2)) {
10452
+ if (isWhitespace2(c2)) {
10453
10453
  continue;
10454
10454
  }
10455
10455
  if (c2 === ">") {
@@ -41841,7 +41841,7 @@ const _SuperConverter = class _SuperConverter2 {
41841
41841
  static getStoredSuperdocVersion(docx) {
41842
41842
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
41843
41843
  }
41844
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.30") {
41844
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.31") {
41845
41845
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
41846
41846
  }
41847
41847
  /**
@@ -45147,7 +45147,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
45147
45147
  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);
45148
45148
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
45149
45149
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
45150
- 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;
45150
+ 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;
45151
45151
  var GOOD_LEAF_SIZE = 200;
45152
45152
  var RopeSequence = function RopeSequence2() {
45153
45153
  };
@@ -59014,7 +59014,7 @@ const isHeadless = (editor) => {
59014
59014
  const shouldSkipNodeView = (editor) => {
59015
59015
  return isHeadless(editor);
59016
59016
  };
59017
- const summaryVersion = "1.0.0-beta.30";
59017
+ const summaryVersion = "1.0.0-beta.31";
59018
59018
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59019
59019
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59020
59020
  function mapAttributes(attrs) {
@@ -59803,7 +59803,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
59803
59803
  { default: remarkStringify },
59804
59804
  { default: remarkGfm }
59805
59805
  ] = await Promise.all([
59806
- import("./index-DUzV7kkk-BvBMF_lo.es.js"),
59806
+ import("./index-eG-VYUeN-CIuOnW8W.es.js"),
59807
59807
  import("./index-DRCvimau-Cw339678.es.js"),
59808
59808
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
59809
59809
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60008,7 +60008,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60008
60008
  * Process collaboration migrations
60009
60009
  */
60010
60010
  processCollaborationMigrations() {
60011
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.30");
60011
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.31");
60012
60012
  if (!this.options.ydoc) return;
60013
60013
  const metaMap = this.options.ydoc.getMap("meta");
60014
60014
  let docVersion = metaMap.get("version");
@@ -62045,9 +62045,11 @@ const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG
62045
62045
  case TRACK_INSERT_MARK:
62046
62046
  case TRACK_DELETE_MARK:
62047
62047
  case TRACK_FORMAT_MARK: {
62048
- const tracked = buildTrackedChangeMetaFromMark(mark);
62049
- if (tracked) {
62050
- run2.trackedChange = selectTrackedChangeMeta(run2.trackedChange, tracked);
62048
+ if (!isTabRun2) {
62049
+ const tracked = buildTrackedChangeMetaFromMark(mark);
62050
+ if (tracked) {
62051
+ run2.trackedChange = selectTrackedChangeMeta(run2.trackedChange, tracked);
62052
+ }
62051
62053
  }
62052
62054
  break;
62053
62055
  }
@@ -67587,6 +67589,38 @@ function measureCharacterXSegmentBased(block, line, charOffset, ctx2) {
67587
67589
  }
67588
67590
  return line.width;
67589
67591
  }
67592
+ function charOffsetToPm(block, line, charOffset, fallbackPmStart) {
67593
+ if (!Number.isFinite(charOffset) || !Number.isFinite(fallbackPmStart)) {
67594
+ console.warn("[charOffsetToPm] Invalid input:", { charOffset, fallbackPmStart });
67595
+ return fallbackPmStart;
67596
+ }
67597
+ const safeCharOffset = Math.max(0, charOffset);
67598
+ if (block.kind !== "paragraph") {
67599
+ return fallbackPmStart + safeCharOffset;
67600
+ }
67601
+ const runs = sliceRunsForLine$1(block, line);
67602
+ let cursor = 0;
67603
+ let lastPm = fallbackPmStart;
67604
+ for (const run2 of runs) {
67605
+ const isTab = isTabRun$1(run2);
67606
+ const text = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text ?? "";
67607
+ const runLength = isTab ? TAB_CHAR_LENGTH : text.length;
67608
+ const runPmStart = typeof run2.pmStart === "number" ? run2.pmStart : null;
67609
+ const runPmEnd = typeof run2.pmEnd === "number" ? run2.pmEnd : runPmStart != null ? runPmStart + runLength : null;
67610
+ if (runPmStart != null) {
67611
+ lastPm = runPmStart;
67612
+ }
67613
+ if (safeCharOffset <= cursor + runLength) {
67614
+ const offsetInRun = Math.max(0, safeCharOffset - cursor);
67615
+ return runPmStart != null ? runPmStart + Math.min(offsetInRun, runLength) : fallbackPmStart + safeCharOffset;
67616
+ }
67617
+ if (runPmEnd != null) {
67618
+ lastPm = runPmEnd;
67619
+ }
67620
+ cursor += runLength;
67621
+ }
67622
+ return lastPm;
67623
+ }
67590
67624
  function findCharacterAtX(block, line, x2, pmStart) {
67591
67625
  const ctx2 = getMeasurementContext();
67592
67626
  if (!ctx2) {
@@ -67601,9 +67635,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67601
67635
  );
67602
67636
  const ratio = Math.max(0, Math.min(1, x2 / line.width));
67603
67637
  const charOffset = Math.round(ratio * charsInLine);
67638
+ const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
67604
67639
  return {
67605
67640
  charOffset,
67606
- pmPosition: pmStart + charOffset
67641
+ pmPosition: pmPosition2
67607
67642
  };
67608
67643
  }
67609
67644
  const runs = sliceRunsForLine$1(block, line);
@@ -67619,11 +67654,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67619
67654
  const midpoint = startX + tabWidth / 2;
67620
67655
  const offsetInRun = safeX < midpoint ? 0 : TAB_CHAR_LENGTH;
67621
67656
  const charOffset = currentCharOffset + offsetInRun;
67622
- const pmBase = run2.pmStart ?? pmStart + currentCharOffset;
67623
- const pmPosition = pmBase + offsetInRun;
67657
+ const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
67624
67658
  return {
67625
67659
  charOffset,
67626
- pmPosition
67660
+ pmPosition: pmPosition2
67627
67661
  };
67628
67662
  }
67629
67663
  currentX = endX;
@@ -67640,9 +67674,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67640
67674
  const charX = currentX + measured2.width + computeLetterSpacingWidth(run2, i, runLength);
67641
67675
  if (charX >= safeX) {
67642
67676
  if (i === 0) {
67677
+ const pmPosition3 = charOffsetToPm(block, line, currentCharOffset, pmStart);
67643
67678
  return {
67644
67679
  charOffset: currentCharOffset,
67645
- pmPosition: pmStart + currentCharOffset
67680
+ pmPosition: pmPosition3
67646
67681
  };
67647
67682
  }
67648
67683
  const prevText = text.slice(0, i - 1);
@@ -67651,9 +67686,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67651
67686
  const distToPrev = Math.abs(safeX - prevX);
67652
67687
  const distToCurrent = Math.abs(safeX - charX);
67653
67688
  const charOffset = distToPrev < distToCurrent ? currentCharOffset + i - 1 : currentCharOffset + i;
67689
+ const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
67654
67690
  return {
67655
67691
  charOffset,
67656
- pmPosition: pmStart + charOffset
67692
+ pmPosition: pmPosition2
67657
67693
  };
67658
67694
  }
67659
67695
  }
@@ -67661,9 +67697,10 @@ function findCharacterAtX(block, line, x2, pmStart) {
67661
67697
  currentX += measured.width + computeLetterSpacingWidth(run2, runLength, runLength);
67662
67698
  currentCharOffset += runLength;
67663
67699
  }
67700
+ const pmPosition = charOffsetToPm(block, line, currentCharOffset, pmStart);
67664
67701
  return {
67665
67702
  charOffset: currentCharOffset,
67666
- pmPosition: pmStart + currentCharOffset
67703
+ pmPosition
67667
67704
  };
67668
67705
  }
67669
67706
  const computeLetterSpacingWidth = (run2, precedingChars, runLength) => {
@@ -67869,7 +67906,9 @@ function processFragment(fragmentEl, viewX, viewY) {
67869
67906
  pmEnd: spanEnd,
67870
67907
  text: targetEl.textContent?.substring(0, 30),
67871
67908
  visibility: targetEl.style.visibility,
67872
- rect: { left: targetRect.left, right: targetRect.right, width: targetRect.width }
67909
+ rect: { left: targetRect.left, right: targetRect.right, width: targetRect.width },
67910
+ pageX: viewX,
67911
+ pageY: viewY
67873
67912
  });
67874
67913
  if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd)) {
67875
67914
  return null;
@@ -71435,6 +71474,88 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
71435
71474
  }
71436
71475
  return result;
71437
71476
  }
71477
+ function findWordBoundaries(blocks, pos) {
71478
+ const blockInfo = findBlockAtPosition(blocks, pos);
71479
+ if (!blockInfo) return null;
71480
+ const { block, localPos } = blockInfo;
71481
+ if (block.kind !== "paragraph") return null;
71482
+ const { text, pmStart } = extractBlockText(block);
71483
+ if (text.length === 0) return null;
71484
+ const clampedPos = Math.max(0, Math.min(localPos, text.length));
71485
+ let wordStart = clampedPos;
71486
+ while (wordStart > 0 && isWordChar(text[wordStart - 1])) {
71487
+ wordStart--;
71488
+ }
71489
+ let wordEnd = clampedPos;
71490
+ while (wordEnd < text.length && isWordChar(text[wordEnd])) {
71491
+ wordEnd++;
71492
+ }
71493
+ if (wordStart === wordEnd) {
71494
+ while (wordStart > 0 && isWhitespace(text[wordStart - 1])) {
71495
+ wordStart--;
71496
+ }
71497
+ while (wordEnd < text.length && isWhitespace(text[wordEnd])) {
71498
+ wordEnd++;
71499
+ }
71500
+ if (wordStart === wordEnd) {
71501
+ return null;
71502
+ }
71503
+ }
71504
+ return {
71505
+ from: pmStart + wordStart,
71506
+ to: pmStart + wordEnd
71507
+ };
71508
+ }
71509
+ function findParagraphBoundaries(blocks, pos) {
71510
+ const blockInfo = findBlockAtPosition(blocks, pos);
71511
+ if (!blockInfo) return null;
71512
+ const { block } = blockInfo;
71513
+ if (block.kind === "paragraph") {
71514
+ const { pmStart, pmEnd } = extractBlockText(block);
71515
+ return { from: pmStart, to: pmEnd };
71516
+ }
71517
+ if (block.kind === "image") {
71518
+ return { from: pos, to: pos + 1 };
71519
+ }
71520
+ return null;
71521
+ }
71522
+ function extractBlockText(block) {
71523
+ if (block.kind !== "paragraph") {
71524
+ return { text: "", pmStart: 0, pmEnd: 0 };
71525
+ }
71526
+ let text = "";
71527
+ let pmStart = Infinity;
71528
+ let pmEnd = 0;
71529
+ for (const run2 of block.runs) {
71530
+ text += "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text;
71531
+ if (run2.pmStart !== void 0) {
71532
+ pmStart = Math.min(pmStart, run2.pmStart);
71533
+ }
71534
+ if (run2.pmEnd !== void 0) {
71535
+ pmEnd = Math.max(pmEnd, run2.pmEnd);
71536
+ }
71537
+ }
71538
+ if (pmStart === Infinity) pmStart = 0;
71539
+ if (pmEnd === 0 && text.length > 0) pmEnd = pmStart + text.length;
71540
+ return { text, pmStart, pmEnd };
71541
+ }
71542
+ function findBlockAtPosition(blocks, pos) {
71543
+ for (const block of blocks) {
71544
+ if (block.kind === "paragraph") {
71545
+ const { pmStart, pmEnd } = extractBlockText(block);
71546
+ if (pos >= pmStart && pos <= pmEnd) {
71547
+ return { block, localPos: pos - pmStart };
71548
+ }
71549
+ }
71550
+ }
71551
+ return null;
71552
+ }
71553
+ function isWordChar(char) {
71554
+ return /[\p{L}\p{N}_]/u.test(char);
71555
+ }
71556
+ function isWhitespace(char) {
71557
+ return /\s/.test(char);
71558
+ }
71438
71559
  let canvas = null;
71439
71560
  let ctx$1 = null;
71440
71561
  function getCtx() {
@@ -72228,6 +72349,12 @@ const isAtomicFragment = (fragment) => {
72228
72349
  };
72229
72350
  const logClickStage = (_level, _stage, _payload) => {
72230
72351
  };
72352
+ const logPositionDebug = (payload) => {
72353
+ return;
72354
+ };
72355
+ const logSelectionMapDebug = (payload) => {
72356
+ return;
72357
+ };
72231
72358
  const blockPmRangeFromAttrs = (block) => {
72232
72359
  const attrs = block?.attrs;
72233
72360
  const pmStart = typeof attrs?.pmStart === "number" ? attrs.pmStart : void 0;
@@ -72497,6 +72624,10 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
72497
72624
  return null;
72498
72625
  }
72499
72626
  const column = determineColumn(layout, fragment.x);
72627
+ logPositionDebug({
72628
+ blockId: fragment.blockId,
72629
+ x: pageRelativePoint.x - fragment.x
72630
+ });
72500
72631
  logClickStage("log", "success", {
72501
72632
  blockId: fragment.blockId
72502
72633
  });
@@ -72605,10 +72736,13 @@ function selectionToRects(layout, blocks, measures, from2, to) {
72605
72736
  const sliceFrom = Math.max(range2.pmStart, from2);
72606
72737
  const sliceTo = Math.min(range2.pmEnd, to);
72607
72738
  if (sliceFrom >= sliceTo) return;
72608
- const x1 = mapPmToX(block, line, sliceFrom - range2.pmStart, fragment.width);
72609
- const x2 = mapPmToX(block, line, sliceTo - range2.pmStart, fragment.width);
72610
- const rectX = fragment.x + Math.min(x1, x2);
72611
- const rectWidth = Math.max(1, Math.abs(x2 - x1));
72739
+ const charOffsetFrom = pmPosToCharOffset(block, line, sliceFrom);
72740
+ const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
72741
+ const startX = mapPmToX(block, line, charOffsetFrom, fragment.width);
72742
+ const endX = mapPmToX(block, line, charOffsetTo, fragment.width);
72743
+ const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
72744
+ const rectX = fragment.x + markerWidth + Math.min(startX, endX);
72745
+ const rectWidth = Math.max(1, Math.abs(endX - startX));
72612
72746
  const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
72613
72747
  const rectY = fragment.y + lineOffset;
72614
72748
  rects.push({
@@ -72766,6 +72900,57 @@ function computeLinePmRange$1(block, line) {
72766
72900
  }
72767
72901
  return { pmStart, pmEnd };
72768
72902
  }
72903
+ function pmPosToCharOffset(block, line, pmPos) {
72904
+ if (block.kind !== "paragraph") return 0;
72905
+ let charOffset = 0;
72906
+ for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
72907
+ const run2 = block.runs[runIndex];
72908
+ if (!run2) continue;
72909
+ const text = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text ?? "";
72910
+ const runTextLength = text.length;
72911
+ const runPmStart = run2.pmStart ?? null;
72912
+ const runPmEnd = run2.pmEnd ?? (runPmStart != null ? runPmStart + runTextLength : null);
72913
+ if (runPmStart == null || runPmEnd == null || runTextLength === 0) continue;
72914
+ const isFirstRun = runIndex === line.fromRun;
72915
+ const isLastRun = runIndex === line.toRun;
72916
+ const lineStartChar = isFirstRun ? line.fromChar : 0;
72917
+ const lineEndChar = isLastRun ? line.toChar : runTextLength;
72918
+ const runSliceCharCount = lineEndChar - lineStartChar;
72919
+ const runPmRange = runPmEnd - runPmStart;
72920
+ const runSlicePmStart = runPmStart + lineStartChar / runTextLength * runPmRange;
72921
+ const runSlicePmEnd = runPmStart + lineEndChar / runTextLength * runPmRange;
72922
+ if (pmPos >= runSlicePmStart && pmPos <= runSlicePmEnd) {
72923
+ const runSlicePmRange = runSlicePmEnd - runSlicePmStart;
72924
+ if (runSlicePmRange > 0) {
72925
+ const pmOffsetInSlice = pmPos - runSlicePmStart;
72926
+ const charOffsetInSlice = Math.round(pmOffsetInSlice / runSlicePmRange * runSliceCharCount);
72927
+ const result = charOffset + Math.min(charOffsetInSlice, runSliceCharCount);
72928
+ const runText2 = text;
72929
+ const offsetInRun = result - charOffset - (isFirstRun ? 0 : 0);
72930
+ logSelectionMapDebug({
72931
+ blockId: block.id,
72932
+ lineFromRun: line.fromRun,
72933
+ lineToRun: line.toRun,
72934
+ runTextPreview: runText2.slice(Math.max(0, offsetInRun - 10), Math.min(runText2.length, offsetInRun + 10))
72935
+ });
72936
+ return result;
72937
+ }
72938
+ logSelectionMapDebug({
72939
+ blockId: block.id
72940
+ });
72941
+ return charOffset;
72942
+ }
72943
+ if (pmPos > runSlicePmEnd) {
72944
+ charOffset += runSliceCharCount;
72945
+ }
72946
+ }
72947
+ logSelectionMapDebug({
72948
+ blockId: block.id,
72949
+ lineFromRun: line.fromRun,
72950
+ lineToRun: line.toRun
72951
+ });
72952
+ return charOffset;
72953
+ }
72769
72954
  const determineColumn = (layout, fragmentX) => {
72770
72955
  const columns = layout.columns;
72771
72956
  if (!columns || columns.count <= 1) return 0;
@@ -72810,8 +72995,8 @@ const mapPointToPm = (block, line, x2, isRTL) => {
72810
72995
  if (isRTL) {
72811
72996
  const charOffset = result.charOffset;
72812
72997
  const charsInLine = Math.max(1, line.toChar - line.fromChar);
72813
- const reversedOffset = charsInLine - charOffset;
72814
- return range2.pmStart + reversedOffset;
72998
+ const reversedOffset = Math.max(0, Math.min(charsInLine, charsInLine - charOffset));
72999
+ return charOffsetToPm(block, line, reversedOffset, range2.pmStart);
72815
73000
  }
72816
73001
  return result.pmPosition;
72817
73002
  };
@@ -76668,8 +76853,22 @@ const _DomPainter = class _DomPainter2 {
76668
76853
  const paraIndentRight = paraIndent?.right ?? 0;
76669
76854
  const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
76670
76855
  const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
76856
+ const isListParagraph = !!(fragment.markerWidth && wordLayout?.marker);
76857
+ const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
76858
+ const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
76671
76859
  lines.forEach((line, index2) => {
76672
- const lineEl = this.renderLine(block, line, context);
76860
+ const availableWidthOverride = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
76861
+ const isLastLineOfFragment = index2 === lines.length - 1;
76862
+ const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
76863
+ const shouldSkipJustifyForLastLine = isLastLineOfParagraph && !paragraphEndsWithLineBreak;
76864
+ const lineEl = this.renderLine(
76865
+ block,
76866
+ line,
76867
+ context,
76868
+ availableWidthOverride,
76869
+ fragment.fromLine + index2,
76870
+ isListParagraph || shouldSkipJustifyForLastLine
76871
+ );
76673
76872
  const isListFirstLine = index2 === 0 && !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
76674
76873
  const hasExplicitSegmentPositioning = line.segments?.some((seg) => seg.x !== void 0);
76675
76874
  const isFirstLine = index2 === 0 && !fragment.continuesFromPrev;
@@ -76898,8 +77097,13 @@ const _DomPainter = class _DomPainter2 {
76898
77097
  const lines = itemMeasure.paragraph.lines.slice(fragment.fromLine, fragment.toLine);
76899
77098
  const contentAttrs = wordLayout ? item.paragraph.attrs : stripListIndent(item.paragraph.attrs);
76900
77099
  applyParagraphBlockStyles(contentEl, contentAttrs);
76901
- lines.forEach((line) => {
76902
- const lineEl = this.renderLine(item.paragraph, line, context);
77100
+ contentEl.style.textAlign = "left";
77101
+ const paraForList = {
77102
+ ...item.paragraph,
77103
+ attrs: { ...item.paragraph.attrs || {}, alignment: "left" }
77104
+ };
77105
+ lines.forEach((line, idx) => {
77106
+ const lineEl = this.renderLine(paraForList, line, context, fragment.width, fragment.fromLine + idx, true);
76903
77107
  contentEl.appendChild(lineEl);
76904
77108
  });
76905
77109
  fragmentEl.appendChild(contentEl);
@@ -77421,12 +77625,15 @@ const _DomPainter = class _DomPainter2 {
77421
77625
  const applyFragmentFrameWithSection = (el, frag) => {
77422
77626
  this.applyFragmentFrame(el, frag, context.section);
77423
77627
  };
77628
+ const renderLineForTableCell = (block, line, ctx2) => {
77629
+ return this.renderLine(block, line, ctx2, void 0, void 0, true);
77630
+ };
77424
77631
  return renderTableFragment({
77425
77632
  doc: this.doc,
77426
77633
  fragment,
77427
77634
  context,
77428
77635
  blockLookup: this.blockLookup,
77429
- renderLine: this.renderLine.bind(this),
77636
+ renderLine: renderLineForTableCell,
77430
77637
  applyFragmentFrame: applyFragmentFrameWithSection,
77431
77638
  applySdtDataset: this.applySdtDataset.bind(this),
77432
77639
  applyStyles: applyStyles$2
@@ -77761,7 +77968,18 @@ const _DomPainter = class _DomPainter2 {
77761
77968
  }
77762
77969
  return img;
77763
77970
  }
77764
- renderLine(block, line, context) {
77971
+ /**
77972
+ * Renders a single line of a paragraph block.
77973
+ *
77974
+ * @param block - The paragraph block containing the line
77975
+ * @param line - The line measurement data
77976
+ * @param context - Rendering context with fragment information
77977
+ * @param availableWidthOverride - Optional override for available width used in justification calculations
77978
+ * @param lineIndex - Optional zero-based index of the line within the fragment
77979
+ * @param skipJustify - When true, prevents justification even if alignment is 'justify'
77980
+ * @returns The rendered line element
77981
+ */
77982
+ renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify) {
77765
77983
  if (!this.doc) {
77766
77984
  throw new Error("DomPainter: document is not available");
77767
77985
  }
@@ -77773,8 +77991,10 @@ const _DomPainter = class _DomPainter2 {
77773
77991
  el.setAttribute("styleid", styleId);
77774
77992
  }
77775
77993
  const alignment2 = block.attrs?.alignment;
77776
- if (alignment2 === "center" || alignment2 === "right" || alignment2 === "justify") {
77777
- el.style.textAlign = alignment2 === "justify" ? "justify" : alignment2;
77994
+ if (alignment2 === "center" || alignment2 === "right") {
77995
+ el.style.textAlign = alignment2;
77996
+ } else if (alignment2 === "justify") {
77997
+ el.style.textAlign = "left";
77778
77998
  } else {
77779
77999
  el.style.textAlign = "left";
77780
78000
  }
@@ -77787,6 +78007,7 @@ const _DomPainter = class _DomPainter2 {
77787
78007
  }
77788
78008
  const runsForLine = sliceRunsForLine(block, line);
77789
78009
  const trackedConfig = this.resolveTrackedChangesConfig(block);
78010
+ 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);
77790
78011
  if (runsForLine.length === 0) {
77791
78012
  const span = this.doc.createElement("span");
77792
78013
  span.innerHTML = "&nbsp;";
@@ -77833,6 +78054,19 @@ const _DomPainter = class _DomPainter2 {
77833
78054
  });
77834
78055
  }
77835
78056
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
78057
+ const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
78058
+ const shouldJustify = !skipJustify && alignment2 === "justify" && !hasExplicitPositioning;
78059
+ if (shouldJustify) {
78060
+ const spaceCount = textSlices.reduce(
78061
+ (sum, s2) => sum + Array.from(s2).filter((ch) => ch === " " || ch === " ").length,
78062
+ 0
78063
+ );
78064
+ const slack = Math.max(0, availableWidth - line.width);
78065
+ if (spaceCount > 0 && slack > 0) {
78066
+ const extraPerSpace = slack / spaceCount;
78067
+ el.style.wordSpacing = `${extraPerSpace}px`;
78068
+ }
78069
+ }
77836
78070
  if (hasExplicitPositioning && line.segments) {
77837
78071
  let cumulativeX = 0;
77838
78072
  const segmentsByRun = /* @__PURE__ */ new Map();
@@ -78616,6 +78850,23 @@ const applyParagraphShadingStyles = (element, shading) => {
78616
78850
  if (!shading?.fill) return;
78617
78851
  element.style.backgroundColor = shading.fill;
78618
78852
  };
78853
+ const gatherTextSlicesForLine = (block, line) => {
78854
+ const slices = [];
78855
+ const startRun = line.fromRun ?? 0;
78856
+ const endRun = line.toRun ?? startRun;
78857
+ for (let runIndex = startRun; runIndex <= endRun; runIndex += 1) {
78858
+ const run2 = block.runs[runIndex];
78859
+ if (!run2 || run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2) || !run2.text) continue;
78860
+ const isFirst = runIndex === startRun;
78861
+ const isLast = runIndex === endRun;
78862
+ const start2 = isFirst ? line.fromChar ?? 0 : 0;
78863
+ const end2 = isLast ? line.toChar ?? run2.text.length : run2.text.length;
78864
+ if (start2 >= end2) continue;
78865
+ const slice2 = run2.text.slice(start2, end2);
78866
+ if (slice2) slices.push(slice2);
78867
+ }
78868
+ return slices;
78869
+ };
78619
78870
  const sliceRunsForLine = (block, line) => {
78620
78871
  const result = [];
78621
78872
  for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
@@ -81429,6 +81680,9 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
81429
81680
  __privateAdd$1(this, _lastClickTime, 0);
81430
81681
  __privateAdd$1(this, _lastClickPosition, { x: 0, y: 0 });
81431
81682
  __privateAdd$1(this, _lastSelectedImageBlockId, null);
81683
+ __privateAdd$1(this, _dragAnchor, null);
81684
+ __privateAdd$1(this, _isDragging, false);
81685
+ __privateAdd$1(this, _dragExtensionMode, "char");
81432
81686
  __privateAdd$1(this, _remoteCursorState, /* @__PURE__ */ new Map());
81433
81687
  __privateAdd$1(this, _remoteCursorDirty, false);
81434
81688
  __privateAdd$1(this, _remoteCursorOverlay, null);
@@ -81571,13 +81825,56 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
81571
81825
  this.emit("imageDeselected", { blockId: __privateGet$1(this, _lastSelectedImageBlockId) });
81572
81826
  __privateSet(this, _lastSelectedImageBlockId, null);
81573
81827
  }
81828
+ if (event.shiftKey && __privateGet$1(this, _editor3).state.selection.$anchor) {
81829
+ const anchor = __privateGet$1(this, _editor3).state.selection.anchor;
81830
+ const head = hit.pos;
81831
+ const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
81832
+ try {
81833
+ const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
81834
+ __privateGet$1(this, _editor3).view?.dispatch(tr);
81835
+ __privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
81836
+ } catch (error) {
81837
+ console.warn("[SELECTION] Failed to extend selection on shift+click:", {
81838
+ error,
81839
+ anchor,
81840
+ head,
81841
+ selAnchor,
81842
+ selHead,
81843
+ mode: __privateGet$1(this, _dragExtensionMode)
81844
+ });
81845
+ }
81846
+ if (document.activeElement instanceof HTMLElement) {
81847
+ document.activeElement.blur();
81848
+ }
81849
+ const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
81850
+ if (editorDom2) {
81851
+ editorDom2.focus();
81852
+ __privateGet$1(this, _editor3).view?.focus();
81853
+ }
81854
+ return;
81855
+ }
81574
81856
  const clickDepth = __privateMethod$1(this, _PresentationEditor_instances, registerPointerClick_fn).call(this, event);
81857
+ if (clickDepth === 1) {
81858
+ __privateSet(this, _dragAnchor, hit.pos);
81859
+ }
81860
+ __privateSet(this, _isDragging, true);
81861
+ if (clickDepth >= 3) {
81862
+ __privateSet(this, _dragExtensionMode, "para");
81863
+ } else if (clickDepth === 2) {
81864
+ __privateSet(this, _dragExtensionMode, "word");
81865
+ } else {
81866
+ __privateSet(this, _dragExtensionMode, "char");
81867
+ }
81868
+ if (typeof __privateGet$1(this, _viewportHost).setPointerCapture === "function") {
81869
+ __privateGet$1(this, _viewportHost).setPointerCapture(event.pointerId);
81870
+ }
81575
81871
  let handledByDepth = false;
81576
81872
  if (__privateGet$1(this, _session).mode === "body") {
81873
+ const selectionPos = clickDepth >= 2 && __privateGet$1(this, _dragAnchor) !== null ? __privateGet$1(this, _dragAnchor) : hit.pos;
81577
81874
  if (clickDepth >= 3) {
81578
- handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectParagraphAt_fn).call(this, hit.pos);
81875
+ handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectParagraphAt_fn).call(this, selectionPos);
81579
81876
  } else if (clickDepth === 2) {
81580
- handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectWordAt_fn).call(this, hit.pos);
81877
+ handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectWordAt_fn).call(this, selectionPos);
81581
81878
  }
81582
81879
  }
81583
81880
  if (!handledByDepth) {
@@ -81602,6 +81899,36 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
81602
81899
  if (!__privateGet$1(this, _layoutState).layout) return;
81603
81900
  const normalized = __privateMethod$1(this, _PresentationEditor_instances, normalizeClientPoint_fn).call(this, event.clientX, event.clientY);
81604
81901
  if (!normalized) return;
81902
+ if (__privateGet$1(this, _isDragging) && __privateGet$1(this, _dragAnchor) !== null && event.buttons & 1) {
81903
+ const hit = clickToPosition(
81904
+ __privateGet$1(this, _layoutState).layout,
81905
+ __privateGet$1(this, _layoutState).blocks,
81906
+ __privateGet$1(this, _layoutState).measures,
81907
+ { x: normalized.x, y: normalized.y },
81908
+ __privateGet$1(this, _viewportHost),
81909
+ event.clientX,
81910
+ event.clientY
81911
+ );
81912
+ if (!hit) return;
81913
+ const anchor = __privateGet$1(this, _dragAnchor);
81914
+ const head = hit.pos;
81915
+ const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
81916
+ try {
81917
+ const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
81918
+ __privateGet$1(this, _editor3).view?.dispatch(tr);
81919
+ __privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
81920
+ } catch (error) {
81921
+ console.warn("[SELECTION] Failed to extend selection during drag:", {
81922
+ error,
81923
+ anchor,
81924
+ head,
81925
+ selAnchor,
81926
+ selHead,
81927
+ mode: __privateGet$1(this, _dragExtensionMode)
81928
+ });
81929
+ }
81930
+ return;
81931
+ }
81605
81932
  if (__privateGet$1(this, _session).mode !== "body") {
81606
81933
  __privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
81607
81934
  return;
@@ -81620,6 +81947,13 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
81620
81947
  __privateAdd$1(this, _handlePointerLeave, () => {
81621
81948
  __privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
81622
81949
  });
81950
+ __privateAdd$1(this, _handlePointerUp, (event) => {
81951
+ if (!__privateGet$1(this, _isDragging)) return;
81952
+ if (typeof __privateGet$1(this, _viewportHost).hasPointerCapture === "function" && typeof __privateGet$1(this, _viewportHost).releasePointerCapture === "function" && __privateGet$1(this, _viewportHost).hasPointerCapture(event.pointerId)) {
81953
+ __privateGet$1(this, _viewportHost).releasePointerCapture(event.pointerId);
81954
+ }
81955
+ __privateSet(this, _isDragging, false);
81956
+ });
81623
81957
  __privateAdd$1(this, _handleDoubleClick, (event) => {
81624
81958
  if (event.button !== 0) return;
81625
81959
  if (!__privateGet$1(this, _layoutState).layout) return;
@@ -82539,6 +82873,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
82539
82873
  __privateGet$1(this, _viewportHost)?.removeEventListener("pointerdown", __privateGet$1(this, _handlePointerDown));
82540
82874
  __privateGet$1(this, _viewportHost)?.removeEventListener("dblclick", __privateGet$1(this, _handleDoubleClick));
82541
82875
  __privateGet$1(this, _viewportHost)?.removeEventListener("pointermove", __privateGet$1(this, _handlePointerMove));
82876
+ __privateGet$1(this, _viewportHost)?.removeEventListener("pointerup", __privateGet$1(this, _handlePointerUp));
82542
82877
  __privateGet$1(this, _viewportHost)?.removeEventListener("pointerleave", __privateGet$1(this, _handlePointerLeave));
82543
82878
  __privateGet$1(this, _visibleHost)?.removeEventListener("keydown", __privateGet$1(this, _handleKeyDown));
82544
82879
  __privateGet$1(this, _inputBridge)?.notifyTargetChanged();
@@ -82648,6 +82983,9 @@ _clickCount = /* @__PURE__ */ new WeakMap();
82648
82983
  _lastClickTime = /* @__PURE__ */ new WeakMap();
82649
82984
  _lastClickPosition = /* @__PURE__ */ new WeakMap();
82650
82985
  _lastSelectedImageBlockId = /* @__PURE__ */ new WeakMap();
82986
+ _dragAnchor = /* @__PURE__ */ new WeakMap();
82987
+ _isDragging = /* @__PURE__ */ new WeakMap();
82988
+ _dragExtensionMode = /* @__PURE__ */ new WeakMap();
82651
82989
  _remoteCursorState = /* @__PURE__ */ new WeakMap();
82652
82990
  _remoteCursorDirty = /* @__PURE__ */ new WeakMap();
82653
82991
  _remoteCursorOverlay = /* @__PURE__ */ new WeakMap();
@@ -82983,6 +83321,7 @@ setupPointerHandlers_fn = function() {
82983
83321
  __privateGet$1(this, _viewportHost).addEventListener("pointerdown", __privateGet$1(this, _handlePointerDown));
82984
83322
  __privateGet$1(this, _viewportHost).addEventListener("dblclick", __privateGet$1(this, _handleDoubleClick));
82985
83323
  __privateGet$1(this, _viewportHost).addEventListener("pointermove", __privateGet$1(this, _handlePointerMove));
83324
+ __privateGet$1(this, _viewportHost).addEventListener("pointerup", __privateGet$1(this, _handlePointerUp));
82986
83325
  __privateGet$1(this, _viewportHost).addEventListener("pointerleave", __privateGet$1(this, _handlePointerLeave));
82987
83326
  __privateGet$1(this, _visibleHost).addEventListener("keydown", __privateGet$1(this, _handleKeyDown));
82988
83327
  };
@@ -83062,8 +83401,11 @@ getFirstTextPosition_fn = function() {
83062
83401
  registerPointerClick_fn = function(event) {
83063
83402
  const MAX_CLICK_COUNT = 3;
83064
83403
  const time2 = event.timeStamp ?? performance.now();
83065
- const withinTime = time2 - __privateGet$1(this, _lastClickTime) <= MULTI_CLICK_TIME_THRESHOLD_MS;
83066
- 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;
83404
+ const timeDelta = time2 - __privateGet$1(this, _lastClickTime);
83405
+ const withinTime = timeDelta <= MULTI_CLICK_TIME_THRESHOLD_MS;
83406
+ const distanceX = Math.abs(event.clientX - __privateGet$1(this, _lastClickPosition).x);
83407
+ const distanceY = Math.abs(event.clientY - __privateGet$1(this, _lastClickPosition).y);
83408
+ const withinDistance = distanceX <= MULTI_CLICK_DISTANCE_THRESHOLD_PX && distanceY <= MULTI_CLICK_DISTANCE_THRESHOLD_PX;
83067
83409
  if (withinTime && withinDistance) {
83068
83410
  __privateSet(this, _clickCount, Math.min(__privateGet$1(this, _clickCount) + 1, MAX_CLICK_COUNT));
83069
83411
  } else {
@@ -83078,6 +83420,9 @@ selectWordAt_fn = function(pos) {
83078
83420
  if (!state2?.doc) {
83079
83421
  return false;
83080
83422
  }
83423
+ if (pos < 0 || pos > state2.doc.content.size) {
83424
+ return false;
83425
+ }
83081
83426
  const $pos = state2.doc.resolve(pos);
83082
83427
  let textblockPos = $pos;
83083
83428
  while (textblockPos.depth > 0) {
@@ -83164,6 +83509,30 @@ selectParagraphAt_fn = function(pos) {
83164
83509
  return false;
83165
83510
  }
83166
83511
  };
83512
+ calculateExtendedSelection_fn = function(anchor, head, mode) {
83513
+ if (mode === "word") {
83514
+ const anchorBounds = findWordBoundaries(__privateGet$1(this, _layoutState).blocks, anchor);
83515
+ const headBounds = findWordBoundaries(__privateGet$1(this, _layoutState).blocks, head);
83516
+ if (anchorBounds && headBounds) {
83517
+ if (head >= anchor) {
83518
+ return { selAnchor: anchorBounds.from, selHead: headBounds.to };
83519
+ } else {
83520
+ return { selAnchor: anchorBounds.to, selHead: headBounds.from };
83521
+ }
83522
+ }
83523
+ } else if (mode === "para") {
83524
+ const anchorBounds = findParagraphBoundaries(__privateGet$1(this, _layoutState).blocks, anchor);
83525
+ const headBounds = findParagraphBoundaries(__privateGet$1(this, _layoutState).blocks, head);
83526
+ if (anchorBounds && headBounds) {
83527
+ if (head >= anchor) {
83528
+ return { selAnchor: anchorBounds.from, selHead: headBounds.to };
83529
+ } else {
83530
+ return { selAnchor: anchorBounds.to, selHead: headBounds.from };
83531
+ }
83532
+ }
83533
+ }
83534
+ return { selAnchor: anchor, selHead: head };
83535
+ };
83167
83536
  isWordCharacter_fn = function(char) {
83168
83537
  if (!char) {
83169
83538
  return false;
@@ -83172,6 +83541,7 @@ isWordCharacter_fn = function(char) {
83172
83541
  };
83173
83542
  _handlePointerMove = /* @__PURE__ */ new WeakMap();
83174
83543
  _handlePointerLeave = /* @__PURE__ */ new WeakMap();
83544
+ _handlePointerUp = /* @__PURE__ */ new WeakMap();
83175
83545
  _handleDoubleClick = /* @__PURE__ */ new WeakMap();
83176
83546
  _handleKeyDown = /* @__PURE__ */ new WeakMap();
83177
83547
  focusHeaderFooterShortcut_fn = function(kind) {
@@ -84344,10 +84714,12 @@ convertPageLocalToOverlayCoords_fn = function(pageIndex, pageLocalX, pageLocalY)
84344
84714
  }
84345
84715
  const pageRect = pageEl.getBoundingClientRect();
84346
84716
  const overlayRect = __privateGet$1(this, _selectionOverlay2).getBoundingClientRect();
84347
- const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
84717
+ const layoutPageSize = __privateGet$1(this, _layoutState).layout?.pageSize;
84718
+ const scaleX = layoutPageSize && typeof layoutPageSize.w === "number" && layoutPageSize.w > 0 ? pageRect.width / layoutPageSize.w : 1;
84719
+ const scaleY = layoutPageSize && typeof layoutPageSize.h === "number" && layoutPageSize.h > 0 ? pageRect.height / layoutPageSize.h : 1;
84348
84720
  return {
84349
- x: pageRect.left - overlayRect.left + pageLocalX * zoom,
84350
- y: pageRect.top - overlayRect.top + pageLocalY * zoom
84721
+ x: pageRect.left - overlayRect.left + pageLocalX * scaleX,
84722
+ y: pageRect.top - overlayRect.top + pageLocalY * scaleY
84351
84723
  };
84352
84724
  };
84353
84725
  normalizeClientPoint_fn = function(clientX, clientY) {