@harbour-enterprises/superdoc 0.21.0-RC2 → 0.21.0-next.2

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 (32) hide show
  1. package/README.md +4 -4
  2. package/dist/chunks/{PdfViewer-DGbJ8_qc.cjs → PdfViewer-1mNuyy3m.cjs} +1 -1
  3. package/dist/chunks/{PdfViewer-CbGuPQY8.es.js → PdfViewer-BkXBRXPs.es.js} +1 -1
  4. package/dist/chunks/{index-ecl0ZFNw.cjs → index-BB3Qn69u.cjs} +57 -15
  5. package/dist/chunks/{index-qjntJEk0.es.js → index-C-44kxYe.es.js} +57 -15
  6. package/dist/chunks/{super-editor.es-BF_Xaucb.es.js → super-editor.es-CKw7iZcz.es.js} +217 -128
  7. package/dist/chunks/{super-editor.es-CS5l-cVZ.cjs → super-editor.es-Dd0joLAR.cjs} +217 -128
  8. package/dist/core/SuperDoc.d.ts.map +1 -1
  9. package/dist/stores/comments-store.d.ts.map +1 -1
  10. package/dist/style.css +1 -1
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-DUqGq6qj.js → converter-FESR2WO7.js} +41 -25
  13. package/dist/super-editor/chunks/{docx-zipper-CQsQR8Zs.js → docx-zipper-BWZ2o1H5.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-gMF6aWiz.js → editor-XsrBXzy-.js} +156 -93
  15. package/dist/super-editor/chunks/{toolbar-BxsT1ZgG.js → toolbar-tBWlOBPh.js} +21 -11
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/src/extensions/comment/comment-import-helpers.d.ts +15 -0
  21. package/dist/super-editor/src/extensions/search/prosemirror-search-patched.d.ts +110 -0
  22. package/dist/super-editor/style.css +1 -1
  23. package/dist/super-editor/super-editor.es.js +6 -6
  24. package/dist/super-editor/toolbar.es.js +2 -2
  25. package/dist/super-editor.cjs +1 -1
  26. package/dist/super-editor.es.js +1 -1
  27. package/dist/superdoc.cjs +2 -2
  28. package/dist/superdoc.es.js +2 -2
  29. package/dist/superdoc.umd.js +272 -141
  30. package/dist/superdoc.umd.js.map +1 -1
  31. package/npm-deprecation-notice.cjs +10 -0
  32. package/package.json +11 -6
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
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, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_fn;
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 ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-DUqGq6qj.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 ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-FESR2WO7.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-CQsQR8Zs.js";
17
+ import { D as DocxZipper } from "./docx-zipper-BWZ2o1H5.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -1872,17 +1872,18 @@ class NodeViewDesc extends ViewDesc {
1872
1872
  }
1873
1873
  // Mark this node as being the selected node.
1874
1874
  selectNode() {
1875
- if (this.nodeDOM.nodeType == 1)
1875
+ if (this.nodeDOM.nodeType == 1) {
1876
1876
  this.nodeDOM.classList.add("ProseMirror-selectednode");
1877
- if (this.contentDOM || !this.node.type.spec.draggable)
1878
- this.dom.draggable = true;
1877
+ if (this.contentDOM || !this.node.type.spec.draggable)
1878
+ this.nodeDOM.draggable = true;
1879
+ }
1879
1880
  }
1880
1881
  // Remove selected node marking from this node.
1881
1882
  deselectNode() {
1882
1883
  if (this.nodeDOM.nodeType == 1) {
1883
1884
  this.nodeDOM.classList.remove("ProseMirror-selectednode");
1884
1885
  if (this.contentDOM || !this.node.type.spec.draggable)
1885
- this.dom.removeAttribute("draggable");
1886
+ this.nodeDOM.removeAttribute("draggable");
1886
1887
  }
1887
1888
  }
1888
1889
  get domAtom() {
@@ -3542,7 +3543,7 @@ class MouseDown {
3542
3543
  }
3543
3544
  const target = flushed ? null : event.target;
3544
3545
  const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
3545
- this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;
3546
+ this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
3546
3547
  let { selection } = view.state;
3547
3548
  if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
3548
3549
  this.mightDrag = {
@@ -11287,6 +11288,33 @@ const getTrackChangesDecorations = (state, onlyOriginalShown, onlyModifiedShown)
11287
11288
  return DecorationSet.create(state.doc, decorations);
11288
11289
  };
11289
11290
  const CommentMarkName = "commentMark";
11291
+ const resolveCommentMeta = ({ converter, importedId }) => {
11292
+ const comments = converter?.comments || [];
11293
+ const matchingImportedComment = comments.find((c) => c.importedId == importedId);
11294
+ const resolvedCommentId = matchingImportedComment?.commentId ?? (importedId ? String(importedId) : v4());
11295
+ const internal = matchingImportedComment?.internal ?? matchingImportedComment?.isInternal ?? false;
11296
+ return {
11297
+ resolvedCommentId,
11298
+ importedId,
11299
+ internal,
11300
+ matchingImportedComment
11301
+ };
11302
+ };
11303
+ const ensureFallbackComment = ({ converter, matchingImportedComment, commentId, importedId }) => {
11304
+ if (matchingImportedComment || !converter) return;
11305
+ converter.comments = converter.comments || [];
11306
+ const alreadyExists = converter.comments.some((comment) => comment.commentId === commentId);
11307
+ if (alreadyExists) return;
11308
+ converter.comments.push({
11309
+ commentId,
11310
+ importedId,
11311
+ textJson: null,
11312
+ creatorName: null,
11313
+ creatorEmail: null,
11314
+ createdTime: null,
11315
+ isDone: false
11316
+ });
11317
+ };
11290
11318
  const removeCommentsById = ({ commentId, state, tr, dispatch }) => {
11291
11319
  const positions = getCommentPositionsById(commentId, state.doc);
11292
11320
  positions.forEach(({ from: from2, to }) => {
@@ -11380,24 +11408,31 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
11380
11408
  const { type } = node;
11381
11409
  const commentNodes = ["commentRangeStart", "commentRangeEnd", "commentReference"];
11382
11410
  if (!commentNodes.includes(type.name)) return;
11383
- const matchingImportedComment = converter.comments?.find((c) => c.importedId == node.attrs["w:id"]) || {};
11384
- const { commentId } = matchingImportedComment;
11385
- if (!commentId) return;
11411
+ const { resolvedCommentId, importedId, internal, matchingImportedComment } = resolveCommentMeta({
11412
+ converter,
11413
+ importedId: node.attrs["w:id"]
11414
+ });
11386
11415
  if (type.name === "commentRangeStart") {
11387
11416
  toMark.push({
11388
- "w:id": commentId,
11389
- importedId: node.attrs["w:id"],
11390
- internal: false,
11417
+ commentId: resolvedCommentId,
11418
+ importedId,
11419
+ internal,
11391
11420
  start: pos
11392
11421
  });
11422
+ ensureFallbackComment({
11423
+ converter,
11424
+ matchingImportedComment,
11425
+ commentId: resolvedCommentId,
11426
+ importedId
11427
+ });
11393
11428
  toDelete.push({ start: pos, end: pos + 1 });
11394
11429
  } else if (type.name === "commentRangeEnd") {
11395
- const itemToMark = toMark.find((p) => p.importedId === node.attrs["w:id"]);
11430
+ const itemToMark = toMark.find((p) => p.importedId === importedId);
11396
11431
  if (!itemToMark) return;
11397
11432
  const { start: start2 } = itemToMark;
11398
11433
  const markAttrs = {
11399
- commentId,
11400
- importedId: node.attrs["w:id"],
11434
+ commentId: itemToMark.commentId,
11435
+ importedId,
11401
11436
  internal: itemToMark.internal
11402
11437
  };
11403
11438
  tr.addMark(start2, pos + 1, schema.marks[CommentMarkName].create(markAttrs));
@@ -14849,7 +14884,7 @@ const _Editor = class _Editor extends EventEmitter {
14849
14884
  * @returns {Object | void} Migration results
14850
14885
  */
14851
14886
  processCollaborationMigrations() {
14852
- console.debug("[checkVersionMigrations] Current editor version", "0.21.0-RC2");
14887
+ console.debug("[checkVersionMigrations] Current editor version", "0.20.2");
14853
14888
  if (!this.options.ydoc) return;
14854
14889
  const metaMap = this.options.ydoc.getMap("meta");
14855
14890
  let docVersion = metaMap.get("version");
@@ -32844,8 +32879,8 @@ function getScaleFactor(element) {
32844
32879
  }
32845
32880
  class SearchQuery {
32846
32881
  /**
32847
- Create a query object.
32848
- */
32882
+ Create a query object.
32883
+ */
32849
32884
  constructor(config) {
32850
32885
  this.search = config.search;
32851
32886
  this.caseSensitive = !!config.caseSensitive;
@@ -32858,72 +32893,70 @@ class SearchQuery {
32858
32893
  this.impl = !this.valid ? nullQuery : this.regexp ? new RegExpQuery(this) : new StringQuery(this);
32859
32894
  }
32860
32895
  /**
32861
- Compare this query to another query.
32862
- */
32896
+ Compare this query to another query.
32897
+ */
32863
32898
  eq(other) {
32864
32899
  return this.search == other.search && this.replace == other.replace && this.caseSensitive == other.caseSensitive && this.regexp == other.regexp && this.wholeWord == other.wholeWord;
32865
32900
  }
32866
32901
  /**
32867
- Find the next occurrence of this query in the given range.
32868
- */
32902
+ Find the next occurrence of this query in the given range.
32903
+ */
32869
32904
  findNext(state, from2 = 0, to = state.doc.content.size) {
32870
32905
  for (; ; ) {
32871
- if (from2 >= to)
32872
- return null;
32906
+ if (from2 >= to) return null;
32873
32907
  let result = this.impl.findNext(state, from2, to);
32874
- if (!result || this.checkResult(state, result))
32875
- return result;
32908
+ if (!result || this.checkResult(state, result)) return result;
32876
32909
  from2 = result.from + 1;
32877
32910
  }
32878
32911
  }
32879
32912
  /**
32880
- Find the previous occurrence of this query in the given range.
32881
- Note that, if `to` is given, it should be _less_ than `from`.
32882
- */
32913
+ Find the previous occurrence of this query in the given range.
32914
+ Note that, if `to` is given, it should be _less_ than `from`.
32915
+ */
32883
32916
  findPrev(state, from2 = state.doc.content.size, to = 0) {
32884
32917
  for (; ; ) {
32885
- if (from2 <= to)
32886
- return null;
32918
+ if (from2 <= to) return null;
32887
32919
  let result = this.impl.findPrev(state, from2, to);
32888
- if (!result || this.checkResult(state, result))
32889
- return result;
32920
+ if (!result || this.checkResult(state, result)) return result;
32890
32921
  from2 = result.to - 1;
32891
32922
  }
32892
32923
  }
32893
32924
  /**
32894
- @internal
32895
- */
32925
+ @internal
32926
+ */
32896
32927
  checkResult(state, result) {
32897
32928
  return (!this.wholeWord || checkWordBoundary(state, result.from) && checkWordBoundary(state, result.to)) && (!this.filter || this.filter(state, result));
32898
32929
  }
32899
32930
  /**
32900
- @internal
32901
- */
32931
+ @internal
32932
+ */
32902
32933
  unquote(string) {
32903
32934
  return this.literal ? string : string.replace(/\\([nrt\\])/g, (_, ch) => ch == "n" ? "\n" : ch == "r" ? "\r" : ch == "t" ? " " : "\\");
32904
32935
  }
32905
32936
  /**
32906
- Get the ranges that should be replaced for this result. This can
32907
- return multiple ranges when `this.replace` contains
32908
- `$1`/`$&`-style placeholders, in which case the preserved
32909
- content is skipped by the replacements.
32910
-
32911
- Ranges are sorted by position, and `from`/`to` positions all
32912
- refer to positions in `state.doc`. When applying these, you'll
32913
- want to either apply them from back to front, or map these
32914
- positions through your transaction's current mapping.
32915
- */
32937
+ Get the ranges that should be replaced for this result. This can
32938
+ return multiple ranges when `this.replace` contains
32939
+ `$1`/`$&`-style placeholders, in which case the preserved
32940
+ content is skipped by the replacements.
32941
+
32942
+ Ranges are sorted by position, and `from`/`to` positions all
32943
+ refer to positions in `state.doc`. When applying these, you'll
32944
+ want to either apply them from back to front, or map these
32945
+ positions through your transaction's current mapping.
32946
+ */
32916
32947
  getReplacements(state, result) {
32917
32948
  let $from = state.doc.resolve(result.from);
32918
32949
  let marks = $from.marksAcross(state.doc.resolve(result.to));
32919
32950
  let ranges = [];
32920
32951
  let frag = Fragment.empty, pos = result.from, { match } = result;
32921
32952
  let groups = match ? getGroupIndices(match) : [[0, result.to - result.from]];
32922
- let replParts = parseReplacement(this.unquote(this.replace)), groupSpan;
32953
+ let replParts = parseReplacement(this.unquote(this.replace));
32923
32954
  for (let part of replParts) {
32924
32955
  if (typeof part == "string") {
32925
32956
  frag = frag.addToEnd(state.schema.text(part, marks));
32926
- } else if (groupSpan = groups[part.group]) {
32957
+ } else {
32958
+ const groupSpan = groups[part.group];
32959
+ if (!groupSpan) continue;
32927
32960
  let from2 = result.matchStart + groupSpan[0], to = result.matchStart + groupSpan[1];
32928
32961
  if (part.copy) {
32929
32962
  frag = frag.append(state.doc.slice(from2, to).content);
@@ -32953,8 +32986,7 @@ class StringQuery {
32953
32986
  constructor(query) {
32954
32987
  this.query = query;
32955
32988
  let string = query.unquote(query.search);
32956
- if (!query.caseSensitive)
32957
- string = string.toLowerCase();
32989
+ if (!query.caseSensitive) string = string.toLowerCase();
32958
32990
  this.string = string;
32959
32991
  }
32960
32992
  findNext(state, from2, to) {
@@ -32962,17 +32994,26 @@ class StringQuery {
32962
32994
  let off = Math.max(from2, start2);
32963
32995
  let content = textContent(node).slice(off - start2, Math.min(node.content.size, to - start2));
32964
32996
  let index2 = (this.query.caseSensitive ? content : content.toLowerCase()).indexOf(this.string);
32965
- return index2 < 0 ? null : { from: off + index2, to: off + index2 + this.string.length, match: null, matchStart: start2 };
32997
+ if (index2 < 0) return null;
32998
+ const startOffset = off - start2;
32999
+ const absoluteIndex = startOffset + index2;
33000
+ const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
33001
+ const toPos = mapIndexToDocPos(node, start2, absoluteIndex + this.string.length);
33002
+ return { from: fromPos, to: toPos, match: null, matchStart: start2 };
32966
33003
  });
32967
33004
  }
32968
33005
  findPrev(state, from2, to) {
32969
33006
  return scanTextblocks(state.doc, from2, to, (node, start2) => {
32970
33007
  let off = Math.max(start2, to);
32971
33008
  let content = textContent(node).slice(off - start2, Math.min(node.content.size, from2 - start2));
32972
- if (!this.query.caseSensitive)
32973
- content = content.toLowerCase();
33009
+ if (!this.query.caseSensitive) content = content.toLowerCase();
32974
33010
  let index2 = content.lastIndexOf(this.string);
32975
- return index2 < 0 ? null : { from: off + index2, to: off + index2 + this.string.length, match: null, matchStart: start2 };
33011
+ if (index2 < 0) return null;
33012
+ const startOffset = off - start2;
33013
+ const absoluteIndex = startOffset + index2;
33014
+ const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
33015
+ const toPos = mapIndexToDocPos(node, start2, absoluteIndex + this.string.length);
33016
+ return { from: fromPos, to: toPos, match: null, matchStart: start2 };
32976
33017
  });
32977
33018
  }
32978
33019
  }
@@ -32987,7 +33028,11 @@ class RegExpQuery {
32987
33028
  let content = textContent(node).slice(0, Math.min(node.content.size, to - start2));
32988
33029
  this.regexp.lastIndex = from2 - start2;
32989
33030
  let match = this.regexp.exec(content);
32990
- return match ? { from: start2 + match.index, to: start2 + match.index + match[0].length, match, matchStart: start2 } : null;
33031
+ if (!match) return null;
33032
+ const absoluteIndex = match.index;
33033
+ const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
33034
+ const toPos = mapIndexToDocPos(node, start2, absoluteIndex + match[0].length);
33035
+ return { from: fromPos, to: toPos, match, matchStart: start2 };
32991
33036
  });
32992
33037
  }
32993
33038
  findPrev(state, from2, to) {
@@ -32997,18 +33042,20 @@ class RegExpQuery {
32997
33042
  for (let off = 0; ; ) {
32998
33043
  this.regexp.lastIndex = off;
32999
33044
  let next = this.regexp.exec(content);
33000
- if (!next)
33001
- break;
33045
+ if (!next) break;
33002
33046
  match = next;
33003
33047
  off = next.index + 1;
33004
33048
  }
33005
- return match ? { from: start2 + match.index, to: start2 + match.index + match[0].length, match, matchStart: start2 } : null;
33049
+ if (!match) return null;
33050
+ const absoluteIndex = match.index;
33051
+ const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
33052
+ const toPos = mapIndexToDocPos(node, start2, absoluteIndex + match[0].length);
33053
+ return { from: fromPos, to: toPos, match, matchStart: start2 };
33006
33054
  });
33007
33055
  }
33008
33056
  }
33009
33057
  function getGroupIndices(match) {
33010
- if (match.indices)
33011
- return match.indices;
33058
+ if (match.indices) return match.indices;
33012
33059
  let result = [[0, match[0].length]];
33013
33060
  for (let i = 1, pos = 0; i < match.length; i++) {
33014
33061
  let found = match[i] ? match[0].indexOf(match[i], pos) : -1;
@@ -33020,10 +33067,8 @@ function parseReplacement(text) {
33020
33067
  let result = [], highestSeen = -1;
33021
33068
  function add(text2) {
33022
33069
  let last = result.length - 1;
33023
- if (last > -1 && typeof result[last] == "string")
33024
- result[last] += text2;
33025
- else
33026
- result.push(text2);
33070
+ if (last > -1 && typeof result[last] == "string") result[last] += text2;
33071
+ else result.push(text2);
33027
33072
  }
33028
33073
  while (text.length) {
33029
33074
  let m = /\$([$&\d+])/.exec(text);
@@ -33031,8 +33076,7 @@ function parseReplacement(text) {
33031
33076
  add(text);
33032
33077
  return result;
33033
33078
  }
33034
- if (m.index > 0)
33035
- add(text.slice(0, m.index + (m[1] == "$" ? 1 : 0)));
33079
+ if (m.index > 0) add(text.slice(0, m.index + (m[1] == "$" ? 1 : 0)));
33036
33080
  if (m[1] != "$") {
33037
33081
  let n = m[1] == "&" ? 0 : +m[1];
33038
33082
  if (highestSeen >= n) {
@@ -33050,30 +33094,50 @@ function validRegExp(source) {
33050
33094
  try {
33051
33095
  new RegExp(source, baseFlags);
33052
33096
  return true;
33053
- } catch (_a) {
33097
+ } catch {
33054
33098
  return false;
33055
33099
  }
33056
33100
  }
33057
33101
  const TextContentCache = /* @__PURE__ */ new WeakMap();
33058
33102
  function textContent(node) {
33059
33103
  let cached = TextContentCache.get(node);
33060
- if (cached)
33061
- return cached;
33104
+ if (cached) return cached;
33062
33105
  let content = "";
33063
33106
  for (let i = 0; i < node.childCount; i++) {
33064
33107
  let child = node.child(i);
33065
- if (child.isText)
33066
- content += child.text;
33067
- else if (child.isLeaf)
33068
- content += "";
33069
- else
33070
- content += " " + textContent(child) + " ";
33108
+ if (child.isText) content += child.text;
33109
+ else if (child.isLeaf) content += "";
33110
+ else if (child.type && child.type.name === "run") content += textContent(child);
33111
+ else content += " " + textContent(child) + " ";
33071
33112
  }
33072
33113
  TextContentCache.set(node, content);
33073
33114
  return content;
33074
33115
  }
33116
+ function mapIndexToDocPos(node, start2, index2) {
33117
+ if (index2 <= 0) return start2;
33118
+ const fullText = textContent(node);
33119
+ if (index2 >= fullText.length) return start2 + node.content.size;
33120
+ let target = start2;
33121
+ let remaining = index2;
33122
+ let found = false;
33123
+ node.descendants((child, pos) => {
33124
+ if (found) return false;
33125
+ if (!child.isText) return true;
33126
+ const len = child.text.length;
33127
+ if (remaining <= len) {
33128
+ target = start2 + pos + remaining;
33129
+ found = true;
33130
+ return false;
33131
+ }
33132
+ remaining -= len;
33133
+ return true;
33134
+ });
33135
+ return found ? target : start2 + node.content.size;
33136
+ }
33137
+ const transparentInlineNodes = /* @__PURE__ */ new Set(["run"]);
33075
33138
  function scanTextblocks(node, from2, to, f, nodeStart = 0) {
33076
- if (node.inlineContent) {
33139
+ const isTransparentInline = node.inlineContent && node.type && transparentInlineNodes.has(node.type.name);
33140
+ if (node.inlineContent && !isTransparentInline) {
33077
33141
  return f(node, nodeStart);
33078
33142
  } else if (!node.isLeaf) {
33079
33143
  if (from2 > to) {
@@ -33082,8 +33146,7 @@ function scanTextblocks(node, from2, to, f, nodeStart = 0) {
33082
33146
  pos -= child.nodeSize;
33083
33147
  if (pos < from2) {
33084
33148
  let result = scanTextblocks(child, from2, to, f, pos + 1);
33085
- if (result != null)
33086
- return result;
33149
+ if (result != null) return result;
33087
33150
  }
33088
33151
  }
33089
33152
  } else {
@@ -33092,8 +33155,7 @@ function scanTextblocks(node, from2, to, f, nodeStart = 0) {
33092
33155
  pos += child.nodeSize;
33093
33156
  if (pos > from2) {
33094
33157
  let result = scanTextblocks(child, from2, to, f, start2 + 1);
33095
- if (result != null)
33096
- return result;
33158
+ if (result != null) return result;
33097
33159
  }
33098
33160
  }
33099
33161
  }
@@ -33103,8 +33165,7 @@ function scanTextblocks(node, from2, to, f, nodeStart = 0) {
33103
33165
  function checkWordBoundary(state, pos) {
33104
33166
  let $pos = state.doc.resolve(pos);
33105
33167
  let before = $pos.nodeBefore, after = $pos.nodeAfter;
33106
- if (!before || !after || !before.isText || !after.isText)
33107
- return true;
33168
+ if (!before || !after || !before.isText || !after.isText) return true;
33108
33169
  return !/\p{L}$/u.test(before.text) || !/^\p{L}/u.test(after.text);
33109
33170
  }
33110
33171
  class SearchState {
@@ -33115,14 +33176,12 @@ class SearchState {
33115
33176
  }
33116
33177
  }
33117
33178
  function buildMatchDeco(state, query, range) {
33118
- if (!query.valid)
33119
- return DecorationSet.empty;
33179
+ if (!query.valid) return DecorationSet.empty;
33120
33180
  let deco = [];
33121
33181
  let sel = state.selection;
33122
33182
  for (let pos = range ? range.from : 0, end2 = range ? range.to : state.doc.content.size; ; ) {
33123
33183
  let next = query.findNext(state, pos, end2);
33124
- if (!next)
33125
- break;
33184
+ if (!next) break;
33126
33185
  let cls = next.from == sel.from && next.to == sel.to ? "ProseMirror-active-search-match" : "ProseMirror-search-match";
33127
33186
  deco.push(Decoration.inline(next.from, next.to, { class: cls }));
33128
33187
  pos = next.to;
@@ -33141,8 +33200,7 @@ function search(options = {}) {
33141
33200
  },
33142
33201
  apply(tr, search2, _oldState, state) {
33143
33202
  let set = tr.getMeta(searchKey);
33144
- if (set)
33145
- return new SearchState(set.query, set.range, buildMatchDeco(state, set.query, set.range));
33203
+ if (set) return new SearchState(set.query, set.range, buildMatchDeco(state, set.query, set.range));
33146
33204
  if (tr.docChanged || tr.selectionSet) {
33147
33205
  let range = search2.range;
33148
33206
  if (range) {
@@ -33167,6 +33225,7 @@ function getMatchHighlights(state) {
33167
33225
  function setSearchState(tr, query, range = null) {
33168
33226
  return tr.setMeta(searchKey, { query, range });
33169
33227
  }
33228
+ const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
33170
33229
  const Search = Extension.create({
33171
33230
  addStorage() {
33172
33231
  return {
@@ -33236,10 +33295,14 @@ const Search = Extension.create({
33236
33295
  let caseSensitive = false;
33237
33296
  let regexp = false;
33238
33297
  const wholeWord = false;
33239
- if (patternInput instanceof RegExp) {
33298
+ if (isRegExp(patternInput)) {
33299
+ const regexPattern = (
33300
+ /** @type {RegExp} */
33301
+ patternInput
33302
+ );
33240
33303
  regexp = true;
33241
- pattern = patternInput.source;
33242
- caseSensitive = !patternInput.flags.includes("i");
33304
+ pattern = regexPattern.source;
33305
+ caseSensitive = !regexPattern.flags.includes("i");
33243
33306
  } else if (typeof patternInput === "string" && /^\/(.+)\/([gimsuy]*)$/.test(patternInput)) {
33244
33307
  const [, body, flags] = patternInput.match(/^\/(.+)\/([gimsuy]*)$/);
33245
33308
  regexp = true;
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-DUqGq6qj.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-gMF6aWiz.js";
2
+ import { p as process$1 } from "./converter-FESR2WO7.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-XsrBXzy-.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -2483,7 +2483,7 @@ function resolveTo(selector) {
2483
2483
  if (typeof selector === "string") {
2484
2484
  return document.querySelector(selector);
2485
2485
  }
2486
- return selector();
2486
+ return selector() || null;
2487
2487
  }
2488
2488
  const LazyTeleport = defineComponent({
2489
2489
  name: "LazyTeleport",
@@ -2571,8 +2571,11 @@ const oppositeAlignCssPositionProps = {
2571
2571
  };
2572
2572
  const keepOffsetDirection = {
2573
2573
  top: true,
2574
+ // top++
2574
2575
  bottom: false,
2576
+ // top--
2575
2577
  left: true,
2578
+ // left++
2576
2579
  right: false
2577
2580
  // left--
2578
2581
  };
@@ -3689,7 +3692,6 @@ function isFocusable(element) {
3689
3692
  return !!element.href && element.rel !== "ignore";
3690
3693
  case "INPUT":
3691
3694
  return element.type !== "hidden" && element.type !== "file";
3692
- case "BUTTON":
3693
3695
  case "SELECT":
3694
3696
  case "TEXTAREA":
3695
3697
  return true;
@@ -3708,8 +3710,8 @@ const FocusTrap = defineComponent({
3708
3710
  default: true
3709
3711
  },
3710
3712
  onEsc: Function,
3711
- initialFocusTo: String,
3712
- finalFocusTo: String,
3713
+ initialFocusTo: [String, Function],
3714
+ finalFocusTo: [String, Function],
3713
3715
  returnFocusOnDeactivated: {
3714
3716
  type: Boolean,
3715
3717
  default: true
@@ -5807,6 +5809,7 @@ function self$6(vars) {
5807
5809
  });
5808
5810
  }
5809
5811
  const scrollbarLight = {
5812
+ name: "Scrollbar",
5810
5813
  common: derived,
5811
5814
  self: self$6
5812
5815
  };
@@ -7322,11 +7325,14 @@ function self$5(vars) {
7322
7325
  boxShadow: boxShadow2
7323
7326
  });
7324
7327
  }
7325
- const popoverLight = {
7328
+ const popoverLight = createTheme({
7326
7329
  name: "Popover",
7327
7330
  common: derived,
7331
+ peers: {
7332
+ Scrollbar: scrollbarLight
7333
+ },
7328
7334
  self: self$5
7329
- };
7335
+ });
7330
7336
  const oppositePlacement = {
7331
7337
  top: "bottom",
7332
7338
  bottom: "top",
@@ -7546,9 +7552,11 @@ const NPopoverBody = defineComponent({
7546
7552
  const {
7547
7553
  namespaceRef,
7548
7554
  mergedClsPrefixRef,
7549
- inlineThemeDisabled
7555
+ inlineThemeDisabled,
7556
+ mergedRtlRef
7550
7557
  } = useConfig(props);
7551
7558
  const themeRef = useTheme("Popover", "-popover", style$3, popoverLight, props, mergedClsPrefixRef);
7559
+ const rtlEnabledRef = useRtl("Popover", mergedRtlRef, mergedClsPrefixRef);
7552
7560
  const followerRef = ref(null);
7553
7561
  const NPopover2 = inject("NPopover");
7554
7562
  const bodyRef = ref(null);
@@ -7746,6 +7754,8 @@ const NPopoverBody = defineComponent({
7746
7754
  style: props.contentStyle
7747
7755
  }, slots);
7748
7756
  const maybeScrollableBody = props.scrollable ? h(XScrollbar, {
7757
+ themeOverrides: themeRef.value.peerOverrides.Scrollbar,
7758
+ theme: themeRef.value.peers.Scrollbar,
7749
7759
  contentClass: hasHeaderOrFooter ? void 0 : `${mergedClsPrefix}-popover__content ${(_b = props.contentClass) !== null && _b !== void 0 ? _b : ""}`,
7750
7760
  contentStyle: hasHeaderOrFooter ? void 0 : props.contentStyle
7751
7761
  }, {
@@ -7761,7 +7771,7 @@ const NPopoverBody = defineComponent({
7761
7771
  return [maybeScrollableBody, arrow];
7762
7772
  };
7763
7773
  contentNode = h("div", mergeProps({
7764
- class: [`${mergedClsPrefix}-popover`, `${mergedClsPrefix}-popover-shared`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, extraClass.map((v) => `${mergedClsPrefix}-${v}`), {
7774
+ class: [`${mergedClsPrefix}-popover`, `${mergedClsPrefix}-popover-shared`, (rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) && `${mergedClsPrefix}-popover--rtl`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, extraClass.map((v) => `${mergedClsPrefix}-${v}`), {
7765
7775
  [`${mergedClsPrefix}-popover--scrollable`]: props.scrollable,
7766
7776
  [`${mergedClsPrefix}-popover--show-header-or-footer`]: hasHeaderOrFooter,
7767
7777
  [`${mergedClsPrefix}-popover--raw`]: props.raw,
@@ -7785,7 +7795,7 @@ const NPopoverBody = defineComponent({
7785
7795
  // The popover class and overlap class must exists, they will be used
7786
7796
  // to place the body & transition animation.
7787
7797
  // Shadow class exists for reuse box-shadow.
7788
- [`${mergedClsPrefix}-popover-shared`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, props.overlap && `${mergedClsPrefix}-popover-shared--overlap`, props.showArrow && `${mergedClsPrefix}-popover-shared--show-arrow`, props.arrowPointToCenter && `${mergedClsPrefix}-popover-shared--center-arrow`],
7798
+ [`${mergedClsPrefix}-popover-shared`, (rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) && `${mergedClsPrefix}-popover--rtl`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, props.overlap && `${mergedClsPrefix}-popover-shared--overlap`, props.showArrow && `${mergedClsPrefix}-popover-shared--show-arrow`, props.arrowPointToCenter && `${mergedClsPrefix}-popover-shared--center-arrow`],
7789
7799
  bodyRef,
7790
7800
  styleRef.value,
7791
7801
  handleMouseEnter,
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-DUqGq6qj.js";
1
+ import { a5 } from "./chunks/converter-FESR2WO7.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DUqGq6qj.js";
2
- import { D } from "./chunks/docx-zipper-CQsQR8Zs.js";
1
+ import "./chunks/converter-FESR2WO7.js";
2
+ import { D } from "./chunks/docx-zipper-BWZ2o1H5.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-gMF6aWiz.js";
2
- import "./chunks/converter-DUqGq6qj.js";
3
- import "./chunks/docx-zipper-CQsQR8Zs.js";
1
+ import { E } from "./chunks/editor-XsrBXzy-.js";
2
+ import "./chunks/converter-FESR2WO7.js";
3
+ import "./chunks/docx-zipper-BWZ2o1H5.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-CQsQR8Zs.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-BWZ2o1H5.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -0,0 +1,15 @@
1
+ export function resolveCommentMeta({ converter, importedId }: {
2
+ converter: any;
3
+ importedId: any;
4
+ }): {
5
+ resolvedCommentId: any;
6
+ importedId: any;
7
+ internal: any;
8
+ matchingImportedComment: any;
9
+ };
10
+ export function ensureFallbackComment({ converter, matchingImportedComment, commentId, importedId }: {
11
+ converter: any;
12
+ matchingImportedComment: any;
13
+ commentId: any;
14
+ importedId: any;
15
+ }): void;