@stll/folio-core 0.0.1-placeholder.0 → 0.1.0

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 (683) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE.md +29 -0
  3. package/README.md +41 -0
  4. package/dist/_virtual/_rolldown/runtime.js +13 -0
  5. package/dist/ai-edits/apply.d.ts +35 -0
  6. package/dist/ai-edits/apply.js +683 -0
  7. package/dist/ai-edits/clean-text.d.ts +28 -0
  8. package/dist/ai-edits/clean-text.js +23 -0
  9. package/dist/ai-edits/headless.d.ts +225 -0
  10. package/dist/ai-edits/headless.js +513 -0
  11. package/dist/ai-edits/index.d.ts +6 -0
  12. package/dist/ai-edits/index.js +5 -0
  13. package/dist/ai-edits/inline-emphasis.d.ts +38 -0
  14. package/dist/ai-edits/inline-emphasis.js +78 -0
  15. package/dist/ai-edits/snapshot.d.ts +9 -0
  16. package/dist/ai-edits/snapshot.js +195 -0
  17. package/dist/ai-edits/types.d.ts +156 -0
  18. package/dist/ai-edits/types.js +0 -0
  19. package/dist/ai-edits/word-diff.d.ts +20 -0
  20. package/dist/ai-edits/word-diff.js +77 -0
  21. package/dist/ai-suggestions/apply.d.ts +17 -0
  22. package/dist/ai-suggestions/apply.js +64 -0
  23. package/dist/ai-suggestions/conflict.d.ts +22 -0
  24. package/dist/ai-suggestions/conflict.js +67 -0
  25. package/dist/ai-suggestions/text-positions.d.ts +21 -0
  26. package/dist/ai-suggestions/text-positions.js +48 -0
  27. package/dist/ai-suggestions/types.d.ts +199 -0
  28. package/dist/ai-suggestions/types.js +59 -0
  29. package/dist/content-controls/errors.d.ts +52 -0
  30. package/dist/content-controls/errors.js +36 -0
  31. package/dist/content-controls/findContentControls.d.ts +55 -0
  32. package/dist/content-controls/findContentControls.js +75 -0
  33. package/dist/content-controls/index.d.ts +4 -0
  34. package/dist/content-controls/index.js +4 -0
  35. package/dist/content-controls/mutateContentControls.d.ts +51 -0
  36. package/dist/content-controls/mutateContentControls.js +377 -0
  37. package/dist/controller/folioEditor.d.ts +21 -0
  38. package/dist/controller/folioEditor.js +29 -0
  39. package/dist/controller/folioEditorEvents.d.ts +23 -0
  40. package/dist/controller/folioEditorEvents.js +24 -0
  41. package/dist/controller/hiddenEditorApi.d.ts +35 -0
  42. package/dist/controller/hiddenEditorApi.js +112 -0
  43. package/dist/controller/hiddenEditorManager.d.ts +93 -0
  44. package/dist/controller/hiddenEditorManager.js +308 -0
  45. package/dist/controller/layoutPipeline.d.ts +63 -0
  46. package/dist/controller/layoutPipeline.js +406 -0
  47. package/dist/controller/layoutScheduler.d.ts +41 -0
  48. package/dist/controller/layoutScheduler.js +59 -0
  49. package/dist/controller/layoutSession.d.ts +24 -0
  50. package/dist/controller/layoutSession.js +13 -0
  51. package/dist/docx/blockContentParser.d.ts +13 -0
  52. package/dist/docx/blockContentParser.js +289 -0
  53. package/dist/docx/bookmarkParser.d.ts +178 -0
  54. package/dist/docx/bookmarkParser.js +246 -0
  55. package/dist/docx/bookmarkPlacement.d.ts +10 -0
  56. package/dist/docx/bookmarkPlacement.js +50 -0
  57. package/dist/docx/bulletMarkers.d.ts +4 -0
  58. package/dist/docx/bulletMarkers.js +42 -0
  59. package/dist/docx/commentParser.d.ts +34 -0
  60. package/dist/docx/commentParser.js +127 -0
  61. package/dist/docx/commentReferenceNormalization.d.ts +25 -0
  62. package/dist/docx/commentReferenceNormalization.js +97 -0
  63. package/dist/docx/commentReplyMarkers.d.ts +20 -0
  64. package/dist/docx/commentReplyMarkers.js +123 -0
  65. package/dist/docx/compatibility.d.ts +12 -0
  66. package/dist/docx/compatibility.js +77 -0
  67. package/dist/docx/documentParser.d.ts +65 -0
  68. package/dist/docx/documentParser.js +209 -0
  69. package/dist/docx/drawingUtils.d.ts +56 -0
  70. package/dist/docx/drawingUtils.js +305 -0
  71. package/dist/docx/fieldParser.d.ts +228 -0
  72. package/dist/docx/fieldParser.js +559 -0
  73. package/dist/docx/footnoteParser.d.ts +109 -0
  74. package/dist/docx/footnoteParser.js +270 -0
  75. package/dist/docx/headerFooterParser.d.ts +119 -0
  76. package/dist/docx/headerFooterParser.js +266 -0
  77. package/dist/docx/headerFooterRefParser.d.ts +22 -0
  78. package/dist/docx/headerFooterRefParser.js +52 -0
  79. package/dist/docx/headerFooterReferenceNormalization.d.ts +19 -0
  80. package/dist/docx/headerFooterReferenceNormalization.js +64 -0
  81. package/dist/docx/hyperlinkParser.d.ts +108 -0
  82. package/dist/docx/hyperlinkParser.js +230 -0
  83. package/dist/docx/imageParser.d.ts +93 -0
  84. package/dist/docx/imageParser.js +522 -0
  85. package/dist/docx/mathToMathml.d.ts +15 -0
  86. package/dist/docx/mathToMathml.js +357 -0
  87. package/dist/docx/modelValidation.d.ts +13 -0
  88. package/dist/docx/modelValidation.js +21 -0
  89. package/dist/docx/normalizeBaseDirection.d.ts +12 -0
  90. package/dist/docx/normalizeBaseDirection.js +81 -0
  91. package/dist/docx/notePropertiesParser.d.ts +16 -0
  92. package/dist/docx/notePropertiesParser.js +99 -0
  93. package/dist/docx/numberingParser.d.ts +86 -0
  94. package/dist/docx/numberingParser.js +735 -0
  95. package/dist/docx/numberingReferenceNormalization.d.ts +25 -0
  96. package/dist/docx/numberingReferenceNormalization.js +22 -0
  97. package/dist/docx/paragraphParser.d.ts +86 -0
  98. package/dist/docx/paragraphParser.js +1132 -0
  99. package/dist/docx/paragraphTraversal.d.ts +19 -0
  100. package/dist/docx/paragraphTraversal.js +76 -0
  101. package/dist/docx/parser.d.ts +67 -0
  102. package/dist/docx/parser.js +391 -0
  103. package/dist/docx/parserEnums.d.ts +45 -0
  104. package/dist/docx/parserEnums.js +70 -0
  105. package/dist/docx/relsParser.d.ts +160 -0
  106. package/dist/docx/relsParser.js +235 -0
  107. package/dist/docx/replyToComment.d.ts +29 -0
  108. package/dist/docx/replyToComment.js +73 -0
  109. package/dist/docx/rezip.d.ts +166 -0
  110. package/dist/docx/rezip.js +1194 -0
  111. package/dist/docx/runConsolidator.d.ts +57 -0
  112. package/dist/docx/runConsolidator.js +224 -0
  113. package/dist/docx/runParser.d.ts +78 -0
  114. package/dist/docx/runParser.js +661 -0
  115. package/dist/docx/sdtProperties.d.ts +15 -0
  116. package/dist/docx/sdtProperties.js +290 -0
  117. package/dist/docx/sdtPropertiesPatch.d.ts +16 -0
  118. package/dist/docx/sdtPropertiesPatch.js +144 -0
  119. package/dist/docx/sectionParser.d.ts +95 -0
  120. package/dist/docx/sectionParser.js +534 -0
  121. package/dist/docx/selectiveSave.d.ts +25 -0
  122. package/dist/docx/selectiveSave.js +247 -0
  123. package/dist/docx/selectiveSaveFlags.d.ts +33 -0
  124. package/dist/docx/selectiveSaveFlags.js +11 -0
  125. package/dist/docx/selectiveSaveTripwire.d.ts +33 -0
  126. package/dist/docx/selectiveSaveTripwire.js +79 -0
  127. package/dist/docx/selectiveXmlPatch.d.ts +103 -0
  128. package/dist/docx/selectiveXmlPatch.js +493 -0
  129. package/dist/docx/serializer/blockSdtSerializer.d.ts +6 -0
  130. package/dist/docx/serializer/blockSdtSerializer.js +88 -0
  131. package/dist/docx/serializer/borderSerializer.d.ts +25 -0
  132. package/dist/docx/serializer/borderSerializer.js +44 -0
  133. package/dist/docx/serializer/commentSerializer.d.ts +31 -0
  134. package/dist/docx/serializer/commentSerializer.js +184 -0
  135. package/dist/docx/serializer/documentSerializer.d.ts +65 -0
  136. package/dist/docx/serializer/documentSerializer.js +199 -0
  137. package/dist/docx/serializer/headerFooterSerializer.d.ts +12 -0
  138. package/dist/docx/serializer/headerFooterSerializer.js +84 -0
  139. package/dist/docx/serializer/noteSerializer.d.ts +19 -0
  140. package/dist/docx/serializer/noteSerializer.js +70 -0
  141. package/dist/docx/serializer/numberingSerializer.d.ts +12 -0
  142. package/dist/docx/serializer/numberingSerializer.js +93 -0
  143. package/dist/docx/serializer/paragraphSerializer.d.ts +48 -0
  144. package/dist/docx/serializer/paragraphSerializer.js +559 -0
  145. package/dist/docx/serializer/runSerializer.d.ts +56 -0
  146. package/dist/docx/serializer/runSerializer.js +621 -0
  147. package/dist/docx/serializer/sectionPropertiesSerializer.d.ts +6 -0
  148. package/dist/docx/serializer/sectionPropertiesSerializer.js +187 -0
  149. package/dist/docx/serializer/tableSerializer.d.ts +79 -0
  150. package/dist/docx/serializer/tableSerializer.js +422 -0
  151. package/dist/docx/serializer/xmlUtils.d.ts +20 -0
  152. package/dist/docx/serializer/xmlUtils.js +25 -0
  153. package/dist/docx/settingsParser.d.ts +8 -0
  154. package/dist/docx/settingsParser.js +36 -0
  155. package/dist/docx/shapeParser.d.ts +20 -0
  156. package/dist/docx/shapeParser.js +272 -0
  157. package/dist/docx/styleParser.d.ts +50 -0
  158. package/dist/docx/styleParser.js +905 -0
  159. package/dist/docx/tableParser.d.ts +202 -0
  160. package/dist/docx/tableParser.js +811 -0
  161. package/dist/docx/textBoxParser.d.ts +117 -0
  162. package/dist/docx/textBoxParser.js +262 -0
  163. package/dist/docx/themeParser.d.ts +77 -0
  164. package/dist/docx/themeParser.js +330 -0
  165. package/dist/docx/trackedMoveRangeNormalization.d.ts +22 -0
  166. package/dist/docx/trackedMoveRangeNormalization.js +100 -0
  167. package/dist/docx/unzip.d.ts +118 -0
  168. package/dist/docx/unzip.js +383 -0
  169. package/dist/docx/vmlImageParser.d.ts +16 -0
  170. package/dist/docx/vmlImageParser.js +100 -0
  171. package/dist/docx/watermarkParser.d.ts +45 -0
  172. package/dist/docx/watermarkParser.js +348 -0
  173. package/dist/docx/wrapTypes.d.ts +29 -0
  174. package/dist/docx/wrapTypes.js +48 -0
  175. package/dist/docx/xmlParser.d.ts +297 -0
  176. package/dist/docx/xmlParser.js +527 -0
  177. package/dist/fields/bookmarkPages.d.ts +13 -0
  178. package/dist/fields/bookmarkPages.js +66 -0
  179. package/dist/fields/bookmarkText.d.ts +16 -0
  180. package/dist/fields/bookmarkText.js +61 -0
  181. package/dist/fields/evaluateField.d.ts +23 -0
  182. package/dist/fields/evaluateField.js +77 -0
  183. package/dist/fields/fieldContext.d.ts +21 -0
  184. package/dist/fields/fieldContext.js +0 -0
  185. package/dist/fields/resolveFieldValues.d.ts +44 -0
  186. package/dist/fields/resolveFieldValues.js +204 -0
  187. package/dist/fields/sectionPageCounts.d.ts +11 -0
  188. package/dist/fields/sectionPageCounts.js +16 -0
  189. package/dist/fields/seqValues.d.ts +14 -0
  190. package/dist/fields/seqValues.js +36 -0
  191. package/dist/fonts/embeddedFontTable.d.ts +42 -0
  192. package/dist/fonts/embeddedFontTable.js +80 -0
  193. package/dist/fonts/embeddedFonts.d.ts +46 -0
  194. package/dist/fonts/embeddedFonts.js +112 -0
  195. package/dist/fonts/fontDeobfuscation.d.ts +30 -0
  196. package/dist/fonts/fontDeobfuscation.js +57 -0
  197. package/dist/index.d.ts +28 -0
  198. package/dist/index.js +23 -0
  199. package/dist/layout-bridge/convert/footnoteLayout.d.ts +57 -0
  200. package/dist/layout-bridge/convert/footnoteLayout.js +316 -0
  201. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +74 -0
  202. package/dist/layout-bridge/convert/headerFooterLayout.js +432 -0
  203. package/dist/layout-bridge/convert/templatePreviewFlow.d.ts +36 -0
  204. package/dist/layout-bridge/convert/templatePreviewFlow.js +176 -0
  205. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +65 -0
  206. package/dist/layout-bridge/convert/toFlowBlocks.js +1309 -0
  207. package/dist/layout-bridge/convert/wrapEditorViewAsSurface.d.ts +17 -0
  208. package/dist/layout-bridge/convert/wrapEditorViewAsSurface.js +36 -0
  209. package/dist/layout-bridge/dom/clickToPositionDom.d.ts +66 -0
  210. package/dist/layout-bridge/dom/clickToPositionDom.js +304 -0
  211. package/dist/layout-bridge/dom/findBodyPmSpans.d.ts +7 -0
  212. package/dist/layout-bridge/dom/findBodyPmSpans.js +17 -0
  213. package/dist/layout-bridge/dom/findHfPmSpans.d.ts +62 -0
  214. package/dist/layout-bridge/dom/findHfPmSpans.js +197 -0
  215. package/dist/layout-bridge/engine/clickToPosition.d.ts +66 -0
  216. package/dist/layout-bridge/engine/clickToPosition.js +403 -0
  217. package/dist/layout-bridge/engine/hitTest.d.ts +135 -0
  218. package/dist/layout-bridge/engine/hitTest.js +375 -0
  219. package/dist/layout-bridge/engine/measuring/index.d.ts +10 -0
  220. package/dist/layout-bridge/engine/measuring/index.js +9 -0
  221. package/dist/layout-bridge/engine/selectionRects.d.ts +59 -0
  222. package/dist/layout-bridge/engine/selectionRects.js +485 -0
  223. package/dist/layout-bridge/engine/tableWidthUtils.d.ts +7 -0
  224. package/dist/layout-bridge/engine/tableWidthUtils.js +25 -0
  225. package/dist/layout-engine/index.d.ts +44 -0
  226. package/dist/layout-engine/index.js +691 -0
  227. package/dist/layout-engine/keep-together.d.ts +43 -0
  228. package/dist/layout-engine/keep-together.js +98 -0
  229. package/dist/layout-engine/layoutInstrumentation.d.ts +50 -0
  230. package/dist/layout-engine/layoutInstrumentation.js +43 -0
  231. package/dist/layout-engine/lineFlow.d.ts +8 -0
  232. package/dist/layout-engine/lineFlow.js +17 -0
  233. package/dist/layout-engine/measure/cache.d.ts +93 -0
  234. package/dist/layout-engine/measure/cache.js +245 -0
  235. package/dist/layout-engine/measure/clampFloatingWrapMargins.d.ts +20 -0
  236. package/dist/layout-engine/measure/clampFloatingWrapMargins.js +29 -0
  237. package/dist/layout-engine/measure/featureFlags.d.ts +44 -0
  238. package/dist/layout-engine/measure/featureFlags.js +19 -0
  239. package/dist/layout-engine/measure/floatingZones.d.ts +89 -0
  240. package/dist/layout-engine/measure/floatingZones.js +152 -0
  241. package/dist/layout-engine/measure/font-metrics.worker.d.ts +17 -0
  242. package/dist/layout-engine/measure/font-metrics.worker.js +104 -0
  243. package/dist/layout-engine/measure/index.d.ts +9 -0
  244. package/dist/layout-engine/measure/index.js +8 -0
  245. package/dist/layout-engine/measure/listMarkerWidth.d.ts +40 -0
  246. package/dist/layout-engine/measure/listMarkerWidth.js +76 -0
  247. package/dist/layout-engine/measure/measureBlocks.d.ts +25 -0
  248. package/dist/layout-engine/measure/measureBlocks.js +450 -0
  249. package/dist/layout-engine/measure/measureContainer.d.ts +24 -0
  250. package/dist/layout-engine/measure/measureContainer.js +280 -0
  251. package/dist/layout-engine/measure/measureHelpers.d.ts +82 -0
  252. package/dist/layout-engine/measure/measureHelpers.js +156 -0
  253. package/dist/layout-engine/measure/measureParagraph.d.ts +61 -0
  254. package/dist/layout-engine/measure/measureParagraph.js +724 -0
  255. package/dist/layout-engine/measure/measureProvider.d.ts +23 -0
  256. package/dist/layout-engine/measure/measureProvider.js +35 -0
  257. package/dist/layout-engine/measure/measureTypes.d.ts +61 -0
  258. package/dist/layout-engine/measure/measureTypes.js +0 -0
  259. package/dist/layout-engine/measure/measureWorker.d.ts +54 -0
  260. package/dist/layout-engine/measure/measureWorker.js +249 -0
  261. package/dist/layout-engine/measure/measureWorkerProtocol.d.ts +88 -0
  262. package/dist/layout-engine/measure/measureWorkerProtocol.js +20 -0
  263. package/dist/layout-engine/measure/tableCellFloating.d.ts +26 -0
  264. package/dist/layout-engine/measure/tableCellFloating.js +99 -0
  265. package/dist/layout-engine/paginator.d.ts +84 -0
  266. package/dist/layout-engine/paginator.js +348 -0
  267. package/dist/layout-engine/paragraphFragmentRange.d.ts +9 -0
  268. package/dist/layout-engine/paragraphFragmentRange.js +40 -0
  269. package/dist/layout-engine/section-breaks.d.ts +78 -0
  270. package/dist/layout-engine/section-breaks.js +182 -0
  271. package/dist/layout-engine/tableRowBreak.d.ts +23 -0
  272. package/dist/layout-engine/tableRowBreak.js +147 -0
  273. package/dist/layout-engine/textBoxFlow.d.ts +50 -0
  274. package/dist/layout-engine/textBoxFlow.js +160 -0
  275. package/dist/layout-engine/types.d.ts +1031 -0
  276. package/dist/layout-engine/types.js +100 -0
  277. package/dist/layout-painter/documentColors.d.ts +4 -0
  278. package/dist/layout-painter/documentColors.js +40 -0
  279. package/dist/layout-painter/index.d.ts +110 -0
  280. package/dist/layout-painter/index.js +182 -0
  281. package/dist/layout-painter/registry/modules/image.d.ts +6 -0
  282. package/dist/layout-painter/registry/modules/image.js +17 -0
  283. package/dist/layout-painter/registry/modules/paragraph.d.ts +6 -0
  284. package/dist/layout-painter/registry/modules/paragraph.js +18 -0
  285. package/dist/layout-painter/registry/modules/table.d.ts +6 -0
  286. package/dist/layout-painter/registry/modules/table.js +16 -0
  287. package/dist/layout-painter/registry/modules/textBox.d.ts +6 -0
  288. package/dist/layout-painter/registry/modules/textBox.js +13 -0
  289. package/dist/layout-painter/registry/modules.d.ts +6 -0
  290. package/dist/layout-painter/registry/modules.js +26 -0
  291. package/dist/layout-painter/registry/registry.d.ts +24 -0
  292. package/dist/layout-painter/registry/registry.js +53 -0
  293. package/dist/layout-painter/registry/types.d.ts +61 -0
  294. package/dist/layout-painter/registry/types.js +0 -0
  295. package/dist/layout-painter/renderFragment.d.ts +32 -0
  296. package/dist/layout-painter/renderFragment.js +114 -0
  297. package/dist/layout-painter/renderImage.d.ts +88 -0
  298. package/dist/layout-painter/renderImage.js +130 -0
  299. package/dist/layout-painter/renderPage.d.ts +264 -0
  300. package/dist/layout-painter/renderPage.js +1795 -0
  301. package/dist/layout-painter/renderParagraph.d.ts +93 -0
  302. package/dist/layout-painter/renderParagraph.js +1300 -0
  303. package/dist/layout-painter/renderTable.d.ts +36 -0
  304. package/dist/layout-painter/renderTable.js +432 -0
  305. package/dist/layout-painter/renderTextBox.d.ts +22 -0
  306. package/dist/layout-painter/renderTextBox.js +67 -0
  307. package/dist/layout-painter/renderUtils.d.ts +42 -0
  308. package/dist/layout-painter/renderUtils.js +30 -0
  309. package/dist/layout-painter/renderWatermark.d.ts +16 -0
  310. package/dist/layout-painter/renderWatermark.js +61 -0
  311. package/dist/layout-painter/sdtBoundary.d.ts +6 -0
  312. package/dist/layout-painter/sdtBoundary.js +28 -0
  313. package/dist/managers/ContextMenuManager.d.ts +28 -0
  314. package/dist/managers/ContextMenuManager.js +48 -0
  315. package/dist/managers/DocumentLoaderManager.d.ts +47 -0
  316. package/dist/managers/DocumentLoaderManager.js +69 -0
  317. package/dist/managers/EditorModeManager.d.ts +28 -0
  318. package/dist/managers/EditorModeManager.js +50 -0
  319. package/dist/managers/ErrorManager.d.ts +26 -0
  320. package/dist/managers/ErrorManager.js +85 -0
  321. package/dist/managers/FindReplaceManager.d.ts +54 -0
  322. package/dist/managers/FindReplaceManager.js +104 -0
  323. package/dist/managers/HistoryManager.d.ts +92 -0
  324. package/dist/managers/HistoryManager.js +193 -0
  325. package/dist/managers/Subscribable.d.ts +34 -0
  326. package/dist/managers/Subscribable.js +46 -0
  327. package/dist/managers/TableSelectionManager.d.ts +74 -0
  328. package/dist/managers/TableSelectionManager.js +225 -0
  329. package/dist/managers/editorShortcuts.d.ts +42 -0
  330. package/dist/managers/editorShortcuts.js +60 -0
  331. package/dist/managers/types.d.ts +41 -0
  332. package/dist/managers/types.js +0 -0
  333. package/dist/markdown/annotations.d.ts +14 -0
  334. package/dist/markdown/annotations.js +42 -0
  335. package/dist/markdown/escape.d.ts +36 -0
  336. package/dist/markdown/escape.js +59 -0
  337. package/dist/markdown/fromMarkdown.d.ts +11 -0
  338. package/dist/markdown/fromMarkdown.js +223 -0
  339. package/dist/markdown/headings.d.ts +13 -0
  340. package/dist/markdown/headings.js +20 -0
  341. package/dist/markdown/images.d.ts +13 -0
  342. package/dist/markdown/images.js +63 -0
  343. package/dist/markdown/index.d.ts +18 -0
  344. package/dist/markdown/index.js +33 -0
  345. package/dist/markdown/internals.d.ts +15 -0
  346. package/dist/markdown/internals.js +35 -0
  347. package/dist/markdown/renderBlock.d.ts +7 -0
  348. package/dist/markdown/renderBlock.js +68 -0
  349. package/dist/markdown/renderParagraph.d.ts +11 -0
  350. package/dist/markdown/renderParagraph.js +64 -0
  351. package/dist/markdown/renderRuns.d.ts +11 -0
  352. package/dist/markdown/renderRuns.js +265 -0
  353. package/dist/markdown/renderTable.d.ts +8 -0
  354. package/dist/markdown/renderTable.js +229 -0
  355. package/dist/markdown/trailers.d.ts +13 -0
  356. package/dist/markdown/trailers.js +54 -0
  357. package/dist/markdown/types.d.ts +118 -0
  358. package/dist/markdown/types.js +0 -0
  359. package/dist/model.d.ts +13 -0
  360. package/dist/model.js +4 -0
  361. package/dist/paged-layout/LayoutSelectionGate.d.ts +80 -0
  362. package/dist/paged-layout/LayoutSelectionGate.js +131 -0
  363. package/dist/paged-layout/headerFooterMargins.d.ts +73 -0
  364. package/dist/paged-layout/headerFooterMargins.js +120 -0
  365. package/dist/paged-layout/hiddenEditorScroll.d.ts +4 -0
  366. package/dist/paged-layout/hiddenEditorScroll.js +4 -0
  367. package/dist/paged-layout/incrementalMeasure.d.ts +33 -0
  368. package/dist/paged-layout/incrementalMeasure.js +56 -0
  369. package/dist/paged-layout/rangeProjection.d.ts +51 -0
  370. package/dist/paged-layout/rangeProjection.js +153 -0
  371. package/dist/paged-layout/readOnlyEditAttempt.d.ts +5 -0
  372. package/dist/paged-layout/readOnlyEditAttempt.js +22 -0
  373. package/dist/paged-layout/scrollNavigation.d.ts +23 -0
  374. package/dist/paged-layout/scrollNavigation.js +31 -0
  375. package/dist/paged-layout/scrollPageInfo.d.ts +41 -0
  376. package/dist/paged-layout/scrollPageInfo.js +34 -0
  377. package/dist/paged-layout/scrollToPmPosition.d.ts +17 -0
  378. package/dist/paged-layout/scrollToPmPosition.js +95 -0
  379. package/dist/paged-layout/sectionBlockWidths.d.ts +35 -0
  380. package/dist/paged-layout/sectionBlockWidths.js +52 -0
  381. package/dist/paged-layout/sectionGeometry.d.ts +21 -0
  382. package/dist/paged-layout/sectionGeometry.js +36 -0
  383. package/dist/paged-layout/selectionViewportRect.d.ts +29 -0
  384. package/dist/paged-layout/selectionViewportRect.js +55 -0
  385. package/dist/paged-layout/tableColumnResize.d.ts +19 -0
  386. package/dist/paged-layout/tableColumnResize.js +28 -0
  387. package/dist/paged-layout/tableInsertButtonGeometry.d.ts +15 -0
  388. package/dist/paged-layout/tableInsertButtonGeometry.js +15 -0
  389. package/dist/paged-layout/transactionDirtyRange.d.ts +7 -0
  390. package/dist/paged-layout/transactionDirtyRange.js +27 -0
  391. package/dist/paged-layout/zoomScrollAnchor.d.ts +40 -0
  392. package/dist/paged-layout/zoomScrollAnchor.js +25 -0
  393. package/dist/prosemirror/attrs/index.d.ts +80 -0
  394. package/dist/prosemirror/attrs/index.js +1218 -0
  395. package/dist/prosemirror/autospacingBase.d.ts +11 -0
  396. package/dist/prosemirror/autospacingBase.js +16 -0
  397. package/dist/prosemirror/commands/comments.d.ts +93 -0
  398. package/dist/prosemirror/commands/comments.js +435 -0
  399. package/dist/prosemirror/commands/contentControls.d.ts +45 -0
  400. package/dist/prosemirror/commands/contentControls.js +294 -0
  401. package/dist/prosemirror/commands/contentControlsBlockFill.d.ts +15 -0
  402. package/dist/prosemirror/commands/contentControlsBlockFill.js +19 -0
  403. package/dist/prosemirror/commands/formatPainter.d.ts +31 -0
  404. package/dist/prosemirror/commands/formatPainter.js +130 -0
  405. package/dist/prosemirror/commands/formatting.d.ts +32 -0
  406. package/dist/prosemirror/commands/formatting.js +45 -0
  407. package/dist/prosemirror/commands/hyperlink.d.ts +31 -0
  408. package/dist/prosemirror/commands/hyperlink.js +79 -0
  409. package/dist/prosemirror/commands/image.d.ts +59 -0
  410. package/dist/prosemirror/commands/image.js +219 -0
  411. package/dist/prosemirror/commands/index.d.ts +13 -0
  412. package/dist/prosemirror/commands/index.js +13 -0
  413. package/dist/prosemirror/commands/pageBreak.d.ts +10 -0
  414. package/dist/prosemirror/commands/pageBreak.js +47 -0
  415. package/dist/prosemirror/commands/paragraph.d.ts +39 -0
  416. package/dist/prosemirror/commands/paragraph.js +64 -0
  417. package/dist/prosemirror/commands/pastePlainText.d.ts +39 -0
  418. package/dist/prosemirror/commands/pastePlainText.js +67 -0
  419. package/dist/prosemirror/commands/table.d.ts +83 -0
  420. package/dist/prosemirror/commands/table.js +105 -0
  421. package/dist/prosemirror/conversion/fromProseDoc.d.ts +27 -0
  422. package/dist/prosemirror/conversion/fromProseDoc.js +1550 -0
  423. package/dist/prosemirror/conversion/index.d.ts +4 -0
  424. package/dist/prosemirror/conversion/index.js +4 -0
  425. package/dist/prosemirror/conversion/runShadingMark.d.ts +16 -0
  426. package/dist/prosemirror/conversion/runShadingMark.js +39 -0
  427. package/dist/prosemirror/conversion/toProseDoc.d.ts +39 -0
  428. package/dist/prosemirror/conversion/toProseDoc.js +1404 -0
  429. package/dist/prosemirror/extensions/ExtensionManager.d.ts +43 -0
  430. package/dist/prosemirror/extensions/ExtensionManager.js +86 -0
  431. package/dist/prosemirror/extensions/StarterKit.d.ts +16 -0
  432. package/dist/prosemirror/extensions/StarterKit.js +132 -0
  433. package/dist/prosemirror/extensions/core/DocExtension.d.ts +9 -0
  434. package/dist/prosemirror/extensions/core/DocExtension.js +12 -0
  435. package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +13 -0
  436. package/dist/prosemirror/extensions/core/HistoryExtension.js +28 -0
  437. package/dist/prosemirror/extensions/core/ParagraphExtension.d.ts +25 -0
  438. package/dist/prosemirror/extensions/core/ParagraphExtension.js +619 -0
  439. package/dist/prosemirror/extensions/core/TextExtension.d.ts +9 -0
  440. package/dist/prosemirror/extensions/core/TextExtension.js +12 -0
  441. package/dist/prosemirror/extensions/create.d.ts +17 -0
  442. package/dist/prosemirror/extensions/create.js +129 -0
  443. package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +23 -0
  444. package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +106 -0
  445. package/dist/prosemirror/extensions/features/BaseKeymapExtension.d.ts +8 -0
  446. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +172 -0
  447. package/dist/prosemirror/extensions/features/BidiShortcutExtension.d.ts +16 -0
  448. package/dist/prosemirror/extensions/features/BidiShortcutExtension.js +38 -0
  449. package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.d.ts +16 -0
  450. package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.js +21 -0
  451. package/dist/prosemirror/extensions/features/DropCursorExtension.d.ts +12 -0
  452. package/dist/prosemirror/extensions/features/DropCursorExtension.js +20 -0
  453. package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.d.ts +8 -0
  454. package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +44 -0
  455. package/dist/prosemirror/extensions/features/GapCursorExtension.d.ts +19 -0
  456. package/dist/prosemirror/extensions/features/GapCursorExtension.js +24 -0
  457. package/dist/prosemirror/extensions/features/ImageDragExtension.d.ts +15 -0
  458. package/dist/prosemirror/extensions/features/ImageDragExtension.js +66 -0
  459. package/dist/prosemirror/extensions/features/ImagePasteExtension.d.ts +12 -0
  460. package/dist/prosemirror/extensions/features/ImagePasteExtension.js +91 -0
  461. package/dist/prosemirror/extensions/features/ListExtension.d.ts +14 -0
  462. package/dist/prosemirror/extensions/features/ListExtension.js +340 -0
  463. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +9 -0
  464. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +60 -0
  465. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +35 -0
  466. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +188 -0
  467. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +20 -0
  468. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +34 -0
  469. package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.d.ts +20 -0
  470. package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.js +145 -0
  471. package/dist/prosemirror/extensions/features/SelectionTrackerExtension.d.ts +10 -0
  472. package/dist/prosemirror/extensions/features/SelectionTrackerExtension.js +17 -0
  473. package/dist/prosemirror/extensions/features/bidiShortcutController.d.ts +31 -0
  474. package/dist/prosemirror/extensions/features/bidiShortcutController.js +27 -0
  475. package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +31 -0
  476. package/dist/prosemirror/extensions/features/pasteCleanup.js +159 -0
  477. package/dist/prosemirror/extensions/marks/AllCapsExtension.d.ts +9 -0
  478. package/dist/prosemirror/extensions/marks/AllCapsExtension.js +24 -0
  479. package/dist/prosemirror/extensions/marks/BoldExtension.d.ts +9 -0
  480. package/dist/prosemirror/extensions/marks/BoldExtension.js +41 -0
  481. package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.d.ts +14 -0
  482. package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.js +64 -0
  483. package/dist/prosemirror/extensions/marks/CharacterStyleExtension.d.ts +23 -0
  484. package/dist/prosemirror/extensions/marks/CharacterStyleExtension.js +47 -0
  485. package/dist/prosemirror/extensions/marks/CommentExtension.d.ts +12 -0
  486. package/dist/prosemirror/extensions/marks/CommentExtension.js +38 -0
  487. package/dist/prosemirror/extensions/marks/FontFamilyExtension.d.ts +9 -0
  488. package/dist/prosemirror/extensions/marks/FontFamilyExtension.js +55 -0
  489. package/dist/prosemirror/extensions/marks/FontSizeExtension.d.ts +9 -0
  490. package/dist/prosemirror/extensions/marks/FontSizeExtension.js +47 -0
  491. package/dist/prosemirror/extensions/marks/FootnoteRefExtension.d.ts +11 -0
  492. package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +92 -0
  493. package/dist/prosemirror/extensions/marks/HiddenTextExtension.d.ts +23 -0
  494. package/dist/prosemirror/extensions/marks/HiddenTextExtension.js +35 -0
  495. package/dist/prosemirror/extensions/marks/HighlightExtension.d.ts +10 -0
  496. package/dist/prosemirror/extensions/marks/HighlightExtension.js +115 -0
  497. package/dist/prosemirror/extensions/marks/HyperlinkExtension.d.ts +13 -0
  498. package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +146 -0
  499. package/dist/prosemirror/extensions/marks/ItalicExtension.d.ts +9 -0
  500. package/dist/prosemirror/extensions/marks/ItalicExtension.js +34 -0
  501. package/dist/prosemirror/extensions/marks/RtlExtension.d.ts +6 -0
  502. package/dist/prosemirror/extensions/marks/RtlExtension.js +21 -0
  503. package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.d.ts +11 -0
  504. package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +75 -0
  505. package/dist/prosemirror/extensions/marks/RunShadingExtension.d.ts +6 -0
  506. package/dist/prosemirror/extensions/marks/RunShadingExtension.js +38 -0
  507. package/dist/prosemirror/extensions/marks/SmallCapsExtension.d.ts +9 -0
  508. package/dist/prosemirror/extensions/marks/SmallCapsExtension.js +24 -0
  509. package/dist/prosemirror/extensions/marks/StrikeExtension.d.ts +9 -0
  510. package/dist/prosemirror/extensions/marks/StrikeExtension.js +33 -0
  511. package/dist/prosemirror/extensions/marks/SubscriptExtension.d.ts +9 -0
  512. package/dist/prosemirror/extensions/marks/SubscriptExtension.js +25 -0
  513. package/dist/prosemirror/extensions/marks/SuperscriptExtension.d.ts +9 -0
  514. package/dist/prosemirror/extensions/marks/SuperscriptExtension.js +25 -0
  515. package/dist/prosemirror/extensions/marks/TextColorExtension.d.ts +9 -0
  516. package/dist/prosemirror/extensions/marks/TextColorExtension.js +50 -0
  517. package/dist/prosemirror/extensions/marks/TextEffectExtension.d.ts +6 -0
  518. package/dist/prosemirror/extensions/marks/TextEffectExtension.js +35 -0
  519. package/dist/prosemirror/extensions/marks/TextEffectsExtensions.d.ts +31 -0
  520. package/dist/prosemirror/extensions/marks/TextEffectsExtensions.js +134 -0
  521. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +22 -0
  522. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +113 -0
  523. package/dist/prosemirror/extensions/marks/UnderlineExtension.d.ts +9 -0
  524. package/dist/prosemirror/extensions/marks/UnderlineExtension.js +60 -0
  525. package/dist/prosemirror/extensions/marks/markUtils.d.ts +34 -0
  526. package/dist/prosemirror/extensions/marks/markUtils.js +233 -0
  527. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +22 -0
  528. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +122 -0
  529. package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +12 -0
  530. package/dist/prosemirror/extensions/nodes/FieldExtension.js +87 -0
  531. package/dist/prosemirror/extensions/nodes/HardBreakExtension.d.ts +9 -0
  532. package/dist/prosemirror/extensions/nodes/HardBreakExtension.js +38 -0
  533. package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.d.ts +9 -0
  534. package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.js +18 -0
  535. package/dist/prosemirror/extensions/nodes/ImageExtension.d.ts +9 -0
  536. package/dist/prosemirror/extensions/nodes/ImageExtension.js +132 -0
  537. package/dist/prosemirror/extensions/nodes/MathExtension.d.ts +13 -0
  538. package/dist/prosemirror/extensions/nodes/MathExtension.js +56 -0
  539. package/dist/prosemirror/extensions/nodes/PageBreakExtension.d.ts +9 -0
  540. package/dist/prosemirror/extensions/nodes/PageBreakExtension.js +20 -0
  541. package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +12 -0
  542. package/dist/prosemirror/extensions/nodes/SdtExtension.js +107 -0
  543. package/dist/prosemirror/extensions/nodes/ShapeExtension.d.ts +30 -0
  544. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +502 -0
  545. package/dist/prosemirror/extensions/nodes/TabExtension.d.ts +9 -0
  546. package/dist/prosemirror/extensions/nodes/TabExtension.js +27 -0
  547. package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +34 -0
  548. package/dist/prosemirror/extensions/nodes/TableExtension.js +1972 -0
  549. package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +34 -0
  550. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +150 -0
  551. package/dist/prosemirror/extensions/types.d.ts +101 -0
  552. package/dist/prosemirror/extensions/types.js +10 -0
  553. package/dist/prosemirror/findReplaceSelection.d.ts +23 -0
  554. package/dist/prosemirror/findReplaceSelection.js +86 -0
  555. package/dist/prosemirror/index.d.ts +25 -0
  556. package/dist/prosemirror/index.js +23 -0
  557. package/dist/prosemirror/insertOperations.d.ts +12 -0
  558. package/dist/prosemirror/insertOperations.js +19 -0
  559. package/dist/prosemirror/paragraphDirection.d.ts +42 -0
  560. package/dist/prosemirror/paragraphDirection.js +33 -0
  561. package/dist/prosemirror/plugins/aiCitationDecorations.d.ts +40 -0
  562. package/dist/prosemirror/plugins/aiCitationDecorations.js +90 -0
  563. package/dist/prosemirror/plugins/aiSuggestionDecorations.d.ts +42 -0
  564. package/dist/prosemirror/plugins/aiSuggestionDecorations.js +135 -0
  565. package/dist/prosemirror/plugins/anonymizationDecorations.d.ts +60 -0
  566. package/dist/prosemirror/plugins/anonymizationDecorations.js +120 -0
  567. package/dist/prosemirror/plugins/autocompleteSuggestion.d.ts +123 -0
  568. package/dist/prosemirror/plugins/autocompleteSuggestion.js +283 -0
  569. package/dist/prosemirror/plugins/contentControlWidgets.d.ts +56 -0
  570. package/dist/prosemirror/plugins/contentControlWidgets.js +192 -0
  571. package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +37 -0
  572. package/dist/prosemirror/plugins/createDocScanPlugin.js +55 -0
  573. package/dist/prosemirror/plugins/documentStyles.d.ts +18 -0
  574. package/dist/prosemirror/plugins/documentStyles.js +46 -0
  575. package/dist/prosemirror/plugins/index.d.ts +3 -0
  576. package/dist/prosemirror/plugins/index.js +3 -0
  577. package/dist/prosemirror/plugins/pmTextScan.d.ts +19 -0
  578. package/dist/prosemirror/plugins/pmTextScan.js +39 -0
  579. package/dist/prosemirror/plugins/selectionTracker.d.ts +43 -0
  580. package/dist/prosemirror/plugins/selectionTracker.js +179 -0
  581. package/dist/prosemirror/plugins/suggestionMode.d.ts +70 -0
  582. package/dist/prosemirror/plugins/suggestionMode.js +489 -0
  583. package/dist/prosemirror/plugins/templateDirectives.d.ts +25 -0
  584. package/dist/prosemirror/plugins/templateDirectives.js +67 -0
  585. package/dist/prosemirror/plugins/templatePreviewValues.d.ts +49 -0
  586. package/dist/prosemirror/plugins/templatePreviewValues.js +117 -0
  587. package/dist/prosemirror/plugins/templateSlashMenu.d.ts +57 -0
  588. package/dist/prosemirror/plugins/templateSlashMenu.js +184 -0
  589. package/dist/prosemirror/schema/index.d.ts +15 -0
  590. package/dist/prosemirror/schema/index.js +20 -0
  591. package/dist/prosemirror/schema/marks.d.ts +118 -0
  592. package/dist/prosemirror/schema/marks.js +0 -0
  593. package/dist/prosemirror/schema/nodes.d.ts +389 -0
  594. package/dist/prosemirror/schema/nodes.js +0 -0
  595. package/dist/prosemirror/selectionState.d.ts +23 -0
  596. package/dist/prosemirror/selectionState.js +111 -0
  597. package/dist/prosemirror/styles/index.d.ts +2 -0
  598. package/dist/prosemirror/styles/index.js +2 -0
  599. package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +32 -0
  600. package/dist/prosemirror/styles/resolvedStyleAttrs.js +108 -0
  601. package/dist/prosemirror/styles/styleResolver.d.ts +94 -0
  602. package/dist/prosemirror/styles/styleResolver.js +200 -0
  603. package/dist/prosemirror/utils/findParagraphByParaId.d.ts +26 -0
  604. package/dist/prosemirror/utils/findParagraphByParaId.js +37 -0
  605. package/dist/prosemirror/utils/tabCalculator.d.ts +110 -0
  606. package/dist/prosemirror/utils/tabCalculator.js +137 -0
  607. package/dist/prosemirror/validation.d.ts +20 -0
  608. package/dist/prosemirror/validation.js +177 -0
  609. package/dist/server.d.ts +7 -0
  610. package/dist/server.js +6 -0
  611. package/dist/style-engine/index.d.ts +3 -0
  612. package/dist/style-engine/index.js +2 -0
  613. package/dist/style-engine/styleEngine.d.ts +67 -0
  614. package/dist/style-engine/styleEngine.js +70 -0
  615. package/dist/types/block-id.d.ts +58 -0
  616. package/dist/types/block-id.js +61 -0
  617. package/dist/types/colors.d.ts +2 -0
  618. package/dist/types/colors.js +0 -0
  619. package/dist/types/content.d.ts +2 -0
  620. package/dist/types/content.js +0 -0
  621. package/dist/types/document.d.ts +7 -0
  622. package/dist/types/document.js +0 -0
  623. package/dist/types/documentEnumValues.d.ts +89 -0
  624. package/dist/types/documentEnumValues.js +693 -0
  625. package/dist/types/formatting.d.ts +2 -0
  626. package/dist/types/formatting.js +0 -0
  627. package/dist/types/index.d.ts +107 -0
  628. package/dist/types/index.js +0 -0
  629. package/dist/utils/authorColors.d.ts +16 -0
  630. package/dist/utils/authorColors.js +30 -0
  631. package/dist/utils/baseDirection.d.ts +23 -0
  632. package/dist/utils/baseDirection.js +34 -0
  633. package/dist/utils/clipboard.d.ts +126 -0
  634. package/dist/utils/clipboard.js +622 -0
  635. package/dist/utils/colorResolver.d.ts +158 -0
  636. package/dist/utils/colorResolver.js +557 -0
  637. package/dist/utils/createDocument.d.ts +50 -0
  638. package/dist/utils/createDocument.js +262 -0
  639. package/dist/utils/documentLoaderBehavior.d.ts +22 -0
  640. package/dist/utils/documentLoaderBehavior.js +14 -0
  641. package/dist/utils/docxInput.d.ts +22 -0
  642. package/dist/utils/docxInput.js +16 -0
  643. package/dist/utils/domGuards.d.ts +59 -0
  644. package/dist/utils/domGuards.js +82 -0
  645. package/dist/utils/fontFamilyMerge.d.ts +7 -0
  646. package/dist/utils/fontFamilyMerge.js +31 -0
  647. package/dist/utils/fontLoader.d.ts +50 -0
  648. package/dist/utils/fontLoader.js +177 -0
  649. package/dist/utils/fontResolver.d.ts +61 -0
  650. package/dist/utils/fontResolver.js +651 -0
  651. package/dist/utils/fontWeights.d.ts +4 -0
  652. package/dist/utils/fontWeights.js +4 -0
  653. package/dist/utils/formatToStyle.d.ts +103 -0
  654. package/dist/utils/formatToStyle.js +289 -0
  655. package/dist/utils/headerFooter.d.ts +74 -0
  656. package/dist/utils/headerFooter.js +257 -0
  657. package/dist/utils/headingCollector.d.ts +22 -0
  658. package/dist/utils/headingCollector.js +36 -0
  659. package/dist/utils/hexId.d.ts +33 -0
  660. package/dist/utils/hexId.js +37 -0
  661. package/dist/utils/imageValidation.d.ts +5 -0
  662. package/dist/utils/imageValidation.js +31 -0
  663. package/dist/utils/paragraphFormattingMerge.d.ts +14 -0
  664. package/dist/utils/paragraphFormattingMerge.js +68 -0
  665. package/dist/utils/replaceText.d.ts +17 -0
  666. package/dist/utils/replaceText.js +161 -0
  667. package/dist/utils/rotationBoundingBox.d.ts +12 -0
  668. package/dist/utils/rotationBoundingBox.js +36 -0
  669. package/dist/utils/scriptSegments.d.ts +36 -0
  670. package/dist/utils/scriptSegments.js +52 -0
  671. package/dist/utils/tableOperations.d.ts +87 -0
  672. package/dist/utils/tableOperations.js +259 -0
  673. package/dist/utils/textFormattingMerge.d.ts +6 -0
  674. package/dist/utils/textFormattingMerge.js +31 -0
  675. package/dist/utils/tiffConverter.d.ts +18 -0
  676. package/dist/utils/tiffConverter.js +83 -0
  677. package/dist/utils/units.d.ts +99 -0
  678. package/dist/utils/units.js +139 -0
  679. package/dist/utils/urlSecurity.d.ts +7 -0
  680. package/dist/utils/urlSecurity.js +65 -0
  681. package/dist/watermark/index.d.ts +39 -0
  682. package/dist/watermark/index.js +149 -0
  683. package/package.json +122 -2
@@ -0,0 +1,1309 @@
1
+ import { NUMBER_FORMAT_VALUES } from "../../types/documentEnumValues.js";
2
+ import { halfPointsToPixels, halfPointsToPoints, pointsToPixels } from "../../utils/units.js";
3
+ import { padDecimal } from "../../docx/numberingParser.js";
4
+ import { DEFAULT_TEXTBOX_MARGINS } from "../../layout-engine/types.js";
5
+ import { resolveColor, resolveHighlightToCss } from "../../utils/colorResolver.js";
6
+ import { resolveShadingFill } from "../../utils/formatToStyle.js";
7
+ import { convertBulletToUnicode } from "../../docx/bulletMarkers.js";
8
+ import { directionIsRtl } from "../../prosemirror/paragraphDirection.js";
9
+ import { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs } from "../../prosemirror/attrs/index.js";
10
+ import { autospacingMatchesBase } from "../../prosemirror/autospacingBase.js";
11
+ import { runShadingAttrsToShading } from "../../prosemirror/conversion/runShadingMark.js";
12
+ import { assertValidProseMirrorDocument } from "../../prosemirror/validation.js";
13
+ //#region src/layout-bridge/convert/toFlowBlocks.ts
14
+ const DEFAULT_FONT = "Calibri";
15
+ const DEFAULT_TABLE_CELL_MARGIN_TWIPS = {
16
+ top: 0,
17
+ right: 108,
18
+ bottom: 0,
19
+ left: 108
20
+ };
21
+ const DEFAULT_BLACK_TEXT_COLOR_VALUES = /* @__PURE__ */ new Set(["000000", "000"]);
22
+ function normalizeResolvedTextColor(color) {
23
+ return color.trim().toLowerCase().replace(/^#/u, "");
24
+ }
25
+ function isDefaultBlackResolvedTextColor(color) {
26
+ return DEFAULT_BLACK_TEXT_COLOR_VALUES.has(normalizeResolvedTextColor(color));
27
+ }
28
+ function areResolvedTextColorsEqual(left, right) {
29
+ return normalizeResolvedTextColor(left) === normalizeResolvedTextColor(right);
30
+ }
31
+ /**
32
+ * Constrain image dimensions to fit within the page content area.
33
+ * Scales proportionally if height exceeds pageContentHeight.
34
+ */
35
+ function constrainImageToPage(width, height, pageContentHeight) {
36
+ if (!pageContentHeight || height <= pageContentHeight) return {
37
+ width,
38
+ height
39
+ };
40
+ const scale = pageContentHeight / height;
41
+ return {
42
+ width: Math.round(width * scale),
43
+ height: pageContentHeight
44
+ };
45
+ }
46
+ const DEFAULT_SIZE = 11;
47
+ /**
48
+ * Convert twips to pixels (1 twip = 1/1440 inch, 1 inch = 96 CSS px).
49
+ * No rounding — precision prevents cumulative layout drift across paragraphs.
50
+ */
51
+ function twipsToPixels(twips) {
52
+ return twips / 1440 * 96;
53
+ }
54
+ /**
55
+ * Generate a unique block ID.
56
+ */
57
+ let blockIdCounter = 0;
58
+ function nextBlockId() {
59
+ return `block-${++blockIdCounter}`;
60
+ }
61
+ function formatNumberedMarker(counters, level) {
62
+ const parts = [];
63
+ for (let i = 0; i <= level; i += 1) {
64
+ const value = counters[i] ?? 0;
65
+ if (value <= 0) break;
66
+ parts.push(value);
67
+ }
68
+ if (parts.length === 0) return "1.";
69
+ return `${parts.join(".")}.`;
70
+ }
71
+ const ROMAN_PAIRS = [
72
+ [1e3, "M"],
73
+ [900, "CM"],
74
+ [500, "D"],
75
+ [400, "CD"],
76
+ [100, "C"],
77
+ [90, "XC"],
78
+ [50, "L"],
79
+ [40, "XL"],
80
+ [10, "X"],
81
+ [9, "IX"],
82
+ [5, "V"],
83
+ [4, "IV"],
84
+ [1, "I"]
85
+ ];
86
+ function toRoman(value, upper) {
87
+ if (value <= 0) return "";
88
+ let remaining = value;
89
+ let output = "";
90
+ for (const [number, symbol] of ROMAN_PAIRS) while (remaining >= number) {
91
+ output += symbol;
92
+ remaining -= number;
93
+ }
94
+ return upper ? output : output.toLowerCase();
95
+ }
96
+ function toLetter(value, upper) {
97
+ if (value <= 0) return "";
98
+ const zeroBased = value - 1;
99
+ const baseCodePoint = upper ? 65 : 97;
100
+ return String.fromCodePoint(baseCodePoint + zeroBased % 26).repeat(Math.floor(zeroBased / 26) + 1);
101
+ }
102
+ function formatCounter(value, format) {
103
+ if (value <= 0) return "";
104
+ switch (format) {
105
+ case "upperRoman": return toRoman(value, true);
106
+ case "lowerRoman": return toRoman(value, false);
107
+ case "upperLetter": return toLetter(value, true);
108
+ case "lowerLetter": return toLetter(value, false);
109
+ case "decimalZero": return padDecimal(value, 2);
110
+ case "decimalZero3": return padDecimal(value, 3);
111
+ case "decimalZero4": return padDecimal(value, 4);
112
+ case "decimalZero5": return padDecimal(value, 5);
113
+ case "none": return "";
114
+ default: return String(value);
115
+ }
116
+ }
117
+ function resolveListTemplate(template, counters, levelFormats, forceDecimal = false) {
118
+ return template.replace(/%(?<digit>\d)(?<punct>[.):\]])?/gu, (...args) => {
119
+ const { digit, punct = "" } = args.at(-1);
120
+ const index = Number.parseInt(digit, 10) - 1;
121
+ if (index < 0) return "";
122
+ const formatted = formatCounter(counters[index] ?? 0, forceDecimal ? "decimal" : levelFormats?.[index]);
123
+ return formatted ? `${formatted}${punct}` : "";
124
+ });
125
+ }
126
+ function getLastListCounters(listCounters) {
127
+ let lastCounters;
128
+ for (const counters of listCounters.values()) lastCounters = counters;
129
+ return lastCounters;
130
+ }
131
+ function applyMarkerAllCaps(marker, allCaps) {
132
+ if (marker === null || !allCaps) return marker;
133
+ return marker.toLocaleUpperCase();
134
+ }
135
+ function computeListMarker(pmAttrs, listCounters, abstractCounters, seenNumIds) {
136
+ const numId = pmAttrs.numPr?.numId;
137
+ if (numId === void 0 || numId === 0) {
138
+ if (pmAttrs.listMarker?.includes("%") && !pmAttrs.listIsBullet) {
139
+ const counters = getLastListCounters(listCounters);
140
+ if (counters) return resolveListTemplate(pmAttrs.listMarker, counters, pmAttrs.listLevelNumFmts, pmAttrs.listIsLegal);
141
+ }
142
+ return null;
143
+ }
144
+ if (pmAttrs.listIsBullet) return convertBulletToUnicode(pmAttrs.listMarker || "");
145
+ const level = pmAttrs.numPr?.ilvl ?? 0;
146
+ const counters = listCounters.get(numId) ?? Array.from({ length: 9 }, () => 0);
147
+ const abstractNumId = pmAttrs.listAbstractNumId;
148
+ if (abstractNumId !== void 0 && level > 0) {
149
+ const latestAbstractCounters = abstractCounters.get(abstractNumId);
150
+ const missingParentCounters = counters.slice(0, level).every((value) => value === 0);
151
+ if (latestAbstractCounters && missingParentCounters) for (let i = 0; i < level; i += 1) counters[i] = latestAbstractCounters[i] ?? 0;
152
+ }
153
+ const seenKey = `${numId}:${level}`;
154
+ if (!seenNumIds.has(seenKey)) {
155
+ seenNumIds.add(seenKey);
156
+ if (pmAttrs.listStartOverride != null) counters[level] = pmAttrs.listStartOverride - 1;
157
+ }
158
+ counters[level] = (counters[level] ?? 0) + 1;
159
+ for (let i = level + 1; i < counters.length; i += 1) counters[i] = 0;
160
+ const childAdvances = pmAttrs.listImplicitChildLevelAdvances ?? 0;
161
+ if (childAdvances > 0 && level + 1 < counters.length) counters[level + 1] = (counters[level + 1] ?? 0) + childAdvances;
162
+ listCounters.set(numId, counters);
163
+ if (abstractNumId !== void 0) abstractCounters.set(abstractNumId, [...counters]);
164
+ const levelFormats = pmAttrs.listLevelNumFmts ?? (pmAttrs.listNumFmt ? [pmAttrs.listNumFmt] : void 0);
165
+ if (pmAttrs.listMarker && pmAttrs.listMarker.includes("%")) return resolveListTemplate(pmAttrs.listMarker, counters, levelFormats, pmAttrs.listIsLegal);
166
+ if (pmAttrs.listMarker) return pmAttrs.listMarker;
167
+ if ((levelFormats?.[level] ?? pmAttrs.listNumFmt) === "none" || pmAttrs.listMarker === "") return null;
168
+ return formatNumberedMarker(counters, level);
169
+ }
170
+ /**
171
+ * Reset the block ID counter (useful for testing).
172
+ */
173
+ function resetBlockIdCounter() {
174
+ blockIdCounter = 0;
175
+ }
176
+ /**
177
+ * Extract run formatting from ProseMirror marks.
178
+ */
179
+ function extractRunFormatting(marks, theme) {
180
+ const formatting = {};
181
+ let hasNoteRef = false;
182
+ for (const mark of marks) switch (mark.type.name) {
183
+ case "bold":
184
+ formatting.bold = true;
185
+ break;
186
+ case "italic":
187
+ formatting.italic = true;
188
+ break;
189
+ case "underline": {
190
+ const attrs = expectUnderlineMarkAttrs(mark);
191
+ if (attrs.style || attrs.color) {
192
+ const underlineObj = {};
193
+ if (attrs.style) underlineObj.style = attrs.style;
194
+ if (attrs.color) underlineObj.color = resolveColor(attrs.color, theme);
195
+ formatting.underline = underlineObj;
196
+ } else formatting.underline = true;
197
+ break;
198
+ }
199
+ case "strike":
200
+ formatting.strike = true;
201
+ break;
202
+ case "textColor": {
203
+ const attrs = expectTextColorMarkAttrs(mark);
204
+ if (attrs.themeColor || attrs.rgb) {
205
+ const colorArg = {};
206
+ if (attrs.rgb) colorArg.rgb = attrs.rgb;
207
+ if (attrs.themeColor) colorArg.themeColor = attrs.themeColor;
208
+ if (attrs.themeTint) colorArg.themeTint = attrs.themeTint;
209
+ if (attrs.themeShade) colorArg.themeShade = attrs.themeShade;
210
+ if (!isAutomaticTextColorValue(colorArg)) {
211
+ formatting.color = resolveColor(colorArg, theme);
212
+ formatting.textColorSource = "direct";
213
+ }
214
+ }
215
+ break;
216
+ }
217
+ case "highlight":
218
+ formatting.highlight = resolveHighlightToCss(expectHighlightMarkAttrs(mark).color);
219
+ break;
220
+ case "runShading": {
221
+ const shadingCss = resolveShadingFill(runShadingAttrsToShading(expectRunShadingMarkAttrs(mark)), theme);
222
+ if (shadingCss) formatting.shading = shadingCss;
223
+ break;
224
+ }
225
+ case "fontSize":
226
+ formatting.fontSize = expectFontSizeMarkAttrs(mark).size / 2;
227
+ break;
228
+ case "fontFamily": {
229
+ const attrs = expectFontFamilyMarkAttrs(mark);
230
+ const font = attrs.ascii || attrs.hAnsi;
231
+ if (font) formatting.fontFamily = font;
232
+ if (attrs.eastAsia) formatting.eastAsiaFontFamily = attrs.eastAsia;
233
+ break;
234
+ }
235
+ case "characterSpacing": {
236
+ const attrs = expectCharacterSpacingMarkAttrs(mark);
237
+ if (attrs.spacing !== void 0 && attrs.spacing !== 0) formatting.letterSpacing = twipsToPixels(attrs.spacing);
238
+ if (attrs.position !== void 0 && attrs.position !== 0) formatting.positionPx = halfPointsToPixels(attrs.position);
239
+ if (attrs.scale !== void 0 && attrs.scale !== 100) formatting.horizontalScale = attrs.scale;
240
+ if (attrs.kerning !== void 0 && attrs.kerning > 0) formatting.kerningMinPt = halfPointsToPoints(attrs.kerning);
241
+ break;
242
+ }
243
+ case "allCaps":
244
+ formatting.allCaps = true;
245
+ break;
246
+ case "smallCaps":
247
+ formatting.smallCaps = true;
248
+ break;
249
+ case "emboss":
250
+ formatting.emboss = true;
251
+ break;
252
+ case "imprint":
253
+ formatting.imprint = true;
254
+ break;
255
+ case "hidden":
256
+ formatting.hidden = true;
257
+ break;
258
+ case "textShadow":
259
+ formatting.textShadow = true;
260
+ break;
261
+ case "textOutline":
262
+ formatting.textOutline = true;
263
+ break;
264
+ case "rtl":
265
+ formatting.rtl = true;
266
+ break;
267
+ case "textEffect":
268
+ formatting.textEffect = expectTextEffectMarkAttrs(mark).effect;
269
+ break;
270
+ case "runFormattingOverride":
271
+ applyRunFormattingOverrides(formatting, expectRunFormattingOverrideMarkAttrs(mark));
272
+ break;
273
+ case "emphasisMark":
274
+ formatting.emphasisMark = expectEmphasisMarkAttrs(mark).type ?? "dot";
275
+ break;
276
+ case "superscript":
277
+ formatting.superscript = true;
278
+ break;
279
+ case "subscript":
280
+ formatting.subscript = true;
281
+ break;
282
+ case "hyperlink": {
283
+ const attrs = expectHyperlinkMarkAttrs(mark);
284
+ const link = { href: attrs.href };
285
+ if (attrs.tooltip !== void 0) link.tooltip = attrs.tooltip;
286
+ formatting.hyperlink = link;
287
+ break;
288
+ }
289
+ case "footnoteRef": {
290
+ hasNoteRef = true;
291
+ const attrs = expectFootnoteRefMarkAttrs(mark);
292
+ if (attrs.vertAlign === "superscript") formatting.superscript = true;
293
+ const id = typeof attrs.id === "string" ? Number.parseInt(attrs.id, 10) : attrs.id;
294
+ if (attrs.noteType === "endnote") formatting.endnoteRefId = id;
295
+ else formatting.footnoteRefId = id;
296
+ break;
297
+ }
298
+ case "comment": {
299
+ const commentId = expectCommentMarkAttrs(mark).commentId;
300
+ if (commentId) {
301
+ if (!formatting.commentIds) formatting.commentIds = [];
302
+ formatting.commentIds.push(commentId);
303
+ }
304
+ break;
305
+ }
306
+ case "insertion": {
307
+ const attrs = expectTrackedChangeMarkAttrs(mark);
308
+ formatting.isInsertion = true;
309
+ formatting.changeAuthor = attrs.author;
310
+ if (attrs.date !== void 0) formatting.changeDate = attrs.date;
311
+ formatting.changeRevisionId = attrs.revisionId;
312
+ break;
313
+ }
314
+ case "deletion": {
315
+ const attrs = expectTrackedChangeMarkAttrs(mark);
316
+ formatting.isDeletion = true;
317
+ formatting.changeAuthor = attrs.author;
318
+ if (attrs.date !== void 0) formatting.changeDate = attrs.date;
319
+ formatting.changeRevisionId = attrs.revisionId;
320
+ break;
321
+ }
322
+ default: break;
323
+ }
324
+ if (hasNoteRef && formatting.subscript) delete formatting.superscript;
325
+ return formatting;
326
+ }
327
+ function isAutomaticTextColorValue(color) {
328
+ const rgb = color.rgb?.trim().toLowerCase();
329
+ return color.auto === true || rgb === "auto" || !rgb && !color.themeColor;
330
+ }
331
+ function markDefaultBlackTextColorSource(formatting, paraDefaults) {
332
+ if (formatting.textColorSource === "direct" || formatting.color === void 0 || paraDefaults.color === void 0 || !isDefaultBlackResolvedTextColor(formatting.color) || !areResolvedTextColorsEqual(formatting.color, paraDefaults.color)) return formatting;
333
+ return {
334
+ ...formatting,
335
+ textColorSource: "paragraphDefault"
336
+ };
337
+ }
338
+ function mergeRunFormatting(paraDefaults, formatting) {
339
+ return {
340
+ ...paraDefaults,
341
+ ...markDefaultBlackTextColorSource(formatting, paraDefaults)
342
+ };
343
+ }
344
+ function applyRunFormattingOverrides(formatting, attrs) {
345
+ if (attrs.bold === false) formatting.bold = false;
346
+ if (attrs.italic === false) formatting.italic = false;
347
+ if (attrs.underline === "none") formatting.underline = false;
348
+ if (attrs.strike === false) formatting.strike = false;
349
+ if (attrs.allCaps === false) formatting.allCaps = false;
350
+ if (attrs.smallCaps === false) formatting.smallCaps = false;
351
+ if (attrs.emboss === false) formatting.emboss = false;
352
+ if (attrs.imprint === false) formatting.imprint = false;
353
+ if (attrs.shadow === false) formatting.textShadow = false;
354
+ if (attrs.outline === false) formatting.textOutline = false;
355
+ if (attrs.rtl === false) formatting.rtl = false;
356
+ }
357
+ function paragraphRunDefaults(pmAttrs, theme) {
358
+ const defaultTextFormatting = pmAttrs.defaultTextFormatting;
359
+ if (!defaultTextFormatting) return {};
360
+ const result = {};
361
+ const fontFamily = defaultTextFormatting.fontFamily?.ascii ?? defaultTextFormatting.fontFamily?.hAnsi;
362
+ if (fontFamily) result.fontFamily = fontFamily;
363
+ if (defaultTextFormatting.fontFamily?.eastAsia) result.eastAsiaFontFamily = defaultTextFormatting.fontFamily.eastAsia;
364
+ if (defaultTextFormatting.fontSize !== void 0) result.fontSize = defaultTextFormatting.fontSize / 2;
365
+ if (defaultTextFormatting.bold !== void 0) result.bold = defaultTextFormatting.bold;
366
+ if (defaultTextFormatting.italic !== void 0) result.italic = defaultTextFormatting.italic;
367
+ if (defaultTextFormatting.underline && defaultTextFormatting.underline.style !== "none") {
368
+ result.underline = { style: defaultTextFormatting.underline.style };
369
+ if (defaultTextFormatting.underline.color) result.underline.color = resolveColor(defaultTextFormatting.underline.color, theme);
370
+ }
371
+ if (defaultTextFormatting.strike !== void 0) result.strike = defaultTextFormatting.strike;
372
+ if (defaultTextFormatting.color && !isAutomaticTextColorValue(defaultTextFormatting.color)) {
373
+ result.color = resolveColor(defaultTextFormatting.color, theme);
374
+ result.textColorSource = "paragraphDefault";
375
+ }
376
+ if (defaultTextFormatting.highlight) {
377
+ const highlight = resolveHighlightToCss(defaultTextFormatting.highlight);
378
+ if (highlight) result.highlight = highlight;
379
+ }
380
+ if (defaultTextFormatting.vertAlign === "superscript") result.superscript = true;
381
+ if (defaultTextFormatting.vertAlign === "subscript") result.subscript = true;
382
+ if (defaultTextFormatting.allCaps !== void 0) result.allCaps = defaultTextFormatting.allCaps;
383
+ if (defaultTextFormatting.smallCaps !== void 0) result.smallCaps = defaultTextFormatting.smallCaps;
384
+ if (defaultTextFormatting.spacing !== void 0 && defaultTextFormatting.spacing !== 0) result.letterSpacing = twipsToPixels(defaultTextFormatting.spacing);
385
+ if (defaultTextFormatting.position !== void 0 && defaultTextFormatting.position !== 0) result.positionPx = halfPointsToPixels(defaultTextFormatting.position);
386
+ if (defaultTextFormatting.scale !== void 0 && defaultTextFormatting.scale !== 100) result.horizontalScale = defaultTextFormatting.scale;
387
+ if (defaultTextFormatting.kerning !== void 0 && defaultTextFormatting.kerning > 0) result.kerningMinPt = halfPointsToPoints(defaultTextFormatting.kerning);
388
+ if (defaultTextFormatting.emboss !== void 0) result.emboss = defaultTextFormatting.emboss;
389
+ if (defaultTextFormatting.imprint !== void 0) result.imprint = defaultTextFormatting.imprint;
390
+ if (defaultTextFormatting.shadow !== void 0) result.textShadow = defaultTextFormatting.shadow;
391
+ if (defaultTextFormatting.outline !== void 0) result.textOutline = defaultTextFormatting.outline;
392
+ if (defaultTextFormatting.emphasisMark && defaultTextFormatting.emphasisMark !== "none") result.emphasisMark = defaultTextFormatting.emphasisMark;
393
+ return result;
394
+ }
395
+ /**
396
+ * Build an ImageRun from ProseMirror node attrs, applying conditional property assignment
397
+ * to satisfy exactOptionalPropertyTypes.
398
+ */
399
+ function buildImageRun(attrs, constrained, pmStart, pmEnd, trackedChange) {
400
+ const run = {
401
+ kind: "image",
402
+ src: attrs.src,
403
+ width: constrained.width,
404
+ height: constrained.height,
405
+ pmStart,
406
+ pmEnd
407
+ };
408
+ if (attrs.alt !== void 0) run.alt = attrs.alt;
409
+ if (attrs.transform !== void 0) run.transform = attrs.transform;
410
+ if (attrs.opacity != null) run.opacity = attrs.opacity;
411
+ if (attrs.wrapType !== void 0) run.wrapType = attrs.wrapType;
412
+ if (attrs.displayMode !== void 0) run.displayMode = attrs.displayMode;
413
+ if (attrs.cssFloat !== void 0) run.cssFloat = attrs.cssFloat;
414
+ if (attrs.distTop !== void 0) run.distTop = attrs.distTop;
415
+ if (attrs.distBottom !== void 0) run.distBottom = attrs.distBottom;
416
+ if (attrs.distLeft !== void 0) run.distLeft = attrs.distLeft;
417
+ if (attrs.distRight !== void 0) run.distRight = attrs.distRight;
418
+ if (attrs.cropTop != null) run.cropTop = attrs.cropTop;
419
+ if (attrs.cropRight != null) run.cropRight = attrs.cropRight;
420
+ if (attrs.cropBottom != null) run.cropBottom = attrs.cropBottom;
421
+ if (attrs.cropLeft != null) run.cropLeft = attrs.cropLeft;
422
+ if (attrs.position !== void 0) run.position = attrs.position;
423
+ if (trackedChange?.isInsertion) run.isInsertion = true;
424
+ if (trackedChange?.isDeletion) run.isDeletion = true;
425
+ if (trackedChange?.changeAuthor !== void 0) run.changeAuthor = trackedChange.changeAuthor;
426
+ if (trackedChange?.changeDate !== void 0) run.changeDate = trackedChange.changeDate;
427
+ if (trackedChange?.changeRevisionId !== void 0) run.changeRevisionId = trackedChange.changeRevisionId;
428
+ return run;
429
+ }
430
+ /**
431
+ * Paragraph styleId pattern used by Word for TOC entries (TOC, TOC1, TOC2, …).
432
+ * Hyperlinks inside these paragraphs must render in the paragraph's own colour,
433
+ * not the Hyperlink character style — see {@link stripTocHyperlinkStyle}.
434
+ */
435
+ const TOC_STYLE_ID = /^TOC\d*$/iu;
436
+ /**
437
+ * In TOC paragraphs, strip the resolved Hyperlink character-style colour and
438
+ * underline so the painter's link fallback doesn't fire. The PM doc keeps the
439
+ * original marks so copy/paste out of a TOC still carries the Hyperlink
440
+ * styling like Word does. Applies to both text and field runs — a TOC entry's
441
+ * page number is a PAGEREF field inside the entry's hyperlink.
442
+ *
443
+ * Mutates `formatting` in place; cheaper than re-cloning per run.
444
+ */
445
+ function stripTocHyperlinkStyle(formatting) {
446
+ if (!formatting.hyperlink) return;
447
+ formatting.hyperlink = {
448
+ ...formatting.hyperlink,
449
+ noDefaultStyle: true
450
+ };
451
+ delete formatting.color;
452
+ delete formatting.underline;
453
+ }
454
+ /**
455
+ * Convert a paragraph node to runs.
456
+ */
457
+ function paragraphToRuns(node, startPos, _options) {
458
+ const runs = [];
459
+ const offset = startPos + 1;
460
+ const theme = _options.theme;
461
+ const pmAttrs = expectParagraphAttrs(node);
462
+ const paraDefaults = paragraphRunDefaults(pmAttrs, theme);
463
+ const paragraphStyleId = pmAttrs.styleId;
464
+ const inTocParagraph = typeof paragraphStyleId === "string" && TOC_STYLE_ID.test(paragraphStyleId);
465
+ function pushRunsForChild(child, childPos) {
466
+ if (child.isText && child.text) {
467
+ const formatting = extractRunFormatting(child.marks, theme);
468
+ if (inTocParagraph) stripTocHyperlinkStyle(formatting);
469
+ const run = {
470
+ kind: "text",
471
+ text: child.text,
472
+ ...mergeRunFormatting(paraDefaults, formatting),
473
+ pmStart: childPos,
474
+ pmEnd: childPos + child.nodeSize
475
+ };
476
+ runs.push(run);
477
+ return;
478
+ }
479
+ if (child.type.name === "hardBreak") {
480
+ runs.push({
481
+ kind: "lineBreak",
482
+ pmStart: childPos,
483
+ pmEnd: childPos + child.nodeSize
484
+ });
485
+ return;
486
+ }
487
+ if (child.type.name === "tab") {
488
+ const run = {
489
+ kind: "tab",
490
+ ...mergeRunFormatting(paraDefaults, extractRunFormatting(child.marks, theme)),
491
+ pmStart: childPos,
492
+ pmEnd: childPos + child.nodeSize
493
+ };
494
+ runs.push(run);
495
+ return;
496
+ }
497
+ if (child.type.name === "image") {
498
+ const attrs = expectImageAttrs(child);
499
+ const constrained = constrainImageToPage(attrs.width || 100, attrs.height || 100, _options.pageContentHeight);
500
+ const trackedFmt = extractRunFormatting(child.marks, theme);
501
+ const run = buildImageRun(attrs, constrained, childPos, childPos + child.nodeSize, trackedFmt);
502
+ runs.push(run);
503
+ return;
504
+ }
505
+ if (child.type.name === "field") {
506
+ const attrs = expectFieldAttrs(child);
507
+ const ft = attrs.fieldType;
508
+ let mappedType = "OTHER";
509
+ if (ft === "PAGE") mappedType = "PAGE";
510
+ else if (ft === "NUMPAGES") mappedType = "NUMPAGES";
511
+ else if (ft === "DATE") mappedType = "DATE";
512
+ else if (ft === "TIME") mappedType = "TIME";
513
+ const extractedFieldFormatting = extractRunFormatting(child.marks, theme);
514
+ if (inTocParagraph) stripTocHyperlinkStyle(extractedFieldFormatting);
515
+ const fieldFormatting = markDefaultBlackTextColorSource(extractedFieldFormatting, paraDefaults);
516
+ const run = {
517
+ kind: "field",
518
+ fieldType: mappedType,
519
+ instruction: attrs.instruction,
520
+ fallback: attrs.displayText || "",
521
+ ...attrs.fldLock ? { fldLock: true } : {},
522
+ pmStart: childPos,
523
+ pmEnd: childPos + child.nodeSize,
524
+ ...fieldFormatting
525
+ };
526
+ runs.push(run);
527
+ return;
528
+ }
529
+ if (child.type.name === "math") {
530
+ const attrs = expectMathAttrs(child);
531
+ const plainText = attrs.plainText || "[equation]";
532
+ runs.push({
533
+ kind: "math",
534
+ display: attrs.display ?? "inline",
535
+ ommlXml: attrs.ommlXml,
536
+ plainText,
537
+ italic: true,
538
+ fontFamily: "Cambria Math",
539
+ pmStart: childPos,
540
+ pmEnd: childPos + child.nodeSize
541
+ });
542
+ return;
543
+ }
544
+ if (child.type.name === "sdt") {
545
+ const sdtInnerOffset = childPos + 1;
546
+ child.forEach((sdtChild, sdtChildOffset) => {
547
+ pushRunsForChild(sdtChild, sdtInnerOffset + sdtChildOffset);
548
+ });
549
+ }
550
+ }
551
+ node.forEach((child, childOffset) => {
552
+ pushRunsForChild(child, offset + childOffset);
553
+ });
554
+ return runs;
555
+ }
556
+ function toListMarkerRevision(kind, info) {
557
+ const revision = { kind };
558
+ if (typeof info?.author === "string") revision.author = info.author;
559
+ if (typeof info?.date === "string") revision.date = info.date;
560
+ if (typeof info?.id === "number") revision.revisionId = info.id;
561
+ return revision;
562
+ }
563
+ function isAddedNumberingChange(change) {
564
+ const previousFormatting = change.previousFormatting;
565
+ return previousFormatting != null && Object.hasOwn(previousFormatting, "numPr") && previousFormatting["numPr"] == null;
566
+ }
567
+ function isRemovedNumberingChange(change) {
568
+ const previousFormatting = change.previousFormatting;
569
+ return previousFormatting != null && Object.hasOwn(previousFormatting, "numPr") && isListNumPr(previousFormatting["numPr"]);
570
+ }
571
+ function isChangedNumberingChange(currentNumPr, change) {
572
+ const previousFormatting = change.previousFormatting;
573
+ return previousFormatting != null && Object.hasOwn(previousFormatting, "numPr") && isListNumPr(previousFormatting["numPr"]) && !areListNumPrEqual(previousFormatting["numPr"], currentNumPr);
574
+ }
575
+ function areListNumPrEqual(left, right) {
576
+ return left.numId === right.numId && left.ilvl === right.ilvl;
577
+ }
578
+ function isRecord(value) {
579
+ return typeof value === "object" && value !== null;
580
+ }
581
+ function isListNumPr(value) {
582
+ if (!isRecord(value)) return false;
583
+ const numId = value["numId"];
584
+ const ilvl = value["ilvl"];
585
+ return (numId === void 0 || typeof numId === "number") && (ilvl === void 0 || typeof ilvl === "number");
586
+ }
587
+ function isNumberFormat(value) {
588
+ return NUMBER_FORMAT_VALUES.some((format) => format === value);
589
+ }
590
+ function readNumberFormats(value) {
591
+ if (!Array.isArray(value)) return;
592
+ const formats = [];
593
+ for (const item of value) {
594
+ if (!isNumberFormat(item)) return;
595
+ formats.push(item);
596
+ }
597
+ return formats;
598
+ }
599
+ function readListMarkerSuffix(value) {
600
+ if (value === "tab" || value === "space" || value === "nothing") return value;
601
+ }
602
+ function toPreviousListAttrs(previousFormatting) {
603
+ const attrs = {};
604
+ const numPr = previousFormatting["numPr"];
605
+ if (isListNumPr(numPr)) attrs.numPr = numPr;
606
+ const listIsBullet = previousFormatting["listIsBullet"];
607
+ if (typeof listIsBullet === "boolean") attrs.listIsBullet = listIsBullet;
608
+ const listIsLegal = previousFormatting["listIsLegal"];
609
+ if (typeof listIsLegal === "boolean") attrs.listIsLegal = listIsLegal;
610
+ const listMarker = previousFormatting["listMarker"];
611
+ if (typeof listMarker === "string") attrs.listMarker = listMarker;
612
+ const listNumFmt = previousFormatting["listNumFmt"];
613
+ if (isNumberFormat(listNumFmt)) attrs.listNumFmt = listNumFmt;
614
+ const listLevelNumFmts = readNumberFormats(previousFormatting["listLevelNumFmts"]);
615
+ if (listLevelNumFmts) attrs.listLevelNumFmts = listLevelNumFmts;
616
+ const listAbstractNumId = previousFormatting["listAbstractNumId"];
617
+ if (typeof listAbstractNumId === "number") attrs.listAbstractNumId = listAbstractNumId;
618
+ const listStartOverride = previousFormatting["listStartOverride"];
619
+ if (typeof listStartOverride === "number") attrs.listStartOverride = listStartOverride;
620
+ const listMarkerHidden = previousFormatting["listMarkerHidden"];
621
+ if (typeof listMarkerHidden === "boolean") attrs.listMarkerHidden = listMarkerHidden;
622
+ const listMarkerFontFamily = previousFormatting["listMarkerFontFamily"];
623
+ if (typeof listMarkerFontFamily === "string") attrs.listMarkerFontFamily = listMarkerFontFamily;
624
+ const listMarkerFontSize = previousFormatting["listMarkerFontSize"];
625
+ if (typeof listMarkerFontSize === "number") attrs.listMarkerFontSize = listMarkerFontSize;
626
+ const listMarkerSuffix = readListMarkerSuffix(previousFormatting["listMarkerSuffix"]);
627
+ if (listMarkerSuffix) attrs.listMarkerSuffix = listMarkerSuffix;
628
+ return attrs;
629
+ }
630
+ function resolveDeletedListMarker(previousListAttrs, listCounters, listAbstractCounters, listSeenNumIds) {
631
+ if (listCounters && previousListAttrs.numPr) {
632
+ const marker = computeListMarker(previousListAttrs, listCounters, listAbstractCounters ?? /* @__PURE__ */ new Map(), listSeenNumIds ?? /* @__PURE__ */ new Set());
633
+ if (marker) return marker;
634
+ }
635
+ if (previousListAttrs.listMarker) return previousListAttrs.listIsBullet ? convertBulletToUnicode(previousListAttrs.listMarker) : previousListAttrs.listMarker;
636
+ if (previousListAttrs.listIsBullet) return "•";
637
+ return null;
638
+ }
639
+ function applyDeletedListMarkerAttrs(attrs, change, listCounters, listAbstractCounters, listSeenNumIds) {
640
+ const previousListAttrs = toPreviousListAttrs(change.previousFormatting);
641
+ const marker = resolveDeletedListMarker(previousListAttrs, listCounters, listAbstractCounters, listSeenNumIds);
642
+ if (!marker) return;
643
+ attrs.listMarker = marker;
644
+ attrs.listMarkerRevision = toListMarkerRevision("del", change.info);
645
+ if (previousListAttrs.listIsBullet !== void 0) attrs.listIsBullet = previousListAttrs.listIsBullet;
646
+ if (previousListAttrs.listMarkerHidden !== void 0) attrs.listMarkerHidden = previousListAttrs.listMarkerHidden;
647
+ if (previousListAttrs.listMarkerFontFamily) attrs.listMarkerFontFamily = previousListAttrs.listMarkerFontFamily;
648
+ if (previousListAttrs.listMarkerFontSize) attrs.listMarkerFontSize = previousListAttrs.listMarkerFontSize;
649
+ if (previousListAttrs.listMarkerSuffix) attrs.listMarkerSuffix = previousListAttrs.listMarkerSuffix;
650
+ }
651
+ function convertParagraphAttrs(pmAttrs, theme, listCounters, listAbstractCounters, listSeenNumIds, defaultTabStopTwips, originalListCounters, originalListAbstractCounters, originalListSeenNumIds) {
652
+ const attrs = {};
653
+ if (pmAttrs.alignment) {
654
+ const align = pmAttrs.alignment;
655
+ if (align === "both" || align === "distribute") attrs.alignment = "justify";
656
+ else if (align === "left") attrs.alignment = "left";
657
+ else if (align === "center") attrs.alignment = "center";
658
+ else if (align === "right") attrs.alignment = "right";
659
+ }
660
+ const spaceBefore = pmAttrs.spaceBefore;
661
+ const spaceAfter = pmAttrs.spaceAfter;
662
+ const lineSpacing = pmAttrs.lineSpacing;
663
+ const autoBefore = autospacingMatchesBase(pmAttrs._autospacingBase, "before", spaceBefore);
664
+ const autoAfter = autospacingMatchesBase(pmAttrs._autospacingBase, "after", spaceAfter);
665
+ if (autoBefore || autoAfter || typeof spaceBefore === "number" || typeof spaceAfter === "number" || typeof lineSpacing === "number") {
666
+ attrs.spacing = {};
667
+ if (autoBefore) attrs.spacing.before = 14;
668
+ else if (typeof spaceBefore === "number") attrs.spacing.before = twipsToPixels(spaceBefore);
669
+ if (autoAfter) attrs.spacing.after = 14;
670
+ else if (typeof spaceAfter === "number") attrs.spacing.after = twipsToPixels(spaceAfter);
671
+ const pmSpacingExplicit = pmAttrs.spacingExplicit;
672
+ const explicit = {};
673
+ if (autoBefore || pmSpacingExplicit?.before) explicit.before = true;
674
+ if (autoAfter || pmSpacingExplicit?.after) explicit.after = true;
675
+ if (explicit.before !== void 0 || explicit.after !== void 0) attrs.spacingExplicit = explicit;
676
+ if (typeof lineSpacing === "number") if (pmAttrs.lineSpacingRule === "exact" || pmAttrs.lineSpacingRule === "atLeast") {
677
+ attrs.spacing.line = twipsToPixels(lineSpacing);
678
+ attrs.spacing.lineUnit = "px";
679
+ attrs.spacing.lineRule = pmAttrs.lineSpacingRule;
680
+ } else {
681
+ attrs.spacing.line = lineSpacing / 240;
682
+ attrs.spacing.lineUnit = "multiplier";
683
+ attrs.spacing.lineRule = "auto";
684
+ }
685
+ }
686
+ let indentLeft = typeof pmAttrs.indentLeft === "number" ? pmAttrs.indentLeft : void 0;
687
+ let indentFirstLine = typeof pmAttrs.indentFirstLine === "number" ? pmAttrs.indentFirstLine : void 0;
688
+ let hangingIndent = pmAttrs.hangingIndent;
689
+ if (pmAttrs.numPr?.numId && indentLeft === void 0) {
690
+ indentLeft = ((pmAttrs.numPr.ilvl ?? 0) + 1) * 720;
691
+ if (indentFirstLine === void 0) {
692
+ indentFirstLine = -360;
693
+ hangingIndent = true;
694
+ }
695
+ }
696
+ if (indentLeft !== void 0 || typeof pmAttrs.indentRight === "number" || indentFirstLine !== void 0) {
697
+ attrs.indent = {};
698
+ if (indentLeft !== void 0) attrs.indent.left = twipsToPixels(indentLeft);
699
+ if (typeof pmAttrs.indentRight === "number") attrs.indent.right = twipsToPixels(pmAttrs.indentRight);
700
+ if (indentFirstLine !== void 0) if (hangingIndent) attrs.indent.hanging = Math.abs(twipsToPixels(indentFirstLine));
701
+ else attrs.indent.firstLine = twipsToPixels(indentFirstLine);
702
+ }
703
+ if (pmAttrs.styleId) attrs.styleId = pmAttrs.styleId;
704
+ if (pmAttrs.borders) {
705
+ const borders = pmAttrs.borders;
706
+ attrs.borders = {};
707
+ const convertBorder = (border) => border ? convertBorderSpecToLayout(border, theme) : void 0;
708
+ const topBorder = borders.top ? convertBorder(borders.top) : void 0;
709
+ if (topBorder) attrs.borders.top = topBorder;
710
+ const bottomBorder = borders.bottom ? convertBorder(borders.bottom) : void 0;
711
+ if (bottomBorder) attrs.borders.bottom = bottomBorder;
712
+ const leftBorder = borders.left ? convertBorder(borders.left) : void 0;
713
+ if (leftBorder) attrs.borders.left = leftBorder;
714
+ const rightBorder = borders.right ? convertBorder(borders.right) : void 0;
715
+ if (rightBorder) attrs.borders.right = rightBorder;
716
+ const betweenBorder = borders.between ? convertBorder(borders.between) : void 0;
717
+ if (betweenBorder) attrs.borders.between = betweenBorder;
718
+ const barBorder = borders.bar ? convertBorder(borders.bar) : void 0;
719
+ if (barBorder) attrs.borders.bar = barBorder;
720
+ if (!attrs.borders.top && !attrs.borders.bottom && !attrs.borders.left && !attrs.borders.right && !attrs.borders.between && !attrs.borders.bar) delete attrs.borders;
721
+ }
722
+ const shadingRgb = pmAttrs.shading?.fill?.rgb?.toUpperCase();
723
+ if (shadingRgb && shadingRgb !== "FFFFFF" && shadingRgb !== "FFFFFE") attrs.shading = `#${pmAttrs.shading?.fill?.rgb}`;
724
+ if (pmAttrs.tabs && pmAttrs.tabs.length > 0) attrs.tabs = pmAttrs.tabs.map((tab) => {
725
+ const tabStop = {
726
+ val: mapTabAlignment(tab.alignment),
727
+ pos: tab.position
728
+ };
729
+ if (tab.leader) tabStop.leader = tab.leader;
730
+ return tabStop;
731
+ });
732
+ if (pmAttrs.pageBreakBefore) attrs.pageBreakBefore = true;
733
+ if (pmAttrs.keepNext) attrs.keepNext = true;
734
+ if (pmAttrs.keepLines) attrs.keepLines = true;
735
+ if (pmAttrs.contextualSpacing) attrs.contextualSpacing = true;
736
+ if (pmAttrs.runInWithNext) attrs.runInWithNext = true;
737
+ if (directionIsRtl(pmAttrs.direction)) attrs.bidi = true;
738
+ if (pmAttrs.styleId) attrs.styleId = pmAttrs.styleId;
739
+ const pPrChange = pmAttrs._propertyChanges;
740
+ const propertyChanges = Array.isArray(pPrChange) ? pPrChange : [];
741
+ let changedNumberingChange;
742
+ if (pmAttrs.numPr) {
743
+ const numPr = {};
744
+ if (pmAttrs.numPr.numId !== void 0) numPr.numId = pmAttrs.numPr.numId;
745
+ if (pmAttrs.numPr.ilvl !== void 0) numPr.ilvl = pmAttrs.numPr.ilvl;
746
+ attrs.numPr = numPr;
747
+ if (pmAttrs.pPrMark?.kind === "del") attrs.listMarkerRevision = toListMarkerRevision("del", pmAttrs.pPrMark.info);
748
+ else if (pmAttrs.pPrMark?.kind === "ins") attrs.listMarkerRevision = toListMarkerRevision("ins", pmAttrs.pPrMark.info);
749
+ else {
750
+ const numberingAddedChange = propertyChanges.find(isAddedNumberingChange);
751
+ const currentNumPr = pmAttrs.numPr;
752
+ changedNumberingChange = propertyChanges.find((change) => isChangedNumberingChange(currentNumPr, change));
753
+ const numberingInsertionChange = numberingAddedChange ?? changedNumberingChange;
754
+ if (numberingInsertionChange) attrs.listMarkerRevision = toListMarkerRevision("ins", numberingInsertionChange.info);
755
+ }
756
+ }
757
+ const useOriginalStream = attrs.listMarkerRevision?.kind === "del" && originalListCounters !== void 0;
758
+ const streamCounters = useOriginalStream ? originalListCounters : listCounters;
759
+ const resolvedMarker = applyMarkerAllCaps(streamCounters ? computeListMarker(pmAttrs, streamCounters, (useOriginalStream ? originalListAbstractCounters : listAbstractCounters) ?? /* @__PURE__ */ new Map(), (useOriginalStream ? originalListSeenNumIds : listSeenNumIds) ?? /* @__PURE__ */ new Set()) : null, pmAttrs.listMarkerAllCaps);
760
+ const numberedNumId = pmAttrs.numPr?.numId;
761
+ if (attrs.listMarkerRevision === void 0 && !pmAttrs.listIsBullet && originalListCounters !== void 0 && numberedNumId !== void 0 && numberedNumId !== 0) computeListMarker(pmAttrs, originalListCounters, originalListAbstractCounters ?? /* @__PURE__ */ new Map(), originalListSeenNumIds ?? /* @__PURE__ */ new Set());
762
+ else if (changedNumberingChange !== void 0 && originalListCounters !== void 0) {
763
+ const previousListAttrs = toPreviousListAttrs(changedNumberingChange.previousFormatting);
764
+ if (previousListAttrs.numPr && !previousListAttrs.listIsBullet) computeListMarker(previousListAttrs, originalListCounters, originalListAbstractCounters ?? /* @__PURE__ */ new Map(), originalListSeenNumIds ?? /* @__PURE__ */ new Set());
765
+ }
766
+ if (resolvedMarker !== null) attrs.listMarker = resolvedMarker;
767
+ else if (pmAttrs.listMarker) attrs.listMarker = pmAttrs.listIsBullet ? convertBulletToUnicode(pmAttrs.listMarker) : pmAttrs.listMarker;
768
+ if (pmAttrs.listIsBullet !== void 0) attrs.listIsBullet = pmAttrs.listIsBullet;
769
+ if (pmAttrs.listMarkerHidden) attrs.listMarkerHidden = true;
770
+ if (pmAttrs.listMarkerFontFamily) attrs.listMarkerFontFamily = pmAttrs.listMarkerFontFamily;
771
+ if (pmAttrs.listMarkerFontSize) attrs.listMarkerFontSize = pmAttrs.listMarkerFontSize;
772
+ if (pmAttrs.listMarkerSuffix) attrs.listMarkerSuffix = pmAttrs.listMarkerSuffix;
773
+ if (pmAttrs.listMarkerSecondSlotOffsetTwips !== void 0) attrs.listMarkerSecondSlotOffsetTwips = pmAttrs.listMarkerSecondSlotOffsetTwips;
774
+ if (!pmAttrs.numPr) {
775
+ const numberingRemovedChange = propertyChanges.find(isRemovedNumberingChange);
776
+ if (numberingRemovedChange) applyDeletedListMarkerAttrs(attrs, numberingRemovedChange, originalListCounters, originalListAbstractCounters, originalListSeenNumIds);
777
+ }
778
+ if (defaultTabStopTwips !== void 0) attrs.defaultTabStopTwips = defaultTabStopTwips;
779
+ const dtf = pmAttrs.defaultTextFormatting;
780
+ if (dtf) {
781
+ if (dtf.fontSize !== void 0) attrs.defaultFontSize = dtf.fontSize / 2;
782
+ if (dtf.fontFamily) {
783
+ const resolvedFamily = dtf.fontFamily.ascii || dtf.fontFamily.hAnsi;
784
+ if (resolvedFamily) attrs.defaultFontFamily = resolvedFamily;
785
+ }
786
+ }
787
+ return attrs;
788
+ }
789
+ /**
790
+ * Map document TabStopAlignment to layout engine TabAlignment
791
+ */
792
+ function mapTabAlignment(align) {
793
+ switch (align) {
794
+ case "left": return "start";
795
+ case "right": return "end";
796
+ case "center": return "center";
797
+ case "decimal": return "decimal";
798
+ case "bar": return "bar";
799
+ case "clear": return "clear";
800
+ case "num": return "start";
801
+ default: return "start";
802
+ }
803
+ }
804
+ /**
805
+ * Convert a paragraph node to a ParagraphBlock.
806
+ */
807
+ function convertParagraph(node, startPos, options) {
808
+ const pmAttrs = expectParagraphAttrs(node);
809
+ const runs = paragraphToRuns(node, startPos, options);
810
+ const attrs = convertParagraphAttrs(pmAttrs, options.theme, options.listCounters, options.listAbstractCounters, options.listSeenNumIds, options.defaultTabStopTwips, options.originalListCounters, options.originalListAbstractCounters, options.originalListSeenNumIds);
811
+ const bookmarkNames = pmAttrs.bookmarks?.map((b) => b.name);
812
+ return {
813
+ kind: "paragraph",
814
+ id: nextBlockId(),
815
+ runs,
816
+ attrs,
817
+ ...bookmarkNames && bookmarkNames.length > 0 ? { bookmarks: bookmarkNames } : {},
818
+ pmStart: startPos,
819
+ pmEnd: startPos + node.nodeSize
820
+ };
821
+ }
822
+ /**
823
+ * Convert border width from eighths of a point to pixels.
824
+ * OOXML stores border widths in eighths of a point.
825
+ */
826
+ function borderWidthToPixels(eighthsOfPoint) {
827
+ return Math.max(1, Math.round(eighthsOfPoint / 8 * 1.333));
828
+ }
829
+ const OOXML_TO_CSS_BORDER = {
830
+ single: "solid",
831
+ double: "double",
832
+ dotted: "dotted",
833
+ dashed: "dashed",
834
+ thick: "solid",
835
+ dashSmallGap: "dashed",
836
+ dotDash: "dashed",
837
+ dotDotDash: "dotted",
838
+ triple: "double",
839
+ wave: "solid",
840
+ doubleWave: "double",
841
+ threeDEmboss: "ridge",
842
+ threeDEngrave: "groove",
843
+ outset: "outset",
844
+ inset: "inset"
845
+ };
846
+ /**
847
+ * Convert an OOXML BorderSpec to a layout-engine BorderStyle.
848
+ * Shared by paragraph borders, cell borders, and header/footer borders.
849
+ */
850
+ function convertBorderSpecToLayout(border, theme) {
851
+ if (!border.style || border.style === "none" || border.style === "nil") return;
852
+ const result = {
853
+ style: OOXML_TO_CSS_BORDER[border.style] || "solid",
854
+ width: borderWidthToPixels(border.size ?? 0),
855
+ color: border.color ? resolveColor(border.color, theme) : "#000000"
856
+ };
857
+ if (border.space !== void 0) result.space = pointsToPixels(border.space);
858
+ return result;
859
+ }
860
+ /**
861
+ * Extract cell borders from ProseMirror attributes.
862
+ * Borders are full BorderSpec objects with style/size/color.
863
+ */
864
+ function extractCellBorders(borders, theme) {
865
+ if (!borders) return;
866
+ const result = {};
867
+ for (const side of [
868
+ "top",
869
+ "bottom",
870
+ "left",
871
+ "right"
872
+ ]) {
873
+ const border = borders[side];
874
+ result[side] = (border ? convertBorderSpecToLayout(border, theme) : void 0) ?? {
875
+ width: 0,
876
+ style: "none"
877
+ };
878
+ }
879
+ return Object.keys(result).length > 0 ? result : void 0;
880
+ }
881
+ /**
882
+ * Convert a table cell node.
883
+ */
884
+ function convertTableCell(node, startPos, options, tableCellMargins) {
885
+ const blocks = [];
886
+ let offset = startPos + 1;
887
+ node.forEach((child) => {
888
+ if (child.type.name === "paragraph") {
889
+ const block = convertParagraph(child, offset, options);
890
+ blocks.push(block);
891
+ } else if (child.type.name === "table") blocks.push(convertTable(child, offset, options));
892
+ offset += child.nodeSize;
893
+ });
894
+ const attrs = expectTableCellAttrs(node);
895
+ const margins = attrs.margins;
896
+ const resolvePaddingSide = (side, cellTwips, tableTwips) => {
897
+ if (cellTwips !== void 0) {
898
+ const px = twipsToPixels(cellTwips);
899
+ if (px > 0) return px;
900
+ }
901
+ if (tableTwips !== void 0) return twipsToPixels(tableTwips);
902
+ return twipsToPixels(DEFAULT_TABLE_CELL_MARGIN_TWIPS[side]);
903
+ };
904
+ const padding = {
905
+ top: resolvePaddingSide("top", margins?.top, tableCellMargins?.top),
906
+ right: resolvePaddingSide("right", margins?.right, tableCellMargins?.right),
907
+ bottom: resolvePaddingSide("bottom", margins?.bottom, tableCellMargins?.bottom),
908
+ left: resolvePaddingSide("left", margins?.left, tableCellMargins?.left)
909
+ };
910
+ const cell = {
911
+ id: nextBlockId(),
912
+ blocks,
913
+ colSpan: attrs.colspan,
914
+ rowSpan: attrs.rowspan,
915
+ padding
916
+ };
917
+ if (attrs.width) cell.width = twipsToPixels(attrs.width);
918
+ if (attrs.verticalAlign) cell.verticalAlign = attrs.verticalAlign;
919
+ if (attrs.backgroundColor) cell.background = `#${attrs.backgroundColor}`;
920
+ const cellBorders = extractCellBorders(attrs.borders, options.theme);
921
+ if (cellBorders) cell.borders = cellBorders;
922
+ if (attrs.noWrap) cell.noWrap = true;
923
+ return cell;
924
+ }
925
+ /**
926
+ * Convert a table row node.
927
+ */
928
+ function convertTableRow(node, startPos, options, tableCellMargins) {
929
+ const cells = [];
930
+ let offset = startPos + 1;
931
+ node.forEach((child) => {
932
+ if (child.type.name === "tableCell" || child.type.name === "tableHeader") cells.push(convertTableCell(child, offset, options, tableCellMargins));
933
+ offset += child.nodeSize;
934
+ });
935
+ const attrs = expectTableRowAttrs(node);
936
+ const row = {
937
+ id: nextBlockId(),
938
+ cells
939
+ };
940
+ if (attrs.height) row.height = twipsToPixels(attrs.height);
941
+ if (attrs.heightRule) row.heightRule = attrs.heightRule;
942
+ if (attrs.isHeader) row.isHeader = attrs.isHeader;
943
+ return row;
944
+ }
945
+ /**
946
+ * Convert a table node to a TableBlock.
947
+ */
948
+ function convertTable(node, startPos, options) {
949
+ const rows = [];
950
+ let offset = startPos + 1;
951
+ const attrs = expectTableAttrs(node);
952
+ const tableCellMargins = attrs.cellMargins;
953
+ node.forEach((child) => {
954
+ if (child.type.name === "tableRow") rows.push(convertTableRow(child, offset, options, tableCellMargins));
955
+ offset += child.nodeSize;
956
+ });
957
+ let columnWidths = attrs.columnWidths?.map(twipsToPixels);
958
+ const width = attrs.width;
959
+ const widthType = attrs.widthType;
960
+ if (!columnWidths && rows.length > 0) {
961
+ const cellWidths = rows[0].cells.map((cell) => cell.width);
962
+ if (cellWidths.every((w) => w !== void 0 && w > 0)) columnWidths = cellWidths;
963
+ }
964
+ const justification = attrs.justification;
965
+ const originalFormatting = attrs._originalFormatting;
966
+ const indentPx = originalFormatting?.indent?.value && originalFormatting.indent.type === "dxa" ? twipsToPixels(originalFormatting.indent.value) : void 0;
967
+ const floating = attrs.floating;
968
+ let floatingPx;
969
+ if (floating) {
970
+ const fp = {};
971
+ if (floating.horzAnchor) fp.horzAnchor = floating.horzAnchor;
972
+ if (floating.vertAnchor) fp.vertAnchor = floating.vertAnchor;
973
+ if (floating.tblpX !== void 0) fp.tblpX = twipsToPixels(floating.tblpX);
974
+ if (floating.tblpXSpec) fp.tblpXSpec = floating.tblpXSpec;
975
+ if (floating.tblpY !== void 0) fp.tblpY = twipsToPixels(floating.tblpY);
976
+ if (floating.tblpYSpec) fp.tblpYSpec = floating.tblpYSpec;
977
+ if (floating.topFromText !== void 0) fp.topFromText = twipsToPixels(floating.topFromText);
978
+ if (floating.bottomFromText !== void 0) fp.bottomFromText = twipsToPixels(floating.bottomFromText);
979
+ if (floating.leftFromText !== void 0) fp.leftFromText = twipsToPixels(floating.leftFromText);
980
+ if (floating.rightFromText !== void 0) fp.rightFromText = twipsToPixels(floating.rightFromText);
981
+ floatingPx = fp;
982
+ }
983
+ const tableBlock = {
984
+ kind: "table",
985
+ id: nextBlockId(),
986
+ rows,
987
+ pmStart: startPos,
988
+ pmEnd: startPos + node.nodeSize
989
+ };
990
+ if (columnWidths) tableBlock.columnWidths = columnWidths;
991
+ if (width !== void 0) tableBlock.width = width;
992
+ if (widthType !== void 0) tableBlock.widthType = widthType;
993
+ if (justification) tableBlock.justification = justification;
994
+ if (indentPx !== void 0) tableBlock.indent = indentPx;
995
+ if (floatingPx) tableBlock.floating = floatingPx;
996
+ if (originalFormatting?.bidi) tableBlock.bidi = true;
997
+ return tableBlock;
998
+ }
999
+ /**
1000
+ * Convert an image node to an ImageBlock.
1001
+ */
1002
+ function convertImage(node, startPos, pageContentHeight) {
1003
+ const attrs = expectImageAttrs(node);
1004
+ const wrapType = attrs.wrapType;
1005
+ const shouldAnchor = wrapType === "behind" || wrapType === "inFront";
1006
+ const constrained = constrainImageToPage(attrs.width || 100, attrs.height || 100, pageContentHeight);
1007
+ const imgBlock = {
1008
+ kind: "image",
1009
+ id: nextBlockId(),
1010
+ src: attrs.src,
1011
+ width: constrained.width,
1012
+ height: constrained.height,
1013
+ pmStart: startPos,
1014
+ pmEnd: startPos + node.nodeSize
1015
+ };
1016
+ if (attrs.alt) imgBlock.alt = attrs.alt;
1017
+ if (attrs.transform) imgBlock.transform = attrs.transform;
1018
+ if (attrs.opacity != null) imgBlock.opacity = attrs.opacity;
1019
+ if (shouldAnchor) {
1020
+ const anchor = {
1021
+ isAnchored: true,
1022
+ behindDoc: wrapType === "behind"
1023
+ };
1024
+ if (attrs.distLeft !== void 0) anchor.offsetH = attrs.distLeft;
1025
+ if (attrs.distTop !== void 0) anchor.offsetV = attrs.distTop;
1026
+ imgBlock.anchor = anchor;
1027
+ }
1028
+ if (attrs.hlinkHref) imgBlock.hlinkHref = attrs.hlinkHref;
1029
+ if (attrs.cropTop != null) imgBlock.cropTop = attrs.cropTop;
1030
+ if (attrs.cropRight != null) imgBlock.cropRight = attrs.cropRight;
1031
+ if (attrs.cropBottom != null) imgBlock.cropBottom = attrs.cropBottom;
1032
+ if (attrs.cropLeft != null) imgBlock.cropLeft = attrs.cropLeft;
1033
+ return imgBlock;
1034
+ }
1035
+ /**
1036
+ * Convert a textBox PM node to a TextBoxBlock.
1037
+ */
1038
+ function convertTextBoxNode(node, startPos, opts) {
1039
+ const attrs = expectTextBoxAttrs(node);
1040
+ const contentBlocks = [];
1041
+ node.forEach((child, offset) => {
1042
+ if (child.type.name === "paragraph") {
1043
+ const block = convertParagraph(child, startPos + 1 + offset, opts);
1044
+ contentBlocks.push(block);
1045
+ }
1046
+ });
1047
+ const textBox = {
1048
+ kind: "textBox",
1049
+ id: nextBlockId(),
1050
+ width: attrs.width ?? 200,
1051
+ margins: {
1052
+ top: attrs.marginTop ?? DEFAULT_TEXTBOX_MARGINS.top,
1053
+ bottom: attrs.marginBottom ?? DEFAULT_TEXTBOX_MARGINS.bottom,
1054
+ left: attrs.marginLeft ?? DEFAULT_TEXTBOX_MARGINS.left,
1055
+ right: attrs.marginRight ?? DEFAULT_TEXTBOX_MARGINS.right
1056
+ },
1057
+ content: contentBlocks,
1058
+ pmStart: startPos,
1059
+ pmEnd: startPos + node.nodeSize
1060
+ };
1061
+ if (attrs.height !== void 0) textBox.height = attrs.height;
1062
+ if (attrs.fillColor !== void 0) textBox.fillColor = attrs.fillColor;
1063
+ if (attrs.outlineWidth !== void 0) textBox.outlineWidth = attrs.outlineWidth;
1064
+ if (attrs.outlineColor !== void 0) textBox.outlineColor = attrs.outlineColor;
1065
+ if (attrs.outlineStyle !== void 0) textBox.outlineStyle = attrs.outlineStyle;
1066
+ if (attrs.displayMode !== void 0) textBox.displayMode = attrs.displayMode;
1067
+ if (attrs.cssFloat !== void 0) textBox.cssFloat = attrs.cssFloat;
1068
+ if (attrs.wrapType !== void 0) textBox.wrapType = attrs.wrapType;
1069
+ if (attrs.wrapText !== void 0) textBox.wrapText = attrs.wrapText;
1070
+ if (attrs.distTop !== void 0) textBox.distTop = attrs.distTop;
1071
+ if (attrs.distBottom !== void 0) textBox.distBottom = attrs.distBottom;
1072
+ if (attrs.distLeft !== void 0) textBox.distLeft = attrs.distLeft;
1073
+ if (attrs.distRight !== void 0) textBox.distRight = attrs.distRight;
1074
+ if (attrs.position !== void 0) textBox.position = attrs.position;
1075
+ return textBox;
1076
+ }
1077
+ /**
1078
+ * Convert a ProseMirror document to FlowBlock array.
1079
+ *
1080
+ * Walks the document tree, converting each node to the appropriate block type.
1081
+ * Tracks pmStart/pmEnd positions for each block for click-to-position mapping.
1082
+ */
1083
+ function toFlowBlocks(doc, options = {}) {
1084
+ assertValidProseMirrorDocument(doc, "Cannot layout invalid ProseMirror document");
1085
+ resetBlockIdCounter();
1086
+ const opts = {
1087
+ ...options,
1088
+ defaultFont: options.defaultFont ?? DEFAULT_FONT,
1089
+ defaultSize: options.defaultSize ?? DEFAULT_SIZE,
1090
+ listCounters: options.listCounters ?? /* @__PURE__ */ new Map(),
1091
+ listAbstractCounters: options.listAbstractCounters ?? /* @__PURE__ */ new Map(),
1092
+ listSeenNumIds: options.listSeenNumIds ?? /* @__PURE__ */ new Set(),
1093
+ originalListCounters: options.originalListCounters ?? /* @__PURE__ */ new Map(),
1094
+ originalListAbstractCounters: options.originalListAbstractCounters ?? /* @__PURE__ */ new Map(),
1095
+ originalListSeenNumIds: options.originalListSeenNumIds ?? /* @__PURE__ */ new Set()
1096
+ };
1097
+ const blocks = [];
1098
+ const offset = 0;
1099
+ let lastSectionMarginsTwips = {
1100
+ top: 1440,
1101
+ bottom: 1440,
1102
+ left: 1440,
1103
+ right: 1440
1104
+ };
1105
+ let sdtSeq = 0;
1106
+ const sdtStack = [];
1107
+ /**
1108
+ * Stamp the active SDT stack (outer→inner) onto every block produced by the
1109
+ * current call. ParagraphBlock/TableBlock accept `sdtGroups`; section breaks
1110
+ * and page breaks deliberately do not — they bracket layout, not content.
1111
+ */
1112
+ const tagBlockWithSdtStack = (block) => {
1113
+ if (sdtStack.length === 0) return;
1114
+ if (block.kind === "paragraph" || block.kind === "table") block.sdtGroups = [...sdtStack];
1115
+ };
1116
+ const trackedPush = (block) => {
1117
+ tagBlockWithSdtStack(block);
1118
+ blocks.push(block);
1119
+ };
1120
+ const visit = (node, pos) => {
1121
+ switch (node.type.name) {
1122
+ case "blockSdt": {
1123
+ const attrs = expectBlockSdtAttrs(node);
1124
+ sdtSeq += 1;
1125
+ const group = {
1126
+ id: `sdt-${sdtSeq}`,
1127
+ pmPos: pos,
1128
+ sdtType: attrs.sdtType
1129
+ };
1130
+ if (attrs.alias) group.alias = attrs.alias;
1131
+ if (attrs.tag) group.tag = attrs.tag;
1132
+ if (typeof attrs.id === "number") group.sdtId = attrs.id;
1133
+ if (attrs.lock) group.lock = attrs.lock;
1134
+ if (attrs.showingPlaceholder) group.showingPlaceholder = true;
1135
+ if (typeof attrs.checked === "boolean") group.checked = attrs.checked;
1136
+ if (attrs.dateFormat) group.dateFormat = attrs.dateFormat;
1137
+ if (attrs.listItems) group.listItemsJson = attrs.listItems;
1138
+ sdtStack.push(group);
1139
+ const startIndex = blocks.length;
1140
+ let childOffset = pos + 1;
1141
+ for (let i = 0; i < node.childCount; i += 1) {
1142
+ const child = node.child(i);
1143
+ visit(child, childOffset);
1144
+ childOffset += child.nodeSize;
1145
+ }
1146
+ sdtStack.pop();
1147
+ const groupBlocks = [];
1148
+ for (let i = startIndex; i < blocks.length; i += 1) {
1149
+ const b = blocks[i];
1150
+ if (b && (b.kind === "paragraph" || b.kind === "table")) groupBlocks.push(b);
1151
+ }
1152
+ const ourPmPos = group.pmPos;
1153
+ for (let i = 0; i < groupBlocks.length; i += 1) {
1154
+ const b = groupBlocks[i];
1155
+ if (!b || !b.sdtGroups) continue;
1156
+ const idx = b.sdtGroups.findIndex((g) => g.pmPos === ourPmPos);
1157
+ if (idx === -1) continue;
1158
+ let position;
1159
+ if (groupBlocks.length === 1) position = "only";
1160
+ else if (i === 0) position = "first";
1161
+ else if (i === groupBlocks.length - 1) position = "last";
1162
+ else position = "middle";
1163
+ const next = [...b.sdtGroups];
1164
+ const existing = next[idx];
1165
+ if (!existing) continue;
1166
+ next[idx] = {
1167
+ ...existing,
1168
+ position
1169
+ };
1170
+ b.sdtGroups = next;
1171
+ }
1172
+ return;
1173
+ }
1174
+ default: break;
1175
+ }
1176
+ switch (node.type.name) {
1177
+ case "paragraph": {
1178
+ const block = convertParagraph(node, pos, opts);
1179
+ const pmAttrs = expectParagraphAttrs(node);
1180
+ trackedPush(block);
1181
+ const secProps = pmAttrs._sectionProperties;
1182
+ if (secProps || pmAttrs.sectionBreakType) {
1183
+ const sectionBreak = {
1184
+ kind: "sectionBreak",
1185
+ id: nextBlockId()
1186
+ };
1187
+ const breakType = secProps?.sectionStart ?? pmAttrs.sectionBreakType;
1188
+ if (breakType) sectionBreak.type = breakType;
1189
+ if (secProps) {
1190
+ if (secProps.pageWidth || secProps.pageHeight) sectionBreak.pageSize = {
1191
+ w: twipsToPixels(secProps.pageWidth ?? 12240),
1192
+ h: twipsToPixels(secProps.pageHeight ?? 15840)
1193
+ };
1194
+ if (secProps.marginTop !== void 0 || secProps.marginBottom !== void 0 || secProps.marginLeft !== void 0 || secProps.marginRight !== void 0) {
1195
+ lastSectionMarginsTwips = {
1196
+ top: secProps.marginTop ?? lastSectionMarginsTwips.top,
1197
+ bottom: secProps.marginBottom ?? lastSectionMarginsTwips.bottom,
1198
+ left: secProps.marginLeft ?? lastSectionMarginsTwips.left,
1199
+ right: secProps.marginRight ?? lastSectionMarginsTwips.right
1200
+ };
1201
+ sectionBreak.margins = {
1202
+ top: twipsToPixels(lastSectionMarginsTwips.top),
1203
+ bottom: twipsToPixels(lastSectionMarginsTwips.bottom),
1204
+ left: twipsToPixels(lastSectionMarginsTwips.left),
1205
+ right: twipsToPixels(lastSectionMarginsTwips.right)
1206
+ };
1207
+ if (secProps.headerDistance !== void 0) sectionBreak.margins.header = twipsToPixels(secProps.headerDistance);
1208
+ if (secProps.footerDistance !== void 0) sectionBreak.margins.footer = twipsToPixels(secProps.footerDistance);
1209
+ }
1210
+ const colCount = secProps.columnCount ?? 1;
1211
+ if (colCount > 1) {
1212
+ const cols = {
1213
+ count: colCount,
1214
+ gap: twipsToPixels(secProps.columnSpace ?? 720),
1215
+ equalWidth: secProps.equalWidth ?? true
1216
+ };
1217
+ if (secProps.separator !== void 0) cols.separator = secProps.separator;
1218
+ sectionBreak.columns = cols;
1219
+ }
1220
+ }
1221
+ trackedPush(sectionBreak);
1222
+ }
1223
+ break;
1224
+ }
1225
+ case "table":
1226
+ trackedPush(convertTable(node, pos, opts));
1227
+ break;
1228
+ case "image":
1229
+ trackedPush(convertImage(node, pos, opts.pageContentHeight));
1230
+ break;
1231
+ case "textBox":
1232
+ trackedPush(convertTextBoxNode(node, pos, opts));
1233
+ break;
1234
+ case "horizontalRule":
1235
+ case "pageBreak":
1236
+ trackedPush({
1237
+ kind: "pageBreak",
1238
+ id: nextBlockId(),
1239
+ pmStart: pos,
1240
+ pmEnd: pos + node.nodeSize
1241
+ });
1242
+ break;
1243
+ default: break;
1244
+ }
1245
+ };
1246
+ doc.forEach((node, nodeOffset) => {
1247
+ visit(node, offset + nodeOffset);
1248
+ });
1249
+ return mergeRunInParagraphs(blocks);
1250
+ }
1251
+ /**
1252
+ * Merge consecutive paragraph blocks where the first carries
1253
+ * `runInWithNext` (`<w:specVanish/>` on the paragraph mark).
1254
+ *
1255
+ * Word's run-in heading feature renders the next paragraph inline on
1256
+ * the same line, so for layout we collapse the pair into one
1257
+ * ParagraphBlock with combined runs. The merged block keeps the first
1258
+ * paragraph's attrs (heading formatting, list marker, indent) and
1259
+ * extends pmEnd to the second paragraph's range so click-to-position
1260
+ * resolution still maps both ranges back to body content.
1261
+ *
1262
+ * Chains: runInWithNext on the merged block is dropped because the
1263
+ * second paragraph's mark wasn't `specVanish`. If a chain of
1264
+ * specVanish paragraphs needs collapsing (rare in practice), the loop
1265
+ * naturally handles it by re-inspecting the merged block's flag (we
1266
+ * preserve runInWithNext only when the second paragraph itself has
1267
+ * specVanish).
1268
+ */
1269
+ function sdtGroupStacksEqual(a, b) {
1270
+ const lenA = a?.length ?? 0;
1271
+ if (lenA !== (b?.length ?? 0)) return false;
1272
+ if (lenA === 0) return true;
1273
+ for (let i = 0; i < lenA; i++) if (a?.[i]?.pmPos !== b?.[i]?.pmPos) return false;
1274
+ return true;
1275
+ }
1276
+ function mergeRunInParagraphs(blocks) {
1277
+ const out = [];
1278
+ for (let i = 0; i < blocks.length; i++) {
1279
+ let current = blocks[i];
1280
+ if (!current) continue;
1281
+ while (current.kind === "paragraph" && current.attrs?.runInWithNext && i + 1 < blocks.length) {
1282
+ const next = blocks[i + 1];
1283
+ if (!next || next.kind !== "paragraph") break;
1284
+ const a = current;
1285
+ const b = next;
1286
+ if (!sdtGroupStacksEqual(a.sdtGroups, b.sdtGroups)) break;
1287
+ const mergedAttrs = { ...a.attrs };
1288
+ if (b.attrs?.spacing?.after !== void 0) mergedAttrs.spacing = {
1289
+ ...mergedAttrs.spacing,
1290
+ after: b.attrs.spacing.after
1291
+ };
1292
+ if (b.attrs?.runInWithNext) mergedAttrs.runInWithNext = true;
1293
+ else delete mergedAttrs.runInWithNext;
1294
+ const merged = {
1295
+ ...a,
1296
+ runs: [...a.runs, ...b.runs],
1297
+ attrs: mergedAttrs
1298
+ };
1299
+ const mergedPmEnd = b.pmEnd ?? a.pmEnd;
1300
+ if (mergedPmEnd !== void 0) merged.pmEnd = mergedPmEnd;
1301
+ current = merged;
1302
+ i += 1;
1303
+ }
1304
+ out.push(current);
1305
+ }
1306
+ return out;
1307
+ }
1308
+ //#endregion
1309
+ export { convertBorderSpecToLayout, formatCounter, resetBlockIdCounter, resolveListTemplate, toFlowBlocks };