@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,1218 @@
1
+ import { FIELD_TYPE_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LINE_SPACING_RULE_VALUES, OUTLINE_STYLE_ATTR_VALUES, PARAGRAPH_ALIGNMENT_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES } from "../../types/documentEnumValues.js";
2
+ import { isParagraphDirection } from "../paragraphDirection.js";
3
+ import { panic } from "better-result";
4
+ //#region src/prosemirror/attrs/index.ts
5
+ const SECTION_BREAK_TYPES = [
6
+ "nextPage",
7
+ "continuous",
8
+ "oddPage",
9
+ "evenPage"
10
+ ];
11
+ const IMAGE_DISPLAY_MODES = [
12
+ "inline",
13
+ "float",
14
+ "block"
15
+ ];
16
+ const IMAGE_CSS_FLOATS = [
17
+ "left",
18
+ "right",
19
+ "none"
20
+ ];
21
+ const FIELD_KINDS = ["simple", "complex"];
22
+ const MATH_DISPLAYS = ["inline", "block"];
23
+ const SHAPE_FILL_TYPES = [
24
+ "none",
25
+ "solid",
26
+ "gradient",
27
+ "pattern",
28
+ "picture"
29
+ ];
30
+ const SHAPE_GRADIENT_TYPES = [
31
+ "linear",
32
+ "radial",
33
+ "rectangular",
34
+ "path"
35
+ ];
36
+ const SHAPE_OUTLINE_CAPS = [
37
+ "flat",
38
+ "round",
39
+ "square"
40
+ ];
41
+ const SHAPE_LINE_END_TYPES = [
42
+ "none",
43
+ "triangle",
44
+ "stealth",
45
+ "diamond",
46
+ "oval",
47
+ "arrow"
48
+ ];
49
+ const SHAPE_LINE_END_SIZES = [
50
+ "sm",
51
+ "med",
52
+ "lg"
53
+ ];
54
+ const EMPHASIS_MARK_TYPES = [
55
+ "dot",
56
+ "comma",
57
+ "circle",
58
+ "underDot"
59
+ ];
60
+ const TEXT_EFFECT_NON_NONE_VALUES = TEXT_EFFECT_VALUES.filter((value) => value !== "none");
61
+ const NOTE_TYPES = ["footnote", "endnote"];
62
+ const NOTE_REF_VERT_ALIGNS = ["baseline", "superscript"];
63
+ const TEXT_BOX_DOCX_PLACEMENTS = ["standalone", "inlineWithPrevious"];
64
+ const TRACKED_CHANGE_MOVE_KINDS = ["moveTo", "moveFrom"];
65
+ const HARD_BREAK_TYPES = ["column"];
66
+ const RUN_FORMATTING_OVERRIDE_FALSE_KEYS = [
67
+ "bold",
68
+ "italic",
69
+ "strike",
70
+ "doubleStrike",
71
+ "allCaps",
72
+ "smallCaps",
73
+ "hidden",
74
+ "emboss",
75
+ "imprint",
76
+ "shadow",
77
+ "outline"
78
+ ];
79
+ const TEXT_FORMATTING_BOOLEAN_KEYS = [
80
+ "bold",
81
+ "boldCs",
82
+ "italic",
83
+ "italicCs",
84
+ "strike",
85
+ "doubleStrike",
86
+ "smallCaps",
87
+ "allCaps",
88
+ "hidden",
89
+ "emboss",
90
+ "imprint",
91
+ "shadow",
92
+ "outline"
93
+ ];
94
+ const SECTION_ORIENTATIONS = ["portrait", "landscape"];
95
+ const SECTION_START_TYPES = [
96
+ "continuous",
97
+ "nextPage",
98
+ "oddPage",
99
+ "evenPage",
100
+ "nextColumn"
101
+ ];
102
+ const SECTION_VERTICAL_ALIGNMENTS = [
103
+ "top",
104
+ "center",
105
+ "both",
106
+ "bottom"
107
+ ];
108
+ const paragraphAttrsCache = /* @__PURE__ */ new WeakMap();
109
+ const hardBreakAttrsCache = /* @__PURE__ */ new WeakMap();
110
+ const tableAttrsCache = /* @__PURE__ */ new WeakMap();
111
+ const tableRowAttrsCache = /* @__PURE__ */ new WeakMap();
112
+ const tableCellAttrsCache = /* @__PURE__ */ new WeakMap();
113
+ const imageAttrsCache = /* @__PURE__ */ new WeakMap();
114
+ const fieldAttrsCache = /* @__PURE__ */ new WeakMap();
115
+ const mathAttrsCache = /* @__PURE__ */ new WeakMap();
116
+ const sdtAttrsCache = /* @__PURE__ */ new WeakMap();
117
+ const shapeAttrsCache = /* @__PURE__ */ new WeakMap();
118
+ const textBoxAttrsCache = /* @__PURE__ */ new WeakMap();
119
+ const underlineAttrsCache = /* @__PURE__ */ new WeakMap();
120
+ const strikeAttrsCache = /* @__PURE__ */ new WeakMap();
121
+ const textColorAttrsCache = /* @__PURE__ */ new WeakMap();
122
+ const highlightAttrsCache = /* @__PURE__ */ new WeakMap();
123
+ const runShadingAttrsCache = /* @__PURE__ */ new WeakMap();
124
+ const fontSizeAttrsCache = /* @__PURE__ */ new WeakMap();
125
+ const fontFamilyAttrsCache = /* @__PURE__ */ new WeakMap();
126
+ const characterSpacingAttrsCache = /* @__PURE__ */ new WeakMap();
127
+ const characterStyleAttrsCache = /* @__PURE__ */ new WeakMap();
128
+ const emphasisMarkAttrsCache = /* @__PURE__ */ new WeakMap();
129
+ const textEffectAttrsCache = /* @__PURE__ */ new WeakMap();
130
+ const footnoteRefAttrsCache = /* @__PURE__ */ new WeakMap();
131
+ const commentAttrsCache = /* @__PURE__ */ new WeakMap();
132
+ const trackedChangeAttrsCache = /* @__PURE__ */ new WeakMap();
133
+ const runFormattingOverrideAttrsCache = /* @__PURE__ */ new WeakMap();
134
+ const hyperlinkAttrsCache = /* @__PURE__ */ new WeakMap();
135
+ const readParagraphAttrs = (node) => {
136
+ const attrs = attrsRecord(node.attrs);
137
+ const issues = [];
138
+ expectNodeType(node, "paragraph", issues);
139
+ optionalString(attrs, "paraId", "paragraph.attrs.paraId", issues);
140
+ optionalString(attrs, "textId", "paragraph.attrs.textId", issues);
141
+ optionalOneOf(attrs, "alignment", "paragraph.attrs.alignment", issues, PARAGRAPH_ALIGNMENT_VALUES);
142
+ optionalString(attrs, "styleId", "paragraph.attrs.styleId", issues);
143
+ optionalNumber(attrs, "spaceBefore", "paragraph.attrs.spaceBefore", issues);
144
+ optionalNumber(attrs, "spaceAfter", "paragraph.attrs.spaceAfter", issues);
145
+ optionalNumber(attrs, "lineSpacing", "paragraph.attrs.lineSpacing", issues);
146
+ optionalOneOf(attrs, "lineSpacingRule", "paragraph.attrs.lineSpacingRule", issues, LINE_SPACING_RULE_VALUES);
147
+ optionalNumber(attrs, "indentLeft", "paragraph.attrs.indentLeft", issues);
148
+ optionalNumber(attrs, "indentRight", "paragraph.attrs.indentRight", issues);
149
+ optionalNumber(attrs, "indentFirstLine", "paragraph.attrs.indentFirstLine", issues);
150
+ optionalBoolean(attrs, "hangingIndent", "paragraph.attrs.hangingIndent", issues);
151
+ optionalNumber(attrs, "outlineLevel", "paragraph.attrs.outlineLevel", issues);
152
+ optionalString(attrs, "listNumFmt", "paragraph.attrs.listNumFmt", issues);
153
+ optionalBoolean(attrs, "listIsBullet", "paragraph.attrs.listIsBullet", issues);
154
+ optionalBoolean(attrs, "listIsLegal", "paragraph.attrs.listIsLegal", issues);
155
+ optionalString(attrs, "listMarker", "paragraph.attrs.listMarker", issues);
156
+ optionalBoolean(attrs, "listMarkerHidden", "paragraph.attrs.listMarkerHidden", issues);
157
+ optionalString(attrs, "listMarkerFontFamily", "paragraph.attrs.listMarkerFontFamily", issues);
158
+ optionalNumber(attrs, "listMarkerFontSize", "paragraph.attrs.listMarkerFontSize", issues);
159
+ optionalString(attrs, "listMarkerSuffix", "paragraph.attrs.listMarkerSuffix", issues);
160
+ optionalBoolean(attrs, "listMarkerAllCaps", "paragraph.attrs.listMarkerAllCaps", issues);
161
+ optionalNumber(attrs, "listImplicitChildLevelAdvances", "paragraph.attrs.listImplicitChildLevelAdvances", issues);
162
+ optionalNumber(attrs, "listMarkerSecondSlotOffsetTwips", "paragraph.attrs.listMarkerSecondSlotOffsetTwips", issues);
163
+ optionalNumber(attrs, "listStartOverride", "paragraph.attrs.listStartOverride", issues);
164
+ optionalBoolean(attrs, "pageBreakBefore", "paragraph.attrs.pageBreakBefore", issues);
165
+ optionalBoolean(attrs, "renderedPageBreakBefore", "paragraph.attrs.renderedPageBreakBefore", issues);
166
+ optionalBoolean(attrs, "runInWithNext", "paragraph.attrs.runInWithNext", issues);
167
+ optionalBoolean(attrs, "keepNext", "paragraph.attrs.keepNext", issues);
168
+ optionalBoolean(attrs, "keepLines", "paragraph.attrs.keepLines", issues);
169
+ optionalBoolean(attrs, "contextualSpacing", "paragraph.attrs.contextualSpacing", issues);
170
+ const direction = attrs["direction"];
171
+ if (direction !== void 0 && direction !== null && !isParagraphDirection(direction)) issues.push({
172
+ path: "paragraph.attrs.direction",
173
+ message: "Expected a ParagraphDirection."
174
+ });
175
+ optionalOneOf(attrs, "sectionBreakType", "paragraph.attrs.sectionBreakType", issues, SECTION_BREAK_TYPES);
176
+ optionalStringArray(attrs, "listLevelNumFmts", "paragraph.attrs.listLevelNumFmts", issues);
177
+ optionalNumber(attrs, "listAbstractNumId", "paragraph.attrs.listAbstractNumId", issues);
178
+ optionalBorderMap(attrs, "borders", "paragraph.attrs.borders", issues, [
179
+ "top",
180
+ "bottom",
181
+ "left",
182
+ "right",
183
+ "between",
184
+ "bar"
185
+ ]);
186
+ optionalShading(attrs, "shading", "paragraph.attrs.shading", issues);
187
+ optionalTabStops(attrs, "tabs", "paragraph.attrs.tabs", issues);
188
+ optionalRecord(attrs, "spacingExplicit", "paragraph.attrs.spacingExplicit", issues);
189
+ optionalTextFormatting(attrs, "defaultTextFormatting", "paragraph.attrs.defaultTextFormatting", issues);
190
+ optionalRecord(attrs, "numPr", "paragraph.attrs.numPr", issues);
191
+ validateNumPr(attrs["numPr"], issues);
192
+ optionalBookmarkArray(attrs["bookmarks"], issues);
193
+ optionalEmptyHyperlinkArray(attrs["_emptyHyperlinks"], issues);
194
+ optionalAutospacingBase(attrs, issues);
195
+ optionalSectionProperties(attrs, "_sectionProperties", "paragraph.attrs._sectionProperties", issues);
196
+ optionalPropertyChanges(attrs, "_propertyChanges", "paragraph.attrs._propertyChanges", issues, ["paragraphPropertyChange"]);
197
+ return attrsResult(attrs, issues);
198
+ };
199
+ const expectParagraphAttrs = (node) => expectCachedNodeAttrs(node, paragraphAttrsCache, readParagraphAttrs, "paragraph attrs");
200
+ const readHardBreakAttrs = (node) => {
201
+ const attrs = attrsRecord(node.attrs);
202
+ const issues = [];
203
+ expectNodeType(node, "hardBreak", issues);
204
+ optionalOneOf(attrs, "breakType", "hardBreak.attrs.breakType", issues, HARD_BREAK_TYPES);
205
+ return attrsResult(attrs, issues);
206
+ };
207
+ const expectHardBreakAttrs = (node) => expectCachedNodeAttrs(node, hardBreakAttrsCache, readHardBreakAttrs, "hard break attrs");
208
+ const readTableAttrs = (node) => {
209
+ const attrs = attrsRecord(node.attrs);
210
+ const issues = [];
211
+ expectNodeType(node, "table", issues);
212
+ optionalString(attrs, "styleId", "table.attrs.styleId", issues);
213
+ optionalNumber(attrs, "width", "table.attrs.width", issues);
214
+ optionalOneOf(attrs, "widthType", "table.attrs.widthType", issues, TABLE_WIDTH_TYPE_VALUES);
215
+ optionalOneOf(attrs, "justification", "table.attrs.justification", issues, TABLE_JUSTIFICATION_VALUES);
216
+ optionalNumberArray(attrs, "columnWidths", "table.attrs.columnWidths", issues);
217
+ optionalRecord(attrs, "floating", "table.attrs.floating", issues);
218
+ optionalInsetMap(attrs, "cellMargins", "table.attrs.cellMargins", issues);
219
+ optionalRecord(attrs, "look", "table.attrs.look", issues);
220
+ optionalBorderMap(attrs, "borders", "table.attrs.borders", issues, [
221
+ "top",
222
+ "bottom",
223
+ "left",
224
+ "right",
225
+ "insideH",
226
+ "insideV"
227
+ ]);
228
+ optionalRecord(attrs, "_originalFormatting", "table.attrs._originalFormatting", issues);
229
+ return attrsResult(attrs, issues);
230
+ };
231
+ const expectTableAttrs = (node) => expectCachedNodeAttrs(node, tableAttrsCache, readTableAttrs, "table attrs");
232
+ const readTableRowAttrs = (node) => {
233
+ const attrs = attrsRecord(node.attrs);
234
+ const issues = [];
235
+ expectNodeType(node, "tableRow", issues);
236
+ optionalNumber(attrs, "height", "tableRow.attrs.height", issues);
237
+ optionalOneOf(attrs, "heightRule", "tableRow.attrs.heightRule", issues, TABLE_ROW_HEIGHT_RULE_VALUES);
238
+ optionalBoolean(attrs, "isHeader", "tableRow.attrs.isHeader", issues);
239
+ optionalRecord(attrs, "_originalFormatting", "tableRow.attrs._originalFormatting", issues);
240
+ return attrsResult(attrs, issues);
241
+ };
242
+ const expectTableRowAttrs = (node) => expectCachedNodeAttrs(node, tableRowAttrsCache, readTableRowAttrs, "table row attrs");
243
+ const readTableCellAttrs = (node) => {
244
+ const attrs = attrsRecord(node.attrs);
245
+ const issues = [];
246
+ expectNodeTypeOneOf(node, ["tableCell", "tableHeader"], issues);
247
+ requiredNumber(attrs, "colspan", "tableCell.attrs.colspan", issues);
248
+ requiredNumber(attrs, "rowspan", "tableCell.attrs.rowspan", issues);
249
+ optionalNumberArray(attrs, "colwidth", "tableCell.attrs.colwidth", issues, { allowNull: true });
250
+ optionalNumber(attrs, "width", "tableCell.attrs.width", issues);
251
+ optionalOneOf(attrs, "widthType", "tableCell.attrs.widthType", issues, TABLE_WIDTH_TYPE_VALUES);
252
+ optionalOneOf(attrs, "verticalAlign", "tableCell.attrs.verticalAlign", issues, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES);
253
+ optionalString(attrs, "backgroundColor", "tableCell.attrs.backgroundColor", issues);
254
+ optionalOneOf(attrs, "textDirection", "tableCell.attrs.textDirection", issues, TABLE_CELL_TEXT_DIRECTION_VALUES);
255
+ optionalBoolean(attrs, "noWrap", "tableCell.attrs.noWrap", issues);
256
+ optionalBorderMap(attrs, "borders", "tableCell.attrs.borders", issues, [
257
+ "top",
258
+ "bottom",
259
+ "left",
260
+ "right"
261
+ ]);
262
+ optionalInsetMap(attrs, "margins", "tableCell.attrs.margins", issues);
263
+ optionalRecord(attrs, "_originalFormatting", "tableCell.attrs._originalFormatting", issues);
264
+ optionalBoolean(attrs, "_preserveVMergeRestart", "tableCell.attrs._preserveVMergeRestart", issues);
265
+ optionalArray(attrs, "_docxVMergeContinuationCells", "tableCell.attrs._docxVMergeContinuationCells", issues);
266
+ return attrsResult(attrs, issues);
267
+ };
268
+ const expectTableCellAttrs = (node) => expectCachedNodeAttrs(node, tableCellAttrsCache, readTableCellAttrs, "table cell attrs");
269
+ const readImageAttrs = (node) => {
270
+ const attrs = attrsRecord(node.attrs);
271
+ const issues = [];
272
+ expectNodeType(node, "image", issues);
273
+ requiredString(attrs, "src", "image.attrs.src", issues);
274
+ optionalString(attrs, "alt", "image.attrs.alt", issues);
275
+ optionalString(attrs, "title", "image.attrs.title", issues);
276
+ optionalString(attrs, "rId", "image.attrs.rId", issues);
277
+ optionalNumber(attrs, "width", "image.attrs.width", issues);
278
+ optionalNumber(attrs, "height", "image.attrs.height", issues);
279
+ optionalOneOf(attrs, "wrapType", "image.attrs.wrapType", issues, IMAGE_WRAP_TYPE_VALUES);
280
+ optionalOneOf(attrs, "displayMode", "image.attrs.displayMode", issues, IMAGE_DISPLAY_MODES);
281
+ optionalOneOf(attrs, "cssFloat", "image.attrs.cssFloat", issues, IMAGE_CSS_FLOATS);
282
+ optionalString(attrs, "transform", "image.attrs.transform", issues);
283
+ optionalNumber(attrs, "distTop", "image.attrs.distTop", issues);
284
+ optionalNumber(attrs, "distBottom", "image.attrs.distBottom", issues);
285
+ optionalNumber(attrs, "distLeft", "image.attrs.distLeft", issues);
286
+ optionalNumber(attrs, "distRight", "image.attrs.distRight", issues);
287
+ optionalImagePosition(attrs, "position", "image.attrs.position", issues);
288
+ optionalNumber(attrs, "borderWidth", "image.attrs.borderWidth", issues);
289
+ optionalString(attrs, "borderColor", "image.attrs.borderColor", issues);
290
+ optionalString(attrs, "borderStyle", "image.attrs.borderStyle", issues);
291
+ optionalOneOf(attrs, "wrapText", "image.attrs.wrapText", issues, IMAGE_WRAP_TEXT_VALUES);
292
+ optionalString(attrs, "hlinkHref", "image.attrs.hlinkHref", issues);
293
+ optionalString(attrs, "_docxRawXml", "image.attrs._docxRawXml", issues);
294
+ return attrsResult(attrs, issues);
295
+ };
296
+ const expectImageAttrs = (node) => expectCachedNodeAttrs(node, imageAttrsCache, readImageAttrs, "image attrs");
297
+ const readFieldAttrs = (node) => {
298
+ const attrs = attrsRecord(node.attrs);
299
+ const issues = [];
300
+ expectNodeType(node, "field", issues);
301
+ requiredOneOf(attrs, "fieldType", "field.attrs.fieldType", issues, FIELD_TYPE_VALUES);
302
+ requiredString(attrs, "instruction", "field.attrs.instruction", issues);
303
+ requiredString(attrs, "displayText", "field.attrs.displayText", issues);
304
+ requiredOneOf(attrs, "fieldKind", "field.attrs.fieldKind", issues, FIELD_KINDS);
305
+ optionalBoolean(attrs, "fldLock", "field.attrs.fldLock", issues);
306
+ optionalBoolean(attrs, "dirty", "field.attrs.dirty", issues);
307
+ return attrsResult(attrs, issues);
308
+ };
309
+ const expectFieldAttrs = (node) => expectCachedNodeAttrs(node, fieldAttrsCache, readFieldAttrs, "field attrs");
310
+ const readMathAttrs = (node) => {
311
+ const attrs = attrsRecord(node.attrs);
312
+ const issues = [];
313
+ expectNodeType(node, "math", issues);
314
+ optionalOneOf(attrs, "display", "math.attrs.display", issues, MATH_DISPLAYS);
315
+ requiredString(attrs, "ommlXml", "math.attrs.ommlXml", issues);
316
+ optionalString(attrs, "plainText", "math.attrs.plainText", issues);
317
+ return attrsResult(attrs, issues);
318
+ };
319
+ const expectMathAttrs = (node) => expectCachedNodeAttrs(node, mathAttrsCache, readMathAttrs, "math attrs");
320
+ const readSdtAttrs = (node) => {
321
+ const attrs = attrsRecord(node.attrs);
322
+ const issues = [];
323
+ expectNodeType(node, "sdt", issues);
324
+ requiredOneOf(attrs, "sdtType", "sdt.attrs.sdtType", issues, SDT_TYPE_VALUES);
325
+ optionalString(attrs, "alias", "sdt.attrs.alias", issues);
326
+ optionalString(attrs, "tag", "sdt.attrs.tag", issues);
327
+ optionalNumber(attrs, "id", "sdt.attrs.id", issues);
328
+ optionalOneOf(attrs, "lock", "sdt.attrs.lock", issues, SDT_LOCK_VALUES);
329
+ optionalString(attrs, "placeholder", "sdt.attrs.placeholder", issues);
330
+ optionalBoolean(attrs, "showingPlaceholder", "sdt.attrs.showingPlaceholder", issues);
331
+ optionalString(attrs, "dateFormat", "sdt.attrs.dateFormat", issues);
332
+ optionalString(attrs, "dateValueISO", "sdt.attrs.dateValueISO", issues);
333
+ optionalSdtListItems(attrs, "listItems", "sdt.attrs.listItems", issues);
334
+ optionalString(attrs, "dropdownLastValue", "sdt.attrs.dropdownLastValue", issues);
335
+ optionalBoolean(attrs, "checked", "sdt.attrs.checked", issues);
336
+ optionalString(attrs, "rawPropertiesXml", "sdt.attrs.rawPropertiesXml", issues);
337
+ optionalString(attrs, "rawEndPropertiesXml", "sdt.attrs.rawEndPropertiesXml", issues);
338
+ return attrsResult(attrs, issues);
339
+ };
340
+ const expectSdtAttrs = (node) => expectCachedNodeAttrs(node, sdtAttrsCache, readSdtAttrs, "sdt attrs");
341
+ const blockSdtAttrsCache = /* @__PURE__ */ new WeakMap();
342
+ const readBlockSdtAttrs = (node) => {
343
+ const attrs = attrsRecord(node.attrs);
344
+ const issues = [];
345
+ expectNodeType(node, "blockSdt", issues);
346
+ requiredOneOf(attrs, "sdtType", "blockSdt.attrs.sdtType", issues, SDT_TYPE_VALUES);
347
+ optionalString(attrs, "alias", "blockSdt.attrs.alias", issues);
348
+ optionalString(attrs, "tag", "blockSdt.attrs.tag", issues);
349
+ optionalNumber(attrs, "id", "blockSdt.attrs.id", issues);
350
+ optionalOneOf(attrs, "lock", "blockSdt.attrs.lock", issues, SDT_LOCK_VALUES);
351
+ optionalString(attrs, "placeholder", "blockSdt.attrs.placeholder", issues);
352
+ optionalBoolean(attrs, "showingPlaceholder", "blockSdt.attrs.showingPlaceholder", issues);
353
+ optionalString(attrs, "dateFormat", "blockSdt.attrs.dateFormat", issues);
354
+ optionalString(attrs, "dateValueISO", "blockSdt.attrs.dateValueISO", issues);
355
+ optionalSdtListItems(attrs, "listItems", "blockSdt.attrs.listItems", issues);
356
+ optionalString(attrs, "dropdownLastValue", "blockSdt.attrs.dropdownLastValue", issues);
357
+ optionalBoolean(attrs, "checked", "blockSdt.attrs.checked", issues);
358
+ optionalBoolean(attrs, "_originallyEmpty", "blockSdt.attrs._originallyEmpty", issues);
359
+ optionalString(attrs, "rawPropertiesXml", "blockSdt.attrs.rawPropertiesXml", issues);
360
+ optionalString(attrs, "rawEndPropertiesXml", "blockSdt.attrs.rawEndPropertiesXml", issues);
361
+ optionalString(attrs, "rawSdtChildrenBeforeContent", "blockSdt.attrs.rawSdtChildrenBeforeContent", issues);
362
+ optionalString(attrs, "rawSdtChildrenAfterContent", "blockSdt.attrs.rawSdtChildrenAfterContent", issues);
363
+ return attrsResult(attrs, issues);
364
+ };
365
+ const expectBlockSdtAttrs = (node) => expectCachedNodeAttrs(node, blockSdtAttrsCache, readBlockSdtAttrs, "blockSdt attrs");
366
+ const readShapeAttrs = (node) => {
367
+ const attrs = attrsRecord(node.attrs);
368
+ const issues = [];
369
+ expectNodeType(node, "shape", issues);
370
+ optionalString(attrs, "shapeType", "shape.attrs.shapeType", issues);
371
+ optionalString(attrs, "shapeId", "shape.attrs.shapeId", issues);
372
+ optionalNumber(attrs, "width", "shape.attrs.width", issues);
373
+ optionalNumber(attrs, "height", "shape.attrs.height", issues);
374
+ optionalString(attrs, "fillColor", "shape.attrs.fillColor", issues);
375
+ optionalOneOf(attrs, "fillType", "shape.attrs.fillType", issues, SHAPE_FILL_TYPES);
376
+ optionalOneOf(attrs, "gradientType", "shape.attrs.gradientType", issues, SHAPE_GRADIENT_TYPES);
377
+ optionalNumber(attrs, "gradientAngle", "shape.attrs.gradientAngle", issues);
378
+ optionalGradientStops(attrs, "gradientStops", "shape.attrs.gradientStops", issues);
379
+ optionalNumber(attrs, "outlineWidth", "shape.attrs.outlineWidth", issues);
380
+ optionalString(attrs, "outlineColor", "shape.attrs.outlineColor", issues);
381
+ optionalOneOf(attrs, "outlineStyle", "shape.attrs.outlineStyle", issues, OUTLINE_STYLE_ATTR_VALUES);
382
+ optionalOneOf(attrs, "outlineCap", "shape.attrs.outlineCap", issues, SHAPE_OUTLINE_CAPS);
383
+ optionalShapeLineEnd(attrs, "outlineHeadEnd", "shape.attrs.outlineHeadEnd", issues);
384
+ optionalShapeLineEnd(attrs, "outlineTailEnd", "shape.attrs.outlineTailEnd", issues);
385
+ optionalString(attrs, "transform", "shape.attrs.transform", issues);
386
+ optionalOneOf(attrs, "displayMode", "shape.attrs.displayMode", issues, IMAGE_DISPLAY_MODES);
387
+ optionalOneOf(attrs, "cssFloat", "shape.attrs.cssFloat", issues, IMAGE_CSS_FLOATS);
388
+ optionalOneOf(attrs, "wrapType", "shape.attrs.wrapType", issues, IMAGE_WRAP_TYPE_VALUES);
389
+ optionalOneOf(attrs, "wrapText", "shape.attrs.wrapText", issues, IMAGE_WRAP_TEXT_VALUES);
390
+ optionalNumber(attrs, "distTop", "shape.attrs.distTop", issues);
391
+ optionalNumber(attrs, "distBottom", "shape.attrs.distBottom", issues);
392
+ optionalNumber(attrs, "distLeft", "shape.attrs.distLeft", issues);
393
+ optionalNumber(attrs, "distRight", "shape.attrs.distRight", issues);
394
+ optionalImagePosition(attrs, "position", "shape.attrs.position", issues);
395
+ optionalString(attrs, "shadowColor", "shape.attrs.shadowColor", issues);
396
+ optionalNumber(attrs, "shadowBlur", "shape.attrs.shadowBlur", issues);
397
+ optionalNumber(attrs, "shadowOffsetX", "shape.attrs.shadowOffsetX", issues);
398
+ optionalNumber(attrs, "shadowOffsetY", "shape.attrs.shadowOffsetY", issues);
399
+ optionalString(attrs, "glowColor", "shape.attrs.glowColor", issues);
400
+ optionalNumber(attrs, "glowRadius", "shape.attrs.glowRadius", issues);
401
+ return attrsResult(attrs, issues);
402
+ };
403
+ const expectShapeAttrs = (node) => expectCachedNodeAttrs(node, shapeAttrsCache, readShapeAttrs, "shape attrs");
404
+ const readTextBoxAttrs = (node) => {
405
+ const attrs = attrsRecord(node.attrs);
406
+ const issues = [];
407
+ expectNodeType(node, "textBox", issues);
408
+ optionalNumber(attrs, "width", "textBox.attrs.width", issues);
409
+ optionalNumber(attrs, "height", "textBox.attrs.height", issues);
410
+ optionalString(attrs, "textBoxId", "textBox.attrs.textBoxId", issues);
411
+ optionalString(attrs, "fillColor", "textBox.attrs.fillColor", issues);
412
+ optionalNumber(attrs, "outlineWidth", "textBox.attrs.outlineWidth", issues);
413
+ optionalString(attrs, "outlineColor", "textBox.attrs.outlineColor", issues);
414
+ optionalOneOf(attrs, "outlineStyle", "textBox.attrs.outlineStyle", issues, OUTLINE_STYLE_ATTR_VALUES);
415
+ optionalNumber(attrs, "marginTop", "textBox.attrs.marginTop", issues);
416
+ optionalNumber(attrs, "marginBottom", "textBox.attrs.marginBottom", issues);
417
+ optionalNumber(attrs, "marginLeft", "textBox.attrs.marginLeft", issues);
418
+ optionalNumber(attrs, "marginRight", "textBox.attrs.marginRight", issues);
419
+ optionalString(attrs, "verticalAlign", "textBox.attrs.verticalAlign", issues);
420
+ optionalOneOf(attrs, "displayMode", "textBox.attrs.displayMode", issues, IMAGE_DISPLAY_MODES);
421
+ optionalOneOf(attrs, "cssFloat", "textBox.attrs.cssFloat", issues, IMAGE_CSS_FLOATS);
422
+ optionalOneOf(attrs, "wrapType", "textBox.attrs.wrapType", issues, IMAGE_WRAP_TYPE_VALUES);
423
+ optionalOneOf(attrs, "wrapText", "textBox.attrs.wrapText", issues, IMAGE_WRAP_TEXT_VALUES);
424
+ optionalNumber(attrs, "distTop", "textBox.attrs.distTop", issues);
425
+ optionalNumber(attrs, "distBottom", "textBox.attrs.distBottom", issues);
426
+ optionalNumber(attrs, "distLeft", "textBox.attrs.distLeft", issues);
427
+ optionalNumber(attrs, "distRight", "textBox.attrs.distRight", issues);
428
+ optionalImagePosition(attrs, "position", "textBox.attrs.position", issues);
429
+ optionalOneOf(attrs, "_docxPlacement", "textBox.attrs._docxPlacement", issues, TEXT_BOX_DOCX_PLACEMENTS);
430
+ optionalString(attrs, "_docxGroupId", "textBox.attrs._docxGroupId", issues);
431
+ return attrsResult(attrs, issues);
432
+ };
433
+ const expectTextBoxAttrs = (node) => expectCachedNodeAttrs(node, textBoxAttrsCache, readTextBoxAttrs, "text box attrs");
434
+ const readUnderlineMarkAttrs = (mark) => {
435
+ const attrs = attrsRecord(mark.attrs);
436
+ const issues = [];
437
+ expectMarkType(mark, "underline", issues);
438
+ optionalOneOf(attrs, "style", "underline.attrs.style", issues, UNDERLINE_STYLE_VALUES);
439
+ optionalTextColor(attrs, "color", "underline.attrs.color", issues);
440
+ return attrsResult(attrs, issues);
441
+ };
442
+ const expectUnderlineMarkAttrs = (mark) => expectCachedMarkAttrs(mark, underlineAttrsCache, readUnderlineMarkAttrs, "underline attrs");
443
+ const readStrikeMarkAttrs = (mark) => {
444
+ const attrs = attrsRecord(mark.attrs);
445
+ const issues = [];
446
+ expectMarkType(mark, "strike", issues);
447
+ optionalBoolean(attrs, "double", "strike.attrs.double", issues);
448
+ return attrsResult(attrs, issues);
449
+ };
450
+ const expectStrikeMarkAttrs = (mark) => expectCachedMarkAttrs(mark, strikeAttrsCache, readStrikeMarkAttrs, "strike attrs");
451
+ const readTextColorMarkAttrs = (mark) => {
452
+ const attrs = attrsRecord(mark.attrs);
453
+ const issues = [];
454
+ expectMarkType(mark, "textColor", issues);
455
+ optionalTextColorFields(attrs, "textColor.attrs", issues);
456
+ return attrsResult(attrs, issues);
457
+ };
458
+ const expectTextColorMarkAttrs = (mark) => expectCachedMarkAttrs(mark, textColorAttrsCache, readTextColorMarkAttrs, "text color attrs");
459
+ const readHighlightMarkAttrs = (mark) => {
460
+ const attrs = attrsRecord(mark.attrs);
461
+ const issues = [];
462
+ expectMarkType(mark, "highlight", issues);
463
+ requiredOneOf(attrs, "color", "highlight.attrs.color", issues, HIGHLIGHT_COLOR_VALUES);
464
+ return attrsResult(attrs, issues);
465
+ };
466
+ const expectHighlightMarkAttrs = (mark) => expectCachedMarkAttrs(mark, highlightAttrsCache, readHighlightMarkAttrs, "highlight attrs");
467
+ const readRunShadingMarkAttrs = (mark) => {
468
+ const attrs = attrsRecord(mark.attrs);
469
+ const issues = [];
470
+ expectMarkType(mark, "runShading", issues);
471
+ optionalTextColorFields(attrs, "runShading.attrs", issues);
472
+ optionalOneOf(attrs, "pattern", "runShading.attrs.pattern", issues, SHADING_PATTERN_VALUES);
473
+ optionalString(attrs, "patternColor", "runShading.attrs.patternColor", issues);
474
+ return attrsResult(attrs, issues);
475
+ };
476
+ const expectRunShadingMarkAttrs = (mark) => expectCachedMarkAttrs(mark, runShadingAttrsCache, readRunShadingMarkAttrs, "run shading attrs");
477
+ const readCharacterStyleMarkAttrs = (mark) => {
478
+ const attrs = attrsRecord(mark.attrs);
479
+ const issues = [];
480
+ expectMarkType(mark, "characterStyle", issues);
481
+ requiredString(attrs, "styleId", "characterStyle.attrs.styleId", issues);
482
+ optionalRecord(attrs, "_styleRPr", "characterStyle.attrs._styleRPr", issues);
483
+ return attrsResult(attrs, issues);
484
+ };
485
+ const expectCharacterStyleMarkAttrs = (mark) => expectCachedMarkAttrs(mark, characterStyleAttrsCache, readCharacterStyleMarkAttrs, "character style attrs");
486
+ const readFontSizeMarkAttrs = (mark) => {
487
+ const attrs = attrsRecord(mark.attrs);
488
+ const issues = [];
489
+ expectMarkType(mark, "fontSize", issues);
490
+ requiredNumber(attrs, "size", "fontSize.attrs.size", issues);
491
+ return attrsResult(attrs, issues);
492
+ };
493
+ const expectFontSizeMarkAttrs = (mark) => expectCachedMarkAttrs(mark, fontSizeAttrsCache, readFontSizeMarkAttrs, "font size attrs");
494
+ const readFontFamilyMarkAttrs = (mark) => {
495
+ const attrs = attrsRecord(mark.attrs);
496
+ const issues = [];
497
+ expectMarkType(mark, "fontFamily", issues);
498
+ optionalString(attrs, "ascii", "fontFamily.attrs.ascii", issues);
499
+ optionalString(attrs, "hAnsi", "fontFamily.attrs.hAnsi", issues);
500
+ optionalString(attrs, "eastAsia", "fontFamily.attrs.eastAsia", issues);
501
+ optionalString(attrs, "cs", "fontFamily.attrs.cs", issues);
502
+ optionalString(attrs, "asciiTheme", "fontFamily.attrs.asciiTheme", issues);
503
+ optionalString(attrs, "hAnsiTheme", "fontFamily.attrs.hAnsiTheme", issues);
504
+ optionalString(attrs, "eastAsiaTheme", "fontFamily.attrs.eastAsiaTheme", issues);
505
+ optionalString(attrs, "csTheme", "fontFamily.attrs.csTheme", issues);
506
+ return attrsResult(attrs, issues);
507
+ };
508
+ const expectFontFamilyMarkAttrs = (mark) => expectCachedMarkAttrs(mark, fontFamilyAttrsCache, readFontFamilyMarkAttrs, "font family attrs");
509
+ const readCharacterSpacingMarkAttrs = (mark) => {
510
+ const attrs = attrsRecord(mark.attrs);
511
+ const issues = [];
512
+ expectMarkType(mark, "characterSpacing", issues);
513
+ optionalNumber(attrs, "spacing", "characterSpacing.attrs.spacing", issues);
514
+ optionalNumber(attrs, "position", "characterSpacing.attrs.position", issues);
515
+ optionalNumber(attrs, "scale", "characterSpacing.attrs.scale", issues);
516
+ optionalNumber(attrs, "kerning", "characterSpacing.attrs.kerning", issues);
517
+ return attrsResult(attrs, issues);
518
+ };
519
+ const expectCharacterSpacingMarkAttrs = (mark) => expectCachedMarkAttrs(mark, characterSpacingAttrsCache, readCharacterSpacingMarkAttrs, "character spacing attrs");
520
+ const readEmphasisMarkAttrs = (mark) => {
521
+ const attrs = attrsRecord(mark.attrs);
522
+ const issues = [];
523
+ expectMarkType(mark, "emphasisMark", issues);
524
+ optionalOneOf(attrs, "type", "emphasisMark.attrs.type", issues, EMPHASIS_MARK_TYPES);
525
+ return attrsResult(attrs, issues);
526
+ };
527
+ const expectEmphasisMarkAttrs = (mark) => expectCachedMarkAttrs(mark, emphasisMarkAttrsCache, readEmphasisMarkAttrs, "emphasis mark attrs");
528
+ const readTextEffectMarkAttrs = (mark) => {
529
+ const attrs = attrsRecord(mark.attrs);
530
+ const issues = [];
531
+ expectMarkType(mark, "textEffect", issues);
532
+ requiredOneOf(attrs, "effect", "textEffect.attrs.effect", issues, TEXT_EFFECT_NON_NONE_VALUES);
533
+ return attrsResult(attrs, issues);
534
+ };
535
+ const expectTextEffectMarkAttrs = (mark) => expectCachedMarkAttrs(mark, textEffectAttrsCache, readTextEffectMarkAttrs, "text effect attrs");
536
+ const readFootnoteRefMarkAttrs = (mark) => {
537
+ const attrs = attrsRecord(mark.attrs);
538
+ const issues = [];
539
+ expectMarkType(mark, "footnoteRef", issues);
540
+ requiredStringOrNumber(attrs, "id", "footnoteRef.attrs.id", issues);
541
+ optionalOneOf(attrs, "noteType", "footnoteRef.attrs.noteType", issues, NOTE_TYPES);
542
+ optionalOneOf(attrs, "vertAlign", "footnoteRef.attrs.vertAlign", issues, NOTE_REF_VERT_ALIGNS);
543
+ return attrsResult(attrs, issues);
544
+ };
545
+ const expectFootnoteRefMarkAttrs = (mark) => expectCachedMarkAttrs(mark, footnoteRefAttrsCache, readFootnoteRefMarkAttrs, "footnote reference attrs");
546
+ const readCommentMarkAttrs = (mark) => {
547
+ const attrs = attrsRecord(mark.attrs);
548
+ const issues = [];
549
+ expectMarkType(mark, "comment", issues);
550
+ requiredNumber(attrs, "commentId", "comment.attrs.commentId", issues);
551
+ return attrsResult(attrs, issues);
552
+ };
553
+ const expectCommentMarkAttrs = (mark) => expectCachedMarkAttrs(mark, commentAttrsCache, readCommentMarkAttrs, "comment attrs");
554
+ const readTrackedChangeMarkAttrs = (mark) => {
555
+ const attrs = attrsRecord(mark.attrs);
556
+ const issues = [];
557
+ expectMarkTypeOneOf(mark, ["insertion", "deletion"], issues);
558
+ requiredNumber(attrs, "revisionId", `${mark.type.name}.attrs.revisionId`, issues);
559
+ requiredString(attrs, "author", `${mark.type.name}.attrs.author`, issues);
560
+ optionalString(attrs, "date", `${mark.type.name}.attrs.date`, issues);
561
+ optionalOneOf(attrs, "moveKind", `${mark.type.name}.attrs.moveKind`, issues, TRACKED_CHANGE_MOVE_KINDS);
562
+ return attrsResult(attrs, issues);
563
+ };
564
+ const expectTrackedChangeMarkAttrs = (mark) => expectCachedMarkAttrs(mark, trackedChangeAttrsCache, readTrackedChangeMarkAttrs, "tracked change attrs");
565
+ const readRunFormattingOverrideMarkAttrs = (mark) => {
566
+ const attrs = attrsRecord(mark.attrs);
567
+ const issues = [];
568
+ expectMarkType(mark, "runFormattingOverride", issues);
569
+ for (const key of RUN_FORMATTING_OVERRIDE_FALSE_KEYS) optionalFalse(attrs, key, `runFormattingOverride.attrs.${key}`, issues);
570
+ optionalOneOf(attrs, "underline", "runFormattingOverride.attrs.underline", issues, ["none"]);
571
+ return attrsResult(attrs, issues);
572
+ };
573
+ const expectRunFormattingOverrideMarkAttrs = (mark) => expectCachedMarkAttrs(mark, runFormattingOverrideAttrsCache, readRunFormattingOverrideMarkAttrs, "run formatting override attrs");
574
+ const readHyperlinkMarkAttrs = (mark) => {
575
+ const attrs = attrsRecord(mark.attrs);
576
+ const issues = [];
577
+ expectMarkType(mark, "hyperlink", issues);
578
+ requiredString(attrs, "href", "hyperlink.attrs.href", issues);
579
+ optionalString(attrs, "tooltip", "hyperlink.attrs.tooltip", issues);
580
+ optionalString(attrs, "rId", "hyperlink.attrs.rId", issues);
581
+ validateNonNegativeInteger(attrs["_docxHyperlinkIndex"], "hyperlink.attrs._docxHyperlinkIndex", issues);
582
+ return attrsResult(attrs, issues);
583
+ };
584
+ const expectHyperlinkMarkAttrs = (mark) => expectCachedMarkAttrs(mark, hyperlinkAttrsCache, readHyperlinkMarkAttrs, "hyperlink attrs");
585
+ const mergeNodeAttrs = (node, readAttrs, label, patch) => {
586
+ const mergedAttrs = {
587
+ ...expectAttrs(readAttrs(node), label),
588
+ ...patch
589
+ };
590
+ const nextAttrs = {};
591
+ for (const [key, value] of Object.entries(mergedAttrs)) if (value !== void 0) nextAttrs[key] = value;
592
+ return nextAttrs;
593
+ };
594
+ const mergeImageAttrs = (node, patch) => mergeNodeAttrs(node, readImageAttrs, "image attrs", patch);
595
+ const mergeParagraphAttrs = (node, patch) => mergeNodeAttrs(node, readParagraphAttrs, "paragraph attrs", patch);
596
+ const mergeTableAttrs = (node, patch) => mergeNodeAttrs(node, readTableAttrs, "table attrs", patch);
597
+ const mergeTableRowAttrs = (node, patch) => mergeNodeAttrs(node, readTableRowAttrs, "table row attrs", patch);
598
+ const mergeTableCellAttrs = (node, patch) => mergeNodeAttrs(node, readTableCellAttrs, "table cell attrs", patch);
599
+ const attrsRecord = (attrs) => {
600
+ if (isRecord(attrs)) return attrs;
601
+ return {};
602
+ };
603
+ const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
604
+ const attrsResult = (attrs, issues) => {
605
+ if (issues.length > 0) return {
606
+ ok: false,
607
+ issues
608
+ };
609
+ const normalizedAttrs = {};
610
+ for (const [key, value] of Object.entries(attrs)) if (value !== null) normalizedAttrs[key] = value;
611
+ return {
612
+ ok: true,
613
+ value: normalizedAttrs
614
+ };
615
+ };
616
+ const expectAttrs = (result, label) => {
617
+ if (result.ok) return result.value;
618
+ panic(`Invalid ProseMirror ${label}:\n${result.issues.map((issue) => `${issue.path}: ${issue.message}`).join("\n")}`);
619
+ };
620
+ function expectCachedNodeAttrs(node, cache, reader, label) {
621
+ const cached = cache.get(node);
622
+ if (cached) return cached;
623
+ const value = expectAttrs(reader(node), label);
624
+ cache.set(node, value);
625
+ return value;
626
+ }
627
+ function expectCachedMarkAttrs(mark, cache, reader, label) {
628
+ const cached = cache.get(mark);
629
+ if (cached) return cached;
630
+ const value = expectAttrs(reader(mark), label);
631
+ cache.set(mark, value);
632
+ return value;
633
+ }
634
+ const expectNodeType = (node, expected, issues) => {
635
+ if (node.type.name !== expected) issues.push({
636
+ path: "node.type.name",
637
+ message: `Expected ${expected}, got ${node.type.name}.`
638
+ });
639
+ };
640
+ const expectNodeTypeOneOf = (node, expected, issues) => {
641
+ if (!expected.includes(node.type.name)) issues.push({
642
+ path: "node.type.name",
643
+ message: `Expected one of ${expected.join(", ")}, got ${node.type.name}.`
644
+ });
645
+ };
646
+ const expectMarkType = (mark, expected, issues) => {
647
+ if (mark.type.name !== expected) issues.push({
648
+ path: "mark.type.name",
649
+ message: `Expected ${expected}, got ${mark.type.name}.`
650
+ });
651
+ };
652
+ const expectMarkTypeOneOf = (mark, expected, issues) => {
653
+ if (!expected.includes(mark.type.name)) issues.push({
654
+ path: "mark.type.name",
655
+ message: `Expected one of ${expected.join(", ")}, got ${mark.type.name}.`
656
+ });
657
+ };
658
+ const requiredString = (attrs, key, path, issues) => {
659
+ if (typeof attrs[key] !== "string") issues.push({
660
+ path,
661
+ message: "Expected a string."
662
+ });
663
+ };
664
+ const requiredStringOrNumber = (attrs, key, path, issues) => {
665
+ const value = attrs[key];
666
+ if (typeof value !== "string" && typeof value !== "number") issues.push({
667
+ path,
668
+ message: "Expected a string or number."
669
+ });
670
+ };
671
+ const optionalString = (attrs, key, path, issues) => {
672
+ const value = attrs[key];
673
+ if (value !== void 0 && value !== null && typeof value !== "string") issues.push({
674
+ path,
675
+ message: "Expected a string."
676
+ });
677
+ };
678
+ const optionalSdtListItems = (attrs, key, path, issues) => {
679
+ const value = attrs[key];
680
+ if (value === void 0 || value === null) return;
681
+ if (typeof value !== "string") {
682
+ issues.push({
683
+ path,
684
+ message: "Expected a JSON string."
685
+ });
686
+ return;
687
+ }
688
+ const parsed = parseJson(value, path, issues);
689
+ if (!parsed.ok) return;
690
+ if (!Array.isArray(parsed.value)) {
691
+ issues.push({
692
+ path,
693
+ message: "Expected a JSON array."
694
+ });
695
+ return;
696
+ }
697
+ for (const [index, item] of parsed.value.entries()) {
698
+ if (!isRecord(item)) {
699
+ issues.push({
700
+ path: `${path}[${index}]`,
701
+ message: "Expected a list item object."
702
+ });
703
+ continue;
704
+ }
705
+ if (typeof item["displayText"] !== "string") issues.push({
706
+ path: `${path}[${index}].displayText`,
707
+ message: "Expected a string."
708
+ });
709
+ if (typeof item["value"] !== "string") issues.push({
710
+ path: `${path}[${index}].value`,
711
+ message: "Expected a string."
712
+ });
713
+ }
714
+ };
715
+ const optionalGradientStops = (attrs, key, path, issues) => {
716
+ const value = attrs[key];
717
+ if (value === void 0 || value === null) return;
718
+ if (typeof value !== "string") {
719
+ issues.push({
720
+ path,
721
+ message: "Expected a JSON string."
722
+ });
723
+ return;
724
+ }
725
+ const parsed = parseJson(value, path, issues);
726
+ if (!parsed.ok) return;
727
+ if (!Array.isArray(parsed.value)) {
728
+ issues.push({
729
+ path,
730
+ message: "Expected a JSON array."
731
+ });
732
+ return;
733
+ }
734
+ for (const [index, item] of parsed.value.entries()) {
735
+ if (!isRecord(item)) {
736
+ issues.push({
737
+ path: `${path}[${index}]`,
738
+ message: "Expected a gradient stop object."
739
+ });
740
+ continue;
741
+ }
742
+ if (typeof item["position"] !== "number") issues.push({
743
+ path: `${path}[${index}].position`,
744
+ message: "Expected a number."
745
+ });
746
+ if (typeof item["color"] !== "string") issues.push({
747
+ path: `${path}[${index}].color`,
748
+ message: "Expected a string."
749
+ });
750
+ }
751
+ };
752
+ const parseJson = (value, path, issues) => {
753
+ try {
754
+ return {
755
+ ok: true,
756
+ value: JSON.parse(value)
757
+ };
758
+ } catch {
759
+ issues.push({
760
+ path,
761
+ message: "Expected valid JSON."
762
+ });
763
+ return { ok: false };
764
+ }
765
+ };
766
+ const optionalFalse = (attrs, key, path, issues) => {
767
+ const value = attrs[key];
768
+ if (value !== void 0 && value !== null && value !== false) issues.push({
769
+ path,
770
+ message: "Expected false."
771
+ });
772
+ };
773
+ const optionalOneOf = (attrs, key, path, issues, allowed) => {
774
+ const value = attrs[key];
775
+ if (value === void 0 || value === null) return;
776
+ if (typeof value !== "string") {
777
+ issues.push({
778
+ path,
779
+ message: "Expected a string."
780
+ });
781
+ return;
782
+ }
783
+ if (!allowed.includes(value)) issues.push({
784
+ path,
785
+ message: `Expected one of ${allowed.join(", ")}.`
786
+ });
787
+ };
788
+ const optionalShapeLineEnd = (attrs, key, path, issues) => {
789
+ const value = attrs[key];
790
+ if (value === void 0 || value === null) return;
791
+ if (!isRecord(value)) {
792
+ issues.push({
793
+ path,
794
+ message: "Expected an object."
795
+ });
796
+ return;
797
+ }
798
+ optionalOneOf(value, "type", `${path}.type`, issues, SHAPE_LINE_END_TYPES);
799
+ optionalOneOf(value, "width", `${path}.width`, issues, SHAPE_LINE_END_SIZES);
800
+ optionalOneOf(value, "length", `${path}.length`, issues, SHAPE_LINE_END_SIZES);
801
+ };
802
+ const requiredOneOf = (attrs, key, path, issues, allowed) => {
803
+ const value = attrs[key];
804
+ if (typeof value !== "string") {
805
+ issues.push({
806
+ path,
807
+ message: "Expected a string."
808
+ });
809
+ return;
810
+ }
811
+ if (!allowed.includes(value)) issues.push({
812
+ path,
813
+ message: `Expected one of ${allowed.join(", ")}.`
814
+ });
815
+ };
816
+ const optionalTextColor = (attrs, key, path, issues) => {
817
+ const value = attrs[key];
818
+ if (value === void 0 || value === null) return;
819
+ if (!isRecord(value)) {
820
+ issues.push({
821
+ path,
822
+ message: "Expected an object."
823
+ });
824
+ return;
825
+ }
826
+ optionalTextColorFields(value, path, issues);
827
+ };
828
+ const optionalTextColorFields = (attrs, path, issues) => {
829
+ optionalString(attrs, "rgb", `${path}.rgb`, issues);
830
+ optionalOneOf(attrs, "themeColor", `${path}.themeColor`, issues, THEME_COLOR_SLOT_VALUES);
831
+ optionalString(attrs, "themeTint", `${path}.themeTint`, issues);
832
+ optionalString(attrs, "themeShade", `${path}.themeShade`, issues);
833
+ };
834
+ const requiredNumber = (attrs, key, path, issues) => {
835
+ if (typeof attrs[key] !== "number") issues.push({
836
+ path,
837
+ message: "Expected a number."
838
+ });
839
+ };
840
+ const optionalNumber = (attrs, key, path, issues) => {
841
+ const value = attrs[key];
842
+ if (value !== void 0 && value !== null && typeof value !== "number") issues.push({
843
+ path,
844
+ message: "Expected a number."
845
+ });
846
+ };
847
+ const optionalBoolean = (attrs, key, path, issues) => {
848
+ const value = attrs[key];
849
+ if (value !== void 0 && value !== null && typeof value !== "boolean") issues.push({
850
+ path,
851
+ message: "Expected a boolean."
852
+ });
853
+ };
854
+ const optionalRecord = (attrs, key, path, issues) => {
855
+ const value = attrs[key];
856
+ if (value !== void 0 && value !== null && !isRecord(value)) issues.push({
857
+ path,
858
+ message: "Expected an object."
859
+ });
860
+ };
861
+ const optionalAutospacingBase = (attrs, issues) => {
862
+ const value = attrs["_autospacingBase"];
863
+ if (value === void 0 || value === null) return;
864
+ if (!isRecord(value)) {
865
+ issues.push({
866
+ path: "paragraph.attrs._autospacingBase",
867
+ message: "Expected an object."
868
+ });
869
+ return;
870
+ }
871
+ optionalNumber(value, "before", "paragraph.attrs._autospacingBase.before", issues);
872
+ optionalNumber(value, "after", "paragraph.attrs._autospacingBase.after", issues);
873
+ };
874
+ const optionalArray = (attrs, key, path, issues) => {
875
+ const value = attrs[key];
876
+ if (value !== void 0 && value !== null && !Array.isArray(value)) issues.push({
877
+ path,
878
+ message: "Expected an array."
879
+ });
880
+ };
881
+ const optionalBorderMap = (attrs, key, path, issues, sides) => {
882
+ const value = attrs[key];
883
+ if (value === void 0 || value === null) return;
884
+ if (!isRecord(value)) {
885
+ issues.push({
886
+ path,
887
+ message: "Expected an object."
888
+ });
889
+ return;
890
+ }
891
+ for (const side of sides) validateBorderSpec(value[side], `${path}.${side}`, issues);
892
+ };
893
+ const validateBorderSpec = (value, path, issues) => {
894
+ if (value === void 0 || value === null) return;
895
+ if (!isRecord(value)) {
896
+ issues.push({
897
+ path,
898
+ message: "Expected an object."
899
+ });
900
+ return;
901
+ }
902
+ optionalString(value, "style", `${path}.style`, issues);
903
+ optionalNumber(value, "size", `${path}.size`, issues);
904
+ optionalNumber(value, "space", `${path}.space`, issues);
905
+ optionalBoolean(value, "shadow", `${path}.shadow`, issues);
906
+ optionalBoolean(value, "frame", `${path}.frame`, issues);
907
+ optionalColorValue(value, "color", `${path}.color`, issues);
908
+ };
909
+ const optionalColorValue = (attrs, key, path, issues) => {
910
+ const value = attrs[key];
911
+ if (value === void 0 || value === null) return;
912
+ if (!isRecord(value)) {
913
+ issues.push({
914
+ path,
915
+ message: "Expected an object."
916
+ });
917
+ return;
918
+ }
919
+ optionalString(value, "rgb", `${path}.rgb`, issues);
920
+ optionalBoolean(value, "auto", `${path}.auto`, issues);
921
+ optionalOneOf(value, "themeColor", `${path}.themeColor`, issues, THEME_COLOR_SLOT_VALUES);
922
+ optionalString(value, "themeTint", `${path}.themeTint`, issues);
923
+ optionalString(value, "themeShade", `${path}.themeShade`, issues);
924
+ };
925
+ const optionalShading = (attrs, key, path, issues) => {
926
+ const value = attrs[key];
927
+ if (value === void 0 || value === null) return;
928
+ if (!isRecord(value)) {
929
+ issues.push({
930
+ path,
931
+ message: "Expected an object."
932
+ });
933
+ return;
934
+ }
935
+ optionalColorValue(value, "color", `${path}.color`, issues);
936
+ optionalColorValue(value, "fill", `${path}.fill`, issues);
937
+ optionalOneOf(value, "pattern", `${path}.pattern`, issues, SHADING_PATTERN_VALUES);
938
+ };
939
+ const optionalTabStops = (attrs, key, path, issues) => {
940
+ const value = attrs[key];
941
+ if (value === void 0 || value === null) return;
942
+ if (!Array.isArray(value)) {
943
+ issues.push({
944
+ path,
945
+ message: "Expected an array."
946
+ });
947
+ return;
948
+ }
949
+ for (const [index, item] of value.entries()) {
950
+ const itemPath = `${path}[${index}]`;
951
+ if (!isRecord(item)) {
952
+ issues.push({
953
+ path: itemPath,
954
+ message: "Expected an object."
955
+ });
956
+ continue;
957
+ }
958
+ requiredNumber(item, "position", `${itemPath}.position`, issues);
959
+ requiredOneOf(item, "alignment", `${itemPath}.alignment`, issues, TAB_STOP_ALIGNMENT_VALUES);
960
+ optionalOneOf(item, "leader", `${itemPath}.leader`, issues, TAB_LEADER_VALUES);
961
+ }
962
+ };
963
+ const optionalTextFormatting = (attrs, key, path, issues) => {
964
+ const value = attrs[key];
965
+ if (value === void 0 || value === null) return;
966
+ if (!isRecord(value)) {
967
+ issues.push({
968
+ path,
969
+ message: "Expected an object."
970
+ });
971
+ return;
972
+ }
973
+ for (const booleanKey of TEXT_FORMATTING_BOOLEAN_KEYS) optionalBoolean(value, booleanKey, `${path}.${booleanKey}`, issues);
974
+ optionalNumber(value, "fontSize", `${path}.fontSize`, issues);
975
+ optionalNumber(value, "fontSizeCs", `${path}.fontSizeCs`, issues);
976
+ optionalOneOf(value, "highlight", `${path}.highlight`, issues, HIGHLIGHT_COLOR_VALUES);
977
+ optionalColorValue(value, "color", `${path}.color`, issues);
978
+ optionalShading(value, "shading", `${path}.shading`, issues);
979
+ const underline = value["underline"];
980
+ if (underline !== void 0 && underline !== null) if (!isRecord(underline)) issues.push({
981
+ path: `${path}.underline`,
982
+ message: "Expected an object."
983
+ });
984
+ else {
985
+ requiredOneOf(underline, "style", `${path}.underline.style`, issues, UNDERLINE_STYLE_VALUES);
986
+ optionalColorValue(underline, "color", `${path}.underline.color`, issues);
987
+ }
988
+ };
989
+ const optionalInsetMap = (attrs, key, path, issues) => {
990
+ const value = attrs[key];
991
+ if (value === void 0 || value === null) return;
992
+ if (!isRecord(value)) {
993
+ issues.push({
994
+ path,
995
+ message: "Expected an object."
996
+ });
997
+ return;
998
+ }
999
+ optionalNumber(value, "top", `${path}.top`, issues);
1000
+ optionalNumber(value, "bottom", `${path}.bottom`, issues);
1001
+ optionalNumber(value, "left", `${path}.left`, issues);
1002
+ optionalNumber(value, "right", `${path}.right`, issues);
1003
+ };
1004
+ const optionalSectionProperties = (attrs, key, path, issues) => {
1005
+ const value = attrs[key];
1006
+ if (value === void 0 || value === null) return;
1007
+ if (!isRecord(value)) {
1008
+ issues.push({
1009
+ path,
1010
+ message: "Expected an object."
1011
+ });
1012
+ return;
1013
+ }
1014
+ for (const numberKey of [
1015
+ "pageWidth",
1016
+ "pageHeight",
1017
+ "marginTop",
1018
+ "marginBottom",
1019
+ "marginLeft",
1020
+ "marginRight",
1021
+ "headerDistance",
1022
+ "footerDistance",
1023
+ "gutter",
1024
+ "columnCount",
1025
+ "columnSpace"
1026
+ ]) optionalNumber(value, numberKey, `${path}.${numberKey}`, issues);
1027
+ optionalOneOf(value, "orientation", `${path}.orientation`, issues, SECTION_ORIENTATIONS);
1028
+ optionalOneOf(value, "sectionStart", `${path}.sectionStart`, issues, SECTION_START_TYPES);
1029
+ optionalOneOf(value, "verticalAlign", `${path}.verticalAlign`, issues, SECTION_VERTICAL_ALIGNMENTS);
1030
+ optionalBoolean(value, "equalWidth", `${path}.equalWidth`, issues);
1031
+ optionalBoolean(value, "separator", `${path}.separator`, issues);
1032
+ optionalBoolean(value, "bidi", `${path}.bidi`, issues);
1033
+ optionalBoolean(value, "titlePg", `${path}.titlePg`, issues);
1034
+ optionalBoolean(value, "evenAndOddHeaders", `${path}.evenAndOddHeaders`, issues);
1035
+ };
1036
+ const optionalPropertyChanges = (attrs, key, path, issues, allowedTypes) => {
1037
+ const value = attrs[key];
1038
+ if (value === void 0 || value === null) return;
1039
+ if (!Array.isArray(value)) {
1040
+ issues.push({
1041
+ path,
1042
+ message: "Expected an array."
1043
+ });
1044
+ return;
1045
+ }
1046
+ for (const [index, item] of value.entries()) {
1047
+ const itemPath = `${path}[${index}]`;
1048
+ if (!isRecord(item)) {
1049
+ issues.push({
1050
+ path: itemPath,
1051
+ message: "Expected an object."
1052
+ });
1053
+ continue;
1054
+ }
1055
+ requiredOneOf(item, "type", `${itemPath}.type`, issues, allowedTypes);
1056
+ validatePropertyChangeInfo(item["info"], `${itemPath}.info`, issues);
1057
+ optionalRecord(item, "previousFormatting", `${itemPath}.previousFormatting`, issues);
1058
+ optionalRecord(item, "currentFormatting", `${itemPath}.currentFormatting`, issues);
1059
+ }
1060
+ };
1061
+ const validatePropertyChangeInfo = (value, path, issues) => {
1062
+ if (!isRecord(value)) {
1063
+ issues.push({
1064
+ path,
1065
+ message: "Expected an object."
1066
+ });
1067
+ return;
1068
+ }
1069
+ requiredNumber(value, "id", `${path}.id`, issues);
1070
+ requiredString(value, "author", `${path}.author`, issues);
1071
+ optionalString(value, "date", `${path}.date`, issues);
1072
+ optionalString(value, "rsid", `${path}.rsid`, issues);
1073
+ };
1074
+ const optionalImagePosition = (attrs, key, path, issues) => {
1075
+ const value = attrs[key];
1076
+ if (value === void 0 || value === null) return;
1077
+ if (!isRecord(value)) {
1078
+ issues.push({
1079
+ path,
1080
+ message: "Expected an object."
1081
+ });
1082
+ return;
1083
+ }
1084
+ validateImagePositionAxis(value, {
1085
+ key: "horizontal",
1086
+ path,
1087
+ relativeTo: IMAGE_HORIZONTAL_RELATIVE_TO_VALUES,
1088
+ align: IMAGE_HORIZONTAL_ALIGNMENT_VALUES,
1089
+ issues
1090
+ });
1091
+ validateImagePositionAxis(value, {
1092
+ key: "vertical",
1093
+ path,
1094
+ relativeTo: IMAGE_VERTICAL_RELATIVE_TO_VALUES,
1095
+ align: IMAGE_VERTICAL_ALIGNMENT_VALUES,
1096
+ issues
1097
+ });
1098
+ };
1099
+ const validateImagePositionAxis = (attrs, options) => {
1100
+ const value = attrs[options.key];
1101
+ if (value === void 0 || value === null) return;
1102
+ const path = `${options.path}.${options.key}`;
1103
+ if (!isRecord(value)) {
1104
+ options.issues.push({
1105
+ path,
1106
+ message: "Expected an object."
1107
+ });
1108
+ return;
1109
+ }
1110
+ optionalOneOf(value, "relativeTo", `${path}.relativeTo`, options.issues, options.relativeTo);
1111
+ optionalNumber(value, "posOffset", `${path}.posOffset`, options.issues);
1112
+ optionalOneOf(value, "align", `${path}.align`, options.issues, options.align);
1113
+ };
1114
+ const optionalNumberArray = (attrs, key, path, issues, options = {}) => {
1115
+ const value = attrs[key];
1116
+ if (value === null && options.allowNull === true) return;
1117
+ if (value === void 0 || value === null) return;
1118
+ if (!Array.isArray(value)) {
1119
+ issues.push({
1120
+ path,
1121
+ message: "Expected an array of numbers."
1122
+ });
1123
+ return;
1124
+ }
1125
+ for (const [index, item] of value.entries()) if (typeof item !== "number") issues.push({
1126
+ path: `${path}[${index}]`,
1127
+ message: "Expected a number."
1128
+ });
1129
+ };
1130
+ const optionalStringArray = (attrs, key, path, issues) => {
1131
+ const value = attrs[key];
1132
+ if (value === void 0 || value === null) return;
1133
+ if (!Array.isArray(value)) {
1134
+ issues.push({
1135
+ path,
1136
+ message: "Expected an array of strings."
1137
+ });
1138
+ return;
1139
+ }
1140
+ for (const [index, item] of value.entries()) if (typeof item !== "string") issues.push({
1141
+ path: `${path}[${index}]`,
1142
+ message: "Expected a string."
1143
+ });
1144
+ };
1145
+ const validateNumPr = (value, issues) => {
1146
+ if (value === void 0 || value === null || !isRecord(value)) return;
1147
+ validateNonNegativeInteger(value["numId"], "paragraph.attrs.numPr.numId", issues);
1148
+ validateNonNegativeInteger(value["ilvl"], "paragraph.attrs.numPr.ilvl", issues);
1149
+ };
1150
+ const validateNonNegativeInteger = (value, path, issues) => {
1151
+ if (value === void 0 || value === null) return;
1152
+ if (typeof value !== "number") {
1153
+ issues.push({
1154
+ path,
1155
+ message: "Expected a number."
1156
+ });
1157
+ return;
1158
+ }
1159
+ if (!Number.isInteger(value) || value < 0) issues.push({
1160
+ path,
1161
+ message: "Expected a non-negative integer."
1162
+ });
1163
+ };
1164
+ const optionalBookmarkArray = (value, issues) => {
1165
+ if (value === void 0 || value === null) return;
1166
+ if (!Array.isArray(value)) {
1167
+ issues.push({
1168
+ path: "paragraph.attrs.bookmarks",
1169
+ message: "Expected an array of bookmarks."
1170
+ });
1171
+ return;
1172
+ }
1173
+ for (const [index, bookmark] of value.entries()) {
1174
+ if (!bookmark || typeof bookmark !== "object" || Array.isArray(bookmark)) {
1175
+ issues.push({
1176
+ path: `paragraph.attrs.bookmarks[${index}]`,
1177
+ message: "Expected a bookmark object."
1178
+ });
1179
+ continue;
1180
+ }
1181
+ const attrs = bookmark;
1182
+ if (typeof attrs["id"] !== "number") issues.push({
1183
+ path: `paragraph.attrs.bookmarks[${index}].id`,
1184
+ message: "Expected a number."
1185
+ });
1186
+ if (typeof attrs["name"] !== "string") issues.push({
1187
+ path: `paragraph.attrs.bookmarks[${index}].name`,
1188
+ message: "Expected a string."
1189
+ });
1190
+ }
1191
+ };
1192
+ const optionalEmptyHyperlinkArray = (value, issues) => {
1193
+ if (value === void 0 || value === null) return;
1194
+ if (!Array.isArray(value)) {
1195
+ issues.push({
1196
+ path: "paragraph.attrs._emptyHyperlinks",
1197
+ message: "Expected an array of empty hyperlinks."
1198
+ });
1199
+ return;
1200
+ }
1201
+ for (const [index, item] of value.entries()) {
1202
+ const itemPath = `paragraph.attrs._emptyHyperlinks[${index}]`;
1203
+ if (!isRecord(item)) {
1204
+ issues.push({
1205
+ path: itemPath,
1206
+ message: "Expected an object."
1207
+ });
1208
+ continue;
1209
+ }
1210
+ validateNonNegativeInteger(item["offset"], `${itemPath}.offset`, issues);
1211
+ optionalString(item, "href", `${itemPath}.href`, issues);
1212
+ optionalString(item, "anchor", `${itemPath}.anchor`, issues);
1213
+ optionalString(item, "tooltip", `${itemPath}.tooltip`, issues);
1214
+ optionalString(item, "rId", `${itemPath}.rId`, issues);
1215
+ }
1216
+ };
1217
+ //#endregion
1218
+ export { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };