superdoc 1.0.0-beta.56 → 1.0.0-beta.58

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-DsYaXp0H.es.js → PdfViewer-BOtq_Mxx.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CnvD--7P.cjs → PdfViewer-CPNlFudP.cjs} +1 -1
  3. package/dist/chunks/{index-DYnUncjo-Br0s3gQs.es.js → index-BWMksCRw-BE_kaq_r.es.js} +1 -1
  4. package/dist/chunks/{index-DYnUncjo-Uv8YzgRb.cjs → index-BWMksCRw-BtY5hIaC.cjs} +1 -1
  5. package/dist/chunks/{index-DF1aQt8V.es.js → index-Wqm4Y9w9.es.js} +3 -3
  6. package/dist/chunks/{index-BpBdSm3V.cjs → index-yDP_DAl6.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-BxMwj135.es.js → super-editor.es-BtTJyHJj.es.js} +270 -118
  8. package/dist/chunks/{super-editor.es-DkFw0sfq.cjs → super-editor.es-DsUuY-Pt.cjs} +270 -118
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-DwC5XPQX.js → converter-w1IY5-V-.js} +70 -11
  11. package/dist/super-editor/chunks/{docx-zipper-BkCzC50U.js → docx-zipper-B7-XHg8m.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-CoKNeouN.js → editor-CiTfe7Wr.js} +271 -117
  13. package/dist/super-editor/chunks/{index-DYnUncjo.js → index-BWMksCRw.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-DUWk-Bwi.js → toolbar-yy1NR024.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 +272 -120
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -9,11 +9,11 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- 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, hideDimmingOverlay_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
12
+ 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, hideDimmingOverlay_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as resolveRunProperties, at as encodeCSSFromPPr, au as twipsToPixels$2, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-DwC5XPQX.js";
16
- import { D as DocxZipper } from "./docx-zipper-BkCzC50U.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as resolveRunProperties, at as encodeCSSFromPPr, au as twipsToPixels$2, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-w1IY5-V-.js";
16
+ import { D as DocxZipper } from "./docx-zipper-B7-XHg8m.js";
17
17
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
@@ -13504,7 +13504,12 @@ function processRelationships(root, convertedXml, results) {
13504
13504
  }
13505
13505
  }
13506
13506
  if (targetMode.toLowerCase() !== "external" && !looksExternal(target)) {
13507
- const likelyPath = `word/${target.replace(/^\.?\//, "")}`;
13507
+ let likelyPath;
13508
+ if (target.startsWith("../")) {
13509
+ likelyPath = target.replace(/^\.\.\//, "");
13510
+ } else {
13511
+ likelyPath = `word/${target.replace(/^\.?\//, "")}`;
13512
+ }
13508
13513
  if (!(likelyPath in convertedXml)) {
13509
13514
  if (!isImageType(type)) {
13510
13515
  results.push(`Removed relationship ${id} with missing target: ${target}`);
@@ -13918,7 +13923,7 @@ const isHeadless = (editor) => {
13918
13923
  const shouldSkipNodeView = (editor) => {
13919
13924
  return isHeadless(editor);
13920
13925
  };
13921
- const summaryVersion = "1.0.0-beta.56";
13926
+ const summaryVersion = "1.0.0-beta.58";
13922
13927
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
13923
13928
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
13924
13929
  function mapAttributes(attrs) {
@@ -14710,7 +14715,7 @@ const _Editor = class _Editor extends EventEmitter {
14710
14715
  { default: remarkStringify },
14711
14716
  { default: remarkGfm }
14712
14717
  ] = await Promise.all([
14713
- import("./index-DYnUncjo.js"),
14718
+ import("./index-BWMksCRw.js"),
14714
14719
  import("./index-DRCvimau.js"),
14715
14720
  import("./index-C_x_N6Uh.js"),
14716
14721
  import("./index-D_sWOSiG.js"),
@@ -14915,7 +14920,7 @@ const _Editor = class _Editor extends EventEmitter {
14915
14920
  * Process collaboration migrations
14916
14921
  */
14917
14922
  processCollaborationMigrations() {
14918
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.56");
14923
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.58");
14919
14924
  if (!this.options.ydoc) return;
14920
14925
  const metaMap = this.options.ydoc.getMap("meta");
14921
14926
  let docVersion = metaMap.get("version");
@@ -17479,6 +17484,7 @@ const normalizeAlignment = (value) => {
17479
17484
  case "center":
17480
17485
  case "right":
17481
17486
  case "justify":
17487
+ case "left":
17482
17488
  return value;
17483
17489
  case "both":
17484
17490
  case "distribute":
@@ -27034,9 +27040,11 @@ const _DomPainter = class _DomPainter {
27034
27040
  const hasExplicitSegmentPositioning = line.segments?.some((seg) => seg.x !== void 0);
27035
27041
  const isFirstLine = index2 === 0 && !fragment.continuesFromPrev;
27036
27042
  if (!isListFirstLine) {
27037
- if (isFirstLine && hasExplicitSegmentPositioning && firstLineOffset !== 0) {
27038
- const adjustedPadding = paraIndentLeft + firstLineOffset;
27039
- lineEl.style.paddingLeft = `${adjustedPadding}px`;
27043
+ if (hasExplicitSegmentPositioning) {
27044
+ if (isFirstLine && firstLineOffset !== 0) {
27045
+ const adjustedPadding = paraIndentLeft + firstLineOffset;
27046
+ lineEl.style.paddingLeft = `${adjustedPadding}px`;
27047
+ }
27040
27048
  } else if (paraIndentLeft) {
27041
27049
  lineEl.style.paddingLeft = `${paraIndentLeft}px`;
27042
27050
  }
@@ -28467,6 +28475,13 @@ const _DomPainter = class _DomPainter {
28467
28475
  }
28468
28476
  }
28469
28477
  if (hasExplicitPositioning && line.segments) {
28478
+ const paraIndent = block.attrs?.indent;
28479
+ const indentLeft = paraIndent?.left ?? 0;
28480
+ const firstLine = paraIndent?.firstLine ?? 0;
28481
+ const hanging = paraIndent?.hanging ?? 0;
28482
+ const isFirstLineOfPara = lineIndex === 0 || lineIndex === void 0;
28483
+ const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
28484
+ const indentOffset = indentLeft + firstLineOffsetForCumX;
28470
28485
  let cumulativeX = 0;
28471
28486
  const segmentsByRun = /* @__PURE__ */ new Map();
28472
28487
  line.segments.forEach((segment) => {
@@ -28498,7 +28513,7 @@ const _DomPainter = class _DomPainter {
28498
28513
  const actualTabWidth = tabEndX - tabStartX;
28499
28514
  const tabEl = this.doc.createElement("span");
28500
28515
  tabEl.style.position = "absolute";
28501
- tabEl.style.left = `${tabStartX}px`;
28516
+ tabEl.style.left = `${tabStartX + indentOffset}px`;
28502
28517
  tabEl.style.top = "0px";
28503
28518
  tabEl.style.width = `${actualTabWidth}px`;
28504
28519
  tabEl.style.height = `${line.lineHeight}px`;
@@ -28529,12 +28544,13 @@ const _DomPainter = class _DomPainter {
28529
28544
  elem.setAttribute("styleid", styleId);
28530
28545
  }
28531
28546
  const runSegments2 = segmentsByRun.get(runIndex);
28532
- const segX = runSegments2 && runSegments2[0]?.x !== void 0 ? runSegments2[0].x : cumulativeX;
28547
+ const baseSegX = runSegments2 && runSegments2[0]?.x !== void 0 ? runSegments2[0].x : cumulativeX;
28548
+ const segX = baseSegX + indentOffset;
28533
28549
  const segWidth = (runSegments2 && runSegments2[0]?.width !== void 0 ? runSegments2[0].width : elem.offsetWidth) ?? 0;
28534
28550
  elem.style.position = "absolute";
28535
28551
  elem.style.left = `${segX}px`;
28536
28552
  el.appendChild(elem);
28537
- cumulativeX = segX + segWidth;
28553
+ cumulativeX = baseSegX + segWidth;
28538
28554
  }
28539
28555
  continue;
28540
28556
  }
@@ -28551,12 +28567,13 @@ const _DomPainter = class _DomPainter {
28551
28567
  elem.setAttribute("styleid", styleId);
28552
28568
  }
28553
28569
  const runSegments2 = segmentsByRun.get(runIndex);
28554
- const segX = runSegments2 && runSegments2[0]?.x !== void 0 ? runSegments2[0].x : cumulativeX;
28570
+ const baseSegX = runSegments2 && runSegments2[0]?.x !== void 0 ? runSegments2[0].x : cumulativeX;
28571
+ const segX = baseSegX + indentOffset;
28555
28572
  const segWidth = (runSegments2 && runSegments2[0]?.width !== void 0 ? runSegments2[0].width : 0) ?? 0;
28556
28573
  elem.style.position = "absolute";
28557
28574
  elem.style.left = `${segX}px`;
28558
28575
  el.appendChild(elem);
28559
- cumulativeX = segX + segWidth;
28576
+ cumulativeX = baseSegX + segWidth;
28560
28577
  }
28561
28578
  continue;
28562
28579
  }
@@ -28586,7 +28603,8 @@ const _DomPainter = class _DomPainter {
28586
28603
  if (styleId) {
28587
28604
  elem.setAttribute("styleid", styleId);
28588
28605
  }
28589
- const xPos = segment.x !== void 0 ? segment.x : cumulativeX;
28606
+ const baseX = segment.x !== void 0 ? segment.x : cumulativeX;
28607
+ const xPos = baseX + indentOffset;
28590
28608
  elem.style.position = "absolute";
28591
28609
  elem.style.left = `${xPos}px`;
28592
28610
  el.appendChild(elem);
@@ -28600,7 +28618,7 @@ const _DomPainter = class _DomPainter {
28600
28618
  width = measureEl.offsetWidth;
28601
28619
  this.doc.body.removeChild(measureEl);
28602
28620
  }
28603
- cumulativeX = xPos + width;
28621
+ cumulativeX = baseX + width;
28604
28622
  }
28605
28623
  });
28606
28624
  }
@@ -29976,7 +29994,7 @@ const defaultMultiSectionIdentifier = () => ({
29976
29994
  sectionFooterIds: /* @__PURE__ */ new Map(),
29977
29995
  sectionTitlePg: /* @__PURE__ */ new Map()
29978
29996
  });
29979
- function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
29997
+ function buildMultiSectionIdentifier(sectionMetadata, pageStyles2, converterIds) {
29980
29998
  const identifier = defaultMultiSectionIdentifier();
29981
29999
  identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
29982
30000
  identifier.sectionCount = sectionMetadata.length;
@@ -30011,6 +30029,18 @@ function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
30011
30029
  identifier.footerIds = { ...section0Footers };
30012
30030
  }
30013
30031
  identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
30032
+ if (converterIds?.headerIds) {
30033
+ identifier.headerIds.default = identifier.headerIds.default ?? converterIds.headerIds.default ?? null;
30034
+ identifier.headerIds.first = identifier.headerIds.first ?? converterIds.headerIds.first ?? null;
30035
+ identifier.headerIds.even = identifier.headerIds.even ?? converterIds.headerIds.even ?? null;
30036
+ identifier.headerIds.odd = identifier.headerIds.odd ?? converterIds.headerIds.odd ?? null;
30037
+ }
30038
+ if (converterIds?.footerIds) {
30039
+ identifier.footerIds.default = identifier.footerIds.default ?? converterIds.footerIds.default ?? null;
30040
+ identifier.footerIds.first = identifier.footerIds.first ?? converterIds.footerIds.first ?? null;
30041
+ identifier.footerIds.even = identifier.footerIds.even ?? converterIds.footerIds.even ?? null;
30042
+ identifier.footerIds.odd = identifier.footerIds.odd ?? converterIds.footerIds.odd ?? null;
30043
+ }
30014
30044
  return identifier;
30015
30045
  }
30016
30046
  function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
@@ -30990,6 +31020,32 @@ function layoutDrawingBlock({
30990
31020
  state.page.fragments.push(fragment);
30991
31021
  state.cursorY += requiredHeight;
30992
31022
  }
31023
+ function getTableIndentWidth(attrs) {
31024
+ if (!attrs) {
31025
+ return 0;
31026
+ }
31027
+ const tableIndent = attrs.tableIndent;
31028
+ if (!tableIndent || typeof tableIndent !== "object") {
31029
+ return 0;
31030
+ }
31031
+ const width = tableIndent.width;
31032
+ if (width === void 0 || width === null) {
31033
+ return 0;
31034
+ }
31035
+ if (typeof width !== "number") {
31036
+ return 0;
31037
+ }
31038
+ if (!Number.isFinite(width)) {
31039
+ return 0;
31040
+ }
31041
+ return width;
31042
+ }
31043
+ function applyTableIndent(x, width, indent) {
31044
+ return {
31045
+ x: x + indent,
31046
+ width: Math.max(0, width - indent)
31047
+ };
31048
+ }
30993
31049
  function calculateColumnMinWidth(columnIndex, measure) {
30994
31050
  const DEFAULT_MIN_WIDTH = 25;
30995
31051
  const measuredWidth = measure.columnWidths[columnIndex] || DEFAULT_MIN_WIDTH;
@@ -31204,14 +31260,18 @@ function layoutMonolithicTable(context) {
31204
31260
  columnBoundaries: generateColumnBoundaries(context.measure),
31205
31261
  coordinateSystem: "fragment"
31206
31262
  };
31263
+ const tableIndent = getTableIndentWidth(context.block.attrs);
31264
+ const baseX = context.columnX(state.columnIndex);
31265
+ const baseWidth = Math.min(context.columnWidth, context.measure.totalWidth || context.columnWidth);
31266
+ const { x, width } = applyTableIndent(baseX, baseWidth, tableIndent);
31207
31267
  const fragment = {
31208
31268
  kind: "table",
31209
31269
  blockId: context.block.id,
31210
31270
  fromRow: 0,
31211
31271
  toRow: context.block.rows.length,
31212
- x: context.columnX(state.columnIndex),
31272
+ x,
31213
31273
  y: state.cursorY,
31214
- width: Math.min(context.columnWidth, context.measure.totalWidth || context.columnWidth),
31274
+ width,
31215
31275
  height,
31216
31276
  metadata
31217
31277
  };
@@ -31278,14 +31338,18 @@ function layoutTableBlock({
31278
31338
  columnBoundaries: generateColumnBoundaries(measure),
31279
31339
  coordinateSystem: "fragment"
31280
31340
  };
31341
+ const tableIndent = getTableIndentWidth(block.attrs);
31342
+ const baseX = columnX(state.columnIndex);
31343
+ const baseWidth = Math.min(columnWidth, measure.totalWidth || columnWidth);
31344
+ const { x, width } = applyTableIndent(baseX, baseWidth, tableIndent);
31281
31345
  const fragment = {
31282
31346
  kind: "table",
31283
31347
  blockId: block.id,
31284
31348
  fromRow: 0,
31285
31349
  toRow: 0,
31286
- x: columnX(state.columnIndex),
31350
+ x,
31287
31351
  y: state.cursorY,
31288
- width: Math.min(columnWidth, measure.totalWidth || columnWidth),
31352
+ width,
31289
31353
  height,
31290
31354
  metadata
31291
31355
  };
@@ -31333,14 +31397,18 @@ function layoutTableBlock({
31333
31397
  });
31334
31398
  const fragmentHeight2 = continuationPartialRow.partialHeight + (repeatHeaderCount > 0 ? headerHeight : 0);
31335
31399
  if (fragmentHeight2 > 0 && madeProgress) {
31400
+ const tableIndent2 = getTableIndentWidth(block.attrs);
31401
+ const baseX2 = columnX(state.columnIndex);
31402
+ const baseWidth2 = Math.min(columnWidth, measure.totalWidth || columnWidth);
31403
+ const { x: x2, width: width2 } = applyTableIndent(baseX2, baseWidth2, tableIndent2);
31336
31404
  const fragment2 = {
31337
31405
  kind: "table",
31338
31406
  blockId: block.id,
31339
31407
  fromRow: rowIndex,
31340
31408
  toRow: rowIndex + 1,
31341
- x: columnX(state.columnIndex),
31409
+ x: x2,
31342
31410
  y: state.cursorY,
31343
- width: Math.min(columnWidth, measure.totalWidth || columnWidth),
31411
+ width: width2,
31344
31412
  height: fragmentHeight2,
31345
31413
  continuesFromPrev: true,
31346
31414
  continuesOnNext: hasRemainingLinesAfterContinuation || rowIndex + 1 < block.rows.length,
@@ -31373,14 +31441,18 @@ function layoutTableBlock({
31373
31441
  const forcedPartialRow = computePartialRow(bodyStartRow, block.rows[bodyStartRow], measure, availableForBody);
31374
31442
  const forcedEndRow = bodyStartRow + 1;
31375
31443
  const fragmentHeight2 = forcedPartialRow.partialHeight + (repeatHeaderCount > 0 ? headerHeight : 0);
31444
+ const tableIndent2 = getTableIndentWidth(block.attrs);
31445
+ const baseX2 = columnX(state.columnIndex);
31446
+ const baseWidth2 = Math.min(columnWidth, measure.totalWidth || columnWidth);
31447
+ const { x: x2, width: width2 } = applyTableIndent(baseX2, baseWidth2, tableIndent2);
31376
31448
  const fragment2 = {
31377
31449
  kind: "table",
31378
31450
  blockId: block.id,
31379
31451
  fromRow: bodyStartRow,
31380
31452
  toRow: forcedEndRow,
31381
- x: columnX(state.columnIndex),
31453
+ x: x2,
31382
31454
  y: state.cursorY,
31383
- width: Math.min(columnWidth, measure.totalWidth || columnWidth),
31455
+ width: width2,
31384
31456
  height: fragmentHeight2,
31385
31457
  continuesFromPrev: isTableContinuation,
31386
31458
  continuesOnNext: !forcedPartialRow.isLastPart || forcedEndRow < block.rows.length,
@@ -31404,14 +31476,18 @@ function layoutTableBlock({
31404
31476
  measure
31405
31477
  );
31406
31478
  }
31479
+ const tableIndent = getTableIndentWidth(block.attrs);
31480
+ const baseX = columnX(state.columnIndex);
31481
+ const baseWidth = Math.min(columnWidth, measure.totalWidth || columnWidth);
31482
+ const { x, width } = applyTableIndent(baseX, baseWidth, tableIndent);
31407
31483
  const fragment = {
31408
31484
  kind: "table",
31409
31485
  blockId: block.id,
31410
31486
  fromRow: bodyStartRow,
31411
31487
  toRow: endRow,
31412
- x: columnX(state.columnIndex),
31488
+ x,
31413
31489
  y: state.cursorY,
31414
- width: Math.min(columnWidth, measure.totalWidth || columnWidth),
31490
+ width,
31415
31491
  height: fragmentHeight,
31416
31492
  continuesFromPrev: isTableContinuation,
31417
31493
  continuesOnNext: endRow < block.rows.length || (partialRow ? !partialRow.isLastPart : false),
@@ -36199,7 +36275,15 @@ async function measureParagraphBlock(block, maxWidth) {
36199
36275
  currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
36200
36276
  currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
36201
36277
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
36202
- appendSegment(currentLine.segments, runIndex, wordStartChar, wordEndNoSpace, wordOnlyWidth, segmentStartX);
36278
+ const useExplicitXHere = wordIndex === 0 && segmentStartX !== void 0;
36279
+ appendSegment(
36280
+ currentLine.segments,
36281
+ runIndex,
36282
+ wordStartChar,
36283
+ wordEndNoSpace,
36284
+ wordOnlyWidth,
36285
+ useExplicitXHere ? segmentStartX : void 0
36286
+ );
36203
36287
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
36204
36288
  const completedLine = { ...currentLine, ...metrics };
36205
36289
  addBarTabsToLine(completedLine);
@@ -36923,6 +37007,9 @@ const onHeaderFooterDataUpdate = async ({ editor, transaction }, mainEditor, sec
36923
37007
  }
36924
37008
  mainEditor.converter[`${type}s`][sectionId] = updatedData;
36925
37009
  mainEditor.setOptions({ isHeaderFooterChanged: editor.docChanged });
37010
+ if (editor.docChanged && mainEditor.converter) {
37011
+ mainEditor.converter.headerFooterModified = true;
37012
+ }
36926
37013
  await updateYdocDocxData(mainEditor);
36927
37014
  };
36928
37015
  const setEditorToolbar = ({ editor }, mainEditor) => {
@@ -37204,17 +37291,20 @@ class HeaderFooterEditorManager extends EventEmitter {
37204
37291
  * ```
37205
37292
  */
37206
37293
  getDocumentJson(descriptor) {
37207
- if (!descriptor?.id) return null;
37294
+ if (!descriptor?.id) {
37295
+ return null;
37296
+ }
37208
37297
  const liveEntry = __privateGet(this, _editorEntries).get(descriptor.id);
37209
37298
  if (liveEntry) {
37210
37299
  try {
37211
- const json = liveEntry.editor.getJSON?.();
37212
- return json;
37300
+ return liveEntry.editor.getJSON?.();
37213
37301
  } catch {
37214
37302
  }
37215
37303
  }
37216
37304
  const collections = __privateGet(this, _collections);
37217
- if (!collections) return null;
37305
+ if (!collections) {
37306
+ return null;
37307
+ }
37218
37308
  if (descriptor.kind === "header") {
37219
37309
  return collections.headers?.[descriptor.id] ?? null;
37220
37310
  }
@@ -37647,7 +37737,9 @@ class HeaderFooterLayoutAdapter {
37647
37737
  */
37648
37738
  getBatch(kind) {
37649
37739
  const descriptors = __privateGet(this, _manager).getDescriptors(kind);
37650
- if (!descriptors.length) return void 0;
37740
+ if (!descriptors.length) {
37741
+ return void 0;
37742
+ }
37651
37743
  const batch = {};
37652
37744
  let hasBlocks = false;
37653
37745
  descriptors.forEach((descriptor) => {
@@ -37892,13 +37984,7 @@ class EditorOverlayManager {
37892
37984
  showEditingOverlay(pageElement, region, zoom) {
37893
37985
  try {
37894
37986
  const decorationContainer = __privateMethod(this, _EditorOverlayManager_instances, findDecorationContainer_fn).call(this, pageElement, region.kind);
37895
- if (!decorationContainer) {
37896
- return {
37897
- success: false,
37898
- reason: `Decoration container not found for ${region.kind} on page ${region.pageIndex}`
37899
- };
37900
- }
37901
- const editorHost = __privateMethod(this, _EditorOverlayManager_instances, ensureEditorHost_fn).call(this, pageElement, region.kind);
37987
+ const editorHost = __privateMethod(this, _EditorOverlayManager_instances, ensureEditorHost_fn).call(this, pageElement, region.kind, decorationContainer);
37902
37988
  if (!editorHost) {
37903
37989
  return {
37904
37990
  success: false,
@@ -37906,7 +37992,9 @@ class EditorOverlayManager {
37906
37992
  };
37907
37993
  }
37908
37994
  __privateMethod(this, _EditorOverlayManager_instances, positionEditorHost_fn).call(this, editorHost, region, decorationContainer, zoom);
37909
- decorationContainer.style.visibility = "hidden";
37995
+ if (decorationContainer) {
37996
+ decorationContainer.style.visibility = "hidden";
37997
+ }
37910
37998
  editorHost.style.visibility = "visible";
37911
37999
  editorHost.style.zIndex = EDITOR_HOST_Z_INDEX;
37912
38000
  if (region.kind === "footer") {
@@ -37918,7 +38006,7 @@ class EditorOverlayManager {
37918
38006
  }
37919
38007
  }
37920
38008
  }
37921
- __privateMethod(this, _EditorOverlayManager_instances, showHeaderFooterBorder_fn).call(this, pageElement, region, decorationContainer);
38009
+ __privateMethod(this, _EditorOverlayManager_instances, showHeaderFooterBorder_fn).call(this, pageElement, region, decorationContainer, zoom);
37922
38010
  __privateSet(this, _activeEditorHost, editorHost);
37923
38011
  __privateSet(this, _activeDecorationContainer, decorationContainer);
37924
38012
  __privateSet(this, _activeRegion, region);
@@ -38047,17 +38135,18 @@ findDecorationContainer_fn = function(pageElement, kind) {
38047
38135
  return pageElement.querySelector(`.${className}`);
38048
38136
  };
38049
38137
  /**
38050
- * Ensures an editor host element exists as a sibling to the decoration container.
38138
+ * Ensures an editor host element exists for editing.
38051
38139
  *
38052
38140
  * If the editor host doesn't exist, creates it. Otherwise, returns the existing one.
38053
- * The editor host is positioned as a sibling (not child) of the decoration container
38054
- * to avoid the pointer-events: none constraint.
38141
+ * When a decoration container exists, the editor host is positioned as a sibling.
38142
+ * When no decoration container exists (empty header/footer), it's appended to the page.
38055
38143
  *
38056
38144
  * @param pageElement - The page element to create the host within
38057
38145
  * @param kind - The region kind (header or footer)
38146
+ * @param decorationContainer - The decoration container (optional, may not exist for empty regions)
38058
38147
  * @returns The editor host element
38059
38148
  */
38060
- ensureEditorHost_fn = function(pageElement, kind) {
38149
+ ensureEditorHost_fn = function(pageElement, kind, decorationContainer) {
38061
38150
  const className = kind === "header" ? "superdoc-header-editor-host" : "superdoc-footer-editor-host";
38062
38151
  let editorHost = pageElement.querySelector(`.${className}`);
38063
38152
  if (!editorHost) {
@@ -38072,45 +38161,56 @@ ensureEditorHost_fn = function(pageElement, kind) {
38072
38161
  overflow: "hidden",
38073
38162
  boxSizing: "border-box"
38074
38163
  });
38075
- const decorationContainer = __privateMethod(this, _EditorOverlayManager_instances, findDecorationContainer_fn).call(this, pageElement, kind);
38076
- if (!decorationContainer) {
38077
- console.error(`[EditorOverlayManager] Decoration container not found for ${kind}`);
38078
- return null;
38164
+ if (decorationContainer) {
38165
+ decorationContainer.parentNode?.insertBefore(editorHost, decorationContainer.nextSibling);
38166
+ } else {
38167
+ pageElement.appendChild(editorHost);
38079
38168
  }
38080
- decorationContainer.parentNode?.insertBefore(editorHost, decorationContainer.nextSibling);
38081
38169
  }
38082
38170
  return editorHost;
38083
38171
  };
38084
38172
  /**
38085
- * Positions the editor host to match the decoration container bounds.
38173
+ * Positions the editor host for header/footer editing.
38086
38174
  *
38087
- * The editor host is positioned absolutely within the page element to exactly
38088
- * overlap the decoration container's visual space.
38175
+ * When a decoration container exists, positions are derived from its bounds.
38176
+ * When no decoration container exists (empty header/footer), positions are
38177
+ * derived directly from the region data.
38089
38178
  *
38090
38179
  * @param editorHost - The editor host element to position
38091
38180
  * @param region - The header/footer region with dimension data
38092
- * @param decorationContainer - The decoration container to match
38181
+ * @param decorationContainer - The decoration container (optional, may not exist for empty regions)
38093
38182
  * @param zoom - Current zoom level
38094
38183
  */
38095
- positionEditorHost_fn = function(editorHost, region, decorationContainer, _zoom) {
38096
- const decorationRect = decorationContainer.getBoundingClientRect();
38184
+ positionEditorHost_fn = function(editorHost, region, decorationContainer, zoom) {
38097
38185
  const pageElement = editorHost.parentElement;
38098
38186
  if (!pageElement) {
38099
38187
  console.error("[EditorOverlayManager] Editor host has no parent element");
38100
38188
  return;
38101
38189
  }
38102
- const pageRect = pageElement.getBoundingClientRect();
38103
- const top2 = decorationRect.top - pageRect.top;
38104
- const left2 = decorationRect.left - pageRect.left;
38105
- const width = decorationRect.width;
38106
- const height = decorationRect.height;
38190
+ let top2;
38191
+ let left2;
38192
+ let width;
38193
+ let height;
38194
+ if (decorationContainer) {
38195
+ const decorationRect = decorationContainer.getBoundingClientRect();
38196
+ const pageRect = pageElement.getBoundingClientRect();
38197
+ top2 = decorationRect.top - pageRect.top;
38198
+ left2 = decorationRect.left - pageRect.left;
38199
+ width = decorationRect.width;
38200
+ height = decorationRect.height;
38201
+ } else {
38202
+ top2 = region.localY * zoom;
38203
+ left2 = region.localX * zoom;
38204
+ width = region.width * zoom;
38205
+ height = region.height * zoom;
38206
+ }
38107
38207
  Object.assign(editorHost.style, {
38108
38208
  top: `${top2}px`,
38109
38209
  left: `${left2}px`,
38110
38210
  width: `${width}px`,
38111
38211
  height: `${height}px`
38112
38212
  });
38113
- if (region.kind === "footer") {
38213
+ if (region.kind === "footer" && decorationContainer) {
38114
38214
  const fragment = decorationContainer.querySelector(".superdoc-fragment");
38115
38215
  if (fragment instanceof HTMLElement) {
38116
38216
  const fragmentTop = parseFloat(fragment.style.top) || 0;
@@ -38133,14 +38233,19 @@ hideDimmingOverlay_fn = function() {
38133
38233
  * Shows a full-width border line at the bottom of the header or top of the footer.
38134
38234
  * This creates the MS Word style visual indicator spanning edge-to-edge of the page.
38135
38235
  */
38136
- showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer) {
38236
+ showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer, zoom) {
38137
38237
  __privateMethod(this, _EditorOverlayManager_instances, hideHeaderFooterBorder_fn).call(this);
38138
38238
  __privateSet(this, _borderLine, document.createElement("div"));
38139
38239
  __privateGet(this, _borderLine).className = "superdoc-header-footer-border";
38140
- const decorationRect = decorationContainer.getBoundingClientRect();
38141
- const pageRect = pageElement.getBoundingClientRect();
38240
+ let topPosition;
38142
38241
  const isHeader = region.kind === "header";
38143
- const topPosition = isHeader ? decorationRect.bottom - pageRect.top : decorationRect.top - pageRect.top;
38242
+ if (decorationContainer) {
38243
+ const decorationRect = decorationContainer.getBoundingClientRect();
38244
+ const pageRect = pageElement.getBoundingClientRect();
38245
+ topPosition = isHeader ? decorationRect.bottom - pageRect.top : decorationRect.top - pageRect.top;
38246
+ } else {
38247
+ topPosition = isHeader ? (region.localY + region.height) * zoom : region.localY * zoom;
38248
+ }
38144
38249
  Object.assign(__privateGet(this, _borderLine).style, {
38145
38250
  position: "absolute",
38146
38251
  left: "0",
@@ -41071,7 +41176,10 @@ rerender_fn = async function() {
41071
41176
  }
41072
41177
  __privateSet(this, _sectionMetadata, sectionMetadata);
41073
41178
  const converter = __privateGet(this, _editor3).converter;
41074
- __privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
41179
+ __privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles, {
41180
+ headerIds: converter?.headerIds,
41181
+ footerIds: converter?.footerIds
41182
+ }));
41075
41183
  const anchorMap = __privateMethod(this, _PresentationEditor_instances, computeAnchorMap_fn).call(this, bookmarks, layout);
41076
41184
  __privateSet(this, _layoutState, { blocks, measures, layout, bookmarks, anchorMap });
41077
41185
  __privateSet(this, _headerLayoutResults, headerLayouts ?? null);
@@ -41594,41 +41702,83 @@ computeDecorationBox_fn = function(kind, pageMargins, pageHeight) {
41594
41702
  return { x: left2, width, height, offset: offset2 };
41595
41703
  }
41596
41704
  };
41705
+ /**
41706
+ * Computes the expected header/footer section type for a page based on document configuration.
41707
+ *
41708
+ * Unlike getHeaderFooterType/getHeaderFooterTypeForSection, this returns the appropriate
41709
+ * variant even when no header/footer IDs are configured. This is needed to determine
41710
+ * what variant to create when the user double-clicks an empty header/footer region.
41711
+ *
41712
+ * @param kind - Whether this is for a header or footer
41713
+ * @param page - The page to compute the section type for
41714
+ * @param sectionFirstPageNumbers - Map of section index to first page number in that section
41715
+ * @returns The expected section type ('default', 'first', 'even', or 'odd')
41716
+ */
41717
+ computeExpectedSectionType_fn = function(kind, page, sectionFirstPageNumbers) {
41718
+ const sectionIndex = page.sectionIndex ?? 0;
41719
+ const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
41720
+ const sectionPageNumber = typeof firstPageInSection === "number" ? page.number - firstPageInSection + 1 : page.number;
41721
+ const multiSectionId = __privateGet(this, _multiSectionIdentifier);
41722
+ const legacyIdentifier = __privateGet(this, _headerFooterIdentifier);
41723
+ let titlePgEnabled = false;
41724
+ let alternateHeaders = false;
41725
+ if (multiSectionId) {
41726
+ titlePgEnabled = multiSectionId.sectionTitlePg?.get(sectionIndex) ?? multiSectionId.titlePg;
41727
+ alternateHeaders = multiSectionId.alternateHeaders;
41728
+ } else if (legacyIdentifier) {
41729
+ titlePgEnabled = legacyIdentifier.titlePg;
41730
+ alternateHeaders = legacyIdentifier.alternateHeaders;
41731
+ }
41732
+ if (sectionPageNumber === 1 && titlePgEnabled) {
41733
+ return "first";
41734
+ }
41735
+ if (alternateHeaders) {
41736
+ return page.number % 2 === 0 ? "even" : "odd";
41737
+ }
41738
+ return "default";
41739
+ };
41597
41740
  rebuildHeaderFooterRegions_fn = function(layout) {
41598
41741
  __privateGet(this, _headerRegions).clear();
41599
41742
  __privateGet(this, _footerRegions).clear();
41600
41743
  const pageHeight = layout.pageSize?.h ?? __privateGet(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
41601
41744
  if (pageHeight <= 0) return;
41745
+ const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
41746
+ for (const p of layout.pages) {
41747
+ const idx = p.sectionIndex ?? 0;
41748
+ if (!sectionFirstPageNumbers.has(idx)) {
41749
+ sectionFirstPageNumbers.set(idx, p.number);
41750
+ }
41751
+ }
41602
41752
  layout.pages.forEach((page, pageIndex) => {
41603
41753
  var _a, _b;
41604
- const headerPayload = (_a = __privateGet(this, _headerDecorationProvider)) == null ? void 0 : _a.call(this, page.number, page.margins, page);
41605
- if (headerPayload?.hitRegion) {
41606
- __privateGet(this, _headerRegions).set(pageIndex, {
41607
- kind: "header",
41608
- headerId: headerPayload.headerId,
41609
- sectionType: headerPayload.sectionType,
41610
- pageIndex,
41611
- pageNumber: page.number,
41612
- localX: headerPayload.hitRegion.x ?? 0,
41613
- localY: headerPayload.hitRegion.y ?? 0,
41614
- width: headerPayload.hitRegion.width ?? headerPayload.box?.width ?? 0,
41615
- height: headerPayload.hitRegion.height ?? headerPayload.box?.height ?? 0
41616
- });
41617
- }
41618
- const footerPayload = (_b = __privateGet(this, _footerDecorationProvider)) == null ? void 0 : _b.call(this, page.number, page.margins, page);
41619
- if (footerPayload?.hitRegion) {
41620
- __privateGet(this, _footerRegions).set(pageIndex, {
41621
- kind: "footer",
41622
- headerId: footerPayload.headerId,
41623
- sectionType: footerPayload.sectionType,
41624
- pageIndex,
41625
- pageNumber: page.number,
41626
- localX: footerPayload.hitRegion.x ?? 0,
41627
- localY: footerPayload.hitRegion.y ?? 0,
41628
- width: footerPayload.hitRegion.width ?? footerPayload.box?.width ?? 0,
41629
- height: footerPayload.hitRegion.height ?? footerPayload.box?.height ?? 0
41630
- });
41631
- }
41754
+ const margins = page.margins ?? __privateGet(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
41755
+ const actualPageHeight = page.size?.h ?? pageHeight;
41756
+ const headerPayload = (_a = __privateGet(this, _headerDecorationProvider)) == null ? void 0 : _a.call(this, page.number, margins, page);
41757
+ const headerBox = __privateMethod(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, "header", margins, actualPageHeight);
41758
+ __privateGet(this, _headerRegions).set(pageIndex, {
41759
+ kind: "header",
41760
+ headerId: headerPayload?.headerId,
41761
+ sectionType: headerPayload?.sectionType ?? __privateMethod(this, _PresentationEditor_instances, computeExpectedSectionType_fn).call(this, "header", page, sectionFirstPageNumbers),
41762
+ pageIndex,
41763
+ pageNumber: page.number,
41764
+ localX: headerPayload?.hitRegion?.x ?? headerBox.x,
41765
+ localY: headerPayload?.hitRegion?.y ?? headerBox.offset,
41766
+ width: headerPayload?.hitRegion?.width ?? headerBox.width,
41767
+ height: headerPayload?.hitRegion?.height ?? headerBox.height
41768
+ });
41769
+ const footerPayload = (_b = __privateGet(this, _footerDecorationProvider)) == null ? void 0 : _b.call(this, page.number, margins, page);
41770
+ const footerBox = __privateMethod(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, "footer", margins, actualPageHeight);
41771
+ __privateGet(this, _footerRegions).set(pageIndex, {
41772
+ kind: "footer",
41773
+ headerId: footerPayload?.headerId,
41774
+ sectionType: footerPayload?.sectionType ?? __privateMethod(this, _PresentationEditor_instances, computeExpectedSectionType_fn).call(this, "footer", page, sectionFirstPageNumbers),
41775
+ pageIndex,
41776
+ pageNumber: page.number,
41777
+ localX: footerPayload?.hitRegion?.x ?? footerBox.x,
41778
+ localY: footerPayload?.hitRegion?.y ?? footerBox.offset,
41779
+ width: footerPayload?.hitRegion?.width ?? footerBox.width,
41780
+ height: footerPayload?.hitRegion?.height ?? footerBox.height
41781
+ });
41632
41782
  });
41633
41783
  };
41634
41784
  hitTestHeaderFooterRegion_fn = function(x, y) {
@@ -41818,6 +41968,7 @@ enterHeaderFooterMode_fn = async function(region) {
41818
41968
  };
41819
41969
  exitHeaderFooterMode_fn = function() {
41820
41970
  if (__privateGet(this, _session).mode === "body") return;
41971
+ const editedHeaderId = __privateGet(this, _session).headerId;
41821
41972
  if (__privateGet(this, _activeHeaderFooterEditor)) {
41822
41973
  __privateGet(this, _activeHeaderFooterEditor).setEditable(false);
41823
41974
  __privateGet(this, _activeHeaderFooterEditor).setOptions({ documentMode: "viewing" });
@@ -41829,6 +41980,12 @@ exitHeaderFooterMode_fn = function() {
41829
41980
  __privateMethod(this, _PresentationEditor_instances, emitHeaderFooterModeChanged_fn).call(this);
41830
41981
  __privateMethod(this, _PresentationEditor_instances, emitHeaderFooterEditingContext_fn).call(this, __privateGet(this, _editor3));
41831
41982
  __privateGet(this, _inputBridge)?.notifyTargetChanged();
41983
+ if (editedHeaderId) {
41984
+ __privateGet(this, _headerFooterAdapter)?.invalidate(editedHeaderId);
41985
+ }
41986
+ __privateGet(this, _headerFooterManager)?.refresh();
41987
+ __privateSet(this, _pendingDocChange, true);
41988
+ __privateMethod(this, _PresentationEditor_instances, scheduleRerender_fn).call(this);
41832
41989
  __privateGet(this, _editor3).view?.focus();
41833
41990
  };
41834
41991
  getActiveDomTarget_fn = function() {
@@ -41928,34 +42085,31 @@ resolveDescriptorForRegion_fn = function(region) {
41928
42085
  * but no content exists yet. It uses the converter API to create an empty
41929
42086
  * header/footer document.
41930
42087
  *
41931
- * @param region - The header/footer region to create content for
42088
+ * @param region - The header/footer region containing kind ('header' | 'footer')
42089
+ * and sectionType ('default' | 'first' | 'even' | 'odd') information
42090
+ *
42091
+ * Side effects:
42092
+ * - Calls converter.createDefaultHeader() or converter.createDefaultFooter() to
42093
+ * create a new header/footer document in the underlying document model
42094
+ * - Updates this.#headerFooterIdentifier with the new header/footer IDs from
42095
+ * the converter after creation
42096
+ *
42097
+ * Behavior when converter is unavailable:
42098
+ * - Returns early without creating any header/footer if converter is not attached
42099
+ * - Returns early if the appropriate create method is not available on the converter
41932
42100
  */
41933
42101
  createDefaultHeaderFooter_fn = function(region) {
41934
42102
  const converter = __privateGet(this, _editor3).converter;
41935
42103
  if (!converter) {
41936
- console.error("[PresentationEditor] Converter not available for creating header/footer");
41937
42104
  return;
41938
42105
  }
41939
42106
  const variant = region.sectionType ?? "default";
41940
- try {
41941
- if (region.kind === "header") {
41942
- if (typeof converter.createDefaultHeader === "function") {
41943
- const headerId = converter.createDefaultHeader(variant);
41944
- console.log(`[PresentationEditor] Created default header: ${headerId}`);
41945
- } else {
41946
- console.error("[PresentationEditor] converter.createDefaultHeader is not a function");
41947
- }
41948
- } else if (region.kind === "footer") {
41949
- if (typeof converter.createDefaultFooter === "function") {
41950
- const footerId = converter.createDefaultFooter(variant);
41951
- console.log(`[PresentationEditor] Created default footer: ${footerId}`);
41952
- } else {
41953
- console.error("[PresentationEditor] converter.createDefaultFooter is not a function");
41954
- }
41955
- }
41956
- } catch (error) {
41957
- console.error("[PresentationEditor] Failed to create default header/footer:", error);
42107
+ if (region.kind === "header" && typeof converter.createDefaultHeader === "function") {
42108
+ converter.createDefaultHeader(variant);
42109
+ } else if (region.kind === "footer" && typeof converter.createDefaultFooter === "function") {
42110
+ converter.createDefaultFooter(variant);
41958
42111
  }
42112
+ __privateSet(this, _headerFooterIdentifier, extractIdentifierFromConverter(converter));
41959
42113
  };
41960
42114
  /**
41961
42115
  * Gets the DOM element for a specific page index.