superdoc 0.31.0-next.1 → 0.31.0-next.3

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 (232) hide show
  1. package/dist/chunks/{PdfViewer-CSZtzevK.cjs → PdfViewer-DoOKSkNf.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DYfpBL2P.es.js → PdfViewer-UMfEMyPR.es.js} +1 -1
  3. package/dist/chunks/{index-0zP7LFOd-CQ5IRTwG.es.js → index-B74saKaW-CeHVjvs8.es.js} +1 -1
  4. package/dist/chunks/{index-0zP7LFOd-PDPveafF.cjs → index-B74saKaW-nw0M-3t9.cjs} +1 -1
  5. package/dist/chunks/{index-9j37gBmK.cjs → index-CjrYy0l4.cjs} +3 -3
  6. package/dist/chunks/{index-BiYSI2c3.es.js → index-D78pvKjo.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-BzhuUuJx.es.js → super-editor.es-CQFVPho1.es.js} +199 -255
  8. package/dist/chunks/{super-editor.es-D8j9E-4h.cjs → super-editor.es-DTqtLZgT.cjs} +199 -255
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts +132 -52
  10. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  11. package/dist/packages/superdoc/src/core/types/index.d.ts +132 -52
  12. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
  13. package/dist/super-editor/ai-writer.es.js +2 -2
  14. package/dist/super-editor/chunks/{converter-B3mE6WPB.js → converter-BdxQSBuI.js} +10 -7
  15. package/dist/super-editor/chunks/{docx-zipper-FgUekv4g.js → docx-zipper-CeENQy4K.js} +1 -1
  16. package/dist/super-editor/chunks/{editor-B0PiO07g.js → editor-fHPBoGEW.js} +203 -326
  17. package/dist/super-editor/chunks/{index-0zP7LFOd.js → index-B74saKaW.js} +1 -1
  18. package/dist/super-editor/chunks/{toolbar-Bj9E8rmT.js → toolbar-DVn2P_6q.js} +2 -2
  19. package/dist/super-editor/converter.es.js +1 -1
  20. package/dist/super-editor/docx-zipper.es.js +2 -2
  21. package/dist/super-editor/editor.es.js +3 -3
  22. package/dist/super-editor/file-zipper.es.js +1 -1
  23. package/dist/super-editor/super-editor/src/core/Attribute.d.ts +75 -29
  24. package/dist/super-editor/super-editor/src/core/Attribute.d.ts.map +1 -1
  25. package/dist/super-editor/super-editor/src/core/CommandService.d.ts +1 -1
  26. package/dist/super-editor/super-editor/src/core/CommandService.d.ts.map +1 -1
  27. package/dist/super-editor/super-editor/src/core/Editor.d.ts +136 -673
  28. package/dist/super-editor/super-editor/src/core/Editor.d.ts.map +1 -1
  29. package/dist/super-editor/super-editor/src/core/EventEmitter.d.ts +23 -14
  30. package/dist/super-editor/super-editor/src/core/EventEmitter.d.ts.map +1 -1
  31. package/dist/super-editor/super-editor/src/core/Extension.d.ts +25 -11
  32. package/dist/super-editor/super-editor/src/core/Extension.d.ts.map +1 -1
  33. package/dist/super-editor/super-editor/src/core/ExtensionService.d.ts +1 -1
  34. package/dist/super-editor/super-editor/src/core/ExtensionService.d.ts.map +1 -1
  35. package/dist/super-editor/super-editor/src/core/Mark.d.ts +28 -12
  36. package/dist/super-editor/super-editor/src/core/Mark.d.ts.map +1 -1
  37. package/dist/super-editor/super-editor/src/core/Node.d.ts +87 -25
  38. package/dist/super-editor/super-editor/src/core/Node.d.ts.map +1 -1
  39. package/dist/super-editor/super-editor/src/core/OxmlNode.d.ts +20 -13
  40. package/dist/super-editor/super-editor/src/core/OxmlNode.d.ts.map +1 -1
  41. package/dist/super-editor/super-editor/src/core/commands/types/index.d.ts +11 -89
  42. package/dist/super-editor/super-editor/src/core/commands/types/index.d.ts.map +1 -1
  43. package/dist/super-editor/super-editor/src/core/extensions/commands.d.ts +1 -1
  44. package/dist/super-editor/super-editor/src/core/extensions/commands.d.ts.map +1 -1
  45. package/dist/super-editor/super-editor/src/core/extensions/editable.d.ts +1 -1
  46. package/dist/super-editor/super-editor/src/core/extensions/editable.d.ts.map +1 -1
  47. package/dist/super-editor/super-editor/src/core/extensions/editorFocus.d.ts +1 -1
  48. package/dist/super-editor/super-editor/src/core/extensions/editorFocus.d.ts.map +1 -1
  49. package/dist/super-editor/super-editor/src/core/extensions/keymap.d.ts +1 -1
  50. package/dist/super-editor/super-editor/src/core/extensions/keymap.d.ts.map +1 -1
  51. package/dist/super-editor/super-editor/src/core/helpers/annotator.d.ts +3 -2
  52. package/dist/super-editor/super-editor/src/core/helpers/annotator.d.ts.map +1 -1
  53. package/dist/super-editor/super-editor/src/core/helpers/getExtensionConfigField.d.ts +12 -5
  54. package/dist/super-editor/super-editor/src/core/helpers/getExtensionConfigField.d.ts.map +1 -1
  55. package/dist/super-editor/super-editor/src/core/helpers/isList.d.ts +1 -1
  56. package/dist/super-editor/super-editor/src/core/helpers/isList.d.ts.map +1 -1
  57. package/dist/super-editor/super-editor/src/core/helpers/list-numbering-helpers.d.ts.map +1 -1
  58. package/dist/super-editor/super-editor/src/core/index.d.ts +18 -13
  59. package/dist/super-editor/super-editor/src/core/index.d.ts.map +1 -1
  60. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts +1 -1
  61. package/dist/super-editor/super-editor/src/core/types/ChainedCommands.d.ts +118 -0
  62. package/dist/super-editor/super-editor/src/core/types/ChainedCommands.d.ts.map +1 -0
  63. package/dist/super-editor/super-editor/src/core/types/EditorConfig.d.ts +265 -0
  64. package/dist/super-editor/super-editor/src/core/types/EditorConfig.d.ts.map +1 -0
  65. package/dist/super-editor/super-editor/src/core/types/EditorEvents.d.ts +144 -0
  66. package/dist/super-editor/super-editor/src/core/types/EditorEvents.d.ts.map +1 -0
  67. package/dist/super-editor/super-editor/src/core/types/EditorTypes.d.ts +73 -0
  68. package/dist/super-editor/super-editor/src/core/types/EditorTypes.d.ts.map +1 -0
  69. package/dist/super-editor/super-editor/src/core/types/__tests__/command-types.d.ts +2 -0
  70. package/dist/super-editor/super-editor/src/core/types/__tests__/command-types.d.ts.map +1 -0
  71. package/dist/super-editor/super-editor/src/core/utilities/callOrGet.d.ts +6 -2
  72. package/dist/super-editor/super-editor/src/core/utilities/callOrGet.d.ts.map +1 -1
  73. package/dist/super-editor/super-editor/src/core/utilities/isIOS.d.ts.map +1 -1
  74. package/dist/super-editor/super-editor/src/extensions/ai/ai-marks.d.ts +8 -2
  75. package/dist/super-editor/super-editor/src/extensions/ai/ai-marks.d.ts.map +1 -1
  76. package/dist/super-editor/super-editor/src/extensions/ai/ai-nodes.d.ts +7 -1
  77. package/dist/super-editor/super-editor/src/extensions/ai/ai-nodes.d.ts.map +1 -1
  78. package/dist/super-editor/super-editor/src/extensions/ai/ai-plugin.d.ts +1 -1
  79. package/dist/super-editor/super-editor/src/extensions/ai/ai-plugin.d.ts.map +1 -1
  80. package/dist/super-editor/super-editor/src/extensions/block-node/block-node.d.ts +1 -1
  81. package/dist/super-editor/super-editor/src/extensions/block-node/block-node.d.ts.map +1 -1
  82. package/dist/super-editor/super-editor/src/extensions/bold/bold.d.ts +3 -1
  83. package/dist/super-editor/super-editor/src/extensions/bold/bold.d.ts.map +1 -1
  84. package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-end.d.ts +1 -1
  85. package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-end.d.ts.map +1 -1
  86. package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-start.d.ts +1 -1
  87. package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-start.d.ts.map +1 -1
  88. package/dist/super-editor/super-editor/src/extensions/collaboration/collaboration.d.ts +6 -1
  89. package/dist/super-editor/super-editor/src/extensions/collaboration/collaboration.d.ts.map +1 -1
  90. package/dist/super-editor/super-editor/src/extensions/collaboration-cursor/collaboration-cursor.d.ts +9 -1
  91. package/dist/super-editor/super-editor/src/extensions/collaboration-cursor/collaboration-cursor.d.ts.map +1 -1
  92. package/dist/super-editor/super-editor/src/extensions/color/color.d.ts +3 -1
  93. package/dist/super-editor/super-editor/src/extensions/color/color.d.ts.map +1 -1
  94. package/dist/super-editor/super-editor/src/extensions/comment/comment.d.ts +18 -3
  95. package/dist/super-editor/super-editor/src/extensions/comment/comment.d.ts.map +1 -1
  96. package/dist/super-editor/super-editor/src/extensions/comment/comments-marks.d.ts +5 -1
  97. package/dist/super-editor/super-editor/src/extensions/comment/comments-marks.d.ts.map +1 -1
  98. package/dist/super-editor/super-editor/src/extensions/comment/comments-plugin.d.ts +1 -1
  99. package/dist/super-editor/super-editor/src/extensions/comment/comments-plugin.d.ts.map +1 -1
  100. package/dist/super-editor/super-editor/src/extensions/content-block/content-block.d.ts +1 -1
  101. package/dist/super-editor/super-editor/src/extensions/content-block/content-block.d.ts.map +1 -1
  102. package/dist/super-editor/super-editor/src/extensions/custom-selection/custom-selection.d.ts +1 -1
  103. package/dist/super-editor/super-editor/src/extensions/custom-selection/custom-selection.d.ts.map +1 -1
  104. package/dist/super-editor/super-editor/src/extensions/document/document.d.ts +1 -1
  105. package/dist/super-editor/super-editor/src/extensions/document/document.d.ts.map +1 -1
  106. package/dist/super-editor/super-editor/src/extensions/dropcursor/dropcursor.d.ts +5 -1
  107. package/dist/super-editor/super-editor/src/extensions/dropcursor/dropcursor.d.ts.map +1 -1
  108. package/dist/super-editor/super-editor/src/extensions/field-annotation/field-annotation.d.ts +1 -1
  109. package/dist/super-editor/super-editor/src/extensions/field-annotation/field-annotation.d.ts.map +1 -1
  110. package/dist/super-editor/super-editor/src/extensions/font-family/font-family.d.ts +3 -1
  111. package/dist/super-editor/super-editor/src/extensions/font-family/font-family.d.ts.map +1 -1
  112. package/dist/super-editor/super-editor/src/extensions/font-size/font-size.d.ts +9 -1
  113. package/dist/super-editor/super-editor/src/extensions/font-size/font-size.d.ts.map +1 -1
  114. package/dist/super-editor/super-editor/src/extensions/format-commands/format-commands.d.ts +7 -1
  115. package/dist/super-editor/super-editor/src/extensions/format-commands/format-commands.d.ts.map +1 -1
  116. package/dist/super-editor/super-editor/src/extensions/gapcursor/gapcursor.d.ts +1 -1
  117. package/dist/super-editor/super-editor/src/extensions/gapcursor/gapcursor.d.ts.map +1 -1
  118. package/dist/super-editor/super-editor/src/extensions/heading/heading.d.ts +3 -1
  119. package/dist/super-editor/super-editor/src/extensions/heading/heading.d.ts.map +1 -1
  120. package/dist/super-editor/super-editor/src/extensions/highlight/highlight.d.ts +3 -1
  121. package/dist/super-editor/super-editor/src/extensions/highlight/highlight.d.ts.map +1 -1
  122. package/dist/super-editor/super-editor/src/extensions/history/history.d.ts +4 -1
  123. package/dist/super-editor/super-editor/src/extensions/history/history.d.ts.map +1 -1
  124. package/dist/super-editor/super-editor/src/extensions/image/image.d.ts +1 -1
  125. package/dist/super-editor/super-editor/src/extensions/image/image.d.ts.map +1 -1
  126. package/dist/super-editor/super-editor/src/extensions/index.d.ts +22 -2
  127. package/dist/super-editor/super-editor/src/extensions/index.d.ts.map +1 -1
  128. package/dist/super-editor/super-editor/src/extensions/italic/italic.d.ts +3 -1
  129. package/dist/super-editor/super-editor/src/extensions/italic/italic.d.ts.map +1 -1
  130. package/dist/super-editor/super-editor/src/extensions/line-break/line-break.d.ts +2 -2
  131. package/dist/super-editor/super-editor/src/extensions/line-break/line-break.d.ts.map +1 -1
  132. package/dist/super-editor/super-editor/src/extensions/line-height/line-height.d.ts +6 -1
  133. package/dist/super-editor/super-editor/src/extensions/line-height/line-height.d.ts.map +1 -1
  134. package/dist/super-editor/super-editor/src/extensions/link/link.d.ts +9 -1
  135. package/dist/super-editor/super-editor/src/extensions/link/link.d.ts.map +1 -1
  136. package/dist/super-editor/super-editor/src/extensions/linked-styles/linked-styles.d.ts +1 -1
  137. package/dist/super-editor/super-editor/src/extensions/linked-styles/linked-styles.d.ts.map +1 -1
  138. package/dist/super-editor/super-editor/src/extensions/mention/mention.d.ts +6 -1
  139. package/dist/super-editor/super-editor/src/extensions/mention/mention.d.ts.map +1 -1
  140. package/dist/super-editor/super-editor/src/extensions/noderesizer/noderesizer.d.ts +1 -1
  141. package/dist/super-editor/super-editor/src/extensions/noderesizer/noderesizer.d.ts.map +1 -1
  142. package/dist/super-editor/super-editor/src/extensions/page-number/page-number.d.ts +2 -2
  143. package/dist/super-editor/super-editor/src/extensions/page-number/page-number.d.ts.map +1 -1
  144. package/dist/super-editor/super-editor/src/extensions/page-reference/page-reference.d.ts +8 -1
  145. package/dist/super-editor/super-editor/src/extensions/page-reference/page-reference.d.ts.map +1 -1
  146. package/dist/super-editor/super-editor/src/extensions/pagination/pagination.d.ts +5 -1
  147. package/dist/super-editor/super-editor/src/extensions/pagination/pagination.d.ts.map +1 -1
  148. package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts +1 -1
  149. package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts.map +1 -1
  150. package/dist/super-editor/super-editor/src/extensions/placeholder/placeholder.d.ts +3 -1
  151. package/dist/super-editor/super-editor/src/extensions/placeholder/placeholder.d.ts.map +1 -1
  152. package/dist/super-editor/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts +1 -1
  153. package/dist/super-editor/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts.map +1 -1
  154. package/dist/super-editor/super-editor/src/extensions/run/run.d.ts +1 -1
  155. package/dist/super-editor/super-editor/src/extensions/run/run.d.ts.map +1 -1
  156. package/dist/super-editor/super-editor/src/extensions/search/search.d.ts +1 -1
  157. package/dist/super-editor/super-editor/src/extensions/search/search.d.ts.map +1 -1
  158. package/dist/super-editor/super-editor/src/extensions/shape-container/shape-container.d.ts +6 -1
  159. package/dist/super-editor/super-editor/src/extensions/shape-container/shape-container.d.ts.map +1 -1
  160. package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts +1 -1
  161. package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts.map +1 -1
  162. package/dist/super-editor/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts +6 -1
  163. package/dist/super-editor/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts.map +1 -1
  164. package/dist/super-editor/super-editor/src/extensions/slash-menu/slash-menu.d.ts +1 -1
  165. package/dist/super-editor/super-editor/src/extensions/slash-menu/slash-menu.d.ts.map +1 -1
  166. package/dist/super-editor/super-editor/src/extensions/strike/strike.d.ts +3 -1
  167. package/dist/super-editor/super-editor/src/extensions/strike/strike.d.ts.map +1 -1
  168. package/dist/super-editor/super-editor/src/extensions/structured-content/document-part-object.d.ts +6 -1
  169. package/dist/super-editor/super-editor/src/extensions/structured-content/document-part-object.d.ts.map +1 -1
  170. package/dist/super-editor/super-editor/src/extensions/structured-content/document-section.d.ts +1 -1
  171. package/dist/super-editor/super-editor/src/extensions/structured-content/document-section.d.ts.map +1 -1
  172. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-block.d.ts +6 -1
  173. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-block.d.ts.map +1 -1
  174. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +1 -1
  175. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts.map +1 -1
  176. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content.d.ts +6 -1
  177. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content.d.ts.map +1 -1
  178. package/dist/super-editor/super-editor/src/extensions/tab/tab.d.ts +6 -1
  179. package/dist/super-editor/super-editor/src/extensions/tab/tab.d.ts.map +1 -1
  180. package/dist/super-editor/super-editor/src/extensions/table/table.d.ts +1 -1
  181. package/dist/super-editor/super-editor/src/extensions/table/table.d.ts.map +1 -1
  182. package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts +5 -1
  183. package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts.map +1 -1
  184. package/dist/super-editor/super-editor/src/extensions/table-header/table-header.d.ts +5 -1
  185. package/dist/super-editor/super-editor/src/extensions/table-header/table-header.d.ts.map +1 -1
  186. package/dist/super-editor/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +6 -1
  187. package/dist/super-editor/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts.map +1 -1
  188. package/dist/super-editor/super-editor/src/extensions/table-row/table-row.d.ts +5 -1
  189. package/dist/super-editor/super-editor/src/extensions/table-row/table-row.d.ts.map +1 -1
  190. package/dist/super-editor/super-editor/src/extensions/text/text.d.ts +1 -1
  191. package/dist/super-editor/super-editor/src/extensions/text/text.d.ts.map +1 -1
  192. package/dist/super-editor/super-editor/src/extensions/text-align/text-align.d.ts +4 -1
  193. package/dist/super-editor/super-editor/src/extensions/text-align/text-align.d.ts.map +1 -1
  194. package/dist/super-editor/super-editor/src/extensions/text-indent/text-indent.d.ts +7 -1
  195. package/dist/super-editor/super-editor/src/extensions/text-indent/text-indent.d.ts.map +1 -1
  196. package/dist/super-editor/super-editor/src/extensions/text-style/text-style.d.ts +3 -1
  197. package/dist/super-editor/super-editor/src/extensions/text-style/text-style.d.ts.map +1 -1
  198. package/dist/super-editor/super-editor/src/extensions/text-transform/text-transform.d.ts +3 -1
  199. package/dist/super-editor/super-editor/src/extensions/text-transform/text-transform.d.ts.map +1 -1
  200. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts +132 -52
  201. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts.map +1 -1
  202. package/dist/super-editor/super-editor/src/extensions/track-changes/track-changes.d.ts +1 -1
  203. package/dist/super-editor/super-editor/src/extensions/track-changes/track-changes.d.ts.map +1 -1
  204. package/dist/super-editor/super-editor/src/extensions/track-changes/track-delete.d.ts +5 -1
  205. package/dist/super-editor/super-editor/src/extensions/track-changes/track-delete.d.ts.map +1 -1
  206. package/dist/super-editor/super-editor/src/extensions/track-changes/track-format.d.ts +5 -1
  207. package/dist/super-editor/super-editor/src/extensions/track-changes/track-format.d.ts.map +1 -1
  208. package/dist/super-editor/super-editor/src/extensions/track-changes/track-insert.d.ts +5 -1
  209. package/dist/super-editor/super-editor/src/extensions/track-changes/track-insert.d.ts.map +1 -1
  210. package/dist/super-editor/super-editor/src/extensions/track-changes/trackChangesHelpers/trackedTransaction.d.ts +5 -1
  211. package/dist/super-editor/super-editor/src/extensions/track-changes/trackChangesHelpers/trackedTransaction.d.ts.map +1 -1
  212. package/dist/super-editor/super-editor/src/extensions/types/formatting-commands.d.ts +40 -0
  213. package/dist/super-editor/super-editor/src/extensions/types/formatting-commands.d.ts.map +1 -0
  214. package/dist/super-editor/super-editor/src/extensions/types/history-link-table-commands.d.ts +57 -0
  215. package/dist/super-editor/super-editor/src/extensions/types/history-link-table-commands.d.ts.map +1 -0
  216. package/dist/super-editor/super-editor/src/extensions/types/specialized-commands.d.ts +83 -0
  217. package/dist/super-editor/super-editor/src/extensions/types/specialized-commands.d.ts.map +1 -0
  218. package/dist/super-editor/super-editor/src/extensions/underline/underline.d.ts +3 -1
  219. package/dist/super-editor/super-editor/src/extensions/underline/underline.d.ts.map +1 -1
  220. package/dist/super-editor/super-editor/src/extensions/vector-shape/vector-shape.d.ts +1 -1
  221. package/dist/super-editor/super-editor/src/extensions/vector-shape/vector-shape.d.ts.map +1 -1
  222. package/dist/super-editor/super-editor/src/tests/export/export-helpers/export-helpers.d.ts +1 -1
  223. package/dist/super-editor/super-editor/src/tests/export/export-helpers/export-helpers.d.ts.map +1 -1
  224. package/dist/super-editor/super-editor.es.js +6 -6
  225. package/dist/super-editor/toolbar.es.js +2 -2
  226. package/dist/super-editor.cjs +1 -1
  227. package/dist/super-editor.es.js +1 -1
  228. package/dist/superdoc.cjs +2 -2
  229. package/dist/superdoc.es.js +2 -2
  230. package/dist/superdoc.umd.js +201 -257
  231. package/dist/superdoc.umd.js.map +1 -1
  232. package/package.json +1 -1
