@notectl/core 2.4.0 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (485) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +1 -1
  3. package/dist/chunks/AttrRegistry-Di936wMv.mjs.map +1 -1
  4. package/dist/chunks/AttributedMarkCommands-DKHuhZA7.mjs.map +1 -1
  5. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs.map +1 -1
  6. package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -1
  7. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs +2 -0
  8. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs.map +1 -0
  9. package/dist/chunks/BlockTypePickerRegistry-BTET9jM-.mjs.map +1 -1
  10. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +1 -1
  11. package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -1
  12. package/dist/chunks/{CaretNavigationPlugin-BxWjR7SN.mjs → CaretNavigationPlugin-BQPqqK4n.mjs} +2 -2
  13. package/dist/chunks/CaretNavigationPlugin-BQPqqK4n.mjs.map +1 -0
  14. package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs +2 -0
  15. package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs.map +1 -0
  16. package/dist/chunks/ColorGrid-DAs0--ty.mjs.map +1 -1
  17. package/dist/chunks/ColorPickerPopup-B6340f3p.mjs.map +1 -1
  18. package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -1
  19. package/dist/chunks/Commands-Bk7Cl1nH.mjs +2 -0
  20. package/dist/chunks/Commands-Bk7Cl1nH.mjs.map +1 -0
  21. package/dist/chunks/ContentModel-dkGOh3N7.mjs +2 -0
  22. package/dist/chunks/ContentModel-dkGOh3N7.mjs.map +1 -0
  23. package/dist/chunks/CursorMarks-CqHLzGNI.mjs.map +1 -1
  24. package/dist/chunks/Decoration-BoFcdSXk.mjs.map +1 -1
  25. package/dist/chunks/DirectionDetection-a-1iksmh.mjs.map +1 -1
  26. package/dist/chunks/DirectionIcons-Bbawl9ei.mjs.map +1 -1
  27. package/dist/chunks/Document-ssR6hBzG.mjs.map +1 -1
  28. package/dist/chunks/{DocumentParser-BKUrtgw1.mjs → DocumentParser-C99N0MWF.mjs} +2 -2
  29. package/dist/chunks/DocumentParser-C99N0MWF.mjs.map +1 -0
  30. package/dist/chunks/DomUtils-Bf7JLFlx.mjs.map +1 -1
  31. package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -1
  32. package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +1 -1
  33. package/dist/chunks/{FontSizePlugin-BQ9Aj8cT.mjs → FontSizePlugin-Dswra3oU.mjs} +2 -2
  34. package/dist/chunks/FontSizePlugin-Dswra3oU.mjs.map +1 -0
  35. package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs +2 -0
  36. package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs.map +1 -0
  37. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +1 -1
  38. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -1
  39. package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -1
  40. package/dist/chunks/{HardBreakPlugin-svNnJ9Xj.mjs → HardBreakPlugin-gjCq8prD.mjs} +2 -2
  41. package/dist/chunks/HardBreakPlugin-gjCq8prD.mjs.map +1 -0
  42. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +1 -1
  43. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +1 -1
  44. package/dist/chunks/{HorizontalRulePlugin-CQ5NT2Mo.mjs → HorizontalRulePlugin-YywXVZYr.mjs} +2 -2
  45. package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs.map +1 -0
  46. package/dist/chunks/ImagePlugin-BAhZuVdE.mjs +2 -0
  47. package/dist/chunks/ImagePlugin-BAhZuVdE.mjs.map +1 -0
  48. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +1 -1
  49. package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -1
  50. package/dist/chunks/KeyboardNav-D0my3wuy.mjs.map +1 -1
  51. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs +2 -0
  52. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs.map +1 -0
  53. package/dist/chunks/{ListPlugin-DTgpvBEt.mjs → ListPlugin-U1r4p_fE.mjs} +2 -2
  54. package/dist/chunks/ListPlugin-U1r4p_fE.mjs.map +1 -0
  55. package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -1
  56. package/dist/chunks/MarkInputRule-DNneF2gp.mjs.map +1 -1
  57. package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs.map +1 -1
  58. package/dist/chunks/{MarkdownParser-CvYOvU3d.mjs → MarkdownParser-uX1p_GQk.mjs} +2 -2
  59. package/dist/chunks/MarkdownParser-uX1p_GQk.mjs.map +1 -0
  60. package/dist/chunks/{MarkdownSerializer-CdUBWWGI.mjs → MarkdownSerializer--MrgJTdJ.mjs} +2 -2
  61. package/dist/chunks/MarkdownSerializer--MrgJTdJ.mjs.map +1 -0
  62. package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -1
  63. package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -1
  64. package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -1
  65. package/dist/chunks/{NodeSelectionCommands-B0Sb4ux4.mjs → NodeSelectionCommands-CAqIHW_6.mjs} +2 -2
  66. package/dist/chunks/NodeSelectionCommands-CAqIHW_6.mjs.map +1 -0
  67. package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -1
  68. package/dist/chunks/Platform-ByobkiCc.mjs.map +1 -1
  69. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +1 -1
  70. package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs.map +1 -1
  71. package/dist/chunks/PopupManager-Dxv0OVMo.mjs +2 -0
  72. package/dist/chunks/PopupManager-Dxv0OVMo.mjs.map +1 -0
  73. package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
  74. package/dist/chunks/{PrintPlugin-BxNlFk2c.mjs → PrintPlugin-DAEiEyKQ.mjs} +2 -2
  75. package/dist/chunks/PrintPlugin-DAEiEyKQ.mjs.map +1 -0
  76. package/dist/chunks/RangeIterator-sJ_c9MNr.mjs.map +1 -1
  77. package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -1
  78. package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +1 -1
  79. package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -1
  80. package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs +2 -0
  81. package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs.map +1 -0
  82. package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +1 -1
  83. package/dist/chunks/SelectionTransactions-mQ1NfMEg.mjs.map +1 -1
  84. package/dist/chunks/ShortcutFormatting-TwiufqeV.mjs.map +1 -1
  85. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs.map +1 -1
  86. package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs +2 -0
  87. package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs.map +1 -0
  88. package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -1
  89. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs.map +1 -1
  90. package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -1
  91. package/dist/chunks/StyleRuntime-C0RSqKzG.mjs.map +1 -1
  92. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs.map +1 -1
  93. package/dist/chunks/SyntaxTokenTypes-BUCOMtL8.mjs.map +1 -1
  94. package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +1 -1
  95. package/dist/chunks/{TablePlugin-WPwp902E.mjs → TablePlugin-CjKThPug.mjs} +2 -2
  96. package/dist/chunks/TablePlugin-CjKThPug.mjs.map +1 -0
  97. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +1 -1
  98. package/dist/chunks/TextDirectionAutoPlugin-DOH5cfyy.mjs.map +1 -1
  99. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs.map +1 -1
  100. package/dist/chunks/TextDirectionService-BcX07mw2.mjs.map +1 -1
  101. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs.map +1 -1
  102. package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -1
  103. package/dist/chunks/{ToolbarPlugin-DmVI7MN9.mjs → ToolbarPlugin-CgZA2hz8.mjs} +2 -2
  104. package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs.map +1 -0
  105. package/dist/chunks/TypeBrands-Ch9856Gb.mjs.map +1 -1
  106. package/dist/chunks/TypedKeys-CA4bfw9O.mjs.map +1 -1
  107. package/dist/chunks/{VideoPlugin-D3zGQ6QV.mjs → VideoPlugin-DJXfuNA9.mjs} +2 -2
  108. package/dist/chunks/VideoPlugin-DJXfuNA9.mjs.map +1 -0
  109. package/dist/chunks/XmlPatterns-RN32-0ob.mjs.map +1 -1
  110. package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -1
  111. package/dist/chunks/ar--Isa9OHJ.mjs.map +1 -1
  112. package/dist/chunks/ar--O0A9OTR.mjs.map +1 -1
  113. package/dist/chunks/ar-0g2bmXTn.mjs.map +1 -1
  114. package/dist/chunks/ar-4b8e2YSc.mjs.map +1 -1
  115. package/dist/chunks/ar-B03uY4xr.mjs.map +1 -1
  116. package/dist/chunks/ar-BAfInw85.mjs.map +1 -1
  117. package/dist/chunks/ar-BRX5E_Pw.mjs.map +1 -1
  118. package/dist/chunks/ar-BWOue6jG.mjs.map +1 -1
  119. package/dist/chunks/ar-Bdmunk5h.mjs.map +1 -1
  120. package/dist/chunks/ar-BwaoCUVN.mjs.map +1 -1
  121. package/dist/chunks/ar-BzqAYGER.mjs.map +1 -1
  122. package/dist/chunks/ar-C9lO1jsY.mjs.map +1 -1
  123. package/dist/chunks/ar-CMXjVzFx.mjs.map +1 -1
  124. package/dist/chunks/ar-CR6UdFL9.mjs.map +1 -1
  125. package/dist/chunks/ar-CrOb0jL2.mjs.map +1 -1
  126. package/dist/chunks/ar-Cy_77yRf.mjs.map +1 -1
  127. package/dist/chunks/ar-D1jFXqLJ.mjs.map +1 -1
  128. package/dist/chunks/ar-DahJwMI9.mjs.map +1 -1
  129. package/dist/chunks/ar-Dcl3kgtd.mjs.map +1 -1
  130. package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -1
  131. package/dist/chunks/ar-DhwCFHql.mjs +2 -0
  132. package/dist/chunks/ar-DhwCFHql.mjs.map +1 -0
  133. package/dist/chunks/ar-Dx2lO0Nm.mjs.map +1 -1
  134. package/dist/chunks/ar-NV_puwI2.mjs.map +1 -1
  135. package/dist/chunks/ar-Uzo1Azdw.mjs.map +1 -1
  136. package/dist/chunks/ar-XmSFrtmd.mjs.map +1 -1
  137. package/dist/chunks/ar-eOA3UmiE.mjs.map +1 -1
  138. package/dist/chunks/ar-sGZ-oZqB.mjs.map +1 -1
  139. package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -1
  140. package/dist/chunks/de-B8-w9gPi.mjs.map +1 -1
  141. package/dist/chunks/de-B9zSHWqY.mjs.map +1 -1
  142. package/dist/chunks/de-BX4y4PlH.mjs.map +1 -1
  143. package/dist/chunks/de-BXQBXxFJ.mjs.map +1 -1
  144. package/dist/chunks/de-BcPntcnr.mjs.map +1 -1
  145. package/dist/chunks/de-BdD3DpUB.mjs.map +1 -1
  146. package/dist/chunks/de-Bwxlcuee.mjs.map +1 -1
  147. package/dist/chunks/de-BxQIt_1Y.mjs.map +1 -1
  148. package/dist/chunks/de-C-Yf378-.mjs.map +1 -1
  149. package/dist/chunks/de-C7uehgMu.mjs.map +1 -1
  150. package/dist/chunks/de-C9ZhDqPi.mjs.map +1 -1
  151. package/dist/chunks/de-CHcv_Vmf.mjs.map +1 -1
  152. package/dist/chunks/de-CTzAMkXC.mjs.map +1 -1
  153. package/dist/chunks/de-CaeEIyzV.mjs.map +1 -1
  154. package/dist/chunks/de-CjLUbQmg.mjs +2 -0
  155. package/dist/chunks/de-CjLUbQmg.mjs.map +1 -0
  156. package/dist/chunks/de-DHs9i4af.mjs.map +1 -1
  157. package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -1
  158. package/dist/chunks/de-DRbhnS4T.mjs.map +1 -1
  159. package/dist/chunks/de-DViI26lG.mjs.map +1 -1
  160. package/dist/chunks/de-DY3obIAF.mjs.map +1 -1
  161. package/dist/chunks/de-DcMhfRBu.mjs.map +1 -1
  162. package/dist/chunks/de-DiPz7abS.mjs.map +1 -1
  163. package/dist/chunks/de-Dl4QFHMa.mjs.map +1 -1
  164. package/dist/chunks/de-XCCpWyg0.mjs.map +1 -1
  165. package/dist/chunks/de-e6J6nvAD.mjs.map +1 -1
  166. package/dist/chunks/de-i95F9SDy.mjs.map +1 -1
  167. package/dist/chunks/de-uKR7koQe.mjs.map +1 -1
  168. package/dist/chunks/es-B0Za939C.mjs.map +1 -1
  169. package/dist/chunks/es-B8K3Yvf3.mjs.map +1 -1
  170. package/dist/chunks/es-BIXm2Coj.mjs.map +1 -1
  171. package/dist/chunks/es-BJHF95J_.mjs.map +1 -1
  172. package/dist/chunks/es-BMm9kqjC.mjs.map +1 -1
  173. package/dist/chunks/es-BQ9dox_E.mjs.map +1 -1
  174. package/dist/chunks/es-BQweZX6P.mjs.map +1 -1
  175. package/dist/chunks/es-BdpTTRuX.mjs.map +1 -1
  176. package/dist/chunks/es-C7uVqFYr.mjs.map +1 -1
  177. package/dist/chunks/es-CCQFu1t1.mjs.map +1 -1
  178. package/dist/chunks/es-CEAJj7aB.mjs.map +1 -1
  179. package/dist/chunks/es-CMSzvjOT.mjs +2 -0
  180. package/dist/chunks/es-CMSzvjOT.mjs.map +1 -0
  181. package/dist/chunks/es-CUKJujcb.mjs.map +1 -1
  182. package/dist/chunks/es-CXuMz87y.mjs.map +1 -1
  183. package/dist/chunks/es-CgMfhkJJ.mjs.map +1 -1
  184. package/dist/chunks/es-CtOtKQCP.mjs.map +1 -1
  185. package/dist/chunks/es-DD01rZ6N.mjs.map +1 -1
  186. package/dist/chunks/es-DDoqchUq.mjs.map +1 -1
  187. package/dist/chunks/es-DFokqQst.mjs.map +1 -1
  188. package/dist/chunks/es-DHxdoEzR.mjs.map +1 -1
  189. package/dist/chunks/es-DehVGwQ8.mjs.map +1 -1
  190. package/dist/chunks/es-DrJyl38L.mjs.map +1 -1
  191. package/dist/chunks/es-fTW0TkYV.mjs.map +1 -1
  192. package/dist/chunks/es-kfKiqpyD.mjs.map +1 -1
  193. package/dist/chunks/es-nRLq7bgP.mjs.map +1 -1
  194. package/dist/chunks/es-paXY7HFt.mjs.map +1 -1
  195. package/dist/chunks/es-xuahrvJN.mjs.map +1 -1
  196. package/dist/chunks/fr-0qEo3bRP.mjs.map +1 -1
  197. package/dist/chunks/fr-5HkMazAf.mjs.map +1 -1
  198. package/dist/chunks/fr-B9pBLaVx.mjs.map +1 -1
  199. package/dist/chunks/fr-BRXUnq3R.mjs.map +1 -1
  200. package/dist/chunks/fr-BSUKEtTk.mjs.map +1 -1
  201. package/dist/chunks/fr-BeRlON1t.mjs.map +1 -1
  202. package/dist/chunks/fr-Bg937iAy.mjs.map +1 -1
  203. package/dist/chunks/fr-BwWrFThE.mjs.map +1 -1
  204. package/dist/chunks/fr-C3EKRThN.mjs.map +1 -1
  205. package/dist/chunks/fr-CKjH6tJI.mjs.map +1 -1
  206. package/dist/chunks/fr-CQs0-pNX.mjs.map +1 -1
  207. package/dist/chunks/fr-CfhyYN-t.mjs.map +1 -1
  208. package/dist/chunks/fr-D0MDdoir.mjs.map +1 -1
  209. package/dist/chunks/fr-D5ulA3Z6.mjs.map +1 -1
  210. package/dist/chunks/fr-DB_OvHWH.mjs +2 -0
  211. package/dist/chunks/fr-DB_OvHWH.mjs.map +1 -0
  212. package/dist/chunks/fr-DEZ_oxzS.mjs.map +1 -1
  213. package/dist/chunks/fr-DciSEykY.mjs.map +1 -1
  214. package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -1
  215. package/dist/chunks/fr-DiDhVhyV.mjs.map +1 -1
  216. package/dist/chunks/fr-DjMZ-3K5.mjs.map +1 -1
  217. package/dist/chunks/fr-F2ZrfVaF.mjs.map +1 -1
  218. package/dist/chunks/fr-KXmbys88.mjs.map +1 -1
  219. package/dist/chunks/fr-NVOinLyF.mjs.map +1 -1
  220. package/dist/chunks/fr-SbpHNrQ-.mjs.map +1 -1
  221. package/dist/chunks/fr-ZsRdLuys.mjs.map +1 -1
  222. package/dist/chunks/fr-eC0UdAPu.mjs.map +1 -1
  223. package/dist/chunks/fr-fshsDD66.mjs.map +1 -1
  224. package/dist/chunks/full-BsWAZr1w.mjs +2 -0
  225. package/dist/chunks/full-BsWAZr1w.mjs.map +1 -0
  226. package/dist/chunks/hi-4CiAKVjT.mjs.map +1 -1
  227. package/dist/chunks/hi-B-ZuX4aN.mjs.map +1 -1
  228. package/dist/chunks/hi-B2YB3Bo4.mjs.map +1 -1
  229. package/dist/chunks/hi-B2uhiPCN.mjs.map +1 -1
  230. package/dist/chunks/hi-B5cl8TWK.mjs.map +1 -1
  231. package/dist/chunks/hi-BNJIGWQQ.mjs.map +1 -1
  232. package/dist/chunks/hi-BOMkDPqC.mjs.map +1 -1
  233. package/dist/chunks/hi-Bl-yeeOI.mjs.map +1 -1
  234. package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -1
  235. package/dist/chunks/hi-By8YwVIX.mjs.map +1 -1
  236. package/dist/chunks/hi-BzbMD_cP.mjs.map +1 -1
  237. package/dist/chunks/hi-C2jEsf8v.mjs.map +1 -1
  238. package/dist/chunks/hi-CTWubxLY.mjs.map +1 -1
  239. package/dist/chunks/hi-ChNQZZ1z.mjs +2 -0
  240. package/dist/chunks/hi-ChNQZZ1z.mjs.map +1 -0
  241. package/dist/chunks/hi-CoclKAUM.mjs.map +1 -1
  242. package/dist/chunks/hi-CrmakMVj.mjs.map +1 -1
  243. package/dist/chunks/hi-DWX6k5ZD.mjs.map +1 -1
  244. package/dist/chunks/hi-DY55FuDK.mjs.map +1 -1
  245. package/dist/chunks/hi-DrC2H81d.mjs.map +1 -1
  246. package/dist/chunks/hi-DsdXcOB6.mjs.map +1 -1
  247. package/dist/chunks/hi-Dt89SxNy.mjs.map +1 -1
  248. package/dist/chunks/hi-J8ErB5nB.mjs.map +1 -1
  249. package/dist/chunks/hi-L6pJxZam.mjs.map +1 -1
  250. package/dist/chunks/hi-SECtQQzq.mjs.map +1 -1
  251. package/dist/chunks/hi-j3TDLMYd.mjs.map +1 -1
  252. package/dist/chunks/hi-l6DA-aOw.mjs.map +1 -1
  253. package/dist/chunks/hi-uACJUw53.mjs.map +1 -1
  254. package/dist/chunks/minimal-DO7LiFTa.mjs.map +1 -1
  255. package/dist/chunks/pt-5VeuNDd2.mjs.map +1 -1
  256. package/dist/chunks/pt-BCXgUDiU.mjs.map +1 -1
  257. package/dist/chunks/pt-BDam9cDu.mjs.map +1 -1
  258. package/dist/chunks/pt-Bb908r0n.mjs.map +1 -1
  259. package/dist/chunks/pt-BkpVtod-.mjs.map +1 -1
  260. package/dist/chunks/pt-BlFAJZo7.mjs.map +1 -1
  261. package/dist/chunks/pt-Bu7Mbz67.mjs.map +1 -1
  262. package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -1
  263. package/dist/chunks/pt-C8sOyw0V.mjs.map +1 -1
  264. package/dist/chunks/pt-CEUgbrii.mjs.map +1 -1
  265. package/dist/chunks/pt-CFrcl1v_.mjs.map +1 -1
  266. package/dist/chunks/pt-CI8t6oul.mjs +2 -0
  267. package/dist/chunks/pt-CI8t6oul.mjs.map +1 -0
  268. package/dist/chunks/pt-CMrFpUWS.mjs.map +1 -1
  269. package/dist/chunks/pt-CMx2wPPY.mjs.map +1 -1
  270. package/dist/chunks/pt-CR4j8gtE.mjs.map +1 -1
  271. package/dist/chunks/pt-Cc4zysaT.mjs.map +1 -1
  272. package/dist/chunks/pt-Cv6q7x5x.mjs.map +1 -1
  273. package/dist/chunks/pt-DFKJVh7k.mjs.map +1 -1
  274. package/dist/chunks/pt-DYMyMgKQ.mjs.map +1 -1
  275. package/dist/chunks/pt-D__tcM2T.mjs.map +1 -1
  276. package/dist/chunks/pt-Dg2ctkug.mjs.map +1 -1
  277. package/dist/chunks/pt-DgfMoLWR.mjs.map +1 -1
  278. package/dist/chunks/pt-OXa_IR4Q.mjs.map +1 -1
  279. package/dist/chunks/pt-UPF7DBlz.mjs.map +1 -1
  280. package/dist/chunks/pt-_qxIe7zX.mjs.map +1 -1
  281. package/dist/chunks/pt-paXY7HFt.mjs.map +1 -1
  282. package/dist/chunks/pt-zMHcNGPk.mjs.map +1 -1
  283. package/dist/chunks/register-DXLu8Njp.mjs +3 -0
  284. package/dist/chunks/register-DXLu8Njp.mjs.map +1 -0
  285. package/dist/chunks/ru-9WtNGZtl.mjs +2 -0
  286. package/dist/chunks/ru-9WtNGZtl.mjs.map +1 -0
  287. package/dist/chunks/ru-B1m8J9dl.mjs.map +1 -1
  288. package/dist/chunks/ru-BNPUT-3S.mjs.map +1 -1
  289. package/dist/chunks/ru-BotG0MFT.mjs.map +1 -1
  290. package/dist/chunks/ru-C-APN_dm.mjs.map +1 -1
  291. package/dist/chunks/ru-C9yFslEG.mjs.map +1 -1
  292. package/dist/chunks/ru-CkG_bpfo.mjs.map +1 -1
  293. package/dist/chunks/ru-Cs8KCNyq.mjs.map +1 -1
  294. package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -1
  295. package/dist/chunks/ru-CvDl-yEd.mjs.map +1 -1
  296. package/dist/chunks/ru-CwyPz2Va.mjs.map +1 -1
  297. package/dist/chunks/ru-D53d-_UB.mjs.map +1 -1
  298. package/dist/chunks/ru-DJMpeuey.mjs.map +1 -1
  299. package/dist/chunks/ru-DSRv3_Rg.mjs.map +1 -1
  300. package/dist/chunks/ru-DV-lgEtM.mjs.map +1 -1
  301. package/dist/chunks/ru-DiwQV30V.mjs.map +1 -1
  302. package/dist/chunks/ru-DkW9XZFy.mjs.map +1 -1
  303. package/dist/chunks/ru-DyCTlhjg.mjs.map +1 -1
  304. package/dist/chunks/ru-QGX8lOTs.mjs.map +1 -1
  305. package/dist/chunks/ru-QcTo2yoL.mjs.map +1 -1
  306. package/dist/chunks/ru-Y11wuxOB.mjs.map +1 -1
  307. package/dist/chunks/ru-Yngw7nFP.mjs.map +1 -1
  308. package/dist/chunks/ru-d68SZpEe.mjs.map +1 -1
  309. package/dist/chunks/ru-gxbzqLL8.mjs.map +1 -1
  310. package/dist/chunks/ru-k7o3Qks3.mjs.map +1 -1
  311. package/dist/chunks/ru-l73diFXn.mjs.map +1 -1
  312. package/dist/chunks/ru-q8kz-237.mjs.map +1 -1
  313. package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -1
  314. package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -1
  315. package/dist/chunks/zh-BFZOM3lF.mjs.map +1 -1
  316. package/dist/chunks/zh-BGYJXxVl.mjs.map +1 -1
  317. package/dist/chunks/zh-BP97XjlS.mjs.map +1 -1
  318. package/dist/chunks/zh-BQ73oqxc.mjs.map +1 -1
  319. package/dist/chunks/zh-BQqf3wJZ.mjs.map +1 -1
  320. package/dist/chunks/zh-Baxh6v0j.mjs.map +1 -1
  321. package/dist/chunks/zh-BrqJ4ywP.mjs +2 -0
  322. package/dist/chunks/zh-BrqJ4ywP.mjs.map +1 -0
  323. package/dist/chunks/zh-BvuAbM2S.mjs.map +1 -1
  324. package/dist/chunks/zh-C-wHnDo5.mjs.map +1 -1
  325. package/dist/chunks/zh-C7iCgCRP.mjs.map +1 -1
  326. package/dist/chunks/zh-CRsDvfPR.mjs.map +1 -1
  327. package/dist/chunks/zh-CWGAPVei.mjs.map +1 -1
  328. package/dist/chunks/zh-CWIzJcXi.mjs.map +1 -1
  329. package/dist/chunks/zh-CYV-db-K.mjs.map +1 -1
  330. package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -1
  331. package/dist/chunks/zh-CnW44JEw.mjs.map +1 -1
  332. package/dist/chunks/zh-D1HSmSOf.mjs.map +1 -1
  333. package/dist/chunks/zh-DWN1Jqn3.mjs.map +1 -1
  334. package/dist/chunks/zh-DYD476c5.mjs.map +1 -1
  335. package/dist/chunks/zh-DdzgYD7k.mjs.map +1 -1
  336. package/dist/chunks/zh-DgSmvLyw.mjs.map +1 -1
  337. package/dist/chunks/zh-DlVfQn4z.mjs.map +1 -1
  338. package/dist/chunks/zh-Oj-qSUEp.mjs.map +1 -1
  339. package/dist/chunks/zh-YfuE_m2y.mjs.map +1 -1
  340. package/dist/chunks/zh-dGSDBBzb.mjs.map +1 -1
  341. package/dist/chunks/zh-ikm3rSTR.mjs.map +1 -1
  342. package/dist/chunks/zh-oZl1P_p0.mjs.map +1 -1
  343. package/dist/commands/BlockInsertion.d.ts +15 -19
  344. package/dist/commands/BlockInsertion.d.ts.map +1 -1
  345. package/dist/commands/PasteCommand.d.ts.map +1 -1
  346. package/dist/commands/SelectionDeletion.d.ts +7 -5
  347. package/dist/commands/SelectionDeletion.d.ts.map +1 -1
  348. package/dist/commands/SelectionReplacement.d.ts +42 -0
  349. package/dist/commands/SelectionReplacement.d.ts.map +1 -0
  350. package/dist/editor/BlockIdentity.d.ts +16 -0
  351. package/dist/editor/BlockIdentity.d.ts.map +1 -0
  352. package/dist/editor/ContentSerializer.d.ts +13 -11
  353. package/dist/editor/ContentSerializer.d.ts.map +1 -1
  354. package/dist/editor/NotectlEditor.d.ts +6 -5
  355. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  356. package/dist/editor/styles/link.d.ts +3 -0
  357. package/dist/editor/styles/link.d.ts.map +1 -0
  358. package/dist/fonts/math.mjs +1 -1
  359. package/dist/full.mjs +1 -1
  360. package/dist/html.mjs +1 -1
  361. package/dist/index.d.ts +1 -1
  362. package/dist/index.d.ts.map +1 -1
  363. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  364. package/dist/input/PasteHandler.d.ts.map +1 -1
  365. package/dist/input/PasteRichBlockHandler.d.ts +10 -17
  366. package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
  367. package/dist/markdown.mjs +1 -1
  368. package/dist/model/ContentModel.d.ts +6 -1
  369. package/dist/model/ContentModel.d.ts.map +1 -1
  370. package/dist/model/FileHandlerDispatcher.d.ts +3 -1
  371. package/dist/model/FileHandlerDispatcher.d.ts.map +1 -1
  372. package/dist/model/FileHandlerRegistry.d.ts +11 -2
  373. package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
  374. package/dist/notectl-core.mjs +1 -1
  375. package/dist/notectl-core.umd.js +1 -1
  376. package/dist/notectl-core.umd.js.map +1 -1
  377. package/dist/plugins/caret-navigation.mjs +1 -1
  378. package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
  379. package/dist/plugins/code-block.mjs +1 -1
  380. package/dist/plugins/font-size.mjs +1 -1
  381. package/dist/plugins/formula/FormulaCommands.d.ts +6 -4
  382. package/dist/plugins/formula/FormulaCommands.d.ts.map +1 -1
  383. package/dist/plugins/formula.mjs +1 -1
  384. package/dist/plugins/hard-break.mjs +1 -1
  385. package/dist/plugins/horizontal-rule.mjs +1 -1
  386. package/dist/plugins/image/ImageCommands.d.ts +15 -3
  387. package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
  388. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  389. package/dist/plugins/image.mjs +1 -1
  390. package/dist/plugins/link/LinkInteractionController.d.ts +26 -0
  391. package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -0
  392. package/dist/plugins/link/LinkLocale.d.ts +7 -1
  393. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  394. package/dist/plugins/link/LinkNavigation.d.ts +12 -0
  395. package/dist/plugins/link/LinkNavigation.d.ts.map +1 -0
  396. package/dist/plugins/link/LinkPlugin.d.ts +4 -4
  397. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  398. package/dist/plugins/link/LinkPreview.d.ts +28 -0
  399. package/dist/plugins/link/LinkPreview.d.ts.map +1 -0
  400. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  401. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  402. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  403. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  404. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  405. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  406. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  407. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  408. package/dist/plugins/link.mjs +1 -1
  409. package/dist/plugins/list.mjs +1 -1
  410. package/dist/plugins/print.mjs +1 -1
  411. package/dist/plugins/shared/PopupManager.d.ts +5 -0
  412. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  413. package/dist/plugins/shared.mjs +1 -1
  414. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +0 -1
  415. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
  416. package/dist/plugins/smart-paste.mjs +1 -1
  417. package/dist/plugins/table.mjs +1 -1
  418. package/dist/plugins/text-direction.mjs +1 -1
  419. package/dist/plugins/toolbar.mjs +1 -1
  420. package/dist/plugins/video.mjs +1 -1
  421. package/dist/presets/full.mjs +1 -1
  422. package/dist/presets.mjs +1 -1
  423. package/dist/register.mjs +1 -1
  424. package/dist/state/History.d.ts.map +1 -1
  425. package/dist/state/StepApplication.d.ts.map +1 -1
  426. package/dist/state/Steps.d.ts +3 -0
  427. package/dist/state/Steps.d.ts.map +1 -1
  428. package/dist/state/StructuralPositions.d.ts +15 -0
  429. package/dist/state/StructuralPositions.d.ts.map +1 -0
  430. package/dist/state/TransactionBuilder.d.ts +6 -14
  431. package/dist/state/TransactionBuilder.d.ts.map +1 -1
  432. package/dist/test/TestUtils.d.ts.map +1 -1
  433. package/dist/view/EditorViewEvents.d.ts.map +1 -1
  434. package/package.json +8 -8
  435. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs +0 -2
  436. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs.map +0 -1
  437. package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs.map +0 -1
  438. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs +0 -2
  439. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs.map +0 -1
  440. package/dist/chunks/Commands-DBBCAYBn.mjs +0 -2
  441. package/dist/chunks/Commands-DBBCAYBn.mjs.map +0 -1
  442. package/dist/chunks/ContentModel-BLC3Tez8.mjs +0 -2
  443. package/dist/chunks/ContentModel-BLC3Tez8.mjs.map +0 -1
  444. package/dist/chunks/DocumentParser-BKUrtgw1.mjs.map +0 -1
  445. package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs.map +0 -1
  446. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs +0 -2
  447. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs.map +0 -1
  448. package/dist/chunks/HardBreakPlugin-svNnJ9Xj.mjs.map +0 -1
  449. package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs.map +0 -1
  450. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs +0 -2
  451. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs.map +0 -1
  452. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs +0 -2
  453. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs.map +0 -1
  454. package/dist/chunks/ListPlugin-DTgpvBEt.mjs.map +0 -1
  455. package/dist/chunks/MarkdownParser-CvYOvU3d.mjs.map +0 -1
  456. package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs.map +0 -1
  457. package/dist/chunks/NodeSelectionCommands-B0Sb4ux4.mjs.map +0 -1
  458. package/dist/chunks/PopupManager-Jz5JrUdC.mjs +0 -2
  459. package/dist/chunks/PopupManager-Jz5JrUdC.mjs.map +0 -1
  460. package/dist/chunks/PrintPlugin-BxNlFk2c.mjs.map +0 -1
  461. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs +0 -2
  462. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs.map +0 -1
  463. package/dist/chunks/TablePlugin-WPwp902E.mjs.map +0 -1
  464. package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs.map +0 -1
  465. package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs.map +0 -1
  466. package/dist/chunks/ar-Ctrv6cIi.mjs +0 -2
  467. package/dist/chunks/ar-Ctrv6cIi.mjs.map +0 -1
  468. package/dist/chunks/de-JhGflzS5.mjs +0 -2
  469. package/dist/chunks/de-JhGflzS5.mjs.map +0 -1
  470. package/dist/chunks/es-Bv7bDbMp.mjs +0 -2
  471. package/dist/chunks/es-Bv7bDbMp.mjs.map +0 -1
  472. package/dist/chunks/fr-DtzIu6tU.mjs +0 -2
  473. package/dist/chunks/fr-DtzIu6tU.mjs.map +0 -1
  474. package/dist/chunks/full-BiQ93ERr.mjs +0 -2
  475. package/dist/chunks/full-BiQ93ERr.mjs.map +0 -1
  476. package/dist/chunks/hi-Bu799xIO.mjs +0 -2
  477. package/dist/chunks/hi-Bu799xIO.mjs.map +0 -1
  478. package/dist/chunks/pt-DmN9u3NX.mjs +0 -2
  479. package/dist/chunks/pt-DmN9u3NX.mjs.map +0 -1
  480. package/dist/chunks/register-Cb1YTAN4.mjs +0 -3
  481. package/dist/chunks/register-Cb1YTAN4.mjs.map +0 -1
  482. package/dist/chunks/ru-BxySx7an.mjs +0 -2
  483. package/dist/chunks/ru-BxySx7an.mjs.map +0 -1
  484. package/dist/chunks/zh-DuucmOns.mjs +0 -2
  485. package/dist/chunks/zh-DuucmOns.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TableDimensions-BSEOEox2.mjs","names":[],"sources":["../../src/serialization/AlignmentHTML.ts","../../src/serialization/BlockIdHTML.ts","../../src/model/StyleClass.ts","../../src/serialization/CSSClassCollector.ts","../../src/serialization/FirstTagAttributes.ts","../../src/serialization/MarkSerializer.ts","../../src/serialization/StyleClassHTML.ts","../../src/serialization/DocumentSerializer.ts","../../src/model/TableDimensions.ts","../../src/serialization/TableDimensions.ts"],"sourcesContent":["/**\n * Shared rules for block alignment in HTML.\n *\n * Alignment is a logical block attribute (`start`, `center`, `end`, `justify`).\n * HTML carries it as an inline `text-align` style or, in class mode, as a CSS\n * class: an application style class registered for the declaration (#269),\n * otherwise `notectl-align-<alignment>`. Import turns both kinds of class back\n * into the inline style before parsing, so reading alignment means reading the\n * inline style. Serializer and parser must agree on these shapes; this module is\n * the single source of truth.\n */\n\nimport {\n\tBLOCK_ALIGNMENTS,\n\ttype BlockAlignment,\n\talignmentDeclaration,\n\tisBlockAlignment,\n} from '../model/BlockAlignment.js';\nimport type { BlockNode } from '../model/Document.js';\nimport type { NodeSpec } from '../model/NodeSpec.js';\n\n/** Known-safe alignment values accepted by the serializer (defense-in-depth). */\nexport const VALID_ALIGNMENTS: ReadonlySet<string> = new Set<string>(BLOCK_ALIGNMENTS);\n\n/** Physical values from older content, mapped to their logical equivalent. */\nconst LEGACY_ALIGNMENTS: ReadonlyMap<string, BlockAlignment> = new Map([\n\t['left', 'start'],\n\t['right', 'end'],\n]);\n\n/** Prefix of notectl's own alignment class names. */\nconst DEFAULT_CLASS_PREFIX = 'notectl-align-';\n\n/** Browsers render blocks start-aligned, so `start` needs no markup by default. */\nconst BROWSER_DEFAULT_ALIGNMENT: BlockAlignment = 'start';\n\n/** Validates a stored or parsed alignment value and maps legacy `left`/`right`. */\nexport function normalizeAlignment(value: unknown): BlockAlignment | undefined {\n\tif (isBlockAlignment(value)) return value;\n\treturn typeof value === 'string' ? LEGACY_ALIGNMENTS.get(value) : undefined;\n}\n\n/** notectl's own class for alignment declarations, e.g. `notectl-align-center`. */\nconst DEFAULT_CLASS_NAMES: ReadonlyMap<string, string> = new Map(\n\tBLOCK_ALIGNMENTS.map((alignment: BlockAlignment) => [\n\t\talignmentDeclaration(alignment),\n\t\t`${DEFAULT_CLASS_PREFIX}${alignment}`,\n\t]),\n);\n\n/** notectl's own class for one `text-align` declaration, or `undefined` for anything else. */\nexport function defaultAlignmentClassName(declaration: string): string | undefined {\n\treturn DEFAULT_CLASS_NAMES.get(declaration);\n}\n\n/**\n * The declaration of one of notectl's own alignment classes, including the\n * legacy physical names (`notectl-align-left` is `text-align: start`).\n */\nexport function defaultAlignmentDeclaration(className: string): string | undefined {\n\tif (!className.startsWith(DEFAULT_CLASS_PREFIX)) return undefined;\n\tconst alignment: BlockAlignment | undefined = normalizeAlignment(\n\t\tclassName.slice(DEFAULT_CLASS_PREFIX.length),\n\t);\n\treturn alignment ? alignmentDeclaration(alignment) : undefined;\n}\n\n/**\n * Reads an element's alignment from its inline `text-align`, which import\n * also derives from alignment classes before parsing.\n */\nexport function readElementAlignment(el: HTMLElement): BlockAlignment | undefined {\n\treturn normalizeAlignment(el.style?.textAlign);\n}\n\n/** Where a block sits in the exported HTML, as far as its alignment markup is concerned. */\nexport interface AlignmentExportOptions {\n\t/**\n\t * Whether an application style class stands for `text-align: start`. The\n\t * serializer sets it in class mode only.\n\t */\n\treadonly startHasClass?: boolean;\n\t/**\n\t * The alignment the block inherits in the exported HTML from the nearest\n\t * ancestor that writes one, such as an aligned table cell.\n\t */\n\treadonly inherited?: BlockAlignment;\n}\n\n/**\n * Returns the alignment the serializer writes for `block`, or `undefined` when\n * the HTML needs no alignment markup. A block's effective alignment is its own\n * `align` attribute, or the default its spec declares (images are centered).\n * Markup is needed when that alignment differs from the browser default or from\n * the block's own default (so import restores it). An implicit `start` inherits\n * an aligned container, while an explicit `start` overrides it. A registered\n * `start` class also marks implicit defaults outside aligned containers.\n */\nexport function resolveExportAlignment(\n\tblock: BlockNode,\n\tspec: NodeSpec | undefined,\n\toptions: AlignmentExportOptions = {},\n): BlockAlignment | undefined {\n\tconst specDefault: BlockAlignment =\n\t\tnormalizeAlignment(spec?.attrs?.align?.default) ?? BROWSER_DEFAULT_ALIGNMENT;\n\tconst explicit: BlockAlignment | undefined = normalizeAlignment(block.attrs?.align);\n\tconst alignment: BlockAlignment | undefined =\n\t\texplicit ?? (spec?.attrs?.align ? specDefault : undefined);\n\tif (!alignment) return undefined;\n\tif (alignment !== BROWSER_DEFAULT_ALIGNMENT || alignment !== specDefault) return alignment;\n\tif (explicit && options.inherited !== undefined) return alignment;\n\n\tconst pinnedByClass: boolean = options.startHasClass === true && options.inherited === undefined;\n\treturn pinnedByClass ? alignment : undefined;\n}\n","/**\n * Shared rules for the `data-block-id` HTML wire format.\n *\n * Block identity round-trips through `getContentHTML` → `setContentHTML` so the\n * caret-preserving `EditorView.replaceState()` keeps the cursor on the same block\n * across content sync (Angular signal forms, RxJS pipes — see ARCHITECTURE §9.2).\n * Both serializer and parser must agree on the same shape; this module is the\n * single source of truth.\n */\n\nimport { type BlockId, blockId } from '../model/TypeBrands.js';\n\n/**\n * Conservative pattern for `data-block-id` values: alphanumeric, underscore,\n * hyphen, max 64 chars. Defense-in-depth — IDs flow in-memory only, but we keep\n * the wire shape narrow to rule out attribute-injection vectors and to allow\n * `escapeAttr` to be a no-op for valid IDs.\n */\nexport const SAFE_BLOCK_ID_PATTERN: RegExp = /^[A-Za-z0-9_-]{1,64}$/;\n\n/** True if `value` is shaped like a safe `data-block-id`. */\nexport function isSafeBlockId(value: string): boolean {\n\treturn SAFE_BLOCK_ID_PATTERN.test(value);\n}\n\n/**\n * Adopts the `data-block-id` attribute from a parsed element so that block\n * identity survives an HTML round-trip. Returns `undefined` (caller generates\n * a fresh ID) when:\n * - the attribute is missing (e.g. user-pasted external HTML),\n * - the value is malformed,\n * - or the value collides with an already-adopted ID in this parse pass\n * (e.g. concatenated HTML from two documents).\n */\nexport function adoptBlockId(el: Element, used: Set<string>): BlockId | undefined {\n\tconst raw: string | null = el.getAttribute('data-block-id');\n\tif (!raw) return undefined;\n\tif (!isSafeBlockId(raw)) return undefined;\n\tif (used.has(raw)) return undefined;\n\tused.add(raw);\n\treturn blockId(raw);\n}\n","/**\n * Application-defined CSS classes for content HTML (#269).\n *\n * A style class stands for exactly one CSS declaration: class-based export\n * writes the class wherever notectl would write that declaration, and HTML\n * import and paste read the class back as the declaration. The document keeps\n * storing semantic values (an `align` attribute, a `textColor` mark), never\n * class names.\n */\n\n/** An application CSS class that stands for one CSS declaration in content HTML. */\nexport interface StyleClass {\n\t/** The class written to class-based HTML, e.g. `'text-red'`. */\n\treadonly className: string;\n\t/** The one CSS declaration it stands for, e.g. `'color: #e03131'`. */\n\treadonly declaration: string;\n}\n\n/**\n * Application CSS classes keyed by a plugin's own values, e.g.\n * `{ center: 'align-center' }` for alignments or `{ '#e03131': 'text-red' }`\n * for colors.\n */\nexport type StyleClassNames<K extends PropertyKey = string> = Readonly<Partial<Record<K, string>>>;\n\n/** One CSS declaration split into its property and value. */\nexport interface CSSDeclaration {\n\treadonly property: string;\n\treadonly value: string;\n}\n\n/** A CSS property name, including custom properties such as `--ntbl-bc`. */\nconst PROPERTY_PATTERN: RegExp = /^-{0,2}[A-Za-z_][A-Za-z0-9_-]*$/;\n\n/** `!important` is dropped by the CSSOM, so it cannot round-trip through a class. */\nconst IMPORTANT_PATTERN: RegExp = /!\\s*important/i;\n\n/** Characters that end a CSS rule or a `<style>` element wherever they appear. */\nconst RULE_BREAKOUT: RegExp = /[{}<>]/;\n\n/**\n * Parses one CSS declaration. The property is lowercased (custom properties\n * keep their case) and the value trimmed. Returns `undefined` unless the input\n * is exactly one declaration whose value cannot end its declaration or rule; a\n * semicolon inside quotes or parentheses (`url(data:…;base64,…)`) is part of it.\n */\nexport function parseDeclaration(declaration: string): CSSDeclaration | undefined {\n\tconst colon: number = declaration.indexOf(':');\n\tif (colon < 0) return undefined;\n\tconst name: string = declaration.slice(0, colon).trim();\n\tif (!PROPERTY_PATTERN.test(name)) return undefined;\n\tconst value: string = withoutFinalSemicolon(declaration.slice(colon + 1).trim());\n\tif (!isSingleValue(value) || IMPORTANT_PATTERN.test(value)) return undefined;\n\treturn { property: name.startsWith('--') ? name : name.toLowerCase(), value };\n}\n\n/** Returns `true` when CSS text could end a rule or a `<style>` element it is written into. */\nexport function breaksOutOfRule(css: string): boolean {\n\treturn RULE_BREAKOUT.test(css);\n}\n\nfunction isSingleValue(value: string): boolean {\n\tif (value === '' || breaksOutOfRule(value)) return false;\n\tconst parts: readonly string[] = splitDeclarations(value);\n\treturn parts.length === 1 && parts[0] === value;\n}\n\nfunction withoutFinalSemicolon(value: string): string {\n\treturn value.endsWith(';') ? value.slice(0, -1).trimEnd() : value;\n}\n\n/** Writes a parsed declaration as `property: value`. */\nexport function formatDeclaration(declaration: CSSDeclaration): string {\n\treturn `${declaration.property}: ${declaration.value}`;\n}\n\n/**\n * Splits a declaration list such as `color: red; font-family: 'A;B', serif`\n * into its trimmed, non-empty declarations. A semicolon inside quotes or\n * parentheses does not end a declaration.\n */\nexport function splitDeclarations(declarations: string): string[] {\n\tconst parts: string[] = [];\n\tlet quote: string | undefined;\n\tlet depth = 0;\n\tlet start = 0;\n\tfor (let index = 0; index < declarations.length; index++) {\n\t\tconst char: string = declarations.charAt(index);\n\t\tif (quote) {\n\t\t\tif (char === quote) quote = undefined;\n\t\t} else if (char === '\"' || char === \"'\") {\n\t\t\tquote = char;\n\t\t} else if (char === '(') {\n\t\t\tdepth++;\n\t\t} else if (char === ')') {\n\t\t\tdepth = Math.max(0, depth - 1);\n\t\t} else if (char === ';' && depth === 0) {\n\t\t\tparts.push(declarations.slice(start, index));\n\t\t\tstart = index + 1;\n\t\t}\n\t}\n\tparts.push(declarations.slice(start));\n\treturn parts.map((part: string) => part.trim()).filter((part: string) => part.length > 0);\n}\n","/**\n * CSSClassCollector: maps CSS declarations to class names during class-based\n * serialization and produces a minimal stylesheet for the classes it used.\n *\n * Each declaration that has an application style class (#269) gets that class.\n * The remaining declarations of a set share one notectl class: notectl's own\n * name when the set is a single alignment, otherwise a content-hashed\n * `notectl-s-*` name (FNV-1a), deterministic and independent of encounter order.\n */\n\nimport { type StyleClass, breaksOutOfRule, splitDeclarations } from '../model/StyleClass.js';\nimport type { StyleClassLookup } from './StyleClassHTML.js';\n\n/** Prefix for generated style class names (avoids collisions with user classes). */\nconst CLASS_PREFIX = 'notectl-s-';\n\n/** Base for hash encoding output. */\nconst HASH_BASE = 36;\n/** Pad length for consistent 6-char hashes. */\nconst HASH_PAD_LENGTH = 6;\n\n/** FNV-1a 32-bit offset basis. */\nconst FNV_OFFSET_BASIS = 0x811c9dc5;\n/** FNV-1a 32-bit prime. */\nconst FNV_PRIME = 0x01000193;\n\n/**\n * FNV-1a 32-bit hash function.\n * Fast, no crypto dependency, excellent distribution for short strings.\n */\nfunction fnv1aHash(input: string): string {\n\tlet hash: number = FNV_OFFSET_BASIS;\n\tfor (let i = 0; i < input.length; i++) {\n\t\thash ^= input.charCodeAt(i);\n\t\thash = Math.imul(hash, FNV_PRIME);\n\t}\n\t// Convert to unsigned 32-bit, then to base-36, padded to 6 chars\n\tconst unsigned: number = hash >>> 0;\n\treturn unsigned.toString(HASH_BASE).padStart(HASH_PAD_LENGTH, '0');\n}\n\n/** Finds notectl's own class for a single remaining declaration, if it has one. */\nexport type DefaultClassName = (declaration: string) => string | undefined;\n\n/**\n * Stateful collector that assigns CSS class names to declarations.\n * Used during a single serialization pass, then produces the collected stylesheet.\n */\nexport class CSSClassCollector {\n\t/** Class name → declarations of every class used so far, in first-use order. */\n\tprivate readonly rules: Map<string, string> = new Map();\n\t/** Normalized declarations → hashed class name. */\n\tprivate readonly hashedClassNames: Map<string, string> = new Map();\n\t/** Tracks used hashes to handle the (extremely rare) collision case. */\n\tprivate readonly usedHashes: Set<string> = new Set();\n\n\t/**\n\t * @param lookup Finds the application style class of one declaration.\n\t * @param defaultClassName notectl's own class for a single remaining declaration.\n\t */\n\tconstructor(\n\t\tprivate readonly lookup: StyleClassLookup = () => undefined,\n\t\tprivate readonly defaultClassName: DefaultClassName = () => undefined,\n\t) {}\n\n\t/**\n\t * Returns the space-separated class names for the given CSS declarations:\n\t * one application class per declaration that has one, then one notectl class\n\t * for the rest. Declarations that could break out of a CSS rule are left out.\n\t * Returns `''` when no declaration remains.\n\t */\n\tgetClassNames(declarations: string): string {\n\t\tconst classNames: string[] = [];\n\t\tconst unmapped: string[] = [];\n\t\tfor (const declaration of splitDeclarations(declarations).sort()) {\n\t\t\tif (breaksOutOfRule(declaration)) continue;\n\t\t\tconst styleClass: StyleClass | undefined = this.lookup(declaration);\n\t\t\tif (!styleClass) {\n\t\t\t\tunmapped.push(declaration);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.rules.set(styleClass.className, styleClass.declaration);\n\t\t\tif (!classNames.includes(styleClass.className)) classNames.push(styleClass.className);\n\t\t}\n\t\tif (unmapped.length > 0) classNames.push(this.notectlClassName(unmapped.join('; ')));\n\t\treturn classNames.join(' ');\n\t}\n\n\t/** Produces CSS rules for all collected classes. Returns empty string if none collected. */\n\ttoCSS(): string {\n\t\treturn [...this.rules]\n\t\t\t.map(([className, declarations]) => `.${className} { ${declarations}; }`)\n\t\t\t.join('\\n');\n\t}\n\n\t/**\n\t * Returns a map from class name → CSS declarations for round-trip support.\n\t * Used by `setContentHTML` to rehydrate class-based HTML.\n\t */\n\ttoStyleMap(): ReadonlyMap<string, string> {\n\t\treturn new Map(this.rules);\n\t}\n\n\tprivate notectlClassName(normalized: string): string {\n\t\tconst className: string = this.defaultClassName(normalized) ?? this.hashedClassName(normalized);\n\t\tif (!this.rules.has(className)) this.rules.set(className, normalized);\n\t\treturn className;\n\t}\n\n\tprivate hashedClassName(normalized: string): string {\n\t\tconst existing: string | undefined = this.hashedClassNames.get(normalized);\n\t\tif (existing) return existing;\n\n\t\tlet hash: string = fnv1aHash(normalized);\n\t\tlet suffix = 0;\n\t\t// Collision handling: append suffix counter if the hash is already in use\n\t\t// for a different declarations string\n\t\twhile (this.usedHashes.has(hash)) {\n\t\t\tsuffix++;\n\t\t\thash = fnv1aHash(normalized + String(suffix));\n\t\t}\n\t\tthis.usedHashes.add(hash);\n\t\tconst className = `${CLASS_PREFIX}${hash}`;\n\t\tthis.hashedClassNames.set(normalized, className);\n\t\treturn className;\n\t}\n}\n","/**\n * Attribute edits on the first opening tag of an HTML fragment. The serializer\n * uses them to add block-level attributes (`data-block-id`, `dir`, `id`, and the\n * alignment class or style) to whatever markup a NodeSpec's `toHTML()` produced.\n * Tag scanning is quote-aware, so `>` inside attribute values is never a tag end.\n */\n\nimport { escapeAttr, normalizeHTMLId } from '../model/HTMLUtils.js';\n\n/**\n * Injects or merges an attribute into the first opening tag of an HTML fragment.\n * Values are expected to be pre-escaped by the caller.\n */\nexport function injectAttrIntoFirstTag(html: string, attr: string, value: string): string {\n\tconst firstTagRange: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!firstTagRange) return html;\n\tconst firstTag: string = html.slice(firstTagRange.start, firstTagRange.end + 1);\n\tconst pattern: RegExp = new RegExp(`\\\\s${attr}\\\\s*=\\\\s*(\\\"([^\\\"]*)\\\"|'([^']*)')`);\n\tconst existing: RegExpMatchArray | null = firstTag.match(pattern);\n\tif (existing) {\n\t\tconst existingValue: string = existing[2] ?? existing[3] ?? '';\n\t\tif (attr === 'style' && /(?:^|;)\\s*text-align\\s*:/i.test(existingValue)) {\n\t\t\treturn html;\n\t\t}\n\t\tconst sep: string = attr === 'style' ? '; ' : ' ';\n\t\tconst mergedAttr: string = ` ${attr}=\"${existingValue}${sep}${value}\"`;\n\t\tconst nextFirstTag: string = firstTag.replace(pattern, mergedAttr);\n\t\treturn `${html.slice(0, firstTagRange.start)}${nextFirstTag}${html.slice(firstTagRange.end + 1)}`;\n\t}\n\tconst isSelfClosing: boolean = firstTag.endsWith('/>');\n\tconst injectedFirstTag: string = isSelfClosing\n\t\t? `${firstTag.slice(0, -2)} ${attr}=\"${value}\"/>`\n\t\t: `${firstTag.slice(0, -1)} ${attr}=\"${value}\">`;\n\treturn `${html.slice(0, firstTagRange.start)}${injectedFirstTag}${html.slice(firstTagRange.end + 1)}`;\n}\n\n/** Replaces an attribute on the first opening tag, or adds it when absent. */\nfunction setAttrOnFirstTag(html: string, attr: string, value: string): string {\n\tconst firstTagRange: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!firstTagRange) return html;\n\tconst firstTag: string = html.slice(firstTagRange.start, firstTagRange.end + 1);\n\tconst replacement: string = ` ${attr}=\"${value}\"`;\n\tconst withoutExisting: string = removeAttributes(firstTag, attr);\n\tconst isSelfClosing: boolean = withoutExisting.endsWith('/>');\n\tconst nextFirstTag: string = isSelfClosing\n\t\t? `${withoutExisting.slice(0, -2)}${replacement}/>`\n\t\t: `${withoutExisting.slice(0, -1)}${replacement}>`;\n\treturn `${html.slice(0, firstTagRange.start)}${nextFirstTag}${html.slice(firstTagRange.end + 1)}`;\n}\n\n/** Removes real attributes by name without matching attribute-like text inside quoted values. */\nfunction removeAttributes(openingTag: string, attr: string): string {\n\tconst ranges: { readonly start: number; readonly end: number }[] = [];\n\tlet index = 1;\n\n\t// Skip the tag name.\n\twhile (\n\t\tindex < openingTag.length &&\n\t\t!isTagWhitespace(openingTag[index] ?? '') &&\n\t\topeningTag[index] !== '>' &&\n\t\topeningTag[index] !== '/'\n\t) {\n\t\tindex++;\n\t}\n\n\twhile (index < openingTag.length) {\n\t\twhile (isTagWhitespace(openingTag[index] ?? '')) index++;\n\t\tif (openingTag[index] === '>' || openingTag[index] === undefined) break;\n\t\tif (openingTag[index] === '/' && openingTag[index + 1] === '>') break;\n\n\t\tconst start: number = index;\n\t\twhile (\n\t\t\tindex < openingTag.length &&\n\t\t\t!isTagWhitespace(openingTag[index] ?? '') &&\n\t\t\topeningTag[index] !== '=' &&\n\t\t\topeningTag[index] !== '>' &&\n\t\t\topeningTag[index] !== '/'\n\t\t) {\n\t\t\tindex++;\n\t\t}\n\t\tconst name: string = openingTag.slice(start, index);\n\t\tif (name === '') {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\twhile (isTagWhitespace(openingTag[index] ?? '')) index++;\n\t\tif (openingTag[index] === '=') {\n\t\t\tindex++;\n\t\t\twhile (isTagWhitespace(openingTag[index] ?? '')) index++;\n\t\t\tconst quote: string | undefined = openingTag[index];\n\t\t\tif (quote === '\"' || quote === \"'\") {\n\t\t\t\tindex++;\n\t\t\t\twhile (index < openingTag.length && openingTag[index] !== quote) index++;\n\t\t\t\tif (openingTag[index] === quote) index++;\n\t\t\t} else {\n\t\t\t\twhile (\n\t\t\t\t\tindex < openingTag.length &&\n\t\t\t\t\t!isTagWhitespace(openingTag[index] ?? '') &&\n\t\t\t\t\topeningTag[index] !== '>' &&\n\t\t\t\t\t!(openingTag[index] === '/' && openingTag[index + 1] === '>')\n\t\t\t\t) {\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (name.toLowerCase() === attr.toLowerCase()) ranges.push({ start, end: index });\n\t}\n\n\tlet result: string = openingTag;\n\tfor (let rangeIndex = ranges.length - 1; rangeIndex >= 0; rangeIndex--) {\n\t\tconst range = ranges[rangeIndex];\n\t\tif (range) result = `${result.slice(0, range.start)}${result.slice(range.end)}`;\n\t}\n\treturn result;\n}\n\nfunction isTagWhitespace(character: string): boolean {\n\treturn (\n\t\tcharacter === ' ' ||\n\t\tcharacter === '\\t' ||\n\t\tcharacter === '\\n' ||\n\t\tcharacter === '\\f' ||\n\t\tcharacter === '\\r'\n\t);\n}\n\n/** Applies a validated semantic HTML ID to the first element emitted for a block. */\nexport function setHTMLIdOnFirstTag(html: string, value: unknown): string {\n\tconst htmlId: string | undefined = normalizeHTMLId(value);\n\treturn htmlId ? setAttrOnFirstTag(html, 'id', escapeAttr(htmlId)) : html;\n}\n\n/** Finds the first opening tag range, treating `>` inside quotes as attribute text. */\nfunction findFirstOpeningTagRange(html: string): { start: number; end: number } | undefined {\n\tlet start: number = html.indexOf('<');\n\twhile (start >= 0) {\n\t\tconst nextChar: string | undefined = html[start + 1];\n\t\tif (nextChar && /[A-Za-z]/.test(nextChar)) {\n\t\t\tlet quote: '\"' | \"'\" | undefined;\n\t\t\tfor (let i = start + 2; i < html.length; i++) {\n\t\t\t\tconst char: string = html[i] ?? '';\n\t\t\t\tif (quote) {\n\t\t\t\t\tif (char === quote) quote = undefined;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '\"' || char === \"'\") {\n\t\t\t\t\tquote = char;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '>') {\n\t\t\t\t\treturn { start, end: i };\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\tstart = html.indexOf('<', start + 1);\n\t}\n\treturn undefined;\n}\n\n/** Returns the first opening tag of `html` (quote-aware), or `''` if none exists. */\nexport function firstOpeningTag(html: string): string {\n\tconst range: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!range) return '';\n\treturn html.slice(range.start, range.end + 1);\n}\n","/**\n * MarkSerializer: shared mark serialization logic for DocumentSerializer and ClipboardHandler.\n * Separates style-based marks (merged into a single `<span style>`) from tag-based marks\n * (nested wrappers in rank order).\n */\n\nimport type { Mark } from '../model/Document.js';\nimport { escapeAttr, escapeHTML, styleAttribute } from '../model/HTMLUtils.js';\nimport type { MarkSpec } from '../model/MarkSpec.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport type { CSSClassCollector } from './CSSClassCollector.js';\n\n/** Rank assigned to marks whose spec does not declare an explicit `rank`. */\nconst DEFAULT_MARK_RANK = 99;\n\n/** Builds a map of mark type name to rank from the registry (compute once per pass). */\nexport function buildMarkOrder(registry: SchemaRegistry): Map<string, number> {\n\tconst types: readonly string[] = registry.getMarkTypes();\n\tconst order = new Map<string, number>();\n\tfor (const t of types) {\n\t\tconst spec: MarkSpec | undefined = registry.getMarkSpec(t);\n\t\tif (spec) order.set(t, spec.rank ?? DEFAULT_MARK_RANK);\n\t}\n\treturn order;\n}\n\n/**\n * Wraps already-rendered inner HTML in its marks. Style-based marks\n * (`toHTMLStyle`) are merged into a single span via `wrapStyleSpan`; tag-based\n * marks (`toHTMLString`) then wrap the result in rank order. The inner HTML is\n * emitted verbatim (callers pre-escape text; rendered inline-node HTML must not\n * be re-escaped).\n */\nfunction wrapMarks(\n\tinnerHTML: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder: Map<string, number> | undefined,\n\texportCtx: HTMLExportContext | undefined,\n\twrapStyleSpan: (html: string, declarations: string) => string,\n): string {\n\tif (marks.length === 0) return innerHTML;\n\n\tconst order: Map<string, number> = markOrder ?? buildMarkOrder(registry);\n\tconst sortedMarks: Mark[] = [...marks].sort(\n\t\t(a, b) => (order.get(a.type) ?? DEFAULT_MARK_RANK) - (order.get(b.type) ?? DEFAULT_MARK_RANK),\n\t);\n\n\tconst styleParts: string[] = [];\n\tconst tagMarks: Mark[] = [];\n\n\tfor (const mark of sortedMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLStyle) {\n\t\t\tconst style: string | null = markSpec.toHTMLStyle(mark);\n\t\t\tif (style) {\n\t\t\t\tstyleParts.push(style);\n\t\t\t}\n\t\t} else {\n\t\t\ttagMarks.push(mark);\n\t\t}\n\t}\n\n\t// Wrap with the merged style span first (closest to content).\n\tlet html: string = innerHTML;\n\tif (styleParts.length > 0) {\n\t\thtml = wrapStyleSpan(html, styleParts.join('; '));\n\t}\n\n\t// Then wrap with tag-based marks in rank order.\n\tfor (const mark of tagMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLString) {\n\t\t\thtml = markSpec.toHTMLString(mark, html, exportCtx);\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/**\n * Shared text mark-serialization core: escapes `text`, then delegates to\n * {@link wrapMarks}. The two public entry points differ only in how the merged\n * style declarations become a `<span>`.\n */\nfunction serializeMarks(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder: Map<string, number> | undefined,\n\texportCtx: HTMLExportContext | undefined,\n\twrapStyleSpan: (html: string, declarations: string) => string,\n): string {\n\tif (text === '') return '';\n\treturn wrapMarks(escapeHTML(text), marks, registry, markOrder, exportCtx, wrapStyleSpan);\n}\n\n/** Builds the inline-style `<span style>` wrapper used by the style-attribute mode. */\nfunction inlineStyleSpanWrapper(\n\texportCtx: HTMLExportContext | undefined,\n): (html: string, declarations: string) => string {\n\treturn (html, declarations) => {\n\t\tconst attr: string = styleAttribute(declarations, exportCtx);\n\t\treturn attr ? `<span${attr}>${html}</span>` : html;\n\t};\n}\n\n/** Builds the `<span class>` wrapper used by the CSS-class mode. */\nfunction classSpanWrapper(\n\tcollector: CSSClassCollector,\n): (html: string, declarations: string) => string {\n\treturn (html, declarations) => {\n\t\tconst classNames: string = collector.getClassNames(declarations);\n\t\treturn classNames ? `<span class=\"${escapeAttr(classNames)}\">${html}</span>` : html;\n\t};\n}\n\n/**\n * Serializes text with marks to HTML.\n * Style-based marks (`toHTMLStyle`) are merged into a single `<span style=\"...\">`.\n * Tag-based marks (`toHTMLString`) wrap the content in rank order.\n */\nexport function serializeMarksToHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn serializeMarks(\n\t\ttext,\n\t\tmarks,\n\t\tregistry,\n\t\tmarkOrder,\n\t\texportCtx,\n\t\tinlineStyleSpanWrapper(exportCtx),\n\t);\n}\n\n/**\n * Wraps an already-rendered inline-node HTML fragment (e.g. `<img>`) in its marks\n * using inline-style spans, mirroring {@link serializeMarksToHTML} but without\n * escaping the fragment. Lets a linked inline image export as `<a …><img …></a>`.\n */\nexport function serializeInlineNodeMarksToHTML(\n\tinnerHTML: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn wrapMarks(\n\t\tinnerHTML,\n\t\tmarks,\n\t\tregistry,\n\t\tmarkOrder,\n\t\texportCtx,\n\t\tinlineStyleSpanWrapper(exportCtx),\n\t);\n}\n\n/**\n * Serializes text with marks to HTML using CSS class names instead of inline styles.\n * Style-based marks (`toHTMLStyle`) are collected into a `CSSClassCollector` and emitted\n * as `<span class=\"...\">`. Tag-based marks (`toHTMLString`) wrap identically to the inline path.\n */\nexport function serializeMarksToClassHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tcollector: CSSClassCollector,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn serializeMarks(text, marks, registry, markOrder, exportCtx, classSpanWrapper(collector));\n}\n\n/**\n * Wraps an already-rendered inline-node HTML fragment in its marks using\n * CSS-class spans, mirroring {@link serializeMarksToClassHTML} but without\n * escaping the fragment.\n */\nexport function serializeInlineNodeMarksToClassHTML(\n\tinnerHTML: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tcollector: CSSClassCollector,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn wrapMarks(innerHTML, marks, registry, markOrder, exportCtx, classSpanWrapper(collector));\n}\n","/**\n * Style classes in HTML (#269): the class vocabulary of one export or import\n * pass. Export looks up the application class of each declaration; import\n * turns application classes, a caller's `styleMap` and notectl's own alignment\n * classes back into inline declarations that the parse rules already read.\n */\n\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport {\n\ttype CSSDeclaration,\n\ttype StyleClass,\n\tformatDeclaration,\n\tparseDeclaration,\n\tsplitDeclarations,\n} from '../model/StyleClass.js';\nimport { defaultAlignmentDeclaration } from './AlignmentHTML.js';\nimport { type CSSValueCanonicalizer, createCSSValueCanonicalizer } from './CSSValueEquivalence.js';\n\n/** Finds the style class that stands for one declaration during an export. */\nexport type StyleClassLookup = (declaration: string) => StyleClass | undefined;\n\n/** Resolves a class name to the declarations it stands for during an import. */\nexport type ClassDeclarationResolver = (className: string) => string | undefined;\n\n/** Returns the declaration in the form the CSS engine serializes it. */\nexport type DeclarationCanonicalizer = (declaration: CSSDeclaration) => string;\n\n/**\n * Canonicalizes declarations with the engine's own CSS parser, the one that\n * also reads imported HTML. A browser reads `#e03131` back as\n * `rgb(224, 49, 49)` and may requote font families, so comparing the\n * canonical forms finds the class of a value in whichever spelling it has.\n * A value the engine rejects is compared as written.\n */\nexport function createCSSOMCanonicalizer(): DeclarationCanonicalizer {\n\tconst canonicalValue: CSSValueCanonicalizer = createCSSValueCanonicalizer();\n\treturn ({ property, value }: CSSDeclaration): string =>\n\t\tformatDeclaration({ property, value: canonicalValue(property, value) });\n}\n\n/**\n * Builds the export lookup for the given style classes. When two of them\n * stand for equivalent declarations, the first registered wins.\n */\nexport function createStyleClassLookup(\n\tstyleClasses: readonly StyleClass[],\n\tcanonicalize: DeclarationCanonicalizer = createCSSOMCanonicalizer(),\n): StyleClassLookup {\n\tif (styleClasses.length === 0) return () => undefined;\n\tconst keys = new Map<string, string | undefined>();\n\tconst keyOf = (declaration: string): string | undefined => {\n\t\tif (!keys.has(declaration)) {\n\t\t\tconst parsed: CSSDeclaration | undefined = parseDeclaration(declaration);\n\t\t\tkeys.set(declaration, parsed ? canonicalize(parsed) : undefined);\n\t\t}\n\t\treturn keys.get(declaration);\n\t};\n\tconst byKey = new Map<string, StyleClass>();\n\tfor (const styleClass of styleClasses) {\n\t\tconst key: string | undefined = keyOf(styleClass.declaration);\n\t\tif (key !== undefined && !byKey.has(key)) byKey.set(key, styleClass);\n\t}\n\treturn (declaration: string): StyleClass | undefined => {\n\t\tconst key: string | undefined = keyOf(declaration);\n\t\treturn key === undefined ? undefined : byKey.get(key);\n\t};\n}\n\n/**\n * Builds the import resolver: a caller's `styleMap` first (it describes the\n * exact HTML being imported), then the registered style classes, then\n * notectl's own `notectl-align-*` classes.\n */\nexport function createClassDeclarationResolver(\n\tregistry?: SchemaRegistry,\n\tstyleMap?: ReadonlyMap<string, string>,\n): ClassDeclarationResolver {\n\treturn (className: string): string | undefined =>\n\t\tstyleMap?.get(className) ??\n\t\tregistry?.getStyleClass(className)?.declaration ??\n\t\tdefaultAlignmentDeclaration(className);\n}\n\n/**\n * Rehydrates class-based HTML: the declarations a class stands for are added\n * to the element's inline style, so parse rules read them like any inline\n * style. A property the element already sets inline wins over a class, and the\n * first listed class wins over later ones. The classes stay on the element, so\n * other parse rules can still read them. An element whose classes stand for\n * more than `maxDeclarations` declarations in total is left as it is.\n */\nexport function rehydrateStyleClasses(\n\troot: ParentNode,\n\tresolve: ClassDeclarationResolver,\n\tmaxDeclarations: number,\n): void {\n\tfor (const element of Array.from(root.querySelectorAll('[class]'))) {\n\t\tconst declarations: readonly string[] | undefined = classDeclarations(\n\t\t\telement,\n\t\t\tresolve,\n\t\t\tmaxDeclarations,\n\t\t);\n\t\tif (declarations) addMissingDeclarations(element, declarations);\n\t}\n}\n\n/**\n * The declarations of an element's classes, first listed class first, or\n * `undefined` when they are more than `max`.\n */\nfunction classDeclarations(\n\telement: Element,\n\tresolve: ClassDeclarationResolver,\n\tmax: number,\n): readonly string[] | undefined {\n\tconst declarations: string[] = [];\n\tfor (const className of Array.from(element.classList)) {\n\t\tconst resolved: string | undefined = resolve(className);\n\t\tif (!resolved) continue;\n\t\tconst parts: readonly string[] = splitDeclarations(resolved);\n\t\tif (declarations.length + parts.length > max) return undefined;\n\t\tdeclarations.push(...parts);\n\t}\n\treturn declarations;\n}\n\n/**\n * Writes through the CSSOM: a strict CSP (`style-src-attr 'none'`) blocks\n * `style` attributes, in Chromium even in inert template content, but not\n * CSSOM writes. The browser serializes the result back into the attribute, so\n * parsers that read the raw attribute (table border color) still find it.\n */\nfunction addMissingDeclarations(element: Element, declarations: readonly string[]): void {\n\tconst style: CSSStyleDeclaration | undefined = (element as Partial<ElementCSSInlineStyle>).style;\n\tif (!style) return;\n\tfor (const declaration of declarations) {\n\t\tconst parsed: CSSDeclaration | undefined = parseDeclaration(declaration);\n\t\tif (!parsed || style.getPropertyValue(parsed.property)) continue;\n\t\tstyle.setProperty(parsed.property, parsed.value);\n\t}\n}\n","/**\n * DocumentSerializer: converts an immutable Document into sanitized HTML.\n * Pure functions — operates on Document/SchemaRegistry, no class state.\n */\n\nimport { isNodeOfType } from '../model/AttrRegistry.js';\nimport { type BlockAlignment, alignmentDeclaration } from '../model/BlockAlignment.js';\nimport type { BlockNode, Document, InlineNode, TextNode } from '../model/Document.js';\nimport {\n\tgetBlockChildren,\n\tgetInlineChildren,\n\tisInlineNode,\n\tisLeafBlock,\n\tisTextNode,\n\tmarkSetsEqual,\n} from '../model/Document.js';\nimport {\n\tINLINE_STYLE_EXPORT_CONTEXT,\n\tSAFE_URI_REGEXP,\n\tescapeAttr,\n\tescapeHTML,\n} from '../model/HTMLUtils.js';\nimport type { HTMLExportContext, NodeSpec } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { defaultAlignmentClassName, resolveExportAlignment } from './AlignmentHTML.js';\nimport { isSafeBlockId } from './BlockIdHTML.js';\nimport { CSSClassCollector } from './CSSClassCollector.js';\nimport type { ContentCSSResult, SerializeOptions } from './ContentHTMLTypes.js';\nimport {\n\tfirstOpeningTag,\n\tinjectAttrIntoFirstTag,\n\tsetHTMLIdOnFirstTag,\n} from './FirstTagAttributes.js';\nimport { preserveHTMLIdSanitizeConfig, sanitizeHTML } from './HTMLSanitization.js';\nimport {\n\tbuildMarkOrder,\n\tserializeInlineNodeMarksToClassHTML,\n\tserializeInlineNodeMarksToHTML,\n\tserializeMarksToClassHTML,\n\tserializeMarksToHTML,\n} from './MarkSerializer.js';\nimport { type StyleClassLookup, createStyleClassLookup } from './StyleClassHTML.js';\n\n/** Internal context threaded through all serialization helpers. */\ninterface SerializerContext {\n\treadonly registry?: SchemaRegistry;\n\treadonly collector?: CSSClassCollector;\n\treadonly exportCtx?: HTMLExportContext;\n\t/** Resolved from {@link SerializeOptions.includeBlockIds}; defaults to `true`. */\n\treadonly includeBlockIds: boolean;\n\t/** Whether an application style class stands for `text-align: start`; class mode only. */\n\treadonly startHasClass?: boolean;\n\t/** Alignment the blocks being serialized inherit from the nearest ancestor that writes one. */\n\treadonly inheritedAlignment?: BlockAlignment;\n}\n\n/** Known-safe direction values (defense-in-depth). `auto` is excluded — it's the default. */\nexport const VALID_DIRECTIONS: ReadonlySet<string> = new Set(['ltr', 'rtl']);\n\n/** Creates an HTMLExportContext for CSS class mode. */\nfunction createClassExportContext(collector: CSSClassCollector): HTMLExportContext {\n\treturn {\n\t\tstyleAttr(declarations: string): string {\n\t\t\tconst classNames: string = collector.getClassNames(declarations);\n\t\t\treturn classNames ? ` class=\"${escapeAttr(classNames)}\"` : '';\n\t\t},\n\t};\n}\n\n/**\n * DOMPurify config fragment that controls `data-block-id` in the output.\n *\n * `data-block-id` is a `data-*` attribute, which DOMPurify permits by default\n * (`ALLOW_DATA_ATTR`) regardless of `ALLOWED_ATTR`. Excluding it therefore\n * requires `FORBID_ATTR` — this is the load-bearing strip that guarantees clean\n * output even when a third-party `NodeSpec.toHTML` emits its own id (the central\n * injection in `serializeBlock` is merely skipped). Including it needs no special\n * config; the centrally injected attribute passes as a data-* attribute.\n */\nfunction blockIdSanitizeConfig(includeBlockIds: boolean): {\n\treadonly SANITIZE_DOM: false;\n\treadonly FORBID_ATTR?: string[];\n} {\n\treturn preserveHTMLIdSanitizeConfig(...(includeBlockIds ? [] : ['data-block-id']));\n}\n\n/** Serializes a full document to sanitized HTML, wrapping list items in `<ul>`/`<ol>`. */\nexport function serializeDocumentToHTML(\n\tdoc: Document,\n\tregistry?: SchemaRegistry,\n\toptions?: SerializeOptions,\n): string {\n\tconst includeBlockIds: boolean = options?.includeBlockIds !== false;\n\tconst exportCtx: HTMLExportContext = INLINE_STYLE_EXPORT_CONTEXT;\n\tconst ctx: SerializerContext = { registry, exportCtx, includeBlockIds };\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'dir', 'id'];\n\n\treturn sanitizeHTML(\n\t\thtml,\n\t\t{\n\t\t\tALLOWED_TAGS: allowedTags,\n\t\t\tALLOWED_ATTR: allowedAttrs,\n\t\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t\t\t...blockIdSanitizeConfig(includeBlockIds),\n\t\t},\n\t\tregistry,\n\t);\n}\n\n/**\n * Serializes a document to HTML with CSS class names instead of inline styles.\n * Returns the HTML and a collected stylesheet with only the rules actually used.\n */\nexport function serializeDocumentToCSS(\n\tdoc: Document,\n\tregistry?: SchemaRegistry,\n\toptions?: SerializeOptions,\n): ContentCSSResult {\n\tconst includeBlockIds: boolean = options?.includeBlockIds !== false;\n\tconst lookup: StyleClassLookup = createStyleClassLookup(registry?.getStyleClasses() ?? []);\n\tconst collector = new CSSClassCollector(lookup, defaultAlignmentClassName);\n\tconst exportCtx: HTMLExportContext = createClassExportContext(collector);\n\tconst ctx: SerializerContext = {\n\t\tregistry,\n\t\tcollector,\n\t\texportCtx,\n\t\tincludeBlockIds,\n\t\tstartHasClass: lookup(alignmentDeclaration('start')) !== undefined,\n\t};\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst baseAttrs: string[] = registry\n\t\t? registry.getAllowedAttrs()\n\t\t: ['style', 'class', 'dir', 'id'];\n\n\t// In class mode, allow `class` through DOMPurify (it is not a data-* attr, so\n\t// it must be in ALLOWED_ATTR).\n\tconst withClass: string[] = baseAttrs.includes('class')\n\t\t? [...baseAttrs]\n\t\t: [...baseAttrs, 'class'];\n\n\t// Defense-in-depth: strip `style` attribute in class mode to guarantee\n\t// zero inline styles — even from third-party plugins that forgot to use ctx.styleAttr().\n\tconst filteredAttrs: string[] = withClass.filter((attr) => attr !== 'style');\n\n\tconst sanitizedHTML: string = sanitizeHTML(\n\t\thtml,\n\t\t{\n\t\t\tALLOWED_TAGS: allowedTags,\n\t\t\tALLOWED_ATTR: filteredAttrs,\n\t\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t\t\t...blockIdSanitizeConfig(includeBlockIds),\n\t\t},\n\t\tregistry,\n\t);\n\n\treturn { html: sanitizedHTML, css: collector.toCSS(), styleMap: collector.toStyleMap() };\n}\n\n/** Serializes a sequence of blocks to HTML, grouping consecutive list items into wrappers. */\nfunction serializeBlocks(blocks: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tlet i = 0;\n\n\twhile (i < blocks.length) {\n\t\tconst block: BlockNode | undefined = blocks[i];\n\t\tif (!block) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isNodeOfType(block, 'list_item')) {\n\t\t\t// Collect consecutive list items\n\t\t\tconst listItems: BlockNode[] = [];\n\t\t\twhile (i < blocks.length) {\n\t\t\t\tconst item: BlockNode | undefined = blocks[i];\n\t\t\t\tif (!item || !isNodeOfType(item, 'list_item')) break;\n\t\t\t\tlistItems.push(item);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tparts.push(serializeListGroup(listItems, ctx));\n\t\t} else {\n\t\t\tparts.push(serializeBlock(block, ctx));\n\t\t\ti++;\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Serializes a group of consecutive list items into properly nested `<ul>`/`<ol>` wrappers.\n * Uses a stack-based algorithm to handle indent-based nesting.\n * Produces valid HTML5: nested lists open *inside* the parent `<li>`.\n */\nfunction serializeListGroup(items: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tconst stack: { tag: string; indent: number }[] = [];\n\n\tfor (let idx = 0; idx < items.length; idx++) {\n\t\tconst item: BlockNode | undefined = items[idx];\n\t\tif (!item) continue;\n\n\t\tconst listType: string = (item.attrs?.listType as string) ?? 'bullet';\n\t\tconst indent: number = (item.attrs?.indent as number) ?? 0;\n\t\tconst tag: string = listType === 'ordered' ? 'ol' : 'ul';\n\t\t// Pop wrapper levels that are deeper than current indent,\n\t\t// or at the same level when the tag type changes\n\t\twhile (stack.length > 0) {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (!top) break;\n\n\t\t\tif (top.indent > indent) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else if (top.indent === indent && top.tag !== tag) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (stack.length === 0) {\n\t\t\tparts.push(`<${tag}>`);\n\t\t\tstack.push({ tag, indent });\n\t\t} else {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (top && indent > top.indent) {\n\t\t\t\tparts.push(`<${tag}>`);\n\t\t\t\tstack.push({ tag, indent });\n\t\t\t}\n\t\t}\n\n\t\tconst content: string = serializeBlock(item, ctx);\n\n\t\t// Look ahead: if the next item is deeper, strip </li> so the nested\n\t\t// list opens inside this <li> (valid HTML5 nesting).\n\t\tconst nextItem: BlockNode | undefined = items[idx + 1];\n\t\tconst nextIndent: number | undefined = nextItem\n\t\t\t? ((nextItem.attrs?.indent as number) ?? 0)\n\t\t\t: undefined;\n\n\t\tif (nextIndent !== undefined && nextIndent > indent) {\n\t\t\tparts.push(stripTrailingLiClose(content));\n\t\t} else {\n\t\t\tparts.push(content);\n\t\t}\n\t}\n\n\t// Close all remaining open wrappers\n\twhile (stack.length > 0) {\n\t\tconst top = stack.pop();\n\t\tif (!top) break;\n\t\tparts.push(`</${top.tag}>`);\n\t\tif (stack.length > 0) {\n\t\t\tparts.push('</li>');\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/** Removes the trailing `</li>` from serialized list item HTML. */\nfunction stripTrailingLiClose(html: string): string {\n\tconst suffix = '</li>';\n\tif (html.endsWith(suffix)) {\n\t\treturn html.slice(0, -suffix.length);\n\t}\n\treturn html;\n}\n\n/** Serializes a single block to HTML using its NodeSpec. */\nfunction serializeBlock(block: BlockNode, ctx: SerializerContext): string {\n\tconst spec: NodeSpec | undefined = ctx.registry?.getNodeSpec(block.type);\n\tconst alignment: BlockAlignment | undefined = resolveExportAlignment(block, spec, {\n\t\tstartHasClass: ctx.startHasClass,\n\t\tinherited: ctx.inheritedAlignment,\n\t});\n\tconst content: string = isLeafBlock(block)\n\t\t? serializeInlineContent(block, ctx)\n\t\t: serializeBlocks(getBlockChildren(block), inheritAlignment(ctx, alignment));\n\n\tlet html: string;\n\tif (spec?.toHTML) {\n\t\thtml = spec.toHTML(block, content, ctx.exportCtx);\n\t} else {\n\t\thtml = `<p>${content || '<br>'}</p>`;\n\t}\n\n\t// Centrally inject `data-block-id` so each `NodeSpec.toHTML` is relieved of\n\t// the responsibility — and the round-trip identity contract holds for every\n\t// block type, including ones added by future plugins. The serializer's\n\t// allowlist passes `data-block-id` through DOMPurify. Skip if the spec\n\t// already emits one (mirrors the existing `dir` defense-in-depth pattern).\n\t// `escapeAttr` is defense-in-depth — `isSafeBlockId` already excludes any\n\t// character that would need escaping. Skipped entirely when the caller opted\n\t// out via `includeBlockIds: false`; the allowlist strip is the guarantee.\n\tif (ctx.includeBlockIds && isSafeBlockId(block.id)) {\n\t\tif (!firstOpeningTag(html).includes(' data-block-id=')) {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'data-block-id', escapeAttr(block.id));\n\t\t}\n\t}\n\n\t// HTML IDs are semantic, document-local targets and therefore independent of\n\t// the editor's internal `data-block-id` wire identity. The model value wins\n\t// over a NodeSpec-provided `id` so serialization can never emit duplicates.\n\thtml = setHTMLIdOnFirstTag(html, block.htmlId);\n\n\thtml = injectAlignment(html, alignment, ctx);\n\n\t// Defense-in-depth: inject dir into the first opening tag if not already present.\n\t// NodeSpec toHTML may already inject it; this ensures it survives even without a plugin.\n\tconst dir: string | undefined = (block.attrs as Record<string, unknown>)?.dir as\n\t\t| string\n\t\t| undefined;\n\tif (dir && VALID_DIRECTIONS.has(dir)) {\n\t\tif (!firstOpeningTag(html).includes(' dir=')) {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'dir', escapeAttr(dir));\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/** The context for a block's children: they inherit the alignment the block writes. */\nfunction inheritAlignment(\n\tctx: SerializerContext,\n\talignment: BlockAlignment | undefined,\n): SerializerContext {\n\treturn alignment ? { ...ctx, inheritedAlignment: alignment } : ctx;\n}\n\n/**\n * Writes the block's resolved alignment into the first opening tag: a class in\n * class mode, an inline `text-align` otherwise. `resolveExportAlignment` returns\n * only valid alignments; the class name is escaped as defense-in-depth.\n */\nfunction injectAlignment(\n\thtml: string,\n\talignment: BlockAlignment | undefined,\n\tctx: SerializerContext,\n): string {\n\tif (!alignment) return html;\n\tconst declaration: string = alignmentDeclaration(alignment);\n\treturn ctx.collector\n\t\t? injectAttrIntoFirstTag(html, 'class', escapeAttr(ctx.collector.getClassNames(declaration)))\n\t\t: injectAttrIntoFirstTag(html, 'style', escapeAttr(declaration));\n}\n\n/** Serializes inline children (TextNode + InlineNode) of a block. */\nfunction serializeInlineContent(block: BlockNode, ctx: SerializerContext): string {\n\tconst children: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tconst merged: readonly (TextNode | InlineNode)[] = mergeAdjacentTextNodes(children);\n\tconst parts: string[] = [];\n\tconst markOrder: Map<string, number> | undefined = ctx.registry\n\t\t? buildMarkOrder(ctx.registry)\n\t\t: undefined;\n\n\tfor (const child of merged) {\n\t\tif (isInlineNode(child)) {\n\t\t\tconst inlineSpec = ctx.registry?.getInlineNodeSpec(child.inlineType);\n\t\t\tif (inlineSpec?.toHTMLString) {\n\t\t\t\tconst inlineHTML: string = inlineSpec.toHTMLString(child);\n\t\t\t\t// Wrap the atomic node in its marks (e.g. a linked inline image → <a><img></a>).\n\t\t\t\tif (ctx.registry && child.marks.length > 0) {\n\t\t\t\t\tparts.push(\n\t\t\t\t\t\tctx.collector\n\t\t\t\t\t\t\t? serializeInlineNodeMarksToClassHTML(\n\t\t\t\t\t\t\t\t\tinlineHTML,\n\t\t\t\t\t\t\t\t\tchild.marks,\n\t\t\t\t\t\t\t\t\tctx.registry,\n\t\t\t\t\t\t\t\t\tctx.collector,\n\t\t\t\t\t\t\t\t\tmarkOrder,\n\t\t\t\t\t\t\t\t\tctx.exportCtx,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: serializeInlineNodeMarksToHTML(\n\t\t\t\t\t\t\t\t\tinlineHTML,\n\t\t\t\t\t\t\t\t\tchild.marks,\n\t\t\t\t\t\t\t\t\tctx.registry,\n\t\t\t\t\t\t\t\t\tmarkOrder,\n\t\t\t\t\t\t\t\t\tctx.exportCtx,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tparts.push(inlineHTML);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (ctx.registry && ctx.collector) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToClassHTML(\n\t\t\t\t\tchild.text,\n\t\t\t\t\tchild.marks,\n\t\t\t\t\tctx.registry,\n\t\t\t\t\tctx.collector,\n\t\t\t\t\tmarkOrder,\n\t\t\t\t\tctx.exportCtx,\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (ctx.registry) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToHTML(child.text, child.marks, ctx.registry, markOrder, ctx.exportCtx),\n\t\t\t);\n\t\t} else if (child.text !== '') {\n\t\t\tparts.push(escapeHTML(child.text));\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Merges adjacent TextNodes that share identical mark sets.\n * InlineNodes act as merge boundaries.\n */\nfunction mergeAdjacentTextNodes(\n\tchildren: readonly (TextNode | InlineNode)[],\n): readonly (TextNode | InlineNode)[] {\n\tif (children.length <= 1) return children;\n\n\tconst result: (TextNode | InlineNode)[] = [];\n\n\tfor (const child of children) {\n\t\tif (isInlineNode(child)) {\n\t\t\tresult.push(child);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst prev: TextNode | InlineNode | undefined = result[result.length - 1];\n\t\tif (prev && isTextNode(prev) && markSetsEqual(prev.marks, child.marks)) {\n\t\t\tresult[result.length - 1] = {\n\t\t\t\ttype: 'text',\n\t\t\t\ttext: prev.text + child.text,\n\t\t\t\tmarks: prev.marks,\n\t\t\t};\n\t\t} else {\n\t\t\tresult.push(child);\n\t\t}\n\t}\n\n\treturn result;\n}\n","/** Shared, DOM-free table-dimension bounds and normalization. */\n\n/** Smallest supported table column width or row minimum height, in CSS pixels. */\nexport const MIN_TABLE_DIMENSION_PX = 1;\n\n/** Largest supported table column width or row minimum height, in CSS pixels. */\nexport const MAX_TABLE_DIMENSION_PX = 10_000;\n\n/**\n * Normalizes a finite numeric table dimension into the requested bounded range.\n * Non-numeric and non-finite input is rejected with `null`.\n */\nexport function normalizeTableDimensionPx(\n\tvalue: unknown,\n\tminimum = MIN_TABLE_DIMENSION_PX,\n\tmaximum = MAX_TABLE_DIMENSION_PX,\n): number | null {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return null;\n\n\tconst normalizedMinimum: number = normalizeBound(minimum, MIN_TABLE_DIMENSION_PX);\n\tconst normalizedMaximum: number = Math.max(\n\t\tnormalizedMinimum,\n\t\tnormalizeBound(maximum, MAX_TABLE_DIMENSION_PX),\n\t);\n\treturn Math.min(normalizedMaximum, Math.max(normalizedMinimum, value));\n}\n\nfunction normalizeBound(value: number, fallback: number): number {\n\tif (!Number.isFinite(value)) return fallback;\n\treturn Math.min(MAX_TABLE_DIMENSION_PX, Math.max(MIN_TABLE_DIMENSION_PX, value));\n}\n","/**\n * Safe table-dimension parsing and HTML serialization helpers.\n *\n * Table dimensions are stored as finite CSS-pixel numbers. HTML import accepts\n * notectl's numeric wire attributes and a deliberately small conventional\n * subset: unitless numeric presentation attributes and exact `px` CSS values.\n * Arbitrary CSS expressions never cross into document attributes.\n */\n\nimport { styleAttribute } from '../model/HTMLUtils.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport {\n\tMAX_TABLE_DIMENSION_PX,\n\tMIN_TABLE_DIMENSION_PX,\n\tnormalizeTableDimensionPx,\n} from '../model/TableDimensions.js';\n\n/** Canonical HTML metadata carrying one logical column's width in CSS pixels. */\nexport const TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE = 'data-notectl-width-px';\n\n/** Canonical HTML metadata carrying one logical row's minimum height in CSS pixels. */\nexport const TABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE = 'data-notectl-min-height-px';\n\n/** Defensive upper bound for a serialized `<col>` vector. */\nexport const MAX_SERIALIZED_TABLE_COLUMNS = 1_000;\n\n/** HTML's upper bound for a `<col span>` value. */\nexport const MAX_TABLE_COLUMN_SPAN = 1_000;\n\nconst DECIMAL_NUMBER_RE = /^\\d+(?:\\.\\d+)?$/;\nconst CSS_PX_RE = /^(\\d+(?:\\.\\d+)?)px$/i;\nconst POSITIVE_INTEGER_RE = /^\\d+$/;\n\n/** Returns a bounded, finite CSS-pixel value without clamping untrusted serialized input. */\nexport function normalizeSerializedTableDimensionPx(value: unknown): number | undefined {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return undefined;\n\tif (value < MIN_TABLE_DIMENSION_PX || value > MAX_TABLE_DIMENSION_PX) return undefined;\n\treturn normalizeTableDimensionPx(value) ?? undefined;\n}\n\n/** Parses notectl's canonical numeric `data-notectl-*-px` value. */\nexport function parseTableDimensionMetadata(raw: string | null): number | undefined {\n\treturn parseDecimal(raw, false);\n}\n\n/** Parses a conventional numeric or `px` presentation attribute. */\nexport function parseConventionalTableDimension(raw: string | null): number | undefined {\n\treturn parseDecimal(raw, true);\n}\n\n/** Parses an exact CSS `<length>` in pixels. Other units and expressions are rejected. */\nexport function parseCSSTableDimension(raw: string | null): number | undefined {\n\tif (raw === null) return undefined;\n\tconst match: RegExpMatchArray | null = raw.trim().match(CSS_PX_RE);\n\treturn match?.[1] ? parseBoundedNumber(match[1]) : undefined;\n}\n\n/**\n * Reads a dimension from an element using deterministic precedence:\n * notectl metadata, exact CSS properties, then a conventional HTML attribute.\n */\nexport function readTableDimensionPx(\n\telement: HTMLElement,\n\tmetadataAttribute: string,\n\tcssProperties: readonly string[],\n\tconventionalAttribute: string,\n): number | undefined {\n\tconst metadata: number | undefined = parseTableDimensionMetadata(\n\t\telement.getAttribute(metadataAttribute),\n\t);\n\tif (metadata !== undefined) return metadata;\n\n\tfor (const property of cssProperties) {\n\t\tconst cssValue: number | undefined = parseCSSTableDimension(\n\t\t\telement.style.getPropertyValue(property),\n\t\t);\n\t\tif (cssValue !== undefined) return cssValue;\n\t}\n\n\treturn parseConventionalTableDimension(element.getAttribute(conventionalAttribute));\n}\n\n/** Parses a bounded positive integer HTML span, falling back to one when malformed. */\nexport function parseTableColumnSpan(raw: string | null): number {\n\tif (raw === null) return 1;\n\tconst normalized: string = raw.trim();\n\tif (!POSITIVE_INTEGER_RE.test(normalized)) return 1;\n\tconst value: number = Number(normalized);\n\tif (!Number.isSafeInteger(value) || value < 1 || value > MAX_TABLE_COLUMN_SPAN) return 1;\n\treturn value;\n}\n\n/**\n * Normalizes an untrusted logical column-width vector. Invalid entries become\n * automatic (`null`); a vector with no explicit width is omitted.\n */\nexport function normalizeTableColumnWidthsPx(\n\tvalue: unknown,\n): readonly (number | null)[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst widths: (number | null)[] = Array.from(\n\t\tvalue.slice(0, MAX_SERIALIZED_TABLE_COLUMNS),\n\t\t(entry: unknown): number | null => normalizeSerializedTableDimensionPx(entry) ?? null,\n\t);\n\treturn widths.some((width: number | null): boolean => width !== null) ? widths : undefined;\n}\n\n/** True when a table column-width vector contains at least one safe explicit value. */\nexport function hasExplicitTableColumnWidth(value: unknown): boolean {\n\treturn normalizeTableColumnWidthsPx(value) !== undefined;\n}\n\n/**\n * Emits canonical metadata plus mode-aware visual CSS for one safe dimension.\n * `ctx.styleAttr()` remains the sole generated-style path in class/CSP mode.\n */\nexport function serializeTableDimensionAttrs(\n\tmetadataAttribute: string,\n\tcssProperty: 'width' | 'height',\n\tvalue: unknown,\n\tctx?: HTMLExportContext,\n): string {\n\tconst dimension: number | undefined = normalizeSerializedTableDimensionPx(value);\n\tif (dimension === undefined) return '';\n\tconst declarations = `${cssProperty}: ${String(dimension)}px`;\n\treturn ` ${metadataAttribute}=\"${String(dimension)}\"${styleAttribute(declarations, ctx)}`;\n}\n\nfunction parseDecimal(raw: string | null, allowPx: boolean): number | undefined {\n\tif (raw === null) return undefined;\n\tconst normalized: string = raw.trim();\n\tif (DECIMAL_NUMBER_RE.test(normalized)) return parseBoundedNumber(normalized);\n\tif (!allowPx) return undefined;\n\tconst match: RegExpMatchArray | null = normalized.match(CSS_PX_RE);\n\treturn match?.[1] ? parseBoundedNumber(match[1]) : undefined;\n}\n\nfunction parseBoundedNumber(raw: string): number | undefined {\n\tconst value: number = Number(raw);\n\treturn normalizeSerializedTableDimensionPx(value);\n}\n"],"mappings":"0aAsBA,IAAa,EAAwC,IAAI,IAAY,GAG/D,iBAAyD,IAAI,IAAI,CACtE,CAAC,OAAQ,SACT,CAAC,QAAS,SAIL,EAAuB,iBAGvB,EAA4C,QAGlD,SAAgB,EAAmB,GAClC,OAAI,EAAiB,GAAe,EACZ,iBAAV,EAAqB,EAAkB,IAAI,QAAS,CACnE,CAGA,IAAM,EAAmD,IAAI,IAC5D,EAAiB,IAAK,GAA8B,CACnD,EAAqB,GACrB,GAAG,IAAuB,OAK5B,SAAgB,EAA0B,GACzC,OAAO,EAAoB,IAAI,EAChC,CAkBA,SAAgB,EAAqB,GACpC,OAAO,EAAmB,EAAG,OAAO,UACrC,CCvDA,IAAa,EAAgC,wBAG7C,SAAgB,EAAc,GAC7B,OAAO,EAAsB,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K,OAAO,cAAc,IAAU,EAAQ,GAAK,EAAA,IAAsC,EAChF,CACR,CAMA,SAAgB,GACf,GAEA,IAAK,MAAM,QAAQ,GAAQ,OAC3B,MAAM,EAA4B,MAAM,KACvC,EAAM,MAAM,EA7E8B,KA8EzC,GAAkC,GAAoC,IAAU,MAElF,OAAO,EAAO,KAAM,GAA4C,OAAV,GAAkB,OAAS,CAClF,CAGA,SAAgB,GAA4B,GAC3C,YAA+C,IAAxC,GAA6B,EACrC,CAMA,SAAgB,GACf,EACA,EACA,EACA,GAEA,MAAM,EAAgC,GAAoC,GAC1E,QAAkB,IAAd,EAAyB,MAAO,GACpC,MAAM,EAAe,GAAG,MAAgB,OAAO,OAC/C,MAAO,IAAI,MAAsB,OAAO,MAAc,EAAe,EAAc,IACpF,CAEA,SAAS,GAAa,EAAoB,GACzC,GAAY,OAAR,EAAc,OAClB,MAAM,EAAqB,EAAI,OAC/B,GAAI,GAAkB,KAAK,GAAa,OAAO,GAAmB,GAClE,IAAK,EAAS,OACd,MAAM,EAAiC,EAAW,MAAM,IACxD,OAAO,IAAQ,GAAK,GAAmB,EAAM,SAAM,CACpD,CAEA,SAAS,GAAmB,GAE3B,OAAO,GADe,OAAO,GAE9B"}
1
+ {"version":3,"file":"TableDimensions-BSEOEox2.mjs","names":["normalizeHTMLId","escapeHTML","SAFE_URI_REGEXP","escapeAttr","INLINE_STYLE_EXPORT_CONTEXT","styleAttribute","isLeafBlock","getBlockChildren","markSetsEqual","getInlineChildren","isTextNode","isInlineNode","blockId","isNodeOfType","alignmentDeclaration","isBlockAlignment","BLOCK_ALIGNMENTS","sanitizeHTML","preserveHTMLIdSanitizeConfig","createCSSValueCanonicalizer","VALID_ALIGNMENTS","Set","LEGACY_ALIGNMENTS","Map","DEFAULT_CLASS_PREFIX","BROWSER_DEFAULT_ALIGNMENT","normalizeAlignment","value","get","DEFAULT_CLASS_NAMES","map","alignment","defaultAlignmentClassName","declaration","readElementAlignment","el","style","textAlign","SAFE_BLOCK_ID_PATTERN","isSafeBlockId","test","adoptBlockId","used","raw","getAttribute","has","add","PROPERTY_PATTERN","IMPORTANT_PATTERN","RULE_BREAKOUT","parseDeclaration","colon","indexOf","name","slice","trim","endsWith","trimEnd","withoutFinalSemicolon","breaksOutOfRule","parts","splitDeclarations","length","isSingleValue","property","startsWith","toLowerCase","css","formatDeclaration","declarations","quote","depth","start","index","char","charAt","Math","max","push","part","filter","fnv1aHash","input","hash","i","charCodeAt","imul","toString","padStart","CSSClassCollector","lookup","defaultClassName","rules","hashedClassNames","usedHashes","constructor","this","getClassNames","classNames","unmapped","sort","styleClass","set","className","includes","notectlClassName","join","toCSS","toStyleMap","normalized","hashedClassName","existing","suffix","String","injectAttrIntoFirstTag","html","attr","firstTagRange","findFirstOpeningTagRange","firstTag","end","pattern","RegExp","match","existingValue","mergedAttr","nextFirstTag","replace","injectedFirstTag","isTagWhitespace","character","setHTMLIdOnFirstTag","htmlId","replacement","withoutExisting","openingTag","ranges","result","rangeIndex","range","removeAttributes","setAttrOnFirstTag","nextChar","firstOpeningTag","buildMarkOrder","registry","types","getMarkTypes","order","t","spec","getMarkSpec","rank","wrapMarks","innerHTML","marks","markOrder","exportCtx","wrapStyleSpan","sortedMarks","a","b","type","styleParts","tagMarks","mark","markSpec","toHTMLStyle","toHTMLString","serializeMarks","text","inlineStyleSpanWrapper","classSpanWrapper","collector","serializeMarksToHTML","serializeInlineNodeMarksToHTML","serializeMarksToClassHTML","serializeInlineNodeMarksToClassHTML","createClassDeclarationResolver","styleMap","getStyleClass","defaultAlignmentDeclaration","rehydrateStyleClasses","root","resolve","maxDeclarations","element","Array","from","querySelectorAll","classDeclarations","addMissingDeclarations","classList","resolved","parsed","getPropertyValue","setProperty","VALID_DIRECTIONS","createClassExportContext","styleAttr","blockIdSanitizeConfig","includeBlockIds","serializeDocumentToHTML","doc","options","ctx","serializeBlocks","children","allowedTags","getAllowedTags","allowedAttrs","getAllowedAttrs","ALLOWED_TAGS","ALLOWED_ATTR","ALLOWED_URI_REGEXP","serializeDocumentToCSS","styleClasses","canonicalize","canonicalValue","createCSSOMCanonicalizer","keys","keyOf","byKey","key","createStyleClassLookup","getStyleClasses","startHasClass","baseAttrs","filteredAttrs","blocks","block","listItems","item","serializeListGroup","serializeBlock","items","stack","idx","listType","attrs","indent","tag","top","pop","content","nextItem","nextIndent","stripTrailingLiClose","getNodeSpec","specDefault","align","default","explicit","inherited","resolveExportAlignment","inheritedAlignment","merged","child","prev","mergeAdjacentTextNodes","inlineSpec","getInlineNodeSpec","inlineType","inlineHTML","serializeInlineContent","inheritAlignment","toHTML","id","injectAlignment","dir","MAX_TABLE_DIMENSION_PX","normalizeTableDimensionPx","minimum","maximum","Number","isFinite","normalizedMinimum","normalizeBound","normalizedMaximum","min","fallback","TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE","TABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE","MAX_SERIALIZED_TABLE_COLUMNS","DECIMAL_NUMBER_RE","CSS_PX_RE","POSITIVE_INTEGER_RE","normalizeSerializedTableDimensionPx","parseCSSTableDimension","parseBoundedNumber","readTableDimensionPx","metadataAttribute","cssProperties","conventionalAttribute","metadata","parseDecimal","cssValue","parseTableColumnSpan","isSafeInteger","normalizeTableColumnWidthsPx","isArray","widths","entry","some","width","hasExplicitTableColumnWidth","serializeTableDimensionAttrs","cssProperty","dimension","allowPx"],"sources":["../../src/serialization/AlignmentHTML.ts","../../src/serialization/BlockIdHTML.ts","../../src/model/StyleClass.ts","../../src/serialization/CSSClassCollector.ts","../../src/serialization/FirstTagAttributes.ts","../../src/serialization/MarkSerializer.ts","../../src/serialization/StyleClassHTML.ts","../../src/serialization/DocumentSerializer.ts","../../src/model/TableDimensions.ts","../../src/serialization/TableDimensions.ts"],"sourcesContent":["/**\n * Shared rules for block alignment in HTML.\n *\n * Alignment is a logical block attribute (`start`, `center`, `end`, `justify`).\n * HTML carries it as an inline `text-align` style or, in class mode, as a CSS\n * class: an application style class registered for the declaration (#269),\n * otherwise `notectl-align-<alignment>`. Import turns both kinds of class back\n * into the inline style before parsing, so reading alignment means reading the\n * inline style. Serializer and parser must agree on these shapes; this module is\n * the single source of truth.\n */\n\nimport {\n\tBLOCK_ALIGNMENTS,\n\ttype BlockAlignment,\n\talignmentDeclaration,\n\tisBlockAlignment,\n} from '../model/BlockAlignment.js';\nimport type { BlockNode } from '../model/Document.js';\nimport type { NodeSpec } from '../model/NodeSpec.js';\n\n/** Known-safe alignment values accepted by the serializer (defense-in-depth). */\nexport const VALID_ALIGNMENTS: ReadonlySet<string> = new Set<string>(BLOCK_ALIGNMENTS);\n\n/** Physical values from older content, mapped to their logical equivalent. */\nconst LEGACY_ALIGNMENTS: ReadonlyMap<string, BlockAlignment> = new Map([\n\t['left', 'start'],\n\t['right', 'end'],\n]);\n\n/** Prefix of notectl's own alignment class names. */\nconst DEFAULT_CLASS_PREFIX = 'notectl-align-';\n\n/** Browsers render blocks start-aligned, so `start` needs no markup by default. */\nconst BROWSER_DEFAULT_ALIGNMENT: BlockAlignment = 'start';\n\n/** Validates a stored or parsed alignment value and maps legacy `left`/`right`. */\nexport function normalizeAlignment(value: unknown): BlockAlignment | undefined {\n\tif (isBlockAlignment(value)) return value;\n\treturn typeof value === 'string' ? LEGACY_ALIGNMENTS.get(value) : undefined;\n}\n\n/** notectl's own class for alignment declarations, e.g. `notectl-align-center`. */\nconst DEFAULT_CLASS_NAMES: ReadonlyMap<string, string> = new Map(\n\tBLOCK_ALIGNMENTS.map((alignment: BlockAlignment) => [\n\t\talignmentDeclaration(alignment),\n\t\t`${DEFAULT_CLASS_PREFIX}${alignment}`,\n\t]),\n);\n\n/** notectl's own class for one `text-align` declaration, or `undefined` for anything else. */\nexport function defaultAlignmentClassName(declaration: string): string | undefined {\n\treturn DEFAULT_CLASS_NAMES.get(declaration);\n}\n\n/**\n * The declaration of one of notectl's own alignment classes, including the\n * legacy physical names (`notectl-align-left` is `text-align: start`).\n */\nexport function defaultAlignmentDeclaration(className: string): string | undefined {\n\tif (!className.startsWith(DEFAULT_CLASS_PREFIX)) return undefined;\n\tconst alignment: BlockAlignment | undefined = normalizeAlignment(\n\t\tclassName.slice(DEFAULT_CLASS_PREFIX.length),\n\t);\n\treturn alignment ? alignmentDeclaration(alignment) : undefined;\n}\n\n/**\n * Reads an element's alignment from its inline `text-align`, which import\n * also derives from alignment classes before parsing.\n */\nexport function readElementAlignment(el: HTMLElement): BlockAlignment | undefined {\n\treturn normalizeAlignment(el.style?.textAlign);\n}\n\n/** Where a block sits in the exported HTML, as far as its alignment markup is concerned. */\nexport interface AlignmentExportOptions {\n\t/**\n\t * Whether an application style class stands for `text-align: start`. The\n\t * serializer sets it in class mode only.\n\t */\n\treadonly startHasClass?: boolean;\n\t/**\n\t * The alignment the block inherits in the exported HTML from the nearest\n\t * ancestor that writes one, such as an aligned table cell.\n\t */\n\treadonly inherited?: BlockAlignment;\n}\n\n/**\n * Returns the alignment the serializer writes for `block`, or `undefined` when\n * the HTML needs no alignment markup. A block's effective alignment is its own\n * `align` attribute, or the default its spec declares (images are centered).\n * Markup is needed when that alignment differs from the browser default or from\n * the block's own default (so import restores it). An implicit `start` inherits\n * an aligned container, while an explicit `start` overrides it. A registered\n * `start` class also marks implicit defaults outside aligned containers.\n */\nexport function resolveExportAlignment(\n\tblock: BlockNode,\n\tspec: NodeSpec | undefined,\n\toptions: AlignmentExportOptions = {},\n): BlockAlignment | undefined {\n\tconst specDefault: BlockAlignment =\n\t\tnormalizeAlignment(spec?.attrs?.align?.default) ?? BROWSER_DEFAULT_ALIGNMENT;\n\tconst explicit: BlockAlignment | undefined = normalizeAlignment(block.attrs?.align);\n\tconst alignment: BlockAlignment | undefined =\n\t\texplicit ?? (spec?.attrs?.align ? specDefault : undefined);\n\tif (!alignment) return undefined;\n\tif (alignment !== BROWSER_DEFAULT_ALIGNMENT || alignment !== specDefault) return alignment;\n\tif (explicit && options.inherited !== undefined) return alignment;\n\n\tconst pinnedByClass: boolean = options.startHasClass === true && options.inherited === undefined;\n\treturn pinnedByClass ? alignment : undefined;\n}\n","/**\n * Shared rules for the `data-block-id` HTML wire format.\n *\n * Block identity round-trips through `getContentHTML` → `setContentHTML` so the\n * caret-preserving `EditorView.replaceState()` keeps the cursor on the same block\n * across content sync (Angular signal forms, RxJS pipes — see ARCHITECTURE §9.2).\n * Both serializer and parser must agree on the same shape; this module is the\n * single source of truth.\n */\n\nimport { type BlockId, blockId } from '../model/TypeBrands.js';\n\n/**\n * Conservative pattern for `data-block-id` values: alphanumeric, underscore,\n * hyphen, max 64 chars. Defense-in-depth — IDs flow in-memory only, but we keep\n * the wire shape narrow to rule out attribute-injection vectors and to allow\n * `escapeAttr` to be a no-op for valid IDs.\n */\nexport const SAFE_BLOCK_ID_PATTERN: RegExp = /^[A-Za-z0-9_-]{1,64}$/;\n\n/** True if `value` is shaped like a safe `data-block-id`. */\nexport function isSafeBlockId(value: string): boolean {\n\treturn SAFE_BLOCK_ID_PATTERN.test(value);\n}\n\n/**\n * Adopts the `data-block-id` attribute from a parsed element so that block\n * identity survives an HTML round-trip. Returns `undefined` (caller generates\n * a fresh ID) when:\n * - the attribute is missing (e.g. user-pasted external HTML),\n * - the value is malformed,\n * - or the value collides with an already-adopted ID in this parse pass\n * (e.g. concatenated HTML from two documents).\n */\nexport function adoptBlockId(el: Element, used: Set<string>): BlockId | undefined {\n\tconst raw: string | null = el.getAttribute('data-block-id');\n\tif (!raw) return undefined;\n\tif (!isSafeBlockId(raw)) return undefined;\n\tif (used.has(raw)) return undefined;\n\tused.add(raw);\n\treturn blockId(raw);\n}\n","/**\n * Application-defined CSS classes for content HTML (#269).\n *\n * A style class stands for exactly one CSS declaration: class-based export\n * writes the class wherever notectl would write that declaration, and HTML\n * import and paste read the class back as the declaration. The document keeps\n * storing semantic values (an `align` attribute, a `textColor` mark), never\n * class names.\n */\n\n/** An application CSS class that stands for one CSS declaration in content HTML. */\nexport interface StyleClass {\n\t/** The class written to class-based HTML, e.g. `'text-red'`. */\n\treadonly className: string;\n\t/** The one CSS declaration it stands for, e.g. `'color: #e03131'`. */\n\treadonly declaration: string;\n}\n\n/**\n * Application CSS classes keyed by a plugin's own values, e.g.\n * `{ center: 'align-center' }` for alignments or `{ '#e03131': 'text-red' }`\n * for colors.\n */\nexport type StyleClassNames<K extends PropertyKey = string> = Readonly<Partial<Record<K, string>>>;\n\n/** One CSS declaration split into its property and value. */\nexport interface CSSDeclaration {\n\treadonly property: string;\n\treadonly value: string;\n}\n\n/** A CSS property name, including custom properties such as `--ntbl-bc`. */\nconst PROPERTY_PATTERN: RegExp = /^-{0,2}[A-Za-z_][A-Za-z0-9_-]*$/;\n\n/** `!important` is dropped by the CSSOM, so it cannot round-trip through a class. */\nconst IMPORTANT_PATTERN: RegExp = /!\\s*important/i;\n\n/** Characters that end a CSS rule or a `<style>` element wherever they appear. */\nconst RULE_BREAKOUT: RegExp = /[{}<>]/;\n\n/**\n * Parses one CSS declaration. The property is lowercased (custom properties\n * keep their case) and the value trimmed. Returns `undefined` unless the input\n * is exactly one declaration whose value cannot end its declaration or rule; a\n * semicolon inside quotes or parentheses (`url(data:…;base64,…)`) is part of it.\n */\nexport function parseDeclaration(declaration: string): CSSDeclaration | undefined {\n\tconst colon: number = declaration.indexOf(':');\n\tif (colon < 0) return undefined;\n\tconst name: string = declaration.slice(0, colon).trim();\n\tif (!PROPERTY_PATTERN.test(name)) return undefined;\n\tconst value: string = withoutFinalSemicolon(declaration.slice(colon + 1).trim());\n\tif (!isSingleValue(value) || IMPORTANT_PATTERN.test(value)) return undefined;\n\treturn { property: name.startsWith('--') ? name : name.toLowerCase(), value };\n}\n\n/** Returns `true` when CSS text could end a rule or a `<style>` element it is written into. */\nexport function breaksOutOfRule(css: string): boolean {\n\treturn RULE_BREAKOUT.test(css);\n}\n\nfunction isSingleValue(value: string): boolean {\n\tif (value === '' || breaksOutOfRule(value)) return false;\n\tconst parts: readonly string[] = splitDeclarations(value);\n\treturn parts.length === 1 && parts[0] === value;\n}\n\nfunction withoutFinalSemicolon(value: string): string {\n\treturn value.endsWith(';') ? value.slice(0, -1).trimEnd() : value;\n}\n\n/** Writes a parsed declaration as `property: value`. */\nexport function formatDeclaration(declaration: CSSDeclaration): string {\n\treturn `${declaration.property}: ${declaration.value}`;\n}\n\n/**\n * Splits a declaration list such as `color: red; font-family: 'A;B', serif`\n * into its trimmed, non-empty declarations. A semicolon inside quotes or\n * parentheses does not end a declaration.\n */\nexport function splitDeclarations(declarations: string): string[] {\n\tconst parts: string[] = [];\n\tlet quote: string | undefined;\n\tlet depth = 0;\n\tlet start = 0;\n\tfor (let index = 0; index < declarations.length; index++) {\n\t\tconst char: string = declarations.charAt(index);\n\t\tif (quote) {\n\t\t\tif (char === quote) quote = undefined;\n\t\t} else if (char === '\"' || char === \"'\") {\n\t\t\tquote = char;\n\t\t} else if (char === '(') {\n\t\t\tdepth++;\n\t\t} else if (char === ')') {\n\t\t\tdepth = Math.max(0, depth - 1);\n\t\t} else if (char === ';' && depth === 0) {\n\t\t\tparts.push(declarations.slice(start, index));\n\t\t\tstart = index + 1;\n\t\t}\n\t}\n\tparts.push(declarations.slice(start));\n\treturn parts.map((part: string) => part.trim()).filter((part: string) => part.length > 0);\n}\n","/**\n * CSSClassCollector: maps CSS declarations to class names during class-based\n * serialization and produces a minimal stylesheet for the classes it used.\n *\n * Each declaration that has an application style class (#269) gets that class.\n * The remaining declarations of a set share one notectl class: notectl's own\n * name when the set is a single alignment, otherwise a content-hashed\n * `notectl-s-*` name (FNV-1a), deterministic and independent of encounter order.\n */\n\nimport { type StyleClass, breaksOutOfRule, splitDeclarations } from '../model/StyleClass.js';\nimport type { StyleClassLookup } from './StyleClassHTML.js';\n\n/** Prefix for generated style class names (avoids collisions with user classes). */\nconst CLASS_PREFIX = 'notectl-s-';\n\n/** Base for hash encoding output. */\nconst HASH_BASE = 36;\n/** Pad length for consistent 6-char hashes. */\nconst HASH_PAD_LENGTH = 6;\n\n/** FNV-1a 32-bit offset basis. */\nconst FNV_OFFSET_BASIS = 0x811c9dc5;\n/** FNV-1a 32-bit prime. */\nconst FNV_PRIME = 0x01000193;\n\n/**\n * FNV-1a 32-bit hash function.\n * Fast, no crypto dependency, excellent distribution for short strings.\n */\nfunction fnv1aHash(input: string): string {\n\tlet hash: number = FNV_OFFSET_BASIS;\n\tfor (let i = 0; i < input.length; i++) {\n\t\thash ^= input.charCodeAt(i);\n\t\thash = Math.imul(hash, FNV_PRIME);\n\t}\n\t// Convert to unsigned 32-bit, then to base-36, padded to 6 chars\n\tconst unsigned: number = hash >>> 0;\n\treturn unsigned.toString(HASH_BASE).padStart(HASH_PAD_LENGTH, '0');\n}\n\n/** Finds notectl's own class for a single remaining declaration, if it has one. */\nexport type DefaultClassName = (declaration: string) => string | undefined;\n\n/**\n * Stateful collector that assigns CSS class names to declarations.\n * Used during a single serialization pass, then produces the collected stylesheet.\n */\nexport class CSSClassCollector {\n\t/** Class name → declarations of every class used so far, in first-use order. */\n\tprivate readonly rules: Map<string, string> = new Map();\n\t/** Normalized declarations → hashed class name. */\n\tprivate readonly hashedClassNames: Map<string, string> = new Map();\n\t/** Tracks used hashes to handle the (extremely rare) collision case. */\n\tprivate readonly usedHashes: Set<string> = new Set();\n\n\t/**\n\t * @param lookup Finds the application style class of one declaration.\n\t * @param defaultClassName notectl's own class for a single remaining declaration.\n\t */\n\tconstructor(\n\t\tprivate readonly lookup: StyleClassLookup = () => undefined,\n\t\tprivate readonly defaultClassName: DefaultClassName = () => undefined,\n\t) {}\n\n\t/**\n\t * Returns the space-separated class names for the given CSS declarations:\n\t * one application class per declaration that has one, then one notectl class\n\t * for the rest. Declarations that could break out of a CSS rule are left out.\n\t * Returns `''` when no declaration remains.\n\t */\n\tgetClassNames(declarations: string): string {\n\t\tconst classNames: string[] = [];\n\t\tconst unmapped: string[] = [];\n\t\tfor (const declaration of splitDeclarations(declarations).sort()) {\n\t\t\tif (breaksOutOfRule(declaration)) continue;\n\t\t\tconst styleClass: StyleClass | undefined = this.lookup(declaration);\n\t\t\tif (!styleClass) {\n\t\t\t\tunmapped.push(declaration);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.rules.set(styleClass.className, styleClass.declaration);\n\t\t\tif (!classNames.includes(styleClass.className)) classNames.push(styleClass.className);\n\t\t}\n\t\tif (unmapped.length > 0) classNames.push(this.notectlClassName(unmapped.join('; ')));\n\t\treturn classNames.join(' ');\n\t}\n\n\t/** Produces CSS rules for all collected classes. Returns empty string if none collected. */\n\ttoCSS(): string {\n\t\treturn [...this.rules]\n\t\t\t.map(([className, declarations]) => `.${className} { ${declarations}; }`)\n\t\t\t.join('\\n');\n\t}\n\n\t/**\n\t * Returns a map from class name → CSS declarations for round-trip support.\n\t * Used by `setContentHTML` to rehydrate class-based HTML.\n\t */\n\ttoStyleMap(): ReadonlyMap<string, string> {\n\t\treturn new Map(this.rules);\n\t}\n\n\tprivate notectlClassName(normalized: string): string {\n\t\tconst className: string = this.defaultClassName(normalized) ?? this.hashedClassName(normalized);\n\t\tif (!this.rules.has(className)) this.rules.set(className, normalized);\n\t\treturn className;\n\t}\n\n\tprivate hashedClassName(normalized: string): string {\n\t\tconst existing: string | undefined = this.hashedClassNames.get(normalized);\n\t\tif (existing) return existing;\n\n\t\tlet hash: string = fnv1aHash(normalized);\n\t\tlet suffix = 0;\n\t\t// Collision handling: append suffix counter if the hash is already in use\n\t\t// for a different declarations string\n\t\twhile (this.usedHashes.has(hash)) {\n\t\t\tsuffix++;\n\t\t\thash = fnv1aHash(normalized + String(suffix));\n\t\t}\n\t\tthis.usedHashes.add(hash);\n\t\tconst className = `${CLASS_PREFIX}${hash}`;\n\t\tthis.hashedClassNames.set(normalized, className);\n\t\treturn className;\n\t}\n}\n","/**\n * Attribute edits on the first opening tag of an HTML fragment. The serializer\n * uses them to add block-level attributes (`data-block-id`, `dir`, `id`, and the\n * alignment class or style) to whatever markup a NodeSpec's `toHTML()` produced.\n * Tag scanning is quote-aware, so `>` inside attribute values is never a tag end.\n */\n\nimport { escapeAttr, normalizeHTMLId } from '../model/HTMLUtils.js';\n\n/**\n * Injects or merges an attribute into the first opening tag of an HTML fragment.\n * Values are expected to be pre-escaped by the caller.\n */\nexport function injectAttrIntoFirstTag(html: string, attr: string, value: string): string {\n\tconst firstTagRange: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!firstTagRange) return html;\n\tconst firstTag: string = html.slice(firstTagRange.start, firstTagRange.end + 1);\n\tconst pattern: RegExp = new RegExp(`\\\\s${attr}\\\\s*=\\\\s*(\\\"([^\\\"]*)\\\"|'([^']*)')`);\n\tconst existing: RegExpMatchArray | null = firstTag.match(pattern);\n\tif (existing) {\n\t\tconst existingValue: string = existing[2] ?? existing[3] ?? '';\n\t\tif (attr === 'style' && /(?:^|;)\\s*text-align\\s*:/i.test(existingValue)) {\n\t\t\treturn html;\n\t\t}\n\t\tconst sep: string = attr === 'style' ? '; ' : ' ';\n\t\tconst mergedAttr: string = ` ${attr}=\"${existingValue}${sep}${value}\"`;\n\t\tconst nextFirstTag: string = firstTag.replace(pattern, mergedAttr);\n\t\treturn `${html.slice(0, firstTagRange.start)}${nextFirstTag}${html.slice(firstTagRange.end + 1)}`;\n\t}\n\tconst isSelfClosing: boolean = firstTag.endsWith('/>');\n\tconst injectedFirstTag: string = isSelfClosing\n\t\t? `${firstTag.slice(0, -2)} ${attr}=\"${value}\"/>`\n\t\t: `${firstTag.slice(0, -1)} ${attr}=\"${value}\">`;\n\treturn `${html.slice(0, firstTagRange.start)}${injectedFirstTag}${html.slice(firstTagRange.end + 1)}`;\n}\n\n/** Replaces an attribute on the first opening tag, or adds it when absent. */\nfunction setAttrOnFirstTag(html: string, attr: string, value: string): string {\n\tconst firstTagRange: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!firstTagRange) return html;\n\tconst firstTag: string = html.slice(firstTagRange.start, firstTagRange.end + 1);\n\tconst replacement: string = ` ${attr}=\"${value}\"`;\n\tconst withoutExisting: string = removeAttributes(firstTag, attr);\n\tconst isSelfClosing: boolean = withoutExisting.endsWith('/>');\n\tconst nextFirstTag: string = isSelfClosing\n\t\t? `${withoutExisting.slice(0, -2)}${replacement}/>`\n\t\t: `${withoutExisting.slice(0, -1)}${replacement}>`;\n\treturn `${html.slice(0, firstTagRange.start)}${nextFirstTag}${html.slice(firstTagRange.end + 1)}`;\n}\n\n/** Removes real attributes by name without matching attribute-like text inside quoted values. */\nfunction removeAttributes(openingTag: string, attr: string): string {\n\tconst ranges: { readonly start: number; readonly end: number }[] = [];\n\tlet index = 1;\n\n\t// Skip the tag name.\n\twhile (\n\t\tindex < openingTag.length &&\n\t\t!isTagWhitespace(openingTag[index] ?? '') &&\n\t\topeningTag[index] !== '>' &&\n\t\topeningTag[index] !== '/'\n\t) {\n\t\tindex++;\n\t}\n\n\twhile (index < openingTag.length) {\n\t\twhile (isTagWhitespace(openingTag[index] ?? '')) index++;\n\t\tif (openingTag[index] === '>' || openingTag[index] === undefined) break;\n\t\tif (openingTag[index] === '/' && openingTag[index + 1] === '>') break;\n\n\t\tconst start: number = index;\n\t\twhile (\n\t\t\tindex < openingTag.length &&\n\t\t\t!isTagWhitespace(openingTag[index] ?? '') &&\n\t\t\topeningTag[index] !== '=' &&\n\t\t\topeningTag[index] !== '>' &&\n\t\t\topeningTag[index] !== '/'\n\t\t) {\n\t\t\tindex++;\n\t\t}\n\t\tconst name: string = openingTag.slice(start, index);\n\t\tif (name === '') {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\twhile (isTagWhitespace(openingTag[index] ?? '')) index++;\n\t\tif (openingTag[index] === '=') {\n\t\t\tindex++;\n\t\t\twhile (isTagWhitespace(openingTag[index] ?? '')) index++;\n\t\t\tconst quote: string | undefined = openingTag[index];\n\t\t\tif (quote === '\"' || quote === \"'\") {\n\t\t\t\tindex++;\n\t\t\t\twhile (index < openingTag.length && openingTag[index] !== quote) index++;\n\t\t\t\tif (openingTag[index] === quote) index++;\n\t\t\t} else {\n\t\t\t\twhile (\n\t\t\t\t\tindex < openingTag.length &&\n\t\t\t\t\t!isTagWhitespace(openingTag[index] ?? '') &&\n\t\t\t\t\topeningTag[index] !== '>' &&\n\t\t\t\t\t!(openingTag[index] === '/' && openingTag[index + 1] === '>')\n\t\t\t\t) {\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (name.toLowerCase() === attr.toLowerCase()) ranges.push({ start, end: index });\n\t}\n\n\tlet result: string = openingTag;\n\tfor (let rangeIndex = ranges.length - 1; rangeIndex >= 0; rangeIndex--) {\n\t\tconst range = ranges[rangeIndex];\n\t\tif (range) result = `${result.slice(0, range.start)}${result.slice(range.end)}`;\n\t}\n\treturn result;\n}\n\nfunction isTagWhitespace(character: string): boolean {\n\treturn (\n\t\tcharacter === ' ' ||\n\t\tcharacter === '\\t' ||\n\t\tcharacter === '\\n' ||\n\t\tcharacter === '\\f' ||\n\t\tcharacter === '\\r'\n\t);\n}\n\n/** Applies a validated semantic HTML ID to the first element emitted for a block. */\nexport function setHTMLIdOnFirstTag(html: string, value: unknown): string {\n\tconst htmlId: string | undefined = normalizeHTMLId(value);\n\treturn htmlId ? setAttrOnFirstTag(html, 'id', escapeAttr(htmlId)) : html;\n}\n\n/** Finds the first opening tag range, treating `>` inside quotes as attribute text. */\nfunction findFirstOpeningTagRange(html: string): { start: number; end: number } | undefined {\n\tlet start: number = html.indexOf('<');\n\twhile (start >= 0) {\n\t\tconst nextChar: string | undefined = html[start + 1];\n\t\tif (nextChar && /[A-Za-z]/.test(nextChar)) {\n\t\t\tlet quote: '\"' | \"'\" | undefined;\n\t\t\tfor (let i = start + 2; i < html.length; i++) {\n\t\t\t\tconst char: string = html[i] ?? '';\n\t\t\t\tif (quote) {\n\t\t\t\t\tif (char === quote) quote = undefined;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '\"' || char === \"'\") {\n\t\t\t\t\tquote = char;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '>') {\n\t\t\t\t\treturn { start, end: i };\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\tstart = html.indexOf('<', start + 1);\n\t}\n\treturn undefined;\n}\n\n/** Returns the first opening tag of `html` (quote-aware), or `''` if none exists. */\nexport function firstOpeningTag(html: string): string {\n\tconst range: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!range) return '';\n\treturn html.slice(range.start, range.end + 1);\n}\n","/**\n * MarkSerializer: shared mark serialization logic for DocumentSerializer and ClipboardHandler.\n * Separates style-based marks (merged into a single `<span style>`) from tag-based marks\n * (nested wrappers in rank order).\n */\n\nimport type { Mark } from '../model/Document.js';\nimport { escapeAttr, escapeHTML, styleAttribute } from '../model/HTMLUtils.js';\nimport type { MarkSpec } from '../model/MarkSpec.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport type { CSSClassCollector } from './CSSClassCollector.js';\n\n/** Rank assigned to marks whose spec does not declare an explicit `rank`. */\nconst DEFAULT_MARK_RANK = 99;\n\n/** Builds a map of mark type name to rank from the registry (compute once per pass). */\nexport function buildMarkOrder(registry: SchemaRegistry): Map<string, number> {\n\tconst types: readonly string[] = registry.getMarkTypes();\n\tconst order = new Map<string, number>();\n\tfor (const t of types) {\n\t\tconst spec: MarkSpec | undefined = registry.getMarkSpec(t);\n\t\tif (spec) order.set(t, spec.rank ?? DEFAULT_MARK_RANK);\n\t}\n\treturn order;\n}\n\n/**\n * Wraps already-rendered inner HTML in its marks. Style-based marks\n * (`toHTMLStyle`) are merged into a single span via `wrapStyleSpan`; tag-based\n * marks (`toHTMLString`) then wrap the result in rank order. The inner HTML is\n * emitted verbatim (callers pre-escape text; rendered inline-node HTML must not\n * be re-escaped).\n */\nfunction wrapMarks(\n\tinnerHTML: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder: Map<string, number> | undefined,\n\texportCtx: HTMLExportContext | undefined,\n\twrapStyleSpan: (html: string, declarations: string) => string,\n): string {\n\tif (marks.length === 0) return innerHTML;\n\n\tconst order: Map<string, number> = markOrder ?? buildMarkOrder(registry);\n\tconst sortedMarks: Mark[] = [...marks].sort(\n\t\t(a, b) => (order.get(a.type) ?? DEFAULT_MARK_RANK) - (order.get(b.type) ?? DEFAULT_MARK_RANK),\n\t);\n\n\tconst styleParts: string[] = [];\n\tconst tagMarks: Mark[] = [];\n\n\tfor (const mark of sortedMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLStyle) {\n\t\t\tconst style: string | null = markSpec.toHTMLStyle(mark);\n\t\t\tif (style) {\n\t\t\t\tstyleParts.push(style);\n\t\t\t}\n\t\t} else {\n\t\t\ttagMarks.push(mark);\n\t\t}\n\t}\n\n\t// Wrap with the merged style span first (closest to content).\n\tlet html: string = innerHTML;\n\tif (styleParts.length > 0) {\n\t\thtml = wrapStyleSpan(html, styleParts.join('; '));\n\t}\n\n\t// Then wrap with tag-based marks in rank order.\n\tfor (const mark of tagMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLString) {\n\t\t\thtml = markSpec.toHTMLString(mark, html, exportCtx);\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/**\n * Shared text mark-serialization core: escapes `text`, then delegates to\n * {@link wrapMarks}. The two public entry points differ only in how the merged\n * style declarations become a `<span>`.\n */\nfunction serializeMarks(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder: Map<string, number> | undefined,\n\texportCtx: HTMLExportContext | undefined,\n\twrapStyleSpan: (html: string, declarations: string) => string,\n): string {\n\tif (text === '') return '';\n\treturn wrapMarks(escapeHTML(text), marks, registry, markOrder, exportCtx, wrapStyleSpan);\n}\n\n/** Builds the inline-style `<span style>` wrapper used by the style-attribute mode. */\nfunction inlineStyleSpanWrapper(\n\texportCtx: HTMLExportContext | undefined,\n): (html: string, declarations: string) => string {\n\treturn (html, declarations) => {\n\t\tconst attr: string = styleAttribute(declarations, exportCtx);\n\t\treturn attr ? `<span${attr}>${html}</span>` : html;\n\t};\n}\n\n/** Builds the `<span class>` wrapper used by the CSS-class mode. */\nfunction classSpanWrapper(\n\tcollector: CSSClassCollector,\n): (html: string, declarations: string) => string {\n\treturn (html, declarations) => {\n\t\tconst classNames: string = collector.getClassNames(declarations);\n\t\treturn classNames ? `<span class=\"${escapeAttr(classNames)}\">${html}</span>` : html;\n\t};\n}\n\n/**\n * Serializes text with marks to HTML.\n * Style-based marks (`toHTMLStyle`) are merged into a single `<span style=\"...\">`.\n * Tag-based marks (`toHTMLString`) wrap the content in rank order.\n */\nexport function serializeMarksToHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn serializeMarks(\n\t\ttext,\n\t\tmarks,\n\t\tregistry,\n\t\tmarkOrder,\n\t\texportCtx,\n\t\tinlineStyleSpanWrapper(exportCtx),\n\t);\n}\n\n/**\n * Wraps an already-rendered inline-node HTML fragment (e.g. `<img>`) in its marks\n * using inline-style spans, mirroring {@link serializeMarksToHTML} but without\n * escaping the fragment. Lets a linked inline image export as `<a …><img …></a>`.\n */\nexport function serializeInlineNodeMarksToHTML(\n\tinnerHTML: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn wrapMarks(\n\t\tinnerHTML,\n\t\tmarks,\n\t\tregistry,\n\t\tmarkOrder,\n\t\texportCtx,\n\t\tinlineStyleSpanWrapper(exportCtx),\n\t);\n}\n\n/**\n * Serializes text with marks to HTML using CSS class names instead of inline styles.\n * Style-based marks (`toHTMLStyle`) are collected into a `CSSClassCollector` and emitted\n * as `<span class=\"...\">`. Tag-based marks (`toHTMLString`) wrap identically to the inline path.\n */\nexport function serializeMarksToClassHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tcollector: CSSClassCollector,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn serializeMarks(text, marks, registry, markOrder, exportCtx, classSpanWrapper(collector));\n}\n\n/**\n * Wraps an already-rendered inline-node HTML fragment in its marks using\n * CSS-class spans, mirroring {@link serializeMarksToClassHTML} but without\n * escaping the fragment.\n */\nexport function serializeInlineNodeMarksToClassHTML(\n\tinnerHTML: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tcollector: CSSClassCollector,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn wrapMarks(innerHTML, marks, registry, markOrder, exportCtx, classSpanWrapper(collector));\n}\n","/**\n * Style classes in HTML (#269): the class vocabulary of one export or import\n * pass. Export looks up the application class of each declaration; import\n * turns application classes, a caller's `styleMap` and notectl's own alignment\n * classes back into inline declarations that the parse rules already read.\n */\n\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport {\n\ttype CSSDeclaration,\n\ttype StyleClass,\n\tformatDeclaration,\n\tparseDeclaration,\n\tsplitDeclarations,\n} from '../model/StyleClass.js';\nimport { defaultAlignmentDeclaration } from './AlignmentHTML.js';\nimport { type CSSValueCanonicalizer, createCSSValueCanonicalizer } from './CSSValueEquivalence.js';\n\n/** Finds the style class that stands for one declaration during an export. */\nexport type StyleClassLookup = (declaration: string) => StyleClass | undefined;\n\n/** Resolves a class name to the declarations it stands for during an import. */\nexport type ClassDeclarationResolver = (className: string) => string | undefined;\n\n/** Returns the declaration in the form the CSS engine serializes it. */\nexport type DeclarationCanonicalizer = (declaration: CSSDeclaration) => string;\n\n/**\n * Canonicalizes declarations with the engine's own CSS parser, the one that\n * also reads imported HTML. A browser reads `#e03131` back as\n * `rgb(224, 49, 49)` and may requote font families, so comparing the\n * canonical forms finds the class of a value in whichever spelling it has.\n * A value the engine rejects is compared as written.\n */\nexport function createCSSOMCanonicalizer(): DeclarationCanonicalizer {\n\tconst canonicalValue: CSSValueCanonicalizer = createCSSValueCanonicalizer();\n\treturn ({ property, value }: CSSDeclaration): string =>\n\t\tformatDeclaration({ property, value: canonicalValue(property, value) });\n}\n\n/**\n * Builds the export lookup for the given style classes. When two of them\n * stand for equivalent declarations, the first registered wins.\n */\nexport function createStyleClassLookup(\n\tstyleClasses: readonly StyleClass[],\n\tcanonicalize: DeclarationCanonicalizer = createCSSOMCanonicalizer(),\n): StyleClassLookup {\n\tif (styleClasses.length === 0) return () => undefined;\n\tconst keys = new Map<string, string | undefined>();\n\tconst keyOf = (declaration: string): string | undefined => {\n\t\tif (!keys.has(declaration)) {\n\t\t\tconst parsed: CSSDeclaration | undefined = parseDeclaration(declaration);\n\t\t\tkeys.set(declaration, parsed ? canonicalize(parsed) : undefined);\n\t\t}\n\t\treturn keys.get(declaration);\n\t};\n\tconst byKey = new Map<string, StyleClass>();\n\tfor (const styleClass of styleClasses) {\n\t\tconst key: string | undefined = keyOf(styleClass.declaration);\n\t\tif (key !== undefined && !byKey.has(key)) byKey.set(key, styleClass);\n\t}\n\treturn (declaration: string): StyleClass | undefined => {\n\t\tconst key: string | undefined = keyOf(declaration);\n\t\treturn key === undefined ? undefined : byKey.get(key);\n\t};\n}\n\n/**\n * Builds the import resolver: a caller's `styleMap` first (it describes the\n * exact HTML being imported), then the registered style classes, then\n * notectl's own `notectl-align-*` classes.\n */\nexport function createClassDeclarationResolver(\n\tregistry?: SchemaRegistry,\n\tstyleMap?: ReadonlyMap<string, string>,\n): ClassDeclarationResolver {\n\treturn (className: string): string | undefined =>\n\t\tstyleMap?.get(className) ??\n\t\tregistry?.getStyleClass(className)?.declaration ??\n\t\tdefaultAlignmentDeclaration(className);\n}\n\n/**\n * Rehydrates class-based HTML: the declarations a class stands for are added\n * to the element's inline style, so parse rules read them like any inline\n * style. A property the element already sets inline wins over a class, and the\n * first listed class wins over later ones. The classes stay on the element, so\n * other parse rules can still read them. An element whose classes stand for\n * more than `maxDeclarations` declarations in total is left as it is.\n */\nexport function rehydrateStyleClasses(\n\troot: ParentNode,\n\tresolve: ClassDeclarationResolver,\n\tmaxDeclarations: number,\n): void {\n\tfor (const element of Array.from(root.querySelectorAll('[class]'))) {\n\t\tconst declarations: readonly string[] | undefined = classDeclarations(\n\t\t\telement,\n\t\t\tresolve,\n\t\t\tmaxDeclarations,\n\t\t);\n\t\tif (declarations) addMissingDeclarations(element, declarations);\n\t}\n}\n\n/**\n * The declarations of an element's classes, first listed class first, or\n * `undefined` when they are more than `max`.\n */\nfunction classDeclarations(\n\telement: Element,\n\tresolve: ClassDeclarationResolver,\n\tmax: number,\n): readonly string[] | undefined {\n\tconst declarations: string[] = [];\n\tfor (const className of Array.from(element.classList)) {\n\t\tconst resolved: string | undefined = resolve(className);\n\t\tif (!resolved) continue;\n\t\tconst parts: readonly string[] = splitDeclarations(resolved);\n\t\tif (declarations.length + parts.length > max) return undefined;\n\t\tdeclarations.push(...parts);\n\t}\n\treturn declarations;\n}\n\n/**\n * Writes through the CSSOM: a strict CSP (`style-src-attr 'none'`) blocks\n * `style` attributes, in Chromium even in inert template content, but not\n * CSSOM writes. The browser serializes the result back into the attribute, so\n * parsers that read the raw attribute (table border color) still find it.\n */\nfunction addMissingDeclarations(element: Element, declarations: readonly string[]): void {\n\tconst style: CSSStyleDeclaration | undefined = (element as Partial<ElementCSSInlineStyle>).style;\n\tif (!style) return;\n\tfor (const declaration of declarations) {\n\t\tconst parsed: CSSDeclaration | undefined = parseDeclaration(declaration);\n\t\tif (!parsed || style.getPropertyValue(parsed.property)) continue;\n\t\tstyle.setProperty(parsed.property, parsed.value);\n\t}\n}\n","/**\n * DocumentSerializer: converts an immutable Document into sanitized HTML.\n * Pure functions — operates on Document/SchemaRegistry, no class state.\n */\n\nimport { isNodeOfType } from '../model/AttrRegistry.js';\nimport { type BlockAlignment, alignmentDeclaration } from '../model/BlockAlignment.js';\nimport type { BlockNode, Document, InlineNode, TextNode } from '../model/Document.js';\nimport {\n\tgetBlockChildren,\n\tgetInlineChildren,\n\tisInlineNode,\n\tisLeafBlock,\n\tisTextNode,\n\tmarkSetsEqual,\n} from '../model/Document.js';\nimport {\n\tINLINE_STYLE_EXPORT_CONTEXT,\n\tSAFE_URI_REGEXP,\n\tescapeAttr,\n\tescapeHTML,\n} from '../model/HTMLUtils.js';\nimport type { HTMLExportContext, NodeSpec } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { defaultAlignmentClassName, resolveExportAlignment } from './AlignmentHTML.js';\nimport { isSafeBlockId } from './BlockIdHTML.js';\nimport { CSSClassCollector } from './CSSClassCollector.js';\nimport type { ContentCSSResult, SerializeOptions } from './ContentHTMLTypes.js';\nimport {\n\tfirstOpeningTag,\n\tinjectAttrIntoFirstTag,\n\tsetHTMLIdOnFirstTag,\n} from './FirstTagAttributes.js';\nimport { preserveHTMLIdSanitizeConfig, sanitizeHTML } from './HTMLSanitization.js';\nimport {\n\tbuildMarkOrder,\n\tserializeInlineNodeMarksToClassHTML,\n\tserializeInlineNodeMarksToHTML,\n\tserializeMarksToClassHTML,\n\tserializeMarksToHTML,\n} from './MarkSerializer.js';\nimport { type StyleClassLookup, createStyleClassLookup } from './StyleClassHTML.js';\n\n/** Internal context threaded through all serialization helpers. */\ninterface SerializerContext {\n\treadonly registry?: SchemaRegistry;\n\treadonly collector?: CSSClassCollector;\n\treadonly exportCtx?: HTMLExportContext;\n\t/** Resolved from {@link SerializeOptions.includeBlockIds}; defaults to `true`. */\n\treadonly includeBlockIds: boolean;\n\t/** Whether an application style class stands for `text-align: start`; class mode only. */\n\treadonly startHasClass?: boolean;\n\t/** Alignment the blocks being serialized inherit from the nearest ancestor that writes one. */\n\treadonly inheritedAlignment?: BlockAlignment;\n}\n\n/** Known-safe direction values (defense-in-depth). `auto` is excluded — it's the default. */\nexport const VALID_DIRECTIONS: ReadonlySet<string> = new Set(['ltr', 'rtl']);\n\n/** Creates an HTMLExportContext for CSS class mode. */\nfunction createClassExportContext(collector: CSSClassCollector): HTMLExportContext {\n\treturn {\n\t\tstyleAttr(declarations: string): string {\n\t\t\tconst classNames: string = collector.getClassNames(declarations);\n\t\t\treturn classNames ? ` class=\"${escapeAttr(classNames)}\"` : '';\n\t\t},\n\t};\n}\n\n/**\n * DOMPurify config fragment that controls `data-block-id` in the output.\n *\n * `data-block-id` is a `data-*` attribute, which DOMPurify permits by default\n * (`ALLOW_DATA_ATTR`) regardless of `ALLOWED_ATTR`. Excluding it therefore\n * requires `FORBID_ATTR` — this is the load-bearing strip that guarantees clean\n * output even when a third-party `NodeSpec.toHTML` emits its own id (the central\n * injection in `serializeBlock` is merely skipped). Including it needs no special\n * config; the centrally injected attribute passes as a data-* attribute.\n */\nfunction blockIdSanitizeConfig(includeBlockIds: boolean): {\n\treadonly SANITIZE_DOM: false;\n\treadonly FORBID_ATTR?: string[];\n} {\n\treturn preserveHTMLIdSanitizeConfig(...(includeBlockIds ? [] : ['data-block-id']));\n}\n\n/** Serializes a full document to sanitized HTML, wrapping list items in `<ul>`/`<ol>`. */\nexport function serializeDocumentToHTML(\n\tdoc: Document,\n\tregistry?: SchemaRegistry,\n\toptions?: SerializeOptions,\n): string {\n\tconst includeBlockIds: boolean = options?.includeBlockIds !== false;\n\tconst exportCtx: HTMLExportContext = INLINE_STYLE_EXPORT_CONTEXT;\n\tconst ctx: SerializerContext = { registry, exportCtx, includeBlockIds };\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'dir', 'id'];\n\n\treturn sanitizeHTML(\n\t\thtml,\n\t\t{\n\t\t\tALLOWED_TAGS: allowedTags,\n\t\t\tALLOWED_ATTR: allowedAttrs,\n\t\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t\t\t...blockIdSanitizeConfig(includeBlockIds),\n\t\t},\n\t\tregistry,\n\t);\n}\n\n/**\n * Serializes a document to HTML with CSS class names instead of inline styles.\n * Returns the HTML and a collected stylesheet with only the rules actually used.\n */\nexport function serializeDocumentToCSS(\n\tdoc: Document,\n\tregistry?: SchemaRegistry,\n\toptions?: SerializeOptions,\n): ContentCSSResult {\n\tconst includeBlockIds: boolean = options?.includeBlockIds !== false;\n\tconst lookup: StyleClassLookup = createStyleClassLookup(registry?.getStyleClasses() ?? []);\n\tconst collector = new CSSClassCollector(lookup, defaultAlignmentClassName);\n\tconst exportCtx: HTMLExportContext = createClassExportContext(collector);\n\tconst ctx: SerializerContext = {\n\t\tregistry,\n\t\tcollector,\n\t\texportCtx,\n\t\tincludeBlockIds,\n\t\tstartHasClass: lookup(alignmentDeclaration('start')) !== undefined,\n\t};\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst baseAttrs: string[] = registry\n\t\t? registry.getAllowedAttrs()\n\t\t: ['style', 'class', 'dir', 'id'];\n\n\t// In class mode, allow `class` through DOMPurify (it is not a data-* attr, so\n\t// it must be in ALLOWED_ATTR).\n\tconst withClass: string[] = baseAttrs.includes('class')\n\t\t? [...baseAttrs]\n\t\t: [...baseAttrs, 'class'];\n\n\t// Defense-in-depth: strip `style` attribute in class mode to guarantee\n\t// zero inline styles — even from third-party plugins that forgot to use ctx.styleAttr().\n\tconst filteredAttrs: string[] = withClass.filter((attr) => attr !== 'style');\n\n\tconst sanitizedHTML: string = sanitizeHTML(\n\t\thtml,\n\t\t{\n\t\t\tALLOWED_TAGS: allowedTags,\n\t\t\tALLOWED_ATTR: filteredAttrs,\n\t\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t\t\t...blockIdSanitizeConfig(includeBlockIds),\n\t\t},\n\t\tregistry,\n\t);\n\n\treturn { html: sanitizedHTML, css: collector.toCSS(), styleMap: collector.toStyleMap() };\n}\n\n/** Serializes a sequence of blocks to HTML, grouping consecutive list items into wrappers. */\nfunction serializeBlocks(blocks: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tlet i = 0;\n\n\twhile (i < blocks.length) {\n\t\tconst block: BlockNode | undefined = blocks[i];\n\t\tif (!block) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isNodeOfType(block, 'list_item')) {\n\t\t\t// Collect consecutive list items\n\t\t\tconst listItems: BlockNode[] = [];\n\t\t\twhile (i < blocks.length) {\n\t\t\t\tconst item: BlockNode | undefined = blocks[i];\n\t\t\t\tif (!item || !isNodeOfType(item, 'list_item')) break;\n\t\t\t\tlistItems.push(item);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tparts.push(serializeListGroup(listItems, ctx));\n\t\t} else {\n\t\t\tparts.push(serializeBlock(block, ctx));\n\t\t\ti++;\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Serializes a group of consecutive list items into properly nested `<ul>`/`<ol>` wrappers.\n * Uses a stack-based algorithm to handle indent-based nesting.\n * Produces valid HTML5: nested lists open *inside* the parent `<li>`.\n */\nfunction serializeListGroup(items: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tconst stack: { tag: string; indent: number }[] = [];\n\n\tfor (let idx = 0; idx < items.length; idx++) {\n\t\tconst item: BlockNode | undefined = items[idx];\n\t\tif (!item) continue;\n\n\t\tconst listType: string = (item.attrs?.listType as string) ?? 'bullet';\n\t\tconst indent: number = (item.attrs?.indent as number) ?? 0;\n\t\tconst tag: string = listType === 'ordered' ? 'ol' : 'ul';\n\t\t// Pop wrapper levels that are deeper than current indent,\n\t\t// or at the same level when the tag type changes\n\t\twhile (stack.length > 0) {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (!top) break;\n\n\t\t\tif (top.indent > indent) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else if (top.indent === indent && top.tag !== tag) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (stack.length === 0) {\n\t\t\tparts.push(`<${tag}>`);\n\t\t\tstack.push({ tag, indent });\n\t\t} else {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (top && indent > top.indent) {\n\t\t\t\tparts.push(`<${tag}>`);\n\t\t\t\tstack.push({ tag, indent });\n\t\t\t}\n\t\t}\n\n\t\tconst content: string = serializeBlock(item, ctx);\n\n\t\t// Look ahead: if the next item is deeper, strip </li> so the nested\n\t\t// list opens inside this <li> (valid HTML5 nesting).\n\t\tconst nextItem: BlockNode | undefined = items[idx + 1];\n\t\tconst nextIndent: number | undefined = nextItem\n\t\t\t? ((nextItem.attrs?.indent as number) ?? 0)\n\t\t\t: undefined;\n\n\t\tif (nextIndent !== undefined && nextIndent > indent) {\n\t\t\tparts.push(stripTrailingLiClose(content));\n\t\t} else {\n\t\t\tparts.push(content);\n\t\t}\n\t}\n\n\t// Close all remaining open wrappers\n\twhile (stack.length > 0) {\n\t\tconst top = stack.pop();\n\t\tif (!top) break;\n\t\tparts.push(`</${top.tag}>`);\n\t\tif (stack.length > 0) {\n\t\t\tparts.push('</li>');\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/** Removes the trailing `</li>` from serialized list item HTML. */\nfunction stripTrailingLiClose(html: string): string {\n\tconst suffix = '</li>';\n\tif (html.endsWith(suffix)) {\n\t\treturn html.slice(0, -suffix.length);\n\t}\n\treturn html;\n}\n\n/** Serializes a single block to HTML using its NodeSpec. */\nfunction serializeBlock(block: BlockNode, ctx: SerializerContext): string {\n\tconst spec: NodeSpec | undefined = ctx.registry?.getNodeSpec(block.type);\n\tconst alignment: BlockAlignment | undefined = resolveExportAlignment(block, spec, {\n\t\tstartHasClass: ctx.startHasClass,\n\t\tinherited: ctx.inheritedAlignment,\n\t});\n\tconst content: string = isLeafBlock(block)\n\t\t? serializeInlineContent(block, ctx)\n\t\t: serializeBlocks(getBlockChildren(block), inheritAlignment(ctx, alignment));\n\n\tlet html: string;\n\tif (spec?.toHTML) {\n\t\thtml = spec.toHTML(block, content, ctx.exportCtx);\n\t} else {\n\t\thtml = `<p>${content || '<br>'}</p>`;\n\t}\n\n\t// Centrally inject `data-block-id` so each `NodeSpec.toHTML` is relieved of\n\t// the responsibility — and the round-trip identity contract holds for every\n\t// block type, including ones added by future plugins. The serializer's\n\t// allowlist passes `data-block-id` through DOMPurify. Skip if the spec\n\t// already emits one (mirrors the existing `dir` defense-in-depth pattern).\n\t// `escapeAttr` is defense-in-depth — `isSafeBlockId` already excludes any\n\t// character that would need escaping. Skipped entirely when the caller opted\n\t// out via `includeBlockIds: false`; the allowlist strip is the guarantee.\n\tif (ctx.includeBlockIds && isSafeBlockId(block.id)) {\n\t\tif (!firstOpeningTag(html).includes(' data-block-id=')) {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'data-block-id', escapeAttr(block.id));\n\t\t}\n\t}\n\n\t// HTML IDs are semantic, document-local targets and therefore independent of\n\t// the editor's internal `data-block-id` wire identity. The model value wins\n\t// over a NodeSpec-provided `id` so serialization can never emit duplicates.\n\thtml = setHTMLIdOnFirstTag(html, block.htmlId);\n\n\thtml = injectAlignment(html, alignment, ctx);\n\n\t// Defense-in-depth: inject dir into the first opening tag if not already present.\n\t// NodeSpec toHTML may already inject it; this ensures it survives even without a plugin.\n\tconst dir: string | undefined = (block.attrs as Record<string, unknown>)?.dir as\n\t\t| string\n\t\t| undefined;\n\tif (dir && VALID_DIRECTIONS.has(dir)) {\n\t\tif (!firstOpeningTag(html).includes(' dir=')) {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'dir', escapeAttr(dir));\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/** The context for a block's children: they inherit the alignment the block writes. */\nfunction inheritAlignment(\n\tctx: SerializerContext,\n\talignment: BlockAlignment | undefined,\n): SerializerContext {\n\treturn alignment ? { ...ctx, inheritedAlignment: alignment } : ctx;\n}\n\n/**\n * Writes the block's resolved alignment into the first opening tag: a class in\n * class mode, an inline `text-align` otherwise. `resolveExportAlignment` returns\n * only valid alignments; the class name is escaped as defense-in-depth.\n */\nfunction injectAlignment(\n\thtml: string,\n\talignment: BlockAlignment | undefined,\n\tctx: SerializerContext,\n): string {\n\tif (!alignment) return html;\n\tconst declaration: string = alignmentDeclaration(alignment);\n\treturn ctx.collector\n\t\t? injectAttrIntoFirstTag(html, 'class', escapeAttr(ctx.collector.getClassNames(declaration)))\n\t\t: injectAttrIntoFirstTag(html, 'style', escapeAttr(declaration));\n}\n\n/** Serializes inline children (TextNode + InlineNode) of a block. */\nfunction serializeInlineContent(block: BlockNode, ctx: SerializerContext): string {\n\tconst children: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tconst merged: readonly (TextNode | InlineNode)[] = mergeAdjacentTextNodes(children);\n\tconst parts: string[] = [];\n\tconst markOrder: Map<string, number> | undefined = ctx.registry\n\t\t? buildMarkOrder(ctx.registry)\n\t\t: undefined;\n\n\tfor (const child of merged) {\n\t\tif (isInlineNode(child)) {\n\t\t\tconst inlineSpec = ctx.registry?.getInlineNodeSpec(child.inlineType);\n\t\t\tif (inlineSpec?.toHTMLString) {\n\t\t\t\tconst inlineHTML: string = inlineSpec.toHTMLString(child);\n\t\t\t\t// Wrap the atomic node in its marks (e.g. a linked inline image → <a><img></a>).\n\t\t\t\tif (ctx.registry && child.marks.length > 0) {\n\t\t\t\t\tparts.push(\n\t\t\t\t\t\tctx.collector\n\t\t\t\t\t\t\t? serializeInlineNodeMarksToClassHTML(\n\t\t\t\t\t\t\t\t\tinlineHTML,\n\t\t\t\t\t\t\t\t\tchild.marks,\n\t\t\t\t\t\t\t\t\tctx.registry,\n\t\t\t\t\t\t\t\t\tctx.collector,\n\t\t\t\t\t\t\t\t\tmarkOrder,\n\t\t\t\t\t\t\t\t\tctx.exportCtx,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: serializeInlineNodeMarksToHTML(\n\t\t\t\t\t\t\t\t\tinlineHTML,\n\t\t\t\t\t\t\t\t\tchild.marks,\n\t\t\t\t\t\t\t\t\tctx.registry,\n\t\t\t\t\t\t\t\t\tmarkOrder,\n\t\t\t\t\t\t\t\t\tctx.exportCtx,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tparts.push(inlineHTML);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (ctx.registry && ctx.collector) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToClassHTML(\n\t\t\t\t\tchild.text,\n\t\t\t\t\tchild.marks,\n\t\t\t\t\tctx.registry,\n\t\t\t\t\tctx.collector,\n\t\t\t\t\tmarkOrder,\n\t\t\t\t\tctx.exportCtx,\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (ctx.registry) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToHTML(child.text, child.marks, ctx.registry, markOrder, ctx.exportCtx),\n\t\t\t);\n\t\t} else if (child.text !== '') {\n\t\t\tparts.push(escapeHTML(child.text));\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Merges adjacent TextNodes that share identical mark sets.\n * InlineNodes act as merge boundaries.\n */\nfunction mergeAdjacentTextNodes(\n\tchildren: readonly (TextNode | InlineNode)[],\n): readonly (TextNode | InlineNode)[] {\n\tif (children.length <= 1) return children;\n\n\tconst result: (TextNode | InlineNode)[] = [];\n\n\tfor (const child of children) {\n\t\tif (isInlineNode(child)) {\n\t\t\tresult.push(child);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst prev: TextNode | InlineNode | undefined = result[result.length - 1];\n\t\tif (prev && isTextNode(prev) && markSetsEqual(prev.marks, child.marks)) {\n\t\t\tresult[result.length - 1] = {\n\t\t\t\ttype: 'text',\n\t\t\t\ttext: prev.text + child.text,\n\t\t\t\tmarks: prev.marks,\n\t\t\t};\n\t\t} else {\n\t\t\tresult.push(child);\n\t\t}\n\t}\n\n\treturn result;\n}\n","/** Shared, DOM-free table-dimension bounds and normalization. */\n\n/** Smallest supported table column width or row minimum height, in CSS pixels. */\nexport const MIN_TABLE_DIMENSION_PX = 1;\n\n/** Largest supported table column width or row minimum height, in CSS pixels. */\nexport const MAX_TABLE_DIMENSION_PX = 10_000;\n\n/**\n * Normalizes a finite numeric table dimension into the requested bounded range.\n * Non-numeric and non-finite input is rejected with `null`.\n */\nexport function normalizeTableDimensionPx(\n\tvalue: unknown,\n\tminimum = MIN_TABLE_DIMENSION_PX,\n\tmaximum = MAX_TABLE_DIMENSION_PX,\n): number | null {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return null;\n\n\tconst normalizedMinimum: number = normalizeBound(minimum, MIN_TABLE_DIMENSION_PX);\n\tconst normalizedMaximum: number = Math.max(\n\t\tnormalizedMinimum,\n\t\tnormalizeBound(maximum, MAX_TABLE_DIMENSION_PX),\n\t);\n\treturn Math.min(normalizedMaximum, Math.max(normalizedMinimum, value));\n}\n\nfunction normalizeBound(value: number, fallback: number): number {\n\tif (!Number.isFinite(value)) return fallback;\n\treturn Math.min(MAX_TABLE_DIMENSION_PX, Math.max(MIN_TABLE_DIMENSION_PX, value));\n}\n","/**\n * Safe table-dimension parsing and HTML serialization helpers.\n *\n * Table dimensions are stored as finite CSS-pixel numbers. HTML import accepts\n * notectl's numeric wire attributes and a deliberately small conventional\n * subset: unitless numeric presentation attributes and exact `px` CSS values.\n * Arbitrary CSS expressions never cross into document attributes.\n */\n\nimport { styleAttribute } from '../model/HTMLUtils.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport {\n\tMAX_TABLE_DIMENSION_PX,\n\tMIN_TABLE_DIMENSION_PX,\n\tnormalizeTableDimensionPx,\n} from '../model/TableDimensions.js';\n\n/** Canonical HTML metadata carrying one logical column's width in CSS pixels. */\nexport const TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE = 'data-notectl-width-px';\n\n/** Canonical HTML metadata carrying one logical row's minimum height in CSS pixels. */\nexport const TABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE = 'data-notectl-min-height-px';\n\n/** Defensive upper bound for a serialized `<col>` vector. */\nexport const MAX_SERIALIZED_TABLE_COLUMNS = 1_000;\n\n/** HTML's upper bound for a `<col span>` value. */\nexport const MAX_TABLE_COLUMN_SPAN = 1_000;\n\nconst DECIMAL_NUMBER_RE = /^\\d+(?:\\.\\d+)?$/;\nconst CSS_PX_RE = /^(\\d+(?:\\.\\d+)?)px$/i;\nconst POSITIVE_INTEGER_RE = /^\\d+$/;\n\n/** Returns a bounded, finite CSS-pixel value without clamping untrusted serialized input. */\nexport function normalizeSerializedTableDimensionPx(value: unknown): number | undefined {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return undefined;\n\tif (value < MIN_TABLE_DIMENSION_PX || value > MAX_TABLE_DIMENSION_PX) return undefined;\n\treturn normalizeTableDimensionPx(value) ?? undefined;\n}\n\n/** Parses notectl's canonical numeric `data-notectl-*-px` value. */\nexport function parseTableDimensionMetadata(raw: string | null): number | undefined {\n\treturn parseDecimal(raw, false);\n}\n\n/** Parses a conventional numeric or `px` presentation attribute. */\nexport function parseConventionalTableDimension(raw: string | null): number | undefined {\n\treturn parseDecimal(raw, true);\n}\n\n/** Parses an exact CSS `<length>` in pixels. Other units and expressions are rejected. */\nexport function parseCSSTableDimension(raw: string | null): number | undefined {\n\tif (raw === null) return undefined;\n\tconst match: RegExpMatchArray | null = raw.trim().match(CSS_PX_RE);\n\treturn match?.[1] ? parseBoundedNumber(match[1]) : undefined;\n}\n\n/**\n * Reads a dimension from an element using deterministic precedence:\n * notectl metadata, exact CSS properties, then a conventional HTML attribute.\n */\nexport function readTableDimensionPx(\n\telement: HTMLElement,\n\tmetadataAttribute: string,\n\tcssProperties: readonly string[],\n\tconventionalAttribute: string,\n): number | undefined {\n\tconst metadata: number | undefined = parseTableDimensionMetadata(\n\t\telement.getAttribute(metadataAttribute),\n\t);\n\tif (metadata !== undefined) return metadata;\n\n\tfor (const property of cssProperties) {\n\t\tconst cssValue: number | undefined = parseCSSTableDimension(\n\t\t\telement.style.getPropertyValue(property),\n\t\t);\n\t\tif (cssValue !== undefined) return cssValue;\n\t}\n\n\treturn parseConventionalTableDimension(element.getAttribute(conventionalAttribute));\n}\n\n/** Parses a bounded positive integer HTML span, falling back to one when malformed. */\nexport function parseTableColumnSpan(raw: string | null): number {\n\tif (raw === null) return 1;\n\tconst normalized: string = raw.trim();\n\tif (!POSITIVE_INTEGER_RE.test(normalized)) return 1;\n\tconst value: number = Number(normalized);\n\tif (!Number.isSafeInteger(value) || value < 1 || value > MAX_TABLE_COLUMN_SPAN) return 1;\n\treturn value;\n}\n\n/**\n * Normalizes an untrusted logical column-width vector. Invalid entries become\n * automatic (`null`); a vector with no explicit width is omitted.\n */\nexport function normalizeTableColumnWidthsPx(\n\tvalue: unknown,\n): readonly (number | null)[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst widths: (number | null)[] = Array.from(\n\t\tvalue.slice(0, MAX_SERIALIZED_TABLE_COLUMNS),\n\t\t(entry: unknown): number | null => normalizeSerializedTableDimensionPx(entry) ?? null,\n\t);\n\treturn widths.some((width: number | null): boolean => width !== null) ? widths : undefined;\n}\n\n/** True when a table column-width vector contains at least one safe explicit value. */\nexport function hasExplicitTableColumnWidth(value: unknown): boolean {\n\treturn normalizeTableColumnWidthsPx(value) !== undefined;\n}\n\n/**\n * Emits canonical metadata plus mode-aware visual CSS for one safe dimension.\n * `ctx.styleAttr()` remains the sole generated-style path in class/CSP mode.\n */\nexport function serializeTableDimensionAttrs(\n\tmetadataAttribute: string,\n\tcssProperty: 'width' | 'height',\n\tvalue: unknown,\n\tctx?: HTMLExportContext,\n): string {\n\tconst dimension: number | undefined = normalizeSerializedTableDimensionPx(value);\n\tif (dimension === undefined) return '';\n\tconst declarations = `${cssProperty}: ${String(dimension)}px`;\n\treturn ` ${metadataAttribute}=\"${String(dimension)}\"${styleAttribute(declarations, ctx)}`;\n}\n\nfunction parseDecimal(raw: string | null, allowPx: boolean): number | undefined {\n\tif (raw === null) return undefined;\n\tconst normalized: string = raw.trim();\n\tif (DECIMAL_NUMBER_RE.test(normalized)) return parseBoundedNumber(normalized);\n\tif (!allowPx) return undefined;\n\tconst match: RegExpMatchArray | null = normalized.match(CSS_PX_RE);\n\treturn match?.[1] ? parseBoundedNumber(match[1]) : undefined;\n}\n\nfunction parseBoundedNumber(raw: string): number | undefined {\n\tconst value: number = Number(raw);\n\treturn normalizeSerializedTableDimensionPx(value);\n}\n"],"mappings":"Y,8ZAsBA,IAAaoB,EAAwC,IAAIC,IAAYL,GAG/DM,iBAAyD,IAAIC,IAAI,CACtE,CAAC,OAAQ,SACT,CAAC,QAAS,SAILC,EAAuB,iBAGvBC,EAA4C,QAGlD,SAAgBC,EAAmBC,GAClC,OAAIZ,EAAiBY,GAAeA,EACZ,iBAAVA,EAAqBL,EAAkBM,IAAID,QAAS,CACnE,CAGA,IAAME,EAAmD,IAAIN,IAC5DP,EAAiBc,IAAKC,GAA8B,CACnDjB,EAAqBiB,GACrB,GAAGP,IAAuBO,OAK5B,SAAgBC,EAA0BC,GACzC,OAAOJ,EAAoBD,IAAIK,EAChC,CAkBA,SAAgBC,EAAqBC,GACpC,OAAOT,EAAmBS,EAAGC,OAAOC,UACrC,CCvDA,IAAaC,EAAgC,wBAG7C,SAAgBC,EAAcZ,GAC7B,OAAOW,EAAsBE,KAAKb,EACnC,CAWA,SAAgBc,EAAaN,EAAaO,GACzC,MAAMC,EAAqBR,EAAGS,aAAa,iBAC3C,GAAKD,GACAJ,EAAcI,KACfD,EAAKG,IAAIF,GAEb,OADAD,EAAKI,IAAIH,GACF/B,EAAQ+B,EAChB,CCTA,IAAMI,EAA2B,kCAG3BC,EAA4B,iBAG5BC,EAAwB,SAQ9B,SAAgBC,EAAiBjB,GAChC,MAAMkB,EAAgBlB,EAAYmB,QAAQ,KAC1C,GA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