@@ -11686,8 +11686,9 @@ var bufferCrc32 = crc32;
11686
11686
  const index$2 = /* @__PURE__ */ getDefaultExportFromCjs(bufferCrc32);
11687
11687
  function callOrGet(value, context = null, ...props) {
11688
11688
  if (typeof value === "function") {
11689
- if (context) return value.bind(context)(...props);
11690
- return value(...props);
11689
+ const fn2 = value;
11690
+ if (context) return fn2.bind(context)(...props);
11691
+ return fn2(...props);
11691
11692
  }
11692
11693
  return value;
11693
11694
  }
@@ -11698,6 +11699,7 @@ const isMacOS = () => {
11698
11699
  return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
11699
11700
  };
11700
11701
  const isIOS = () => {
11702
+ if (typeof navigator === "undefined") return false;
11701
11703
  return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
11702
11704
  navigator.platform
11703
11705
  );
@@ -25118,11 +25120,12 @@ function createDocument(converter, schema, editor, { check = false } = {}) {
25118
25120
  return schema.topNodeType.createAndFill();
25119
25121
  }
25120
25122
  function getExtensionConfigField(extension, field, context = {}) {
25121
- if (typeof extension.config[field] === "function") {
25122
- const value = extension.config[field].bind({ ...context });
25123
- return value;
25123
+ const fieldValue = extension.config[field];
25124
+ if (typeof fieldValue === "function") {
25125
+ const boundValue = fieldValue.bind({ ...context });
25126
+ return boundValue;
25124
25127
  }
25125
- return extension.config[field];
25128
+ return fieldValue;
25126
25129
  }
25127
25130
  function getSchemaTypeByName(name, schema) {
25128
25131
  return schema.nodes[name] || schema.marks[name] || null;
@@ -35247,7 +35250,7 @@ const _SuperConverter = class _SuperConverter2 {
35247
35250
  static getStoredSuperdocVersion(docx) {
35248
35251
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35249
35252
  }
35250
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.1") {
35253
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.3") {
35251
35254
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35252
35255
  }
35253
35256
  /**
@@ -38446,7 +38449,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
38446
38449
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
38447
38450
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
38448
38451
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
38449
- 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, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_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, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, updateHTMLAttributes_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;
38452
+ 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, 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, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, updateHTMLAttributes_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;
38450
38453
  var GOOD_LEAF_SIZE = 200;
38451
38454
  var RopeSequence = function RopeSequence2() {
38452
38455
  };
@@ -46078,15 +46081,10 @@ const yUndoPlugin = ({ protectedNodes = defaultProtectedNodes, trackedOrigins =
46078
46081
  });
46079
46082
  class Extension {
46080
46083
  constructor(config2) {
46081
- __publicField$1(this, "type", "extension");
46082
- __publicField$1(this, "name", "extension");
46083
- __publicField$1(this, "options");
46084
- __publicField$1(this, "storage");
46085
- __publicField$1(this, "config", {
46086
- name: this.name
46087
- });
46084
+ this.type = "extension";
46085
+ this.name = "extension";
46088
46086
  this.config = {
46089
- ...this.config,
46087
+ name: this.name,
46090
46088
  ...config2
46091
46089
  };
46092
46090
  this.name = this.config.name;
@@ -46095,7 +46093,9 @@ class Extension {
46095
46093
  getExtensionConfigField(this, "addOptions", {
46096
46094
  name: this.name
46097
46095
  })
46098
- );
46096
+ ) || {};
46097
+ } else {
46098
+ this.options = {};
46099
46099
  }
46100
46100
  this.storage = callOrGet(
46101
46101
  getExtensionConfigField(this, "addStorage", {
@@ -46106,10 +46106,10 @@ class Extension {
46106
46106
  }
46107
46107
  /**
46108
46108
  * Static method for creating an extension.
46109
- * @param args Arguments for the constructor.
46109
+ * @param config Configuration for the extension.
46110
46110
  */
46111
- static create(...args) {
46112
- return new Extension(...args);
46111
+ static create(config2) {
46112
+ return new Extension(config2);
46113
46113
  }
46114
46114
  }
46115
46115
  const History = Extension.create({
@@ -46176,22 +46176,11 @@ const createUndoPlugin = () => {
46176
46176
  return yUndoPluginInstance;
46177
46177
  };
46178
46178
  let Node$1 = class Node22 {
46179
- /**
46180
- * @param {import('./types/index.js').EditorNodeConfig} config
46181
- */
46182
46179
  constructor(config2) {
46183
- __publicField$1(this, "type", "node");
46184
- __publicField$1(this, "name", "node");
46185
- __publicField$1(this, "options");
46186
- __publicField$1(this, "group");
46187
- __publicField$1(this, "atom");
46188
- __publicField$1(this, "editor");
46189
- __publicField$1(this, "storage");
46190
- __publicField$1(this, "config", {
46191
- name: this.name
46192
- });
46180
+ this.type = "node";
46181
+ this.name = "node";
46193
46182
  this.config = {
46194
- ...this.config,
46183
+ name: this.name,
46195
46184
  ...config2
46196
46185
  };
46197
46186
  this.name = this.config.name;
@@ -46201,7 +46190,9 @@ let Node$1 = class Node22 {
46201
46190
  getExtensionConfigField(this, "addOptions", {
46202
46191
  name: this.name
46203
46192
  })
46204
- );
46193
+ ) || {};
46194
+ } else {
46195
+ this.options = {};
46205
46196
  }
46206
46197
  this.storage = callOrGet(
46207
46198
  getExtensionConfigField(this, "addStorage", {
@@ -46212,9 +46203,8 @@ let Node$1 = class Node22 {
46212
46203
  }
46213
46204
  /**
46214
46205
  * Factory method to construct a new Node extension.
46215
- *
46216
- * @param {import('./types/index.js').EditorNodeConfig} config - The node configuration.
46217
- * @returns {Node} A new Node instance.
46206
+ * @param config - The node configuration.
46207
+ * @returns A new Node instance.
46218
46208
  */
46219
46209
  static create(config2) {
46220
46210
  return new Node22(config2);
@@ -46222,16 +46212,10 @@ let Node$1 = class Node22 {
46222
46212
  };
46223
46213
  class Mark2 {
46224
46214
  constructor(config2) {
46225
- __publicField$1(this, "type", "mark");
46226
- __publicField$1(this, "name", "mark");
46227
- __publicField$1(this, "options");
46228
- __publicField$1(this, "storage");
46229
- __publicField$1(this, "isExternal");
46230
- __publicField$1(this, "config", {
46231
- name: this.name
46232
- });
46215
+ this.type = "mark";
46216
+ this.name = "mark";
46233
46217
  this.config = {
46234
- ...this.config,
46218
+ name: this.name,
46235
46219
  ...config2
46236
46220
  };
46237
46221
  this.name = this.config.name;
@@ -46241,7 +46225,9 @@ class Mark2 {
46241
46225
  getExtensionConfigField(this, "addOptions", {
46242
46226
  name: this.name
46243
46227
  })
46244
- );
46228
+ ) || {};
46229
+ } else {
46230
+ this.options = {};
46245
46231
  }
46246
46232
  this.storage = callOrGet(
46247
46233
  getExtensionConfigField(this, "addStorage", {
@@ -46252,10 +46238,10 @@ class Mark2 {
46252
46238
  }
46253
46239
  /**
46254
46240
  * Static method for creating Mark extension.
46255
- * @param args Arguments for the constructor.
46241
+ * @param config Configuration for the mark.
46256
46242
  */
46257
- static create(...args) {
46258
- return new Mark2(...args);
46243
+ static create(config2) {
46244
+ return new Mark2(config2);
46259
46245
  }
46260
46246
  }
46261
46247
  class Attribute2 {
@@ -46347,8 +46333,10 @@ class Attribute2 {
46347
46333
  continue;
46348
46334
  }
46349
46335
  if (key2 === "class") {
46350
- const valueClasses = value ? value.split(" ") : [];
46351
- const existingClasses = mergedAttributes[key2] ? mergedAttributes[key2].split(" ") : [];
46336
+ const valueStr = typeof value === "string" ? value : String(value);
46337
+ const existingStr = typeof mergedAttributes[key2] === "string" ? mergedAttributes[key2] : String(mergedAttributes[key2] || "");
46338
+ const valueClasses = valueStr ? valueStr.split(" ") : [];
46339
+ const existingClasses = existingStr ? existingStr.split(" ") : [];
46352
46340
  const insertClasses = valueClasses.filter((value2) => !existingClasses.includes(value2));
46353
46341
  mergedAttributes[key2] = [...existingClasses, ...insertClasses].join(" ");
46354
46342
  } else if (key2 === "style") {
@@ -46452,7 +46440,11 @@ getGlobalAttributes_fn = function(extensions, defaultAttribute) {
46452
46440
  options: extension.options,
46453
46441
  storage: extension.storage
46454
46442
  };
46455
- const addGlobalAttributes = getExtensionConfigField(extension, "addGlobalAttributes", context);
46443
+ const addGlobalAttributes = getExtensionConfigField(
46444
+ extension,
46445
+ "addGlobalAttributes",
46446
+ context
46447
+ );
46456
46448
  if (!addGlobalAttributes) continue;
46457
46449
  const globalAttributes = addGlobalAttributes();
46458
46450
  for (const globalAttr of globalAttributes) {
@@ -46472,7 +46464,11 @@ getNodeAndMarksAttributes_fn = function(extensions, defaultAttribute) {
46472
46464
  options: extension.options,
46473
46465
  storage: extension.storage
46474
46466
  };
46475
- const addAttributes = getExtensionConfigField(extension, "addAttributes", context);
46467
+ const addAttributes = getExtensionConfigField(
46468
+ extension,
46469
+ "addAttributes",
46470
+ context
46471
+ );
46476
46472
  if (!addAttributes) continue;
46477
46473
  const attributes = addAttributes();
46478
46474
  for (const [name, attribute] of Object.entries(attributes)) {
@@ -46617,19 +46613,14 @@ createMarksSchema_fn = function(markExtensions, attributes, editor) {
46617
46613
  __privateAdd$1(_Schema, _Schema_static);
46618
46614
  let Schema2 = _Schema;
46619
46615
  class OxmlNode extends Node$1 {
46620
- /**
46621
- * @param {import('./types/index.js').OxmlNodeConfig} config
46622
- */
46623
46616
  constructor(config2) {
46624
46617
  super(config2);
46625
- __publicField$1(this, "oXmlName");
46626
46618
  this.oXmlName = config2.oXmlName;
46627
46619
  }
46628
46620
  /**
46629
46621
  * Factory method to construct a new OxmlNode instance.
46630
- *
46631
- * @param {import('./types/index.js').OxmlNodeConfig} config
46632
- * @returns {OxmlNode} A new OxmlNode instance.
46622
+ * @param config - The OXML node configuration.
46623
+ * @returns A new OxmlNode instance.
46633
46624
  */
46634
46625
  static create(config2) {
46635
46626
  return new OxmlNode(config2);
@@ -48142,8 +48133,8 @@ let EventEmitter$1 = class EventEmitter {
48142
48133
  }
48143
48134
  /**
48144
48135
  * Subscribe to the event.
48145
- * @param {string} name Event name.
48146
- * @param {(...args: any[]) => void} fn Callback.
48136
+ * @param name Event name.
48137
+ * @param fn Callback.
48147
48138
  * @returns {void}
48148
48139
  */
48149
48140
  on(name, fn2) {
@@ -48153,8 +48144,8 @@ let EventEmitter$1 = class EventEmitter {
48153
48144
  }
48154
48145
  /**
48155
48146
  * Emit event.
48156
- * @param {string} name Event name.
48157
- * @param {...any} args Arguments to pass to each listener.
48147
+ * @param name Event name.
48148
+ * @param args Arguments to pass to each listener.
48158
48149
  * @returns {void}
48159
48150
  */
48160
48151
  emit(name, ...args) {
@@ -48167,8 +48158,8 @@ let EventEmitter$1 = class EventEmitter {
48167
48158
  /**
48168
48159
  * Remove a specific callback from event
48169
48160
  * or all event subscriptions.
48170
- * @param {string} name Event name.
48171
- * @param {(...args: any[]) => void} fn Callback.
48161
+ * @param name Event name.
48162
+ * @param fn Callback.
48172
48163
  * @returns {void}
48173
48164
  */
48174
48165
  off(name, fn2) {
@@ -48185,8 +48176,8 @@ let EventEmitter$1 = class EventEmitter {
48185
48176
  }
48186
48177
  /**
48187
48178
  * Subscribe to an event that will be called only once.
48188
- * @param {string} name Event name.
48189
- * @param {(...args: any[]) => void} fn Callback.
48179
+ * @param name Event name.
48180
+ * @param fn Callback.
48190
48181
  * @returns {void}
48191
48182
  */
48192
48183
  once(name, fn2) {
@@ -51912,19 +51903,16 @@ const getLevel = (node) => {
51912
51903
  const _Editor = class _Editor2 extends EventEmitter$1 {
51913
51904
  /**
51914
51905
  * Create a new Editor instance
51915
- * @param {EditorOptions} options - Editor configuration options
51906
+ * @param options - Editor configuration options
51916
51907
  */
51917
51908
  constructor(options) {
51918
51909
  super();
51919
51910
  __privateAdd$1(this, _Editor_instances);
51920
51911
  __privateAdd$1(this, _commandService);
51921
- __publicField$1(this, "extensionService");
51922
- __publicField$1(this, "extensionStorage", {});
51923
- __publicField$1(this, "schema");
51924
- __publicField$1(this, "view");
51925
- __publicField$1(this, "isFocused", false);
51926
- __publicField$1(this, "fontsImported", []);
51927
- __publicField$1(this, "options", {
51912
+ this.extensionStorage = {};
51913
+ this.isFocused = false;
51914
+ this.fontsImported = [];
51915
+ this.options = {
51928
51916
  element: null,
51929
51917
  selector: null,
51930
51918
  isHeadless: false,
@@ -51957,11 +51945,15 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
51957
51945
  annotations: false,
51958
51946
  isInternal: false,
51959
51947
  externalExtensions: [],
51948
+ isChildEditor: false,
51960
51949
  numbering: {},
51961
51950
  isHeaderOrFooter: false,
51951
+ pagination: null,
51962
51952
  lastSelection: null,
51963
51953
  suppressDefaultDocxStyles: false,
51964
51954
  jsonOverride: null,
51955
+ loadFromSchema: false,
51956
+ fragment: null,
51965
51957
  onBeforeCreate: () => null,
51966
51958
  onCreate: () => null,
51967
51959
  onUpdate: () => null,
@@ -51993,15 +51985,20 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
51993
51985
  customUpdatedFiles: {},
51994
51986
  isHeaderFooterChanged: false,
51995
51987
  isCustomXmlChanged: false,
51988
+ ydoc: null,
51989
+ collaborationProvider: null,
51990
+ collaborationIsReady: false,
51991
+ shouldLoadComments: false,
51992
+ replacedFile: false,
51996
51993
  focusTarget: null,
51997
51994
  permissionResolver: null,
51998
51995
  // header/footer editors may have parent(main) editor set
51999
51996
  parentEditor: null
52000
- });
51997
+ };
52001
51998
  __privateMethod$1(this, _Editor_instances, initContainerElement_fn).call(this, options);
52002
51999
  __privateMethod$1(this, _Editor_instances, checkHeadless_fn).call(this, options);
52003
52000
  this.setOptions(options);
52004
- let modes = {
52001
+ const modes = {
52005
52002
  docx: () => __privateMethod$1(this, _Editor_instances, init_fn).call(this),
52006
52003
  text: () => __privateMethod$1(this, _Editor_instances, initRichText_fn).call(this),
52007
52004
  html: () => __privateMethod$1(this, _Editor_instances, initRichText_fn).call(this),
@@ -52009,14 +52006,13 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52009
52006
  console.log("Not implemented.");
52010
52007
  }
52011
52008
  };
52012
- let initMode = modes[this.options.mode] ?? modes.default;
52009
+ const initMode = modes[this.options.mode] ?? modes.default;
52013
52010
  const { setHighContrastMode } = useHighContrastMode();
52014
52011
  this.setHighContrastMode = setHighContrastMode;
52015
52012
  initMode();
52016
52013
  }
52017
52014
  /**
52018
52015
  * Getter which indicates if any changes happen in Editor
52019
- * @returns {boolean}
52020
52016
  */
52021
52017
  get docChanged() {
52022
52018
  return this.options.isHeaderFooterChanged || this.options.isCustomXmlChanged || !this.options.initialState.doc.eq(this.state.doc);
@@ -52032,97 +52028,84 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52032
52028
  if (this.view) {
52033
52029
  this.view.destroy();
52034
52030
  }
52035
- this.view = null;
52031
+ this.view = void 0;
52036
52032
  }
52037
52033
  /**
52038
52034
  * Set the toolbar for this editor
52039
- * @param {Object} toolbar - The toolbar instance
52040
- * @returns {void}
52041
52035
  */
52042
52036
  setToolbar(toolbar) {
52043
52037
  this.toolbar = toolbar;
52044
52038
  }
52045
52039
  /**
52046
52040
  * Focus the editor.
52047
- * @returns {void}
52048
52041
  */
52049
52042
  focus() {
52050
52043
  this.view?.focus();
52051
52044
  }
52052
52045
  /**
52053
52046
  * Get the editor state
52054
- * @returns {Object} ProseMirror state
52055
52047
  */
52056
52048
  get state() {
52057
52049
  return this.view?.state;
52058
52050
  }
52059
52051
  /**
52060
52052
  * Get the editor storage.
52061
- * @returns {Object} Editor storage object
52062
52053
  */
52063
52054
  get storage() {
52064
52055
  return this.extensionStorage;
52065
52056
  }
52066
52057
  /**
52067
52058
  * Get object of registered commands.
52068
- * @returns {import('./commands/types/index.js').EditorCommands} Commands object
52069
52059
  */
52070
52060
  get commands() {
52071
52061
  return __privateGet$1(this, _commandService)?.commands;
52072
52062
  }
52073
52063
  /**
52074
52064
  * Get extension helpers.
52075
- * @returns {EditorHelpers} Object with helper methods for extensions
52076
52065
  */
52077
52066
  get helpers() {
52078
52067
  return this.extensionService.helpers;
52079
52068
  }
52080
52069
  /**
52081
52070
  * Check if the editor is editable.
52082
- * @returns {boolean}
52083
52071
  */
52084
52072
  get isEditable() {
52085
52073
  return Boolean(this.options.editable && this.view && this.view.editable);
52086
52074
  }
52087
52075
  /**
52088
52076
  * Check if editor is destroyed.
52089
- * @returns {boolean}
52090
52077
  */
52091
52078
  get isDestroyed() {
52092
52079
  return this.view?.isDestroyed ?? true;
52093
52080
  }
52094
52081
  /**
52095
52082
  * Get the editor element
52096
- * @returns {HTMLElement} The editor element
52097
52083
  */
52098
52084
  get element() {
52099
52085
  return this.options.element;
52100
52086
  }
52101
52087
  /**
52102
52088
  * Get possible users of the editor.
52103
- * @returns {Array.<User>} List of users
52104
52089
  */
52105
52090
  get users() {
52106
52091
  return this.options.users;
52107
52092
  }
52108
52093
  /**
52109
52094
  * Create a chain of commands to call multiple commands at once.
52110
- * @returns {Object} Command chain
52111
52095
  */
52112
52096
  chain() {
52113
52097
  return __privateGet$1(this, _commandService).chain();
52114
52098
  }
52115
52099
  /**
52116
52100
  * Check if a command or a chain of commands can be executed. Without executing it.
52117
- * @returns {Object} Object with methods to check command availability
52118
52101
  */
52119
52102
  can() {
52120
52103
  return __privateGet$1(this, _commandService).can();
52121
52104
  }
52122
52105
  /**
52123
52106
  * Set the document mode
52124
- * @param {string} documentMode - The document mode ('editing', 'viewing', 'suggesting')
52125
- * @param {string} caller - Calling context
52107
+ * @param documentMode - The document mode ('editing', 'viewing', 'suggesting')
52108
+ * @param caller - Calling context
52126
52109
  */
52127
52110
  setDocumentMode(documentMode, caller) {
52128
52111
  if (this.options.isHeaderOrFooter || this.options.isChildEditor) return;
@@ -52166,7 +52149,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52166
52149
  }
52167
52150
  /**
52168
52151
  * Export the yjs binary from the current state.
52169
- * @returns {Promise<Uint8Array>} The exported yjs binary
52170
52152
  */
52171
52153
  async generateCollaborationUpdate() {
52172
52154
  return await generateCollaborationData(this);
@@ -52175,11 +52157,10 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52175
52157
  * Initialize data for collaborative editing
52176
52158
  * If we are replacing data and have a valid provider, listen for synced event
52177
52159
  * so that we can initialize the data
52178
- * @returns {void}
52179
52160
  */
52180
52161
  initializeCollaborationData() {
52181
52162
  if (!this.options.isNewFile || !this.options.collaborationProvider) return;
52182
- const { collaborationProvider: provider } = this.options;
52163
+ const provider = this.options.collaborationProvider;
52183
52164
  const postSyncInit = () => {
52184
52165
  provider.off("synced", postSyncInit);
52185
52166
  __privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
@@ -52191,8 +52172,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52191
52172
  * Replace content of editor that was created with loadFromSchema option
52192
52173
  * Used to replace content of other header/footer when one of it was edited
52193
52174
  *
52194
- * @param {object} content - new editor content json (retrieved from editor.getUpdatedJson)
52195
- * @returns {void}
52175
+ * @param content - new editor content json (retrieved from editor.getUpdatedJson)
52196
52176
  */
52197
52177
  replaceContent(content) {
52198
52178
  this.setOptions({
@@ -52209,8 +52189,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52209
52189
  }
52210
52190
  /**
52211
52191
  * Set editor options and update state.
52212
- * @param {EditorOptions} options - Editor options
52213
- * @returns {void}
52214
52192
  */
52215
52193
  setOptions(options = {}) {
52216
52194
  this.options = {
@@ -52230,9 +52208,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52230
52208
  }
52231
52209
  /**
52232
52210
  * Set whether the editor is editable
52233
- * @param {boolean} [editable=true] - Whether the editor is editable
52234
- * @param {boolean} [emitUpdate=true] - Whether to emit an update event
52235
- * @returns {void}
52236
52211
  */
52237
52212
  setEditable(editable = true, emitUpdate = true) {
52238
52213
  this.setOptions({ editable });
@@ -52244,7 +52219,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52244
52219
  * Register PM plugin.
52245
52220
  * @param plugin PM plugin.
52246
52221
  * @param handlePlugins Optional function for handling plugin merge.
52247
- * @returns {void}
52248
52222
  */
52249
52223
  registerPlugin(plugin2, handlePlugins) {
52250
52224
  if (!this.state?.plugins) return;
@@ -52254,25 +52228,21 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52254
52228
  }
52255
52229
  /**
52256
52230
  * Unregister a PM plugin
52257
- * @param {string|Object} nameOrPluginKey - Plugin name or plugin instance
52258
- * @returns {void}
52259
52231
  */
52260
52232
  unregisterPlugin(nameOrPluginKey) {
52261
52233
  if (this.isDestroyed) return;
52262
- const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
52234
+ const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey?.key ?? "";
52263
52235
  const state2 = this.state.reconfigure({
52264
- plugins: this.state.plugins.filter((plugin2) => !plugin2.key.startsWith(name))
52236
+ plugins: this.state.plugins.filter((plugin2) => !__privateMethod$1(this, _Editor_instances, getPluginKeyName_fn).call(this, plugin2).startsWith(name))
52265
52237
  });
52266
52238
  this.view.updateState(state2);
52267
52239
  }
52268
52240
  /**
52269
52241
  * Load the data from DOCX to be used in the schema.
52270
52242
  * Expects a DOCX file.
52271
- * @static
52272
- * @async
52273
- * @param {File|Blob|Buffer} fileSource - The DOCX file to load (File/Blob in browser, Buffer in Node.js)
52274
- * @param {boolean} [isNode=false] - Whether the method is being called in a Node.js environment
52275
- * @returns {Promise<Array>} - A promise that resolves to an array containing:
52243
+ * @param fileSource - The DOCX file to load (File/Blob in browser, Buffer in Node.js)
52244
+ * @param isNode - Whether the method is being called in a Node.js environment
52245
+ * @returns A promise that resolves to an array containing:
52276
52246
  * - [0] xmlFiles - Array of XML files extracted from the DOCX
52277
52247
  * - [1] mediaFiles - Object containing media files with URLs (browser only)
52278
52248
  * - [2] mediaFiles - Object containing media files with base64 data
@@ -52287,33 +52257,22 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52287
52257
  }
52288
52258
  /**
52289
52259
  * Get the document version
52290
- * @static
52291
- * @param {Object} doc - Document object
52292
- * @returns {string} Document version
52293
52260
  */
52294
52261
  static getDocumentVersion(doc2) {
52295
52262
  return SuperConverter.getStoredSuperdocVersion(doc2);
52296
52263
  }
52297
52264
  /**
52298
52265
  * Set the document version
52299
- * @static
52300
- * @param {Object} doc - Document object
52301
- * @param {string} version - New version
52302
- * @returns {string} The set version
52303
52266
  */
52304
52267
  static setDocumentVersion(doc2, version2) {
52305
52268
  return SuperConverter.setStoredSuperdocVersion(doc2, version2);
52306
52269
  }
52307
52270
  /**
52308
52271
  * Get the document GUID
52309
- * @static
52310
- * @param {Object} doc - Document object
52311
- * @returns {string|null} Document GUID
52312
52272
  */
52313
52273
  static getDocumentGuid(doc2) {
52314
52274
  return SuperConverter.extractDocumentGuid(doc2);
52315
52275
  }
52316
- // Deprecated
52317
52276
  /**
52318
52277
  * @deprecated use setDocumentVersion instead
52319
52278
  */
@@ -52323,7 +52282,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52323
52282
  }
52324
52283
  /**
52325
52284
  * Creates all node views.
52326
- * @returns {void}
52327
52285
  */
52328
52286
  createNodeViews() {
52329
52287
  this.view.setProps({
@@ -52332,7 +52290,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52332
52290
  }
52333
52291
  /**
52334
52292
  * Get the maximum content size
52335
- * @returns {Object} Size object with width and height
52336
52293
  */
52337
52294
  getMaxContentSize() {
52338
52295
  if (!this.converter) return {};
@@ -52356,7 +52313,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52356
52313
  return;
52357
52314
  }
52358
52315
  proseMirror.setAttribute("role", "document");
52359
- proseMirror.setAttribute("aria-multiline", true);
52316
+ proseMirror.setAttribute("aria-multiline", "true");
52360
52317
  proseMirror.setAttribute("aria-label", "Main content area, start typing to enter text.");
52361
52318
  proseMirror.setAttribute("aria-description", "");
52362
52319
  proseMirror.classList.remove("view-mode");
@@ -52387,7 +52344,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52387
52344
  element.style.touchAction = "auto";
52388
52345
  element.style.webkitOverflowScrolling = "touch";
52389
52346
  const defaultLineHeight = 1.2;
52390
- proseMirror.style.lineHeight = defaultLineHeight;
52347
+ proseMirror.style.lineHeight = String(defaultLineHeight);
52391
52348
  if (!hasPaginationEnabled) {
52392
52349
  proseMirror.style.paddingTop = "1in";
52393
52350
  proseMirror.style.paddingBottom = "1in";
@@ -52401,8 +52358,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52401
52358
  * Get page size and margins from the converter.
52402
52359
  * Set document default font and font size.
52403
52360
  *
52404
- * @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
52405
- * @returns {void}
52361
+ * @param element - The DOM element to apply styles to
52406
52362
  */
52407
52363
  initDefaultStyles(element = this.element, isPaginationEnabled = true) {
52408
52364
  if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
@@ -52413,9 +52369,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52413
52369
  /**
52414
52370
  * Initializes responsive styles for mobile devices.
52415
52371
  * Sets up scaling based on viewport width and handles orientation changes.
52416
- *
52417
- * @param {HTMLElement|void} element - The DOM element to apply mobile styles to
52418
- * @returns {void}
52419
52372
  */
52420
52373
  initMobileStyles(element) {
52421
52374
  if (!element) {
@@ -52450,30 +52403,28 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52450
52403
  };
52451
52404
  if ("orientation" in screen && "addEventListener" in screen.orientation) {
52452
52405
  screen.orientation.addEventListener("change", handleResize);
52453
- } else if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
52454
- window.matchMedia("(orientation: portrait)").addEventListener("change", handleResize);
52455
- }
52456
- if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
52457
- window.addEventListener("resize", () => handleResize);
52406
+ } else {
52407
+ const mediaQueryList = typeof window.matchMedia === "function" ? window.matchMedia("(orientation: portrait)") : null;
52408
+ if (mediaQueryList?.addEventListener) {
52409
+ mediaQueryList.addEventListener("change", handleResize);
52410
+ }
52458
52411
  }
52412
+ window.addEventListener("resize", () => handleResize);
52459
52413
  }
52460
52414
  /**
52461
52415
  * Get document identifier for telemetry (async - may generate hash)
52462
- * @returns {Promise<string>} GUID for modified docs, hash for unmodified
52463
52416
  */
52464
52417
  async getDocumentIdentifier() {
52465
52418
  return await this.converter?.getDocumentIdentifier() || null;
52466
52419
  }
52467
52420
  /**
52468
52421
  * Get permanent document GUID (sync - only for modified documents)
52469
- * @returns {string|null} GUID or null if document hasn't been modified
52470
52422
  */
52471
52423
  getDocumentGuid() {
52472
52424
  return this.converter?.documentGuid || null;
52473
52425
  }
52474
52426
  /**
52475
52427
  * Check if document has been modified
52476
- * @returns {boolean}
52477
52428
  */
52478
52429
  isDocumentModified() {
52479
52430
  return this.converter?.documentModified || false;
@@ -52489,14 +52440,15 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52489
52440
  version: this.converter?.getSuperdocVersion()
52490
52441
  };
52491
52442
  }
52492
- // Deprecated for backward compatibility
52443
+ /**
52444
+ * @deprecated use getDocumentGuid instead
52445
+ */
52493
52446
  getDocumentId() {
52494
52447
  console.warn("getDocumentId is deprecated, use getDocumentGuid instead");
52495
52448
  return this.getDocumentGuid();
52496
52449
  }
52497
52450
  /**
52498
52451
  * Get attrs of the currently selected node or mark.
52499
- * @param {String} nameOrType
52500
52452
  * @example
52501
52453
  * editor.getAttributes('textStyle').color
52502
52454
  */
@@ -52505,9 +52457,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52505
52457
  }
52506
52458
  /**
52507
52459
  * Returns if the currently selected node or mark is active.
52508
- * @param {String|Object} nameOrAttributes - The name of the node/mark or an attributes object
52509
- * @param {Object} [attributesOrUndefined] - Optional attributes to check when first parameter is a name
52510
- * @returns {Boolean} Whether the node or mark is active with the specified attributes
52460
+ * @param nameOrAttributes - The name of the node/mark or an attributes object
52461
+ * @param attributesOrUndefined - Optional attributes to check when first parameter is a name
52511
52462
  * @example
52512
52463
  * editor.isActive('bold')
52513
52464
  * editor.isActive('textStyle', { color: 'purple' })
@@ -52520,18 +52471,12 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52520
52471
  }
52521
52472
  /**
52522
52473
  * Get the editor content as JSON
52523
- * @returns {Object} Editor content as JSON
52524
52474
  */
52525
52475
  getJSON() {
52526
52476
  return this.state.doc.toJSON();
52527
52477
  }
52528
52478
  /**
52529
52479
  * Get document metadata including GUID, modification status, and version
52530
- * @returns {{
52531
- * documentGuid: string | null,
52532
- * isModified: boolean,
52533
- * version: string | null
52534
- * }} Document metadata
52535
52480
  */
52536
52481
  getMetadata() {
52537
52482
  return {
@@ -52542,9 +52487,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52542
52487
  }
52543
52488
  /**
52544
52489
  * Get the editor content as HTML
52545
- * @param {Object} options - Options for the HTML serializer
52546
- * @param {boolean} [options.unflattenLists] - Whether to unflatten lists in the HTML
52547
- * @returns {string} Editor content as HTML
52548
52490
  */
52549
52491
  getHTML({ unflattenLists = false } = {}) {
52550
52492
  const tempDocument = document.implementation.createHTMLDocument();
@@ -52559,7 +52501,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52559
52501
  }
52560
52502
  /**
52561
52503
  * Get the editor content as Markdown
52562
- * @returns {Promise<string>} Editor content as Markdown
52563
52504
  */
52564
52505
  async getMarkdown() {
52565
52506
  const [
@@ -52569,7 +52510,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52569
52510
  { default: remarkStringify },
52570
52511
  { default: remarkGfm }
52571
52512
  ] = await Promise.all([
52572
- import("./index-0zP7LFOd-CQ5IRTwG.es.js"),
52513
+ import("./index-B74saKaW-CeHVjvs8.es.js"),
52573
52514
  import("./index-DRCvimau-Cw339678.es.js"),
52574
52515
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
52575
52516
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -52584,7 +52525,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52584
52525
  }
52585
52526
  /**
52586
52527
  * Get the document version from the converter
52587
- * @returns {string|null} The SuperDoc version stored in the document
52588
52528
  */
52589
52529
  getDocumentVersion() {
52590
52530
  return this.converter?.getSuperdocVersion() || null;
@@ -52593,25 +52533,18 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52593
52533
  * Create a child editor linked to this editor.
52594
52534
  * This is useful for creating header/footer editors that are linked to the main editor.
52595
52535
  * Or paragraph fields that rely on the same underlying document and list defintions
52596
- * @param {EditorOptions} options - Options for the child editor
52597
- * @returns {Editor} A new child editor instance linked to this editor
52598
52536
  */
52599
52537
  createChildEditor(options) {
52600
52538
  return createLinkedChildEditor(this, options);
52601
52539
  }
52602
52540
  /**
52603
52541
  * Get page styles
52604
- * @returns {Object} Page styles
52605
52542
  */
52606
52543
  getPageStyles() {
52607
52544
  return this.converter?.pageStyles || {};
52608
52545
  }
52609
52546
  /**
52610
52547
  * Update page styles
52611
- *
52612
- * @param {Object} param0
52613
- * @param {Object} param0.pageMargins The new page margins
52614
- * @returns {void}
52615
52548
  */
52616
52549
  updatePageStyle({ pageMargins }) {
52617
52550
  if (!this.converter) return;
@@ -52637,13 +52570,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52637
52570
  }
52638
52571
  /**
52639
52572
  * Export the editor document to DOCX.
52640
- * @async
52641
- * @param {Object} options - The export options
52642
- * @param {boolean} [options.isFinalDoc=false] - Whether this is the final document version
52643
- * @param {string} [options.commentsType] - The type of comments to include
52644
- * @param {Array} [options.comments=[]] - Array of comments to include in the document
52645
- * @param {boolean} [options.getUpdatedDocs=false] - When set to true return only updated docx files
52646
- * @returns {Promise<Blob|ArrayBuffer|Object>} The exported DOCX file or updated docx files
52647
52573
  */
52648
52574
  async exportDocx({
52649
52575
  isFinalDoc = false,
@@ -52678,7 +52604,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52678
52604
  const updatedHeadersFooters = {};
52679
52605
  Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
52680
52606
  if (name.includes("header") || name.includes("footer")) {
52681
- const resultXml = this.converter.schemaToXml(json2.elements[0]);
52607
+ const jsonObj = json2;
52608
+ const resultXml = this.converter.schemaToXml(jsonObj.elements?.[0]);
52682
52609
  updatedHeadersFooters[name] = String(resultXml);
52683
52610
  }
52684
52611
  });
@@ -52733,19 +52660,19 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52733
52660
  fonts: this.options.fonts,
52734
52661
  isHeadless: this.options.isHeadless
52735
52662
  });
52736
- this.options.telemetry?.trackUsage("document_export", {
52663
+ this.options.telemetry?.trackUsage?.("document_export", {
52737
52664
  documentType: "docx",
52738
52665
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
52739
52666
  });
52740
52667
  return result;
52741
52668
  } catch (error) {
52742
- this.emit("exception", { error, editor: this });
52743
- console.error(error);
52669
+ const err = error instanceof Error ? error : new Error(String(error));
52670
+ this.emit("exception", { error: err, editor: this });
52671
+ console.error(err);
52744
52672
  }
52745
52673
  }
52746
52674
  /**
52747
52675
  * Destroy the editor and clean up resources
52748
- * @returns {void}
52749
52676
  */
52750
52677
  destroy() {
52751
52678
  this.emit("destroy");
@@ -52760,34 +52687,31 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52760
52687
  const footerEditors = this.converter?.footerEditors ?? [];
52761
52688
  if (!headerEditors.length && !footerEditors.length) return;
52762
52689
  const editors = [...headerEditors, ...footerEditors].filter(Boolean);
52763
- for (let editorData of editors) {
52690
+ for (const editorData of editors) {
52764
52691
  editorData?.editor?.destroy?.();
52765
52692
  }
52766
52693
  if (headerEditors.length) headerEditors.length = 0;
52767
52694
  if (footerEditors.length) footerEditors.length = 0;
52768
52695
  } catch (error) {
52769
- this.emit("exception", { error, editor: this });
52770
- console.error(error);
52696
+ const err = error instanceof Error ? error : new Error(String(error));
52697
+ this.emit("exception", { error: err, editor: this });
52698
+ console.error(err);
52771
52699
  }
52772
52700
  }
52773
52701
  /**
52774
52702
  * Check if migrations are needed for the data
52775
- * @static
52776
- * @param {Object} data - Document data
52777
- * @returns {boolean} Whether migrations are needed
52778
52703
  */
52779
52704
  static checkIfMigrationsNeeded() {
52780
- const dataVersion = version || "initial";
52705
+ const dataVersion = version ?? "initial";
52781
52706
  const migrations = getNecessaryMigrations(dataVersion) || [];
52782
52707
  console.debug("[checkVersionMigrations] Migrations needed:", dataVersion, migrations.length);
52783
52708
  return migrations.length > 0;
52784
52709
  }
52785
52710
  /**
52786
52711
  * Process collaboration migrations
52787
- * @returns {Object | void} Migration results
52788
52712
  */
52789
52713
  processCollaborationMigrations() {
52790
- console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.1");
52714
+ console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.3");
52791
52715
  if (!this.options.ydoc) return;
52792
52716
  const metaMap = this.options.ydoc.getMap("meta");
52793
52717
  let docVersion = metaMap.get("version");
@@ -52795,10 +52719,10 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52795
52719
  console.debug("[checkVersionMigrations] Document version", docVersion);
52796
52720
  const migrations = getNecessaryMigrations(docVersion) || [];
52797
52721
  const plugins = this.state.plugins;
52798
- const syncPlugin = plugins.find((p) => p.key.startsWith("y-sync"));
52722
+ const syncPlugin = plugins.find((plugin2) => __privateMethod$1(this, _Editor_instances, getPluginKeyName_fn).call(this, plugin2).startsWith("y-sync"));
52799
52723
  if (!syncPlugin) return this.options.ydoc;
52800
52724
  let hasRunMigrations = false;
52801
- for (let migration of migrations) {
52725
+ for (const migration of migrations) {
52802
52726
  console.debug("🏃‍♂️ Running migration", migration.name);
52803
52727
  const result = migration(this);
52804
52728
  if (!result) throw new Error("Migration failed at " + migration.name);
@@ -52810,9 +52734,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52810
52734
  }
52811
52735
  /**
52812
52736
  * Replace the current file
52813
- * @async
52814
- * @param {Object} newFile - New file data
52815
- * @returns {Promise<void>}
52816
52737
  */
52817
52738
  async replaceFile(newFile) {
52818
52739
  this.setOptions({ annotations: true });
@@ -52823,15 +52744,15 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52823
52744
  media,
52824
52745
  mediaFiles,
52825
52746
  fonts,
52826
- isNewFile: true,
52827
- shouldLoadComments: true,
52828
- replacedFile: true
52747
+ isNewFile: true
52829
52748
  });
52749
+ this.options.shouldLoadComments = true;
52750
+ this.options.replacedFile = true;
52830
52751
  __privateMethod$1(this, _Editor_instances, createConverter_fn).call(this);
52831
52752
  __privateMethod$1(this, _Editor_instances, initMedia_fn).call(this);
52832
52753
  this.initDefaultStyles();
52833
52754
  if (this.options.ydoc && this.options.collaborationProvider) {
52834
- updateYdocDocxData(this);
52755
+ updateYdocDocxData(this, this.options.ydoc);
52835
52756
  this.initializeCollaborationData();
52836
52757
  } else {
52837
52758
  __privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
@@ -52843,9 +52764,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52843
52764
  }
52844
52765
  /**
52845
52766
  * Get internal docx file content
52846
- * @param {string} name - File name
52847
- * @param {string} type - type of result (json, string)
52848
- * @returns {Object|String} - file content
52767
+ * @param name - File name
52768
+ * @param type - type of result (json, string)
52849
52769
  */
52850
52770
  getInternalXmlFile(name, type2 = "json") {
52851
52771
  if (!this.converter.convertedXml[name]) {
@@ -52859,8 +52779,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52859
52779
  }
52860
52780
  /**
52861
52781
  * Update internal docx file content
52862
- * @param {string} name - File name
52863
- * @param {string} updatedContent - new file content
52782
+ * @param name - File name
52783
+ * @param updatedContent - new file content
52864
52784
  */
52865
52785
  updateInternalXmlFile(name, updatedContent) {
52866
52786
  if (typeof updatedContent === "string") {
@@ -52873,8 +52793,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52873
52793
  }
52874
52794
  /**
52875
52795
  * Get all nodes of a specific type
52876
- * @param {string} type - Node type
52877
- * @returns {Array} Array of nodes
52878
52796
  */
52879
52797
  getNodesOfType(type2) {
52880
52798
  const { findChildren: findChildren2 } = helpers;
@@ -52882,9 +52800,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52882
52800
  }
52883
52801
  /**
52884
52802
  * Replace a node with HTML content
52885
- * @param {Object} targetNode - The node to replace
52886
- * @param {string} html - HTML content to replace with
52887
- * @returns {void}
52888
52803
  */
52889
52804
  replaceNodeWithHTML(targetNode, html) {
52890
52805
  const { tr } = this.state;
@@ -52901,9 +52816,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52901
52816
  * pre-process the document as needed prior to running in the annotator.
52902
52817
  *
52903
52818
  * Currently this is only used for table generation but additional pre-processing can be done here.
52904
- *
52905
- * @param {FieldValue[]} annotationValues
52906
- * @returns {void}
52907
52819
  */
52908
52820
  prepareForAnnotations(annotationValues = []) {
52909
52821
  const { tr } = this.state;
@@ -52912,8 +52824,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52912
52824
  }
52913
52825
  /**
52914
52826
  * Migrate paragraph fields to lists V2 structure if necessary.
52915
- * @param {FieldValue[]} annotationValues - List of field values to migrate.
52916
- * @returns {Promise<FieldValue[]>} - Returns a promise that resolves to the migrated
52827
+ * @param annotationValues - List of field values to migrate.
52828
+ * @returns Returns a promise that resolves to the migrated values
52917
52829
  */
52918
52830
  async migrateParagraphFields(annotationValues = []) {
52919
52831
  if (!Array.isArray(annotationValues) || !annotationValues.length) return annotationValues;
@@ -52922,10 +52834,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52922
52834
  }
52923
52835
  /**
52924
52836
  * Annotate the document with the given annotation values.
52925
- *
52926
- * @param {FieldValue[]} annotationValues List of field values to apply.
52927
- * @param {String[]} hiddenIds List of field ids to remove from the document.
52928
- * @returns {void}
52929
52837
  */
52930
52838
  annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
52931
52839
  const { state: state2, view, schema } = this;
@@ -52944,10 +52852,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52944
52852
  /**
52945
52853
  * Preview annotations in the editor. It stores a copy of the original state.
52946
52854
  * This can be reverted via closePreview()
52947
- *
52948
- * @param {Object[]} annotationValues
52949
- * @param {string[]} hiddenIds
52950
- * @returns {void}
52951
52855
  */
52952
52856
  previewAnnotations(annotationValues = [], hiddenIds = []) {
52953
52857
  this.originalState = this.view.state;
@@ -52955,8 +52859,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52955
52859
  }
52956
52860
  /**
52957
52861
  * If there is a preview active, this will revert the editor to the original state.
52958
- *
52959
- * @returns {void}
52960
52862
  */
52961
52863
  closePreview() {
52962
52864
  if (!this.originalState) return;
@@ -53002,7 +52904,7 @@ init_fn = function() {
53002
52904
  this.on("update", this.options.onUpdate);
53003
52905
  this.on("selectionUpdate", this.options.onSelectionUpdate);
53004
52906
  this.on("transaction", this.options.onTransaction);
53005
- this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn));
52907
+ this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn).bind(this));
53006
52908
  this.on("blur", this.options.onBlur);
53007
52909
  this.on("destroy", this.options.onDestroy);
53008
52910
  this.on("trackedChangesUpdate", this.options.onTrackedChangesUpdate);
@@ -53010,7 +52912,7 @@ init_fn = function() {
53010
52912
  this.on("commentClick", this.options.onCommentClicked);
53011
52913
  this.on("commentsUpdate", this.options.onCommentsUpdate);
53012
52914
  this.on("locked", this.options.onDocumentLocked);
53013
- this.on("collaborationReady", __privateMethod$1(this, _Editor_instances, onCollaborationReady_fn));
52915
+ this.on("collaborationReady", __privateMethod$1(this, _Editor_instances, onCollaborationReady_fn).bind(this));
53014
52916
  this.on("paginationUpdate", this.options.onPaginationUpdate);
53015
52917
  this.on("comment-positions", this.options.onCommentLocationsUpdate);
53016
52918
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
@@ -53053,7 +52955,7 @@ initRichText_fn = function() {
53053
52955
  this.on("update", this.options.onUpdate);
53054
52956
  this.on("selectionUpdate", this.options.onSelectionUpdate);
53055
52957
  this.on("transaction", this.options.onTransaction);
53056
- this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn));
52958
+ this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn).bind(this));
53057
52959
  this.on("blur", this.options.onBlur);
53058
52960
  this.on("destroy", this.options.onDestroy);
53059
52961
  this.on("commentsLoaded", this.options.onCommentsLoaded);
@@ -53068,7 +52970,11 @@ onFocus_fn = function({ editor, event }) {
53068
52970
  checkHeadless_fn = function(options) {
53069
52971
  if (!options.isHeadless) return;
53070
52972
  if (typeof navigator === "undefined") {
53071
- global$1.navigator = { isHeadless: true };
52973
+ const minimalNavigator = {
52974
+ platform: "node",
52975
+ userAgent: "Node.js"
52976
+ };
52977
+ global$1.navigator = minimalNavigator;
53072
52978
  }
53073
52979
  if (options.mockDocument) {
53074
52980
  global$1.document = options.mockDocument;
@@ -53101,13 +53007,18 @@ insertNewFileData_fn = function() {
53101
53007
  __privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
53102
53008
  }, 50);
53103
53009
  };
53010
+ getPluginKeyName_fn = function(plugin2) {
53011
+ const pluginKey = plugin2.key;
53012
+ return typeof pluginKey?.key === "string" ? pluginKey.key : "";
53013
+ };
53104
53014
  createExtensionService_fn = function() {
53105
53015
  const allowedExtensions = ["extension", "node", "mark"];
53106
53016
  const coreExtensions = [Editable, Commands, EditorFocus, Keymap];
53107
53017
  const externalExtensions = this.options.externalExtensions || [];
53108
- const allExtensions = [...coreExtensions, ...this.options.extensions].filter(
53109
- (e) => allowedExtensions.includes(e?.type)
53110
- );
53018
+ const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension) => {
53019
+ const extensionType = typeof extension?.type === "string" ? extension.type : void 0;
53020
+ return extensionType ? allowedExtensions.includes(extensionType) : false;
53021
+ });
53111
53022
  this.extensionService = ExtensionService.create(allExtensions, externalExtensions, this);
53112
53023
  };
53113
53024
  createCommandService_fn = function() {
@@ -53132,7 +53043,10 @@ createConverter_fn = function() {
53132
53043
  };
53133
53044
  initMedia_fn = function() {
53134
53045
  if (this.options.isChildEditor) return;
53135
- if (!this.options.ydoc) return this.storage.image.media = this.options.mediaFiles;
53046
+ if (!this.options.ydoc) {
53047
+ this.storage.image.media = this.options.mediaFiles;
53048
+ return;
53049
+ }
53136
53050
  const mediaMap = this.options.ydoc.getMap("media");
53137
53051
  if (this.options.isNewFile) {
53138
53052
  Object.entries(this.options.mediaFiles).forEach(([key2, value]) => {
@@ -53162,10 +53076,11 @@ checkFonts_fn = async function() {
53162
53076
  try {
53163
53077
  const fontsUsedInDocument = this.converter.getDocumentFonts();
53164
53078
  const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFonts_fn).call(this, fontsUsedInDocument);
53165
- this.emit("fonts-resolved", {
53079
+ const payload = {
53166
53080
  documentFonts: fontsUsedInDocument,
53167
53081
  unsupportedFonts
53168
- });
53082
+ };
53083
+ this.emit("fonts-resolved", payload);
53169
53084
  } catch {
53170
53085
  console.warn("[SuperDoc] Could not determine document fonts and unsupported fonts");
53171
53086
  }
@@ -53184,9 +53099,10 @@ createSchema_fn = function() {
53184
53099
  generatePmData_fn = function() {
53185
53100
  let doc2;
53186
53101
  try {
53187
- const { mode, fragment, content, loadFromSchema } = this.options;
53102
+ const { mode, content, fragment, loadFromSchema } = this.options;
53103
+ const hasJsonContent = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
53188
53104
  if (mode === "docx") {
53189
- if (loadFromSchema) {
53105
+ if (loadFromSchema && hasJsonContent(content)) {
53190
53106
  doc2 = this.schema.nodeFromJSON(content);
53191
53107
  doc2 = __privateMethod$1(this, _Editor_instances, prepareDocumentForImport_fn).call(this, doc2);
53192
53108
  } else {
@@ -53199,18 +53115,19 @@ generatePmData_fn = function() {
53199
53115
  if (fragment) doc2 = yXmlFragmentToProseMirrorRootNode(fragment, this.schema);
53200
53116
  }
53201
53117
  } else if (mode === "text" || mode === "html") {
53202
- if (loadFromSchema) doc2 = this.schema.nodeFromJSON(content);
53203
- else if (content) doc2 = createDocFromHTML(content, this);
53118
+ if (loadFromSchema && hasJsonContent(content)) doc2 = this.schema.nodeFromJSON(content);
53119
+ else if (typeof content === "string") doc2 = createDocFromHTML(content, this);
53204
53120
  else doc2 = this.schema.topNodeType.createAndFill();
53205
53121
  }
53206
53122
  } catch (err) {
53207
53123
  console.error(err);
53208
- this.emit("contentError", { editor: this, error: err });
53124
+ const error = err instanceof Error ? err : new Error(String(err));
53125
+ this.emit("contentError", { editor: this, error });
53209
53126
  }
53210
53127
  return doc2;
53211
53128
  };
53212
53129
  createView_fn = function(element) {
53213
- let doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
53130
+ const doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
53214
53131
  const state2 = { schema: this.schema };
53215
53132
  if (!this.options.ydoc) state2.doc = doc2;
53216
53133
  this.options.initialState = EditorState.create(state2);
@@ -53219,13 +53136,14 @@ createView_fn = function(element) {
53219
53136
  dispatchTransaction: __privateMethod$1(this, _Editor_instances, dispatchTransaction_fn).bind(this),
53220
53137
  state: this.options.initialState,
53221
53138
  handleClick: __privateMethod$1(this, _Editor_instances, handleNodeSelection_fn).bind(this),
53222
- handleDoubleClick: async (view, pos, event) => {
53139
+ handleDoubleClick: (view, pos, event) => {
53223
53140
  if (this.options.documentMode !== "editing") return;
53224
53141
  if (!isHeadless(this)) {
53225
53142
  const isHeader = hasSomeParentWithClass(event.target, "pagination-section-header");
53226
53143
  const isFooter = hasSomeParentWithClass(event.target, "pagination-section-footer");
53227
53144
  if (isHeader || isFooter) {
53228
- const eventClone = new event.constructor(event.type);
53145
+ const EventConstructor = event.constructor;
53146
+ const eventClone = new EventConstructor(event.type);
53229
53147
  event.target.dispatchEvent(eventClone);
53230
53148
  if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
53231
53149
  return;
@@ -53243,7 +53161,7 @@ createView_fn = function(element) {
53243
53161
  const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
53244
53162
  if (pm) {
53245
53163
  pm.classList.remove("header-footer-edit");
53246
- pm.setAttribute("aria-readonly", false);
53164
+ pm.setAttribute("aria-readonly", "false");
53247
53165
  }
53248
53166
  }
53249
53167
  setWordSelection(view, pos);
@@ -53254,7 +53172,7 @@ createView_fn = function(element) {
53254
53172
  });
53255
53173
  this.view.updateState(newState);
53256
53174
  this.createNodeViews();
53257
- this.options.telemetry?.sendReport();
53175
+ this.options.telemetry?.trackUsage?.("editor_initialized", {});
53258
53176
  };
53259
53177
  onCollaborationReady_fn = function({ editor, ydoc }) {
53260
53178
  if (this.options.collaborationIsReady) return;
@@ -53272,7 +53190,7 @@ onCollaborationReady_fn = function({ editor, ydoc }) {
53272
53190
  if (!this.options.isNewFile) {
53273
53191
  __privateMethod$1(this, _Editor_instances, initPagination_fn).call(this);
53274
53192
  __privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
53275
- updateYdocDocxData(this);
53193
+ updateYdocDocxData(this, this.options.ydoc);
53276
53194
  }
53277
53195
  };
53278
53196
  initComments_fn = function() {
@@ -53280,7 +53198,11 @@ initComments_fn = function() {
53280
53198
  if (this.options.isHeadless) return;
53281
53199
  if (!this.options.shouldLoadComments) return;
53282
53200
  const replacedFile = this.options.replacedFile;
53283
- this.emit("commentsLoaded", { editor: this, replacedFile, comments: this.converter.comments || [] });
53201
+ this.emit("commentsLoaded", {
53202
+ editor: this,
53203
+ replacedFile,
53204
+ comments: this.converter.comments || []
53205
+ });
53284
53206
  setTimeout(() => {
53285
53207
  this.options.replacedFile = false;
53286
53208
  const { state: state2, dispatch } = this.view;
@@ -53397,11 +53319,12 @@ endCollaboration_fn = function() {
53397
53319
  if (!this.options.ydoc) return;
53398
53320
  try {
53399
53321
  console.debug("🔗 [super-editor] Ending collaboration");
53400
- if (this.options.collaborationProvider) this.options.collaborationProvider.disconnect();
53401
- if (this.options.ydoc) this.options.ydoc.destroy();
53322
+ this.options.collaborationProvider?.disconnect?.();
53323
+ this.options.ydoc.destroy();
53402
53324
  } catch (error) {
53403
- this.emit("exception", { error, editor: this });
53404
- console.error(error);
53325
+ const err = error instanceof Error ? error : new Error(String(error));
53326
+ this.emit("exception", { error: err, editor: this });
53327
+ console.error(err);
53405
53328
  }
53406
53329
  };
53407
53330
  validateDocumentInit_fn = function() {
@@ -55690,6 +55613,7 @@ const DocumentSection = Node$1.create({
55690
55613
  return new DocumentSectionView(node, getPos, decorations, editor);
55691
55614
  };
55692
55615
  },
55616
+ // @ts-expect-error - Command signatures will be fixed in TS migration
55693
55617
  addCommands() {
55694
55618
  return {
55695
55619
  /**
@@ -55947,6 +55871,7 @@ const Document = Node$1.create({
55947
55871
  }
55948
55872
  };
55949
55873
  },
55874
+ // @ts-expect-error - Command signatures will be fixed in TS migration
55950
55875
  addCommands() {
55951
55876
  return {
55952
55877
  /**
@@ -56084,6 +56009,7 @@ const Run = OxmlNode.create({
56084
56009
  }
56085
56010
  };
56086
56011
  },
56012
+ // @ts-expect-error - Command signatures will be fixed in TS migration
56087
56013
  addCommands() {
56088
56014
  return {
56089
56015
  splitRun
@@ -58618,6 +58544,9 @@ const TabNode = Node$1.create({
58618
58544
  };
58619
58545
  },
58620
58546
  addPmPlugins() {
58547
+ if (isHeadless(this.editor)) {
58548
+ return [];
58549
+ }
58621
58550
  const { view, helpers: helpers2 } = this.editor;
58622
58551
  const mergeRanges2 = (ranges) => {
58623
58552
  if (ranges.length === 0) return [];
@@ -58735,6 +58664,7 @@ const LineBreak = Node$1.create({
58735
58664
  clear: { rendered: false }
58736
58665
  };
58737
58666
  },
58667
+ // @ts-expect-error - Command signatures will be fixed in TS migration
58738
58668
  addCommands() {
58739
58669
  return {
58740
58670
  /**
@@ -58797,6 +58727,7 @@ const HardBreak = Node$1.create({
58797
58727
  renderDOM({ htmlAttributes }) {
58798
58728
  return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
58799
58729
  },
58730
+ // @ts-expect-error - Command signatures will be fixed in TS migration
58800
58731
  addCommands() {
58801
58732
  return {
58802
58733
  /**
@@ -61543,9 +61474,9 @@ const Table = Node$1.create({
61543
61474
  const attrs = Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
61544
61475
  style: tableWidth ? `width: ${tableWidth}` : `min-width: ${tableMinWidth}`
61545
61476
  });
61546
- const table = ["table", attrs, colgroup, ["tbody", 0]];
61547
- return table;
61477
+ return ["table", attrs, colgroup, ["tbody", 0]];
61548
61478
  },
61479
+ // @ts-expect-error - Command signatures will be fixed in TS migration
61549
61480
  addCommands() {
61550
61481
  return {
61551
61482
  /**
@@ -62067,9 +61998,13 @@ const Table = Node$1.create({
62067
61998
  return [
62068
61999
  ...resizable ? [
62069
62000
  columnResizing({
62001
+ // @ts-expect-error - Options types will be fixed in TS migration
62070
62002
  handleWidth: this.options.handleWidth,
62003
+ // @ts-expect-error - Options types will be fixed in TS migration
62071
62004
  cellMinWidth: this.options.cellMinWidth,
62005
+ // @ts-expect-error - Options types will be fixed in TS migration
62072
62006
  defaultCellMinWidth: this.options.cellMinWidth,
62007
+ // @ts-expect-error - Options types will be fixed in TS migration
62073
62008
  lastColumnResizable: this.options.lastColumnResizable,
62074
62009
  View: createTableView({
62075
62010
  editor: this.editor
@@ -62077,6 +62012,7 @@ const Table = Node$1.create({
62077
62012
  })
62078
62013
  ] : [],
62079
62014
  tableEditing({
62015
+ // @ts-expect-error - Options types will be fixed in TS migration
62080
62016
  allowTableNodeSelection: this.options.allowTableNodeSelection
62081
62017
  })
62082
62018
  ];
@@ -62139,6 +62075,7 @@ const TableHeader = Node$1.create({
62139
62075
  renderDOM: (attrs) => {
62140
62076
  if (!attrs.colwidth) return {};
62141
62077
  return {
62078
+ // @ts-expect-error - colwidth is known to be an array at runtime
62142
62079
  "data-colwidth": attrs.colwidth.join(",")
62143
62080
  };
62144
62081
  }
@@ -62262,6 +62199,7 @@ const TableCell = Node$1.create({
62262
62199
  renderDOM: (attrs) => {
62263
62200
  if (!attrs.colwidth) return {};
62264
62201
  return {
62202
+ // @ts-expect-error - colwidth is known to be an array at runtime
62265
62203
  "data-colwidth": attrs.colwidth.join(",")
62266
62204
  };
62267
62205
  }
@@ -65357,6 +65295,7 @@ const BookmarkStart = Node$1.create({
65357
65295
  renderDOM({ htmlAttributes }) {
65358
65296
  return ["a", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
65359
65297
  },
65298
+ // @ts-expect-error - Command signatures will be fixed in TS migration
65360
65299
  addCommands() {
65361
65300
  return {
65362
65301
  /**
@@ -65460,6 +65399,7 @@ const BookmarkEnd = Node$1.create({
65460
65399
  renderDOM({ htmlAttributes }) {
65461
65400
  return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
65462
65401
  },
65402
+ // @ts-expect-error - Command signatures will be fixed in TS migration
65463
65403
  addCommands() {
65464
65404
  return {
65465
65405
  /**
@@ -65965,8 +65905,10 @@ const ContentBlock = Node$1.create({
65965
65905
  if (size2.top) style2 += `top: ${size2.top}px; `;
65966
65906
  if (size2.left) style2 += `left: ${size2.left}px; `;
65967
65907
  if (size2.width) style2 += `width: ${size2.width.toString().endsWith("%") ? size2.width : `${size2.width}px`}; `;
65968
- if (size2.height)
65969
- style2 += `height: ${size2.height.toString().endsWith("%") ? size2.height : `${size2.height}px`}; `;
65908
+ if (size2.height) {
65909
+ const heightValue = size2.height.toString().endsWith("%") ? size2.height : `${size2.height}px`;
65910
+ style2 += `height: ${heightValue}; `;
65911
+ }
65970
65912
  return { style: style2 };
65971
65913
  }
65972
65914
  },
@@ -65997,6 +65939,7 @@ const ContentBlock = Node$1.create({
65997
65939
  renderDOM({ htmlAttributes }) {
65998
65940
  return ["div", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-type": this.name })];
65999
65941
  },
65942
+ // @ts-expect-error - Command signatures will be fixed in TS migration
66000
65943
  addCommands() {
66001
65944
  return {
66002
65945
  /**
@@ -75321,6 +75264,7 @@ function setSearchState(tr, query, range2 = null) {
75321
75264
  }
75322
75265
  const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
75323
75266
  const Search = Extension.create({
75267
+ // @ts-expect-error - Storage type mismatch will be fixed in TS migration
75324
75268
  addStorage() {
75325
75269
  return {
75326
75270
  /**