@notectl/core 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (757) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/AlignmentPlugin-C26pIVcw.mjs +2 -0
  3. package/dist/chunks/AlignmentPlugin-C26pIVcw.mjs.map +1 -0
  4. package/dist/chunks/AttrRegistry-Di936wMv.mjs.map +1 -1
  5. package/dist/chunks/AttributedMarkCommands-DKHuhZA7.mjs.map +1 -1
  6. package/dist/chunks/BidiIsolationPlugin-nWd1NEF-.mjs +2 -0
  7. package/dist/chunks/BidiIsolationPlugin-nWd1NEF-.mjs.map +1 -0
  8. package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -1
  9. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs +2 -0
  10. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs.map +1 -0
  11. package/dist/chunks/BlockTypePickerRegistry-BTET9jM-.mjs.map +1 -1
  12. package/dist/chunks/BlockquotePlugin-Bag42Zc0.mjs +2 -0
  13. package/dist/chunks/BlockquotePlugin-Bag42Zc0.mjs.map +1 -0
  14. package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -1
  15. package/dist/chunks/CaretNavigationPlugin-DUAoHygg.mjs +2 -0
  16. package/dist/chunks/CaretNavigationPlugin-DUAoHygg.mjs.map +1 -0
  17. package/dist/chunks/CodeBlockPlugin-Dk_J8NAl.mjs +2 -0
  18. package/dist/chunks/CodeBlockPlugin-Dk_J8NAl.mjs.map +1 -0
  19. package/dist/chunks/ColorGrid-DAs0--ty.mjs.map +1 -1
  20. package/dist/chunks/ColorPickerPopup-B6340f3p.mjs.map +1 -1
  21. package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -1
  22. package/dist/chunks/Commands-vqbwh6Ic.mjs +2 -0
  23. package/dist/chunks/Commands-vqbwh6Ic.mjs.map +1 -0
  24. package/dist/chunks/ContentModel-dkGOh3N7.mjs +2 -0
  25. package/dist/chunks/ContentModel-dkGOh3N7.mjs.map +1 -0
  26. package/dist/chunks/CursorMarks-CqHLzGNI.mjs.map +1 -1
  27. package/dist/chunks/Decoration-BoFcdSXk.mjs.map +1 -1
  28. package/dist/chunks/DirectionDetection-a-1iksmh.mjs.map +1 -1
  29. package/dist/chunks/DirectionIcons-Bbawl9ei.mjs.map +1 -1
  30. package/dist/chunks/Document-ssR6hBzG.mjs.map +1 -1
  31. package/dist/chunks/DocumentParser-D4g5npEi.mjs +2 -0
  32. package/dist/chunks/DocumentParser-D4g5npEi.mjs.map +1 -0
  33. package/dist/chunks/DomUtils-Bf7JLFlx.mjs.map +1 -1
  34. package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -1
  35. package/dist/chunks/EditorUI-DrQI95FW.mjs +2 -0
  36. package/dist/chunks/EditorUI-DrQI95FW.mjs.map +1 -0
  37. package/dist/chunks/FontPlugin-Bzlluh1_.mjs +2 -0
  38. package/dist/chunks/FontPlugin-Bzlluh1_.mjs.map +1 -0
  39. package/dist/chunks/FontSizePlugin-kv3zHG0f.mjs +2 -0
  40. package/dist/chunks/FontSizePlugin-kv3zHG0f.mjs.map +1 -0
  41. package/dist/chunks/FormulaPlugin-20vW4Gge.mjs +2 -0
  42. package/dist/chunks/FormulaPlugin-20vW4Gge.mjs.map +1 -0
  43. package/dist/chunks/GapCursorPlugin-BPyNXY4H.mjs +2 -0
  44. package/dist/chunks/GapCursorPlugin-BPyNXY4H.mjs.map +1 -0
  45. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs +2 -0
  46. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs.map +1 -0
  47. package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -1
  48. package/dist/chunks/{HardBreakPlugin-svNnJ9Xj.mjs → HardBreakPlugin-lo8Mcg9G.mjs} +2 -2
  49. package/dist/chunks/HardBreakPlugin-lo8Mcg9G.mjs.map +1 -0
  50. package/dist/chunks/HeadingPlugin-CEZF5DBM.mjs +2 -0
  51. package/dist/chunks/HeadingPlugin-CEZF5DBM.mjs.map +1 -0
  52. package/dist/chunks/HighlightPlugin-yH44UWoe.mjs +2 -0
  53. package/dist/chunks/HighlightPlugin-yH44UWoe.mjs.map +1 -0
  54. package/dist/chunks/HorizontalRulePlugin-SNNum-9V.mjs +2 -0
  55. package/dist/chunks/HorizontalRulePlugin-SNNum-9V.mjs.map +1 -0
  56. package/dist/chunks/ImagePlugin-aeqHr5zx.mjs +2 -0
  57. package/dist/chunks/ImagePlugin-aeqHr5zx.mjs.map +1 -0
  58. package/dist/chunks/InlineCodePlugin-CIks06ti.mjs +2 -0
  59. package/dist/chunks/InlineCodePlugin-CIks06ti.mjs.map +1 -0
  60. package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -1
  61. package/dist/chunks/KeyboardNav-D0my3wuy.mjs.map +1 -1
  62. package/dist/chunks/LinkPlugin-CFw22a9X.mjs +2 -0
  63. package/dist/chunks/LinkPlugin-CFw22a9X.mjs.map +1 -0
  64. package/dist/chunks/ListPlugin-ZNEx8pvk.mjs +2 -0
  65. package/dist/chunks/ListPlugin-ZNEx8pvk.mjs.map +1 -0
  66. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs +2 -0
  67. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs.map +1 -0
  68. package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -1
  69. package/dist/chunks/MarkInputRule-DNneF2gp.mjs.map +1 -1
  70. package/dist/chunks/{MarkdownHTMLRegistry-BunUDiza.mjs → MarkdownHTMLRegistry-Cj7N2wqs.mjs} +2 -2
  71. package/dist/chunks/MarkdownHTMLRegistry-Cj7N2wqs.mjs.map +1 -0
  72. package/dist/chunks/{MarkdownParser-CvYOvU3d.mjs → MarkdownParser-JOfPSvGv.mjs} +2 -2
  73. package/dist/chunks/MarkdownParser-JOfPSvGv.mjs.map +1 -0
  74. package/dist/chunks/{MarkdownSerializer-CdUBWWGI.mjs → MarkdownSerializer-Y6saYClE.mjs} +2 -2
  75. package/dist/chunks/MarkdownSerializer-Y6saYClE.mjs.map +1 -0
  76. package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -1
  77. package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -1
  78. package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -1
  79. package/dist/chunks/{NodeSelectionCommands-B0Sb4ux4.mjs → NodeSelectionCommands-CAqIHW_6.mjs} +2 -2
  80. package/dist/chunks/NodeSelectionCommands-CAqIHW_6.mjs.map +1 -0
  81. package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -1
  82. package/dist/chunks/Platform-ByobkiCc.mjs.map +1 -1
  83. package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs.map +1 -1
  84. package/dist/chunks/PopupManager-DpxoBl54.mjs +2 -0
  85. package/dist/chunks/PopupManager-DpxoBl54.mjs.map +1 -0
  86. package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
  87. package/dist/chunks/PrintPlugin-CYkdUy-m.mjs +2 -0
  88. package/dist/chunks/PrintPlugin-CYkdUy-m.mjs.map +1 -0
  89. package/dist/chunks/RangeIterator-sJ_c9MNr.mjs.map +1 -1
  90. package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -1
  91. package/dist/chunks/{SchemaRegistry-Cs7rxafF.mjs → SchemaRegistry-CT3T7S1i.mjs} +2 -2
  92. package/dist/chunks/SchemaRegistry-CT3T7S1i.mjs.map +1 -0
  93. package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -1
  94. package/dist/chunks/SelectionReplacement-Cj4FLlPz.mjs +2 -0
  95. package/dist/chunks/SelectionReplacement-Cj4FLlPz.mjs.map +1 -0
  96. package/dist/chunks/{SelectionSync-BkjCwGp-.mjs → SelectionSync-8y0nbBHZ.mjs} +2 -2
  97. package/dist/chunks/SelectionSync-8y0nbBHZ.mjs.map +1 -0
  98. package/dist/chunks/SelectionTransactions-mQ1NfMEg.mjs.map +1 -1
  99. package/dist/chunks/ShortcutFormatting-TwiufqeV.mjs.map +1 -1
  100. package/dist/chunks/SimpleMark-DPTsIl9w.mjs +2 -0
  101. package/dist/chunks/SimpleMark-DPTsIl9w.mjs.map +1 -0
  102. package/dist/chunks/SmartPastePlugin-BSMHDDQ2.mjs +2 -0
  103. package/dist/chunks/SmartPastePlugin-BSMHDDQ2.mjs.map +1 -0
  104. package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -1
  105. package/dist/chunks/StrikethroughPlugin-CqqIF3Zk.mjs +2 -0
  106. package/dist/chunks/StrikethroughPlugin-CqqIF3Zk.mjs.map +1 -0
  107. package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -1
  108. package/dist/chunks/StyleRuntime-C0RSqKzG.mjs.map +1 -1
  109. package/dist/chunks/SuperSubPlugin-5ZFM6wdU.mjs +2 -0
  110. package/dist/chunks/SuperSubPlugin-5ZFM6wdU.mjs.map +1 -0
  111. package/dist/chunks/SyntaxTokenTypes-BUCOMtL8.mjs.map +1 -1
  112. package/dist/chunks/{TableDimensions-BSEOEox2.mjs → TableDimensions-B-OWjTuW.mjs} +2 -2
  113. package/dist/chunks/TableDimensions-B-OWjTuW.mjs.map +1 -0
  114. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs +2 -0
  115. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs.map +1 -0
  116. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs +2 -0
  117. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs.map +1 -0
  118. package/dist/chunks/TextColorPlugin-Dwp7eW7F.mjs +2 -0
  119. package/dist/chunks/TextColorPlugin-Dwp7eW7F.mjs.map +1 -0
  120. package/dist/chunks/{TextDirectionAutoPlugin-DOH5cfyy.mjs → TextDirectionAutoPlugin-CkIETM5n.mjs} +2 -2
  121. package/dist/chunks/TextDirectionAutoPlugin-CkIETM5n.mjs.map +1 -0
  122. package/dist/chunks/TextDirectionPlugin-DAcPR5Qc.mjs +2 -0
  123. package/dist/chunks/TextDirectionPlugin-DAcPR5Qc.mjs.map +1 -0
  124. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +2 -0
  125. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs.map +1 -0
  126. package/dist/chunks/TextFormattingPlugin-vml-lduV.mjs +2 -0
  127. package/dist/chunks/TextFormattingPlugin-vml-lduV.mjs.map +1 -0
  128. package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -1
  129. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs +2 -0
  130. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs.map +1 -0
  131. package/dist/chunks/TypeBrands-Ch9856Gb.mjs.map +1 -1
  132. package/dist/chunks/TypedKeys-CA4bfw9O.mjs.map +1 -1
  133. package/dist/chunks/VideoPlugin-lZCBlIon.mjs +2 -0
  134. package/dist/chunks/VideoPlugin-lZCBlIon.mjs.map +1 -0
  135. package/dist/chunks/XmlPatterns-RN32-0ob.mjs.map +1 -1
  136. package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -1
  137. package/dist/chunks/ar--Isa9OHJ.mjs.map +1 -1
  138. package/dist/chunks/ar--O0A9OTR.mjs.map +1 -1
  139. package/dist/chunks/ar-0g2bmXTn.mjs.map +1 -1
  140. package/dist/chunks/ar-4b8e2YSc.mjs.map +1 -1
  141. package/dist/chunks/ar-B03uY4xr.mjs.map +1 -1
  142. package/dist/chunks/ar-BAfInw85.mjs.map +1 -1
  143. package/dist/chunks/ar-BRX5E_Pw.mjs.map +1 -1
  144. package/dist/chunks/ar-BWOue6jG.mjs.map +1 -1
  145. package/dist/chunks/ar-Bdmunk5h.mjs.map +1 -1
  146. package/dist/chunks/ar-BwaoCUVN.mjs.map +1 -1
  147. package/dist/chunks/ar-BzqAYGER.mjs.map +1 -1
  148. package/dist/chunks/ar-C9lO1jsY.mjs.map +1 -1
  149. package/dist/chunks/ar-CMXjVzFx.mjs.map +1 -1
  150. package/dist/chunks/ar-CR6UdFL9.mjs.map +1 -1
  151. package/dist/chunks/ar-CrOb0jL2.mjs.map +1 -1
  152. package/dist/chunks/ar-Cy_77yRf.mjs.map +1 -1
  153. package/dist/chunks/ar-D1jFXqLJ.mjs.map +1 -1
  154. package/dist/chunks/ar-DahJwMI9.mjs.map +1 -1
  155. package/dist/chunks/ar-Dcl3kgtd.mjs.map +1 -1
  156. package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -1
  157. package/dist/chunks/ar-Dp1oBWyG.mjs +2 -0
  158. package/dist/chunks/ar-Dp1oBWyG.mjs.map +1 -0
  159. package/dist/chunks/ar-Dx2lO0Nm.mjs.map +1 -1
  160. package/dist/chunks/ar-NV_puwI2.mjs.map +1 -1
  161. package/dist/chunks/ar-Uzo1Azdw.mjs.map +1 -1
  162. package/dist/chunks/ar-XmSFrtmd.mjs.map +1 -1
  163. package/dist/chunks/ar-eOA3UmiE.mjs.map +1 -1
  164. package/dist/chunks/ar-sGZ-oZqB.mjs.map +1 -1
  165. package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -1
  166. package/dist/chunks/de-B8-w9gPi.mjs.map +1 -1
  167. package/dist/chunks/de-B9zSHWqY.mjs.map +1 -1
  168. package/dist/chunks/de-BX4y4PlH.mjs.map +1 -1
  169. package/dist/chunks/de-BXQBXxFJ.mjs.map +1 -1
  170. package/dist/chunks/de-BcPntcnr.mjs.map +1 -1
  171. package/dist/chunks/de-BdD3DpUB.mjs.map +1 -1
  172. package/dist/chunks/de-Bwxlcuee.mjs.map +1 -1
  173. package/dist/chunks/de-BxQIt_1Y.mjs.map +1 -1
  174. package/dist/chunks/de-C-Yf378-.mjs.map +1 -1
  175. package/dist/chunks/de-C7uehgMu.mjs.map +1 -1
  176. package/dist/chunks/de-C9ZhDqPi.mjs.map +1 -1
  177. package/dist/chunks/de-CHcv_Vmf.mjs.map +1 -1
  178. package/dist/chunks/de-CTzAMkXC.mjs.map +1 -1
  179. package/dist/chunks/de-CaeEIyzV.mjs.map +1 -1
  180. package/dist/chunks/de-D3J8XPCR.mjs +2 -0
  181. package/dist/chunks/de-D3J8XPCR.mjs.map +1 -0
  182. package/dist/chunks/de-DHs9i4af.mjs.map +1 -1
  183. package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -1
  184. package/dist/chunks/de-DRbhnS4T.mjs.map +1 -1
  185. package/dist/chunks/de-DViI26lG.mjs.map +1 -1
  186. package/dist/chunks/de-DY3obIAF.mjs.map +1 -1
  187. package/dist/chunks/de-DcMhfRBu.mjs.map +1 -1
  188. package/dist/chunks/de-DiPz7abS.mjs.map +1 -1
  189. package/dist/chunks/de-Dl4QFHMa.mjs.map +1 -1
  190. package/dist/chunks/de-XCCpWyg0.mjs.map +1 -1
  191. package/dist/chunks/de-e6J6nvAD.mjs.map +1 -1
  192. package/dist/chunks/de-i95F9SDy.mjs.map +1 -1
  193. package/dist/chunks/de-uKR7koQe.mjs.map +1 -1
  194. package/dist/chunks/es-B0Za939C.mjs.map +1 -1
  195. package/dist/chunks/es-B8K3Yvf3.mjs.map +1 -1
  196. package/dist/chunks/es-BIXm2Coj.mjs.map +1 -1
  197. package/dist/chunks/es-BJHF95J_.mjs.map +1 -1
  198. package/dist/chunks/es-BMm9kqjC.mjs.map +1 -1
  199. package/dist/chunks/es-BQ9dox_E.mjs.map +1 -1
  200. package/dist/chunks/es-BQweZX6P.mjs.map +1 -1
  201. package/dist/chunks/es-Bbz885DZ.mjs +2 -0
  202. package/dist/chunks/es-Bbz885DZ.mjs.map +1 -0
  203. package/dist/chunks/es-BdpTTRuX.mjs.map +1 -1
  204. package/dist/chunks/es-C7uVqFYr.mjs.map +1 -1
  205. package/dist/chunks/es-CCQFu1t1.mjs.map +1 -1
  206. package/dist/chunks/es-CEAJj7aB.mjs.map +1 -1
  207. package/dist/chunks/es-CUKJujcb.mjs.map +1 -1
  208. package/dist/chunks/es-CXuMz87y.mjs.map +1 -1
  209. package/dist/chunks/es-CgMfhkJJ.mjs.map +1 -1
  210. package/dist/chunks/es-CtOtKQCP.mjs.map +1 -1
  211. package/dist/chunks/es-DD01rZ6N.mjs.map +1 -1
  212. package/dist/chunks/es-DDoqchUq.mjs.map +1 -1
  213. package/dist/chunks/es-DFokqQst.mjs.map +1 -1
  214. package/dist/chunks/es-DHxdoEzR.mjs.map +1 -1
  215. package/dist/chunks/es-DehVGwQ8.mjs.map +1 -1
  216. package/dist/chunks/es-DrJyl38L.mjs.map +1 -1
  217. package/dist/chunks/es-fTW0TkYV.mjs.map +1 -1
  218. package/dist/chunks/es-kfKiqpyD.mjs.map +1 -1
  219. package/dist/chunks/es-nRLq7bgP.mjs.map +1 -1
  220. package/dist/chunks/es-paXY7HFt.mjs.map +1 -1
  221. package/dist/chunks/es-xuahrvJN.mjs.map +1 -1
  222. package/dist/chunks/fr-0qEo3bRP.mjs.map +1 -1
  223. package/dist/chunks/fr-5HkMazAf.mjs.map +1 -1
  224. package/dist/chunks/fr-B9pBLaVx.mjs.map +1 -1
  225. package/dist/chunks/fr-BRXUnq3R.mjs.map +1 -1
  226. package/dist/chunks/fr-BSUKEtTk.mjs.map +1 -1
  227. package/dist/chunks/fr-BeRlON1t.mjs.map +1 -1
  228. package/dist/chunks/fr-Bg937iAy.mjs.map +1 -1
  229. package/dist/chunks/fr-BwWrFThE.mjs.map +1 -1
  230. package/dist/chunks/fr-C3EKRThN.mjs.map +1 -1
  231. package/dist/chunks/fr-CKjH6tJI.mjs.map +1 -1
  232. package/dist/chunks/fr-CQs0-pNX.mjs.map +1 -1
  233. package/dist/chunks/fr-CfhyYN-t.mjs.map +1 -1
  234. package/dist/chunks/fr-D0MDdoir.mjs.map +1 -1
  235. package/dist/chunks/fr-D5ulA3Z6.mjs.map +1 -1
  236. package/dist/chunks/fr-DEZ_oxzS.mjs.map +1 -1
  237. package/dist/chunks/fr-DciSEykY.mjs.map +1 -1
  238. package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -1
  239. package/dist/chunks/fr-DiDhVhyV.mjs.map +1 -1
  240. package/dist/chunks/fr-DjMZ-3K5.mjs.map +1 -1
  241. package/dist/chunks/fr-F2ZrfVaF.mjs.map +1 -1
  242. package/dist/chunks/fr-GEgM1j3w.mjs +2 -0
  243. package/dist/chunks/fr-GEgM1j3w.mjs.map +1 -0
  244. package/dist/chunks/fr-KXmbys88.mjs.map +1 -1
  245. package/dist/chunks/fr-NVOinLyF.mjs.map +1 -1
  246. package/dist/chunks/fr-SbpHNrQ-.mjs.map +1 -1
  247. package/dist/chunks/fr-ZsRdLuys.mjs.map +1 -1
  248. package/dist/chunks/fr-eC0UdAPu.mjs.map +1 -1
  249. package/dist/chunks/fr-fshsDD66.mjs.map +1 -1
  250. package/dist/chunks/full-wDTdOuGt.mjs +2 -0
  251. package/dist/chunks/full-wDTdOuGt.mjs.map +1 -0
  252. package/dist/chunks/hi-4CiAKVjT.mjs.map +1 -1
  253. package/dist/chunks/hi-B-ZuX4aN.mjs.map +1 -1
  254. package/dist/chunks/hi-B2YB3Bo4.mjs.map +1 -1
  255. package/dist/chunks/hi-B2uhiPCN.mjs.map +1 -1
  256. package/dist/chunks/hi-B5cl8TWK.mjs.map +1 -1
  257. package/dist/chunks/hi-BNJIGWQQ.mjs.map +1 -1
  258. package/dist/chunks/hi-BOMkDPqC.mjs.map +1 -1
  259. package/dist/chunks/hi-Bl-yeeOI.mjs.map +1 -1
  260. package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -1
  261. package/dist/chunks/hi-By8YwVIX.mjs.map +1 -1
  262. package/dist/chunks/hi-BzbMD_cP.mjs.map +1 -1
  263. package/dist/chunks/hi-C2jEsf8v.mjs.map +1 -1
  264. package/dist/chunks/hi-CKg8i4Mm.mjs +2 -0
  265. package/dist/chunks/hi-CKg8i4Mm.mjs.map +1 -0
  266. package/dist/chunks/hi-CTWubxLY.mjs.map +1 -1
  267. package/dist/chunks/hi-CoclKAUM.mjs.map +1 -1
  268. package/dist/chunks/hi-CrmakMVj.mjs.map +1 -1
  269. package/dist/chunks/hi-DWX6k5ZD.mjs.map +1 -1
  270. package/dist/chunks/hi-DY55FuDK.mjs.map +1 -1
  271. package/dist/chunks/hi-DrC2H81d.mjs.map +1 -1
  272. package/dist/chunks/hi-DsdXcOB6.mjs.map +1 -1
  273. package/dist/chunks/hi-Dt89SxNy.mjs.map +1 -1
  274. package/dist/chunks/hi-J8ErB5nB.mjs.map +1 -1
  275. package/dist/chunks/hi-L6pJxZam.mjs.map +1 -1
  276. package/dist/chunks/hi-SECtQQzq.mjs.map +1 -1
  277. package/dist/chunks/hi-j3TDLMYd.mjs.map +1 -1
  278. package/dist/chunks/hi-l6DA-aOw.mjs.map +1 -1
  279. package/dist/chunks/hi-uACJUw53.mjs.map +1 -1
  280. package/dist/chunks/minimal-FfmHwMGU.mjs +2 -0
  281. package/dist/chunks/minimal-FfmHwMGU.mjs.map +1 -0
  282. package/dist/chunks/nl-2IdjTNeJ.mjs +2 -0
  283. package/dist/chunks/nl-2IdjTNeJ.mjs.map +1 -0
  284. package/dist/chunks/nl-B1i04NvZ.mjs +2 -0
  285. package/dist/chunks/nl-B1i04NvZ.mjs.map +1 -0
  286. package/dist/chunks/nl-BEmzpzKO.mjs +2 -0
  287. package/dist/chunks/nl-BEmzpzKO.mjs.map +1 -0
  288. package/dist/chunks/nl-B_U0D3Qq.mjs +2 -0
  289. package/dist/chunks/nl-B_U0D3Qq.mjs.map +1 -0
  290. package/dist/chunks/nl-C437Xz6z.mjs +2 -0
  291. package/dist/chunks/nl-C437Xz6z.mjs.map +1 -0
  292. package/dist/chunks/nl-C5P8Fogm.mjs +2 -0
  293. package/dist/chunks/nl-C5P8Fogm.mjs.map +1 -0
  294. package/dist/chunks/nl-CST62bzx.mjs +2 -0
  295. package/dist/chunks/nl-CST62bzx.mjs.map +1 -0
  296. package/dist/chunks/nl-CWQT-W-6.mjs +2 -0
  297. package/dist/chunks/nl-CWQT-W-6.mjs.map +1 -0
  298. package/dist/chunks/nl-CdpcDkbM.mjs +2 -0
  299. package/dist/chunks/nl-CdpcDkbM.mjs.map +1 -0
  300. package/dist/chunks/nl-CgYWZnga.mjs +2 -0
  301. package/dist/chunks/nl-CgYWZnga.mjs.map +1 -0
  302. package/dist/chunks/nl-Cr--x8bX.mjs +2 -0
  303. package/dist/chunks/nl-Cr--x8bX.mjs.map +1 -0
  304. package/dist/chunks/nl-Cwl5dxFZ.mjs +2 -0
  305. package/dist/chunks/nl-Cwl5dxFZ.mjs.map +1 -0
  306. package/dist/chunks/nl-Czjd9Bw9.mjs +2 -0
  307. package/dist/chunks/nl-Czjd9Bw9.mjs.map +1 -0
  308. package/dist/chunks/nl-DUOT2ZMQ.mjs +2 -0
  309. package/dist/chunks/nl-DUOT2ZMQ.mjs.map +1 -0
  310. package/dist/chunks/nl-DYnRYvZ5.mjs +2 -0
  311. package/dist/chunks/nl-DYnRYvZ5.mjs.map +1 -0
  312. package/dist/chunks/nl-DaNJ-ffX.mjs +2 -0
  313. package/dist/chunks/nl-DaNJ-ffX.mjs.map +1 -0
  314. package/dist/chunks/nl-DeOJ64xy.mjs +2 -0
  315. package/dist/chunks/nl-DeOJ64xy.mjs.map +1 -0
  316. package/dist/chunks/nl-DwZajfpP.mjs +2 -0
  317. package/dist/chunks/nl-DwZajfpP.mjs.map +1 -0
  318. package/dist/chunks/nl-Dyjc9M7o.mjs +2 -0
  319. package/dist/chunks/nl-Dyjc9M7o.mjs.map +1 -0
  320. package/dist/chunks/nl-GBpv7W4L.mjs +2 -0
  321. package/dist/chunks/nl-GBpv7W4L.mjs.map +1 -0
  322. package/dist/chunks/nl-HFfWJOEo.mjs +2 -0
  323. package/dist/chunks/nl-HFfWJOEo.mjs.map +1 -0
  324. package/dist/chunks/nl-KqmiCeD7.mjs +2 -0
  325. package/dist/chunks/nl-KqmiCeD7.mjs.map +1 -0
  326. package/dist/chunks/nl-_QT7e2Qt.mjs +2 -0
  327. package/dist/chunks/nl-_QT7e2Qt.mjs.map +1 -0
  328. package/dist/chunks/nl-i79IajbC.mjs +2 -0
  329. package/dist/chunks/nl-i79IajbC.mjs.map +1 -0
  330. package/dist/chunks/nl-lcZvrAz6.mjs +2 -0
  331. package/dist/chunks/nl-lcZvrAz6.mjs.map +1 -0
  332. package/dist/chunks/nl-tWJ2imhe.mjs +2 -0
  333. package/dist/chunks/nl-tWJ2imhe.mjs.map +1 -0
  334. package/dist/chunks/nl-xfiNOCgg.mjs +2 -0
  335. package/dist/chunks/nl-xfiNOCgg.mjs.map +1 -0
  336. package/dist/chunks/pt-5VeuNDd2.mjs.map +1 -1
  337. package/dist/chunks/pt-BCXgUDiU.mjs.map +1 -1
  338. package/dist/chunks/pt-BDam9cDu.mjs.map +1 -1
  339. package/dist/chunks/pt-Bb908r0n.mjs.map +1 -1
  340. package/dist/chunks/pt-BkpVtod-.mjs.map +1 -1
  341. package/dist/chunks/pt-BlFAJZo7.mjs.map +1 -1
  342. package/dist/chunks/pt-Bu7Mbz67.mjs.map +1 -1
  343. package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -1
  344. package/dist/chunks/pt-C8sOyw0V.mjs.map +1 -1
  345. package/dist/chunks/pt-CEUgbrii.mjs.map +1 -1
  346. package/dist/chunks/pt-CFrcl1v_.mjs.map +1 -1
  347. package/dist/chunks/pt-CMrFpUWS.mjs.map +1 -1
  348. package/dist/chunks/pt-CMx2wPPY.mjs.map +1 -1
  349. package/dist/chunks/pt-CR4j8gtE.mjs.map +1 -1
  350. package/dist/chunks/pt-Cc4zysaT.mjs.map +1 -1
  351. package/dist/chunks/pt-Cv6q7x5x.mjs.map +1 -1
  352. package/dist/chunks/pt-DFKJVh7k.mjs.map +1 -1
  353. package/dist/chunks/pt-DP5c76Vo.mjs +2 -0
  354. package/dist/chunks/pt-DP5c76Vo.mjs.map +1 -0
  355. package/dist/chunks/pt-DYMyMgKQ.mjs.map +1 -1
  356. package/dist/chunks/pt-D__tcM2T.mjs.map +1 -1
  357. package/dist/chunks/pt-Dg2ctkug.mjs.map +1 -1
  358. package/dist/chunks/pt-DgfMoLWR.mjs.map +1 -1
  359. package/dist/chunks/pt-OXa_IR4Q.mjs.map +1 -1
  360. package/dist/chunks/pt-UPF7DBlz.mjs.map +1 -1
  361. package/dist/chunks/pt-_qxIe7zX.mjs.map +1 -1
  362. package/dist/chunks/pt-paXY7HFt.mjs.map +1 -1
  363. package/dist/chunks/pt-zMHcNGPk.mjs.map +1 -1
  364. package/dist/chunks/register-DSRtHVkk.mjs +3 -0
  365. package/dist/chunks/register-DSRtHVkk.mjs.map +1 -0
  366. package/dist/chunks/ru--iYEtsT5.mjs +2 -0
  367. package/dist/chunks/ru--iYEtsT5.mjs.map +1 -0
  368. package/dist/chunks/ru-B1m8J9dl.mjs.map +1 -1
  369. package/dist/chunks/ru-BNPUT-3S.mjs.map +1 -1
  370. package/dist/chunks/ru-BotG0MFT.mjs.map +1 -1
  371. package/dist/chunks/ru-C-APN_dm.mjs.map +1 -1
  372. package/dist/chunks/ru-C9yFslEG.mjs.map +1 -1
  373. package/dist/chunks/ru-CkG_bpfo.mjs.map +1 -1
  374. package/dist/chunks/ru-Cs8KCNyq.mjs.map +1 -1
  375. package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -1
  376. package/dist/chunks/ru-CvDl-yEd.mjs.map +1 -1
  377. package/dist/chunks/ru-CwyPz2Va.mjs.map +1 -1
  378. package/dist/chunks/ru-D53d-_UB.mjs.map +1 -1
  379. package/dist/chunks/ru-DJMpeuey.mjs.map +1 -1
  380. package/dist/chunks/ru-DSRv3_Rg.mjs.map +1 -1
  381. package/dist/chunks/ru-DV-lgEtM.mjs.map +1 -1
  382. package/dist/chunks/ru-DiwQV30V.mjs.map +1 -1
  383. package/dist/chunks/ru-DkW9XZFy.mjs.map +1 -1
  384. package/dist/chunks/ru-DyCTlhjg.mjs.map +1 -1
  385. package/dist/chunks/ru-QGX8lOTs.mjs.map +1 -1
  386. package/dist/chunks/ru-QcTo2yoL.mjs.map +1 -1
  387. package/dist/chunks/ru-Y11wuxOB.mjs.map +1 -1
  388. package/dist/chunks/ru-Yngw7nFP.mjs.map +1 -1
  389. package/dist/chunks/ru-d68SZpEe.mjs.map +1 -1
  390. package/dist/chunks/ru-gxbzqLL8.mjs.map +1 -1
  391. package/dist/chunks/ru-k7o3Qks3.mjs.map +1 -1
  392. package/dist/chunks/ru-l73diFXn.mjs.map +1 -1
  393. package/dist/chunks/ru-q8kz-237.mjs.map +1 -1
  394. package/dist/chunks/src-DDkRstYh.mjs +2 -0
  395. package/dist/chunks/src-DDkRstYh.mjs.map +1 -0
  396. package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -1
  397. package/dist/chunks/zh-BFZOM3lF.mjs.map +1 -1
  398. package/dist/chunks/zh-BGYJXxVl.mjs.map +1 -1
  399. package/dist/chunks/zh-BP97XjlS.mjs.map +1 -1
  400. package/dist/chunks/zh-BQ73oqxc.mjs.map +1 -1
  401. package/dist/chunks/zh-BQqf3wJZ.mjs.map +1 -1
  402. package/dist/chunks/zh-Baxh6v0j.mjs.map +1 -1
  403. package/dist/chunks/zh-BvuAbM2S.mjs.map +1 -1
  404. package/dist/chunks/zh-C-wHnDo5.mjs.map +1 -1
  405. package/dist/chunks/zh-C7iCgCRP.mjs.map +1 -1
  406. package/dist/chunks/zh-CRsDvfPR.mjs.map +1 -1
  407. package/dist/chunks/zh-CWGAPVei.mjs.map +1 -1
  408. package/dist/chunks/zh-CWIzJcXi.mjs.map +1 -1
  409. package/dist/chunks/zh-CYV-db-K.mjs.map +1 -1
  410. package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -1
  411. package/dist/chunks/zh-CnW44JEw.mjs.map +1 -1
  412. package/dist/chunks/zh-D1HSmSOf.mjs.map +1 -1
  413. package/dist/chunks/zh-DUS7JduA.mjs +2 -0
  414. package/dist/chunks/zh-DUS7JduA.mjs.map +1 -0
  415. package/dist/chunks/zh-DWN1Jqn3.mjs.map +1 -1
  416. package/dist/chunks/zh-DYD476c5.mjs.map +1 -1
  417. package/dist/chunks/zh-DdzgYD7k.mjs.map +1 -1
  418. package/dist/chunks/zh-DgSmvLyw.mjs.map +1 -1
  419. package/dist/chunks/zh-DlVfQn4z.mjs.map +1 -1
  420. package/dist/chunks/zh-Oj-qSUEp.mjs.map +1 -1
  421. package/dist/chunks/zh-YfuE_m2y.mjs.map +1 -1
  422. package/dist/chunks/zh-dGSDBBzb.mjs.map +1 -1
  423. package/dist/chunks/zh-ikm3rSTR.mjs.map +1 -1
  424. package/dist/chunks/zh-oZl1P_p0.mjs.map +1 -1
  425. package/dist/commands/BlockInsertion.d.ts +15 -19
  426. package/dist/commands/BlockInsertion.d.ts.map +1 -1
  427. package/dist/commands/Commands.d.ts +3 -0
  428. package/dist/commands/Commands.d.ts.map +1 -1
  429. package/dist/commands/CompositionCommands.d.ts +14 -8
  430. package/dist/commands/CompositionCommands.d.ts.map +1 -1
  431. package/dist/commands/CompositionFallback.d.ts +13 -0
  432. package/dist/commands/CompositionFallback.d.ts.map +1 -0
  433. package/dist/commands/CompositionRebase.d.ts +17 -10
  434. package/dist/commands/CompositionRebase.d.ts.map +1 -1
  435. package/dist/commands/PasteCommand.d.ts.map +1 -1
  436. package/dist/commands/SelectionDeletion.d.ts +7 -5
  437. package/dist/commands/SelectionDeletion.d.ts.map +1 -1
  438. package/dist/commands/SelectionReplacement.d.ts +42 -0
  439. package/dist/commands/SelectionReplacement.d.ts.map +1 -0
  440. package/dist/editor/BlockIdentity.d.ts +16 -0
  441. package/dist/editor/BlockIdentity.d.ts.map +1 -0
  442. package/dist/editor/ContentSerializer.d.ts +13 -11
  443. package/dist/editor/ContentSerializer.d.ts.map +1 -1
  444. package/dist/editor/NotectlEditor.d.ts +6 -5
  445. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  446. package/dist/editor/locales/nl.d.ts +4 -0
  447. package/dist/editor/locales/nl.d.ts.map +1 -0
  448. package/dist/editor/styles/link.d.ts +3 -0
  449. package/dist/editor/styles/link.d.ts.map +1 -0
  450. package/dist/fonts/math.mjs +1 -1
  451. package/dist/fonts.mjs +1 -1
  452. package/dist/full.mjs +1 -1
  453. package/dist/html.mjs +1 -1
  454. package/dist/i18n/Locale.d.ts +1 -0
  455. package/dist/i18n/Locale.d.ts.map +1 -1
  456. package/dist/index.d.ts +1 -1
  457. package/dist/index.d.ts.map +1 -1
  458. package/dist/input/CompositionController.d.ts.map +1 -1
  459. package/dist/input/HTMLLineBreaks.d.ts +14 -0
  460. package/dist/input/HTMLLineBreaks.d.ts.map +1 -0
  461. package/dist/input/HTMLParser.d.ts +1 -7
  462. package/dist/input/HTMLParser.d.ts.map +1 -1
  463. package/dist/input/PasteHTMLHandler.d.ts +0 -1
  464. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  465. package/dist/input/PasteHandler.d.ts.map +1 -1
  466. package/dist/input/PasteRichBlockHandler.d.ts +10 -17
  467. package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
  468. package/dist/markdown.mjs +1 -1
  469. package/dist/model/ContentModel.d.ts +6 -1
  470. package/dist/model/ContentModel.d.ts.map +1 -1
  471. package/dist/model/FileHandlerDispatcher.d.ts +3 -1
  472. package/dist/model/FileHandlerDispatcher.d.ts.map +1 -1
  473. package/dist/model/FileHandlerRegistry.d.ts +11 -2
  474. package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
  475. package/dist/notectl-core.mjs +1 -1
  476. package/dist/notectl-core.umd.js +1 -1
  477. package/dist/notectl-core.umd.js.map +1 -1
  478. package/dist/plugins/PluginContextFactory.d.ts +1 -0
  479. package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
  480. package/dist/plugins/PluginManager.d.ts +5 -0
  481. package/dist/plugins/PluginManager.d.ts.map +1 -1
  482. package/dist/plugins/alignment/locales/nl.d.ts +4 -0
  483. package/dist/plugins/alignment/locales/nl.d.ts.map +1 -0
  484. package/dist/plugins/alignment.mjs +1 -1
  485. package/dist/plugins/bidi-isolation/locales/nl.d.ts +4 -0
  486. package/dist/plugins/bidi-isolation/locales/nl.d.ts.map +1 -0
  487. package/dist/plugins/bidi-isolation.mjs +1 -1
  488. package/dist/plugins/blockquote/locales/nl.d.ts +4 -0
  489. package/dist/plugins/blockquote/locales/nl.d.ts.map +1 -0
  490. package/dist/plugins/blockquote.mjs +1 -1
  491. package/dist/plugins/caret-navigation/locales/nl.d.ts +4 -0
  492. package/dist/plugins/caret-navigation/locales/nl.d.ts.map +1 -0
  493. package/dist/plugins/caret-navigation.mjs +1 -1
  494. package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
  495. package/dist/plugins/code-block/locales/nl.d.ts +4 -0
  496. package/dist/plugins/code-block/locales/nl.d.ts.map +1 -0
  497. package/dist/plugins/code-block.mjs +1 -1
  498. package/dist/plugins/editor-ui/EditorUI.d.ts +50 -0
  499. package/dist/plugins/editor-ui/EditorUI.d.ts.map +1 -0
  500. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts +44 -0
  501. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts.map +1 -0
  502. package/dist/plugins/editor-ui/index.d.ts +6 -0
  503. package/dist/plugins/editor-ui/index.d.ts.map +1 -0
  504. package/dist/plugins/font/locales/nl.d.ts +4 -0
  505. package/dist/plugins/font/locales/nl.d.ts.map +1 -0
  506. package/dist/plugins/font-size/locales/nl.d.ts +4 -0
  507. package/dist/plugins/font-size/locales/nl.d.ts.map +1 -0
  508. package/dist/plugins/font-size.mjs +1 -1
  509. package/dist/plugins/font.mjs +1 -1
  510. package/dist/plugins/formula/FormulaCommands.d.ts +6 -4
  511. package/dist/plugins/formula/FormulaCommands.d.ts.map +1 -1
  512. package/dist/plugins/formula/locales/nl.d.ts +4 -0
  513. package/dist/plugins/formula/locales/nl.d.ts.map +1 -0
  514. package/dist/plugins/formula.mjs +1 -1
  515. package/dist/plugins/gap-cursor/locales/nl.d.ts +4 -0
  516. package/dist/plugins/gap-cursor/locales/nl.d.ts.map +1 -0
  517. package/dist/plugins/gap-cursor.mjs +1 -1
  518. package/dist/plugins/hard-break.mjs +1 -1
  519. package/dist/plugins/heading/locales/nl.d.ts +4 -0
  520. package/dist/plugins/heading/locales/nl.d.ts.map +1 -0
  521. package/dist/plugins/heading.mjs +1 -1
  522. package/dist/plugins/highlight/locales/nl.d.ts +4 -0
  523. package/dist/plugins/highlight/locales/nl.d.ts.map +1 -0
  524. package/dist/plugins/highlight.mjs +1 -1
  525. package/dist/plugins/horizontal-rule/locales/nl.d.ts +4 -0
  526. package/dist/plugins/horizontal-rule/locales/nl.d.ts.map +1 -0
  527. package/dist/plugins/horizontal-rule.mjs +1 -1
  528. package/dist/plugins/image/ImageCommands.d.ts +15 -3
  529. package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
  530. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  531. package/dist/plugins/image/locales/nl.d.ts +4 -0
  532. package/dist/plugins/image/locales/nl.d.ts.map +1 -0
  533. package/dist/plugins/image.mjs +1 -1
  534. package/dist/plugins/inline-code/locales/nl.d.ts +4 -0
  535. package/dist/plugins/inline-code/locales/nl.d.ts.map +1 -0
  536. package/dist/plugins/inline-code.mjs +1 -1
  537. package/dist/plugins/link/LinkBubble.d.ts +31 -0
  538. package/dist/plugins/link/LinkBubble.d.ts.map +1 -0
  539. package/dist/plugins/link/LinkBubbleContent.d.ts +4 -0
  540. package/dist/plugins/link/LinkBubbleContent.d.ts.map +1 -0
  541. package/dist/plugins/link/LinkInteractionController.d.ts +40 -0
  542. package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -0
  543. package/dist/plugins/link/LinkLocale.d.ts +10 -1
  544. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  545. package/dist/plugins/link/LinkNavigation.d.ts +12 -0
  546. package/dist/plugins/link/LinkNavigation.d.ts.map +1 -0
  547. package/dist/plugins/link/LinkPlugin.d.ts +4 -5
  548. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  549. package/dist/plugins/link/LinkRange.d.ts +12 -0
  550. package/dist/plugins/link/LinkRange.d.ts.map +1 -0
  551. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  552. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  553. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  554. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  555. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  556. package/dist/plugins/link/locales/nl.d.ts +4 -0
  557. package/dist/plugins/link/locales/nl.d.ts.map +1 -0
  558. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  559. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  560. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  561. package/dist/plugins/link.mjs +1 -1
  562. package/dist/plugins/list/locales/nl.d.ts +4 -0
  563. package/dist/plugins/list/locales/nl.d.ts.map +1 -0
  564. package/dist/plugins/list.mjs +1 -1
  565. package/dist/plugins/print/locales/nl.d.ts +4 -0
  566. package/dist/plugins/print/locales/nl.d.ts.map +1 -0
  567. package/dist/plugins/print.mjs +1 -1
  568. package/dist/plugins/shared/PopupManager.d.ts +20 -2
  569. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  570. package/dist/plugins/shared/PopupPositioning.d.ts +2 -6
  571. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
  572. package/dist/plugins/shared/index.d.ts +1 -1
  573. package/dist/plugins/shared/index.d.ts.map +1 -1
  574. package/dist/plugins/shared.mjs +1 -1
  575. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +0 -1
  576. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
  577. package/dist/plugins/smart-paste/locales/nl.d.ts +4 -0
  578. package/dist/plugins/smart-paste/locales/nl.d.ts.map +1 -0
  579. package/dist/plugins/smart-paste.mjs +1 -1
  580. package/dist/plugins/strikethrough/locales/nl.d.ts +4 -0
  581. package/dist/plugins/strikethrough/locales/nl.d.ts.map +1 -0
  582. package/dist/plugins/strikethrough.mjs +1 -1
  583. package/dist/plugins/super-sub/locales/nl.d.ts +4 -0
  584. package/dist/plugins/super-sub/locales/nl.d.ts.map +1 -0
  585. package/dist/plugins/super-sub.mjs +1 -1
  586. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
  587. package/dist/plugins/table/TableSelection.d.ts +4 -20
  588. package/dist/plugins/table/TableSelection.d.ts.map +1 -1
  589. package/dist/plugins/table/TableSelectionTypes.d.ts +21 -0
  590. package/dist/plugins/table/TableSelectionTypes.d.ts.map +1 -0
  591. package/dist/plugins/table/locales/nl.d.ts +4 -0
  592. package/dist/plugins/table/locales/nl.d.ts.map +1 -0
  593. package/dist/plugins/table.mjs +1 -1
  594. package/dist/plugins/text-color/locales/nl.d.ts +4 -0
  595. package/dist/plugins/text-color/locales/nl.d.ts.map +1 -0
  596. package/dist/plugins/text-color.mjs +1 -1
  597. package/dist/plugins/text-direction/locales/nl.d.ts +4 -0
  598. package/dist/plugins/text-direction/locales/nl.d.ts.map +1 -0
  599. package/dist/plugins/text-direction-auto.mjs +1 -1
  600. package/dist/plugins/text-direction.mjs +1 -1
  601. package/dist/plugins/text-formatting/locales/nl.d.ts +4 -0
  602. package/dist/plugins/text-formatting/locales/nl.d.ts.map +1 -0
  603. package/dist/plugins/text-formatting.mjs +1 -1
  604. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +2 -2
  605. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
  606. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +2 -1
  607. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  608. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +8 -3
  609. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  610. package/dist/plugins/toolbar/ToolbarRegistry.d.ts +4 -0
  611. package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -1
  612. package/dist/plugins/toolbar/locales/nl.d.ts +4 -0
  613. package/dist/plugins/toolbar/locales/nl.d.ts.map +1 -0
  614. package/dist/plugins/toolbar.mjs +1 -1
  615. package/dist/plugins/video/locales/nl.d.ts +4 -0
  616. package/dist/plugins/video/locales/nl.d.ts.map +1 -0
  617. package/dist/plugins/video.mjs +1 -1
  618. package/dist/presets/full.mjs +1 -1
  619. package/dist/presets/minimal.mjs +1 -1
  620. package/dist/presets.mjs +1 -1
  621. package/dist/register.mjs +1 -1
  622. package/dist/serialization/DocumentParser.d.ts +2 -2
  623. package/dist/serialization/DocumentParser.d.ts.map +1 -1
  624. package/dist/serialization/HTMLParseRules.d.ts.map +1 -1
  625. package/dist/serialization/HTMLSanitization.d.ts +6 -0
  626. package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
  627. package/dist/serialization/PreformattedText.d.ts +3 -0
  628. package/dist/serialization/PreformattedText.d.ts.map +1 -0
  629. package/dist/state/History.d.ts.map +1 -1
  630. package/dist/state/RangeMapping.d.ts +10 -0
  631. package/dist/state/RangeMapping.d.ts.map +1 -0
  632. package/dist/state/StepApplication.d.ts.map +1 -1
  633. package/dist/state/Steps.d.ts +3 -0
  634. package/dist/state/Steps.d.ts.map +1 -1
  635. package/dist/state/StructuralPositions.d.ts +15 -0
  636. package/dist/state/StructuralPositions.d.ts.map +1 -0
  637. package/dist/state/TransactionBuilder.d.ts +6 -14
  638. package/dist/state/TransactionBuilder.d.ts.map +1 -1
  639. package/dist/test/TestUtils.d.ts.map +1 -1
  640. package/dist/ui.d.ts +3 -0
  641. package/dist/ui.d.ts.map +1 -0
  642. package/dist/ui.mjs +1 -0
  643. package/dist/view/EditorInteraction.d.ts +23 -0
  644. package/dist/view/EditorInteraction.d.ts.map +1 -0
  645. package/dist/view/EditorView.d.ts +2 -0
  646. package/dist/view/EditorView.d.ts.map +1 -1
  647. package/dist/view/EditorViewEvents.d.ts.map +1 -1
  648. package/dist/view/SelectionGeometry.d.ts +29 -0
  649. package/dist/view/SelectionGeometry.d.ts.map +1 -0
  650. package/dist/view/SelectionObserver.d.ts +19 -0
  651. package/dist/view/SelectionObserver.d.ts.map +1 -0
  652. package/dist/view/SelectionSync.d.ts +7 -0
  653. package/dist/view/SelectionSync.d.ts.map +1 -1
  654. package/package.json +12 -8
  655. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +0 -2
  656. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +0 -1
  657. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +0 -2
  658. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs.map +0 -1
  659. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs +0 -2
  660. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs.map +0 -1
  661. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +0 -2
  662. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +0 -1
  663. package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs +0 -2
  664. package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs.map +0 -1
  665. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs +0 -2
  666. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs.map +0 -1
  667. package/dist/chunks/Commands-DBBCAYBn.mjs +0 -2
  668. package/dist/chunks/Commands-DBBCAYBn.mjs.map +0 -1
  669. package/dist/chunks/ContentModel-BLC3Tez8.mjs +0 -2
  670. package/dist/chunks/ContentModel-BLC3Tez8.mjs.map +0 -1
  671. package/dist/chunks/DocumentParser-BKUrtgw1.mjs +0 -2
  672. package/dist/chunks/DocumentParser-BKUrtgw1.mjs.map +0 -1
  673. package/dist/chunks/FontPlugin-BcXNFqqO.mjs +0 -2
  674. package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +0 -1
  675. package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs +0 -2
  676. package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs.map +0 -1
  677. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs +0 -2
  678. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs.map +0 -1
  679. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +0 -2
  680. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +0 -1
  681. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +0 -2
  682. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +0 -1
  683. package/dist/chunks/HardBreakPlugin-svNnJ9Xj.mjs.map +0 -1
  684. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +0 -2
  685. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +0 -1
  686. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +0 -2
  687. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +0 -1
  688. package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs +0 -2
  689. package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs.map +0 -1
  690. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs +0 -2
  691. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs.map +0 -1
  692. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +0 -2
  693. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +0 -1
  694. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs +0 -2
  695. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs.map +0 -1
  696. package/dist/chunks/ListPlugin-DTgpvBEt.mjs +0 -2
  697. package/dist/chunks/ListPlugin-DTgpvBEt.mjs.map +0 -1
  698. package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs.map +0 -1
  699. package/dist/chunks/MarkdownParser-CvYOvU3d.mjs.map +0 -1
  700. package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs.map +0 -1
  701. package/dist/chunks/NodeSelectionCommands-B0Sb4ux4.mjs.map +0 -1
  702. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +0 -2
  703. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +0 -1
  704. package/dist/chunks/PopupManager-Jz5JrUdC.mjs +0 -2
  705. package/dist/chunks/PopupManager-Jz5JrUdC.mjs.map +0 -1
  706. package/dist/chunks/PrintPlugin-BxNlFk2c.mjs +0 -2
  707. package/dist/chunks/PrintPlugin-BxNlFk2c.mjs.map +0 -1
  708. package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +0 -1
  709. package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +0 -1
  710. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +0 -2
  711. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs.map +0 -1
  712. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs +0 -2
  713. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs.map +0 -1
  714. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs +0 -2
  715. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs.map +0 -1
  716. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs +0 -2
  717. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs.map +0 -1
  718. package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +0 -1
  719. package/dist/chunks/TablePlugin-WPwp902E.mjs +0 -2
  720. package/dist/chunks/TablePlugin-WPwp902E.mjs.map +0 -1
  721. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +0 -2
  722. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +0 -1
  723. package/dist/chunks/TextDirectionAutoPlugin-DOH5cfyy.mjs.map +0 -1
  724. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs +0 -2
  725. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs.map +0 -1
  726. package/dist/chunks/TextDirectionService-BcX07mw2.mjs +0 -2
  727. package/dist/chunks/TextDirectionService-BcX07mw2.mjs.map +0 -1
  728. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs +0 -2
  729. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs.map +0 -1
  730. package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs +0 -2
  731. package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs.map +0 -1
  732. package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs +0 -2
  733. package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs.map +0 -1
  734. package/dist/chunks/ar-Ctrv6cIi.mjs +0 -2
  735. package/dist/chunks/ar-Ctrv6cIi.mjs.map +0 -1
  736. package/dist/chunks/de-JhGflzS5.mjs +0 -2
  737. package/dist/chunks/de-JhGflzS5.mjs.map +0 -1
  738. package/dist/chunks/es-Bv7bDbMp.mjs +0 -2
  739. package/dist/chunks/es-Bv7bDbMp.mjs.map +0 -1
  740. package/dist/chunks/fr-DtzIu6tU.mjs +0 -2
  741. package/dist/chunks/fr-DtzIu6tU.mjs.map +0 -1
  742. package/dist/chunks/full-BiQ93ERr.mjs +0 -2
  743. package/dist/chunks/full-BiQ93ERr.mjs.map +0 -1
  744. package/dist/chunks/hi-Bu799xIO.mjs +0 -2
  745. package/dist/chunks/hi-Bu799xIO.mjs.map +0 -1
  746. package/dist/chunks/minimal-DO7LiFTa.mjs +0 -2
  747. package/dist/chunks/minimal-DO7LiFTa.mjs.map +0 -1
  748. package/dist/chunks/pt-DmN9u3NX.mjs +0 -2
  749. package/dist/chunks/pt-DmN9u3NX.mjs.map +0 -1
  750. package/dist/chunks/register-Cb1YTAN4.mjs +0 -3
  751. package/dist/chunks/register-Cb1YTAN4.mjs.map +0 -1
  752. package/dist/chunks/ru-BxySx7an.mjs +0 -2
  753. package/dist/chunks/ru-BxySx7an.mjs.map +0 -1
  754. package/dist/chunks/src-5GKFQ2mQ.mjs +0 -2
  755. package/dist/chunks/src-5GKFQ2mQ.mjs.map +0 -1
  756. package/dist/chunks/zh-DuucmOns.mjs +0 -2
  757. package/dist/chunks/zh-DuucmOns.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrintPlugin-BxNlFk2c.mjs","names":[],"sources":["../../src/plugins/print/PrintLocale.ts","../../src/plugins/print/PrintContentPreparer.ts","../../src/plugins/print/PrintDestinationBridge.ts","../../src/plugins/print/PrintHostStyles.ts","../../src/plugins/print/PrintStyleCollector.ts","../../src/plugins/print/PrintServiceImpl.ts","../../src/plugins/print/PrintPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the PrintPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface PrintLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly printingAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const PRINT_LOCALE_EN: PrintLocale = {\n\tlabel: 'Print',\n\ttooltip: (shortcut: string) => `Print (${shortcut})`,\n\tprintingAnnouncement: 'Printing',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<PrintLocale> = import.meta.glob<{\n\tdefault: PrintLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadPrintLocale(lang: string): Promise<PrintLocale> {\n\treturn loadLocaleModule(localeModules, lang, PRINT_LOCALE_EN);\n}\n","/**\n * Prepares editor content for print output.\n * Clones the DOM, sanitizes interactive attributes, applies block filters,\n * and inserts header/footer elements.\n */\n\nimport { sanitizeHTML } from '../../serialization/HTMLSanitization.js';\nimport { setStyleProperties } from '../../style/StyleRuntime.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Deep-clones the .notectl-content element from the editor container. */\nexport function cloneContent(container: HTMLElement): HTMLElement {\n\tconst content: HTMLElement | null = container.querySelector('.notectl-content');\n\tconst source: HTMLElement = content ?? container;\n\treturn source.cloneNode(true) as HTMLElement;\n}\n\n/** Sanitizes the cloned content for print: removes interactive attributes and selection styling. */\nexport function sanitize(clone: HTMLElement): void {\n\t// Remove contenteditable from the root\n\tclone.removeAttribute('contenteditable');\n\n\t// Remove selection-related CSS classes\n\tconst selectionClasses: readonly string[] = [\n\t\t'notectl-node-selected',\n\t\t'notectl-content--empty',\n\t\t'notectl-table-cell--selected',\n\t];\n\tfor (const cls of selectionClasses) {\n\t\tclone.classList.remove(cls);\n\t\tfor (const el of clone.querySelectorAll(`.${cls}`)) {\n\t\t\tel.classList.remove(cls);\n\t\t}\n\t}\n\n\t// Remove data-placeholder to avoid showing placeholder in print\n\tclone.removeAttribute('data-placeholder');\n}\n\n/** Removes excluded block types and applies page-break-before to configured block types. */\nexport function applyBlockFilters(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.excludeBlockTypes) {\n\t\tfor (const type of options.excludeBlockTypes) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tel.remove();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (options.pageBreakBefore) {\n\t\tfor (const type of options.pageBreakBefore) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tsetStyleProperties(el as HTMLElement, {\n\t\t\t\t\tbreakBefore: 'page',\n\t\t\t\t\tpageBreakBefore: 'always',\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Tags allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_TAGS: readonly string[] = [\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'p',\n\t'div',\n\t'span',\n\t'br',\n\t'hr',\n\t'strong',\n\t'b',\n\t'em',\n\t'i',\n\t'u',\n\t's',\n\t'sub',\n\t'sup',\n\t'small',\n\t'ul',\n\t'ol',\n\t'li',\n\t'table',\n\t'thead',\n\t'tbody',\n\t'tr',\n\t'th',\n\t'td',\n\t'img',\n];\n\n/** Attributes allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_ATTRS: readonly string[] = [\n\t'style',\n\t'class',\n\t'src',\n\t'alt',\n\t'width',\n\t'height',\n\t'colspan',\n\t'rowspan',\n];\n\n/** Resolves a header/footer value to a sanitized HTML string. */\nfunction resolveContent(value: string | (() => string)): string {\n\tconst raw: string = typeof value === 'function' ? value() : value;\n\treturn sanitizeHTML(raw, {\n\t\tALLOWED_TAGS: [...HEADER_FOOTER_ALLOWED_TAGS],\n\t\tALLOWED_ATTR: [...HEADER_FOOTER_ALLOWED_ATTRS],\n\t});\n}\n\n/** Inserts header and footer elements into the cloned content. */\nexport function insertHeaderFooter(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.header) {\n\t\tconst headerEl: HTMLDivElement = document.createElement('div');\n\t\theaderEl.className = 'notectl-print-header';\n\t\theaderEl.innerHTML = resolveContent(options.header);\n\t\tclone.insertBefore(headerEl, clone.firstChild);\n\t}\n\n\tif (options.footer) {\n\t\tconst footerEl: HTMLDivElement = document.createElement('div');\n\t\tfooterEl.className = 'notectl-print-footer';\n\t\tfooterEl.innerHTML = resolveContent(options.footer);\n\t\tclone.appendChild(footerEl);\n\t}\n}\n\n/** Orchestrates all content preparation steps. Returns a ready-to-print DOM element. */\nexport function prepare(container: HTMLElement, options: PrintOptions): HTMLElement {\n\tconst clone: HTMLElement = cloneContent(container);\n\tsanitize(clone);\n\tapplyBlockFilters(clone, options);\n\tinsertHeaderFooter(clone, options);\n\treturn clone;\n}\n","/**\n * Projects fragment targets from the print shadow tree into the document tree.\n * Browser fragment navigation and PDF named destinations cannot resolve IDs\n * whose root is a ShadowRoot, so each linked block target gets a slotted\n * light-DOM marker at the same rendered position.\n */\n\nimport { fragmentIdentifiers } from '../../model/HTMLUtils.js';\n\nexport const PRINT_DESTINATION_ATTRIBUTE = 'data-notectl-print-destination';\nexport const PRINT_DESTINATION_SLOT_ATTRIBUTE = 'data-notectl-print-destination-slot';\n\nexport interface PrintDestinationProjection {\n\treadonly markers: readonly HTMLAnchorElement[];\n}\n\ninterface Destination {\n\treadonly id: string;\n\treadonly marker: HTMLAnchorElement;\n}\n\nconst VOID_ELEMENTS: ReadonlySet<string> = new Set([\n\t'AREA',\n\t'BASE',\n\t'BR',\n\t'COL',\n\t'EMBED',\n\t'HR',\n\t'IMG',\n\t'INPUT',\n\t'LINK',\n\t'META',\n\t'PARAM',\n\t'SOURCE',\n\t'TRACK',\n\t'WBR',\n]);\n\nconst TABLE_STRUCTURAL_ELEMENTS: ReadonlySet<string> = new Set([\n\t'TABLE',\n\t'THEAD',\n\t'TBODY',\n\t'TFOOT',\n\t'TR',\n]);\n\n/** Elements whose rendered replacement/fallback UI does not lay out DOM children. */\nconst REPLACED_ELEMENTS: ReadonlySet<string> = new Set([\n\t'AUDIO',\n\t'CANVAS',\n\t'EMBED',\n\t'IFRAME',\n\t'IMG',\n\t'INPUT',\n\t'METER',\n\t'OBJECT',\n\t'PROGRESS',\n\t'SELECT',\n\t'TEXTAREA',\n\t'VIDEO',\n]);\n\nfunction uniqueToken(prefix: string, used: Set<string>): string {\n\tlet value: string;\n\tdo {\n\t\tvalue = `${prefix}-${crypto.randomUUID()}`;\n\t} while (used.has(value));\n\tused.add(value);\n\treturn value;\n}\n\nfunction firstBlockTargets(content: HTMLElement): ReadonlyMap<string, HTMLElement> {\n\tconst targets = new Map<string, HTMLElement>();\n\tif (content.matches('[data-block-id][id]') && content.id !== '') {\n\t\ttargets.set(content.id, content);\n\t}\n\tfor (const target of content.querySelectorAll<HTMLElement>('[data-block-id][id]')) {\n\t\tconst id: string = target.id;\n\t\tif (id !== '' && !targets.has(id)) targets.set(id, target);\n\t}\n\treturn targets;\n}\n\nfunction blockTargets(content: HTMLElement): HTMLElement[] {\n\tconst targets: HTMLElement[] = [];\n\tif (content.matches('[data-block-id][id]') && content.id !== '') targets.push(content);\n\ttargets.push(...content.querySelectorAll<HTMLElement>('[data-block-id][id]'));\n\treturn targets;\n}\n\nfunction resolveTarget(\n\ttargets: ReadonlyMap<string, HTMLElement>,\n\thref: string,\n): HTMLElement | undefined {\n\tfor (const identifier of fragmentIdentifiers(href)) {\n\t\tconst target: HTMLElement | undefined = targets.get(identifier);\n\t\tif (target) return target;\n\t}\n\treturn undefined;\n}\n\n/** Inserts a slot at the target without emitting invalid children for void or table elements. */\nfunction insertTargetSlot(target: HTMLElement, slot: HTMLSlotElement): void {\n\tif (VOID_ELEMENTS.has(target.tagName) || REPLACED_ELEMENTS.has(target.tagName)) {\n\t\ttarget.before(slot);\n\t\treturn;\n\t}\n\n\tif (TABLE_STRUCTURAL_ELEMENTS.has(target.tagName)) {\n\t\tconst cell: HTMLElement | null = target.querySelector<HTMLElement>('th, td');\n\t\tif (cell) {\n\t\t\tcell.insertBefore(slot, cell.firstChild);\n\t\t\treturn;\n\t\t}\n\t\tconst table: HTMLElement | null = target.closest<HTMLElement>('table');\n\t\tif (table?.parentNode) {\n\t\t\ttable.before(slot);\n\t\t\treturn;\n\t\t}\n\t}\n\n\ttarget.insertBefore(slot, target.firstChild);\n}\n\n/** Makes a zero-area PDF destination resistant to host/custom anchor styling. */\nfunction resetDestinationMarker(marker: HTMLAnchorElement): void {\n\tconst styles: Readonly<Record<string, string>> = {\n\t\tall: 'initial',\n\t\tdisplay: 'block',\n\t\tposition: 'absolute',\n\t\twidth: '0',\n\t\theight: '0',\n\t\tmargin: '0',\n\t\tpadding: '0',\n\t\tborder: '0',\n\t\toverflow: 'hidden',\n\t\t'pointer-events': 'none',\n\t\t'font-size': '0',\n\t\t'line-height': '0',\n\t\tcolor: 'transparent',\n\t\tbackground: 'transparent',\n\t};\n\tfor (const [property, value] of Object.entries(styles)) {\n\t\tmarker.style.setProperty(property, value, 'important');\n\t}\n}\n\nfunction createDestination(\n\ttarget: HTMLElement,\n\tdocument: Document,\n\tusedIds: Set<string>,\n\tusedSlotNames: Set<string>,\n): Destination {\n\tconst id: string = uniqueToken('notectl-print-destination', usedIds);\n\tconst slotName: string = uniqueToken('notectl-print-destination-slot', usedSlotNames);\n\n\tconst slot: HTMLSlotElement = document.createElement('slot');\n\tslot.name = slotName;\n\tslot.setAttribute(PRINT_DESTINATION_SLOT_ATTRIBUTE, '');\n\tinsertTargetSlot(target, slot);\n\n\tconst marker: HTMLAnchorElement = document.createElement('a');\n\tmarker.id = id;\n\tmarker.setAttribute('href', `#${id}`);\n\tmarker.slot = slotName;\n\tmarker.tabIndex = -1;\n\tmarker.setAttribute('aria-hidden', 'true');\n\tmarker.setAttribute(PRINT_DESTINATION_ATTRIBUTE, '');\n\tresetDestinationMarker(marker);\n\n\treturn { id, marker };\n}\n\n/**\n * Namespaces modeled IDs in the no-Shadow-DOM fallback so embedding the print\n * export cannot redirect its links to an earlier same-named consumer element.\n */\nexport function namespacePrintFallbackTargets(content: HTMLElement): void {\n\tconst targetsByOriginal: ReadonlyMap<string, HTMLElement> = firstBlockTargets(content);\n\tif (targetsByOriginal.size === 0) return;\n\n\tconst usedIds = new Set<string>();\n\tif (content.id !== '') usedIds.add(content.id);\n\tfor (const element of content.querySelectorAll<HTMLElement>('[id]')) usedIds.add(element.id);\n\n\tconst projectedIds = new Map<HTMLElement, string>();\n\tfor (const target of blockTargets(content)) {\n\t\tconst id: string = uniqueToken('notectl-print-fallback-destination', usedIds);\n\t\tprojectedIds.set(target, id);\n\t\ttarget.id = id;\n\t}\n\n\tfor (const link of content.querySelectorAll<HTMLAnchorElement>('a[href]')) {\n\t\tconst target: HTMLElement | undefined = resolveTarget(\n\t\t\ttargetsByOriginal,\n\t\t\tlink.getAttribute('href') ?? '',\n\t\t);\n\t\tconst id: string | undefined = target ? projectedIds.get(target) : undefined;\n\t\tif (id) link.setAttribute('href', `#${id}`);\n\t}\n}\n\n/**\n * Mutates only the supplied print shadow clone. Resolvable fragment-only links\n * are redirected to generated document-tree markers; all other links remain\n * byte-for-byte unchanged.\n */\nexport function projectPrintDestinations(content: HTMLElement): PrintDestinationProjection {\n\tconst targets: ReadonlyMap<string, HTMLElement> = firstBlockTargets(content);\n\tif (targets.size === 0) return { markers: [] };\n\n\tconst document: Document = content.ownerDocument;\n\tconst usedIds = new Set<string>();\n\tif (content.id !== '') usedIds.add(content.id);\n\tfor (const element of content.querySelectorAll<HTMLElement>('[id]')) {\n\t\tusedIds.add(element.id);\n\t}\n\tconst usedSlotNames = new Set<string>();\n\tfor (const slot of content.querySelectorAll<HTMLSlotElement>('slot[name]')) {\n\t\tusedSlotNames.add(slot.name);\n\t}\n\n\tconst destinations = new Map<HTMLElement, Destination>();\n\tconst markers: HTMLAnchorElement[] = [];\n\tfor (const link of content.querySelectorAll<HTMLAnchorElement>('a[href]')) {\n\t\tconst href: string = link.getAttribute('href') ?? '';\n\t\tif (!href.startsWith('#')) continue;\n\t\tconst target: HTMLElement | undefined = resolveTarget(targets, href);\n\t\tif (!target) continue;\n\n\t\tlet destination: Destination | undefined = destinations.get(target);\n\t\tif (!destination) {\n\t\t\tdestination = createDestination(target, document, usedIds, usedSlotNames);\n\t\t\tdestinations.set(target, destination);\n\t\t\tmarkers.push(destination.marker);\n\t\t}\n\t\tlink.setAttribute('href', `#${destination.id}`);\n\t}\n\n\treturn { markers };\n}\n","/**\n * Copies the host page's stylesheets verbatim into the print document.\n *\n * The print document preserves the editor's shadow boundary (declarative\n * shadow DOM), so host-authored rules — `::part()`, element selectors, custom\n * properties, `@media`, `@layer`, `@supports`, CSS nesting — apply natively\n * and need no translation or rewriting.\n *\n * All copied CSS is wrapped in the `notectl-host` cascade layer. Layering does\n * not weaken it against the editor's shadow styles, because the cascade\n * compares tree context before layers (an outer normal declaration beats a\n * shadow-tree one regardless). It does keep the print document's own rules in\n * control: its unlayered rules (page setup, body typography, customCSS) win\n * over the copy for normal declarations regardless of specificity, and the\n * print guards (host-element reset, forced light theme) — `!important` inside\n * the earlier-declared `notectl-print` layer — win even against `!important`\n * host rules.\n *\n * Stylesheets whose rules are not readable (cross-origin) are re-referenced\n * via hoisted `@import ... layer(notectl-host)` statements so the print\n * document loads them itself. The copy is produced as an ordered segment list\n * (rule chunks and `@import` statements interleaved in source order) so\n * equal-specificity cascade ties resolve exactly as on the live page.\n * Disabled stylesheets are skipped and stylesheet-level media conditions are\n * preserved as `@media` wrappers.\n */\n\n/** Cascade layer that holds the copied host-page styles in print output. */\nexport const HOST_STYLE_LAYER = 'notectl-host';\n\nconst IMPORT_RULE_TYPE = 3;\n\n/**\n * One source-ordered piece of the host-page CSS copy. `rules` segments hold\n * verbatim rule text destined for the `notectl-host` layer; `import` segments\n * hold hoisted `@import` statements for unreadable (cross-origin) sheets.\n * `@import` must precede every other rule of its stylesheet, so each segment\n * is emitted as its own `<style>` element — keeping the live source order,\n * which decides equal-specificity ties within the layer.\n */\nexport type HostStyleSegment =\n\t| { readonly kind: 'rules'; readonly css: string }\n\t| { readonly kind: 'import'; readonly statement: string };\n\ninterface CopyState {\n\treadonly segments: HostStyleSegment[];\n\treadonly seen: Set<CSSStyleSheet>;\n\t/** Base URL for rules from sheets without an own URL (inline styles). */\n\treadonly baseURL: string;\n\t/** Counter for naming hoisted anonymous import layers uniquely. */\n\tanonymousLayerCount: number;\n}\n\n/**\n * Collects the style roots that can hold rules targeting this editor: the\n * document plus any shadow roots the editor is nested in (outermost first, so\n * later, closer scopes win source-order ties after flattening).\n */\nfunction styleRootsOf(host: HTMLElement): readonly (Document | ShadowRoot)[] {\n\tconst roots: (Document | ShadowRoot)[] = [];\n\tlet node: Node = host.getRootNode();\n\twhile (node instanceof ShadowRoot) {\n\t\troots.push(node);\n\t\tnode = node.host.getRootNode();\n\t}\n\troots.push(host.ownerDocument);\n\treturn roots.reverse();\n}\n\nfunction sheetsOfRoot(root: Document | ShadowRoot): readonly CSSStyleSheet[] {\n\tconst sheets: CSSStyleSheet[] = Array.from(root.styleSheets);\n\tconst adopted: readonly CSSStyleSheet[] | undefined = root.adoptedStyleSheets;\n\tif (adopted) sheets.push(...adopted);\n\treturn sheets;\n}\n\n/** Escapes a URL for embedding in `@import url(\"...\")`. */\nfunction escapeImportURL(url: string): string {\n\treturn url.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n}\n\n/**\n * URLs that must not be rebased: fragment-only references stay document-local\n * (SVG paint servers like `fill: url(#gradient)`), and URLs that already have\n * a scheme or are protocol-relative resolve identically everywhere.\n */\nfunction isRebasableURL(url: string): boolean {\n\tif (url.startsWith('#') || url.startsWith('//')) return false;\n\treturn !/^[a-z][a-z0-9+.-]*:/i.test(url);\n}\n\n/** Returns the index just past the closing quote of the string opening at `start`. */\nfunction skipString(cssText: string, start: number): number {\n\tconst quote: string = cssText[start] ?? '\"';\n\tlet i: number = start + 1;\n\twhile (i < cssText.length) {\n\t\tconst ch: string = cssText[i] ?? '';\n\t\tif (ch === '\\\\') {\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === quote) return i + 1;\n\t\ti++;\n\t}\n\treturn cssText.length;\n}\n\n/**\n * Resolves CSS escape sequences (`\\\"`, `\\2f `, …) in a `url()` argument so the\n * actual URL is rebased, not its escaped serialization.\n */\nfunction unescapeCSSValue(value: string): string {\n\treturn value.replace(\n\t\t/\\\\([0-9a-f]{1,6}\\s?|[\\s\\S])/gi,\n\t\t(_match: string, escaped: string): string => {\n\t\t\tconst hex: string = escaped.trim();\n\t\t\tif (/^[0-9a-f]{1,6}$/i.test(hex)) {\n\t\t\t\tconst code: number = Number.parseInt(hex, 16);\n\t\t\t\treturn code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : '�';\n\t\t\t}\n\t\t\treturn escaped;\n\t\t},\n\t);\n}\n\n/** True when a `url(` function token starts at `index` (not part of a longer identifier). */\nfunction isURLTokenStart(cssText: string, index: number): boolean {\n\tif (cssText.slice(index, index + 4).toLowerCase() !== 'url(') return false;\n\tconst before: string = index > 0 ? (cssText[index - 1] ?? '') : '';\n\treturn !/[\\w-]/.test(before);\n}\n\ninterface URLToken {\n\t/** Index just past the closing `)`. */\n\treadonly end: number;\n\t/** The unescaped URL argument. */\n\treadonly url: string;\n}\n\n/** Parses the `url(...)` token starting at `start`; null when malformed. */\nfunction parseURLToken(cssText: string, start: number): URLToken | null {\n\tlet i: number = start + 4;\n\twhile (i < cssText.length && /\\s/.test(cssText[i] ?? '')) i++;\n\tconst ch: string = cssText[i] ?? '';\n\tlet raw: string;\n\tif (ch === '\"' || ch === \"'\") {\n\t\tconst end: number = skipString(cssText, i);\n\t\traw = cssText.slice(i + 1, end - 1);\n\t\ti = end;\n\t} else {\n\t\tconst close: number = cssText.indexOf(')', i);\n\t\tif (close === -1) return null;\n\t\traw = cssText.slice(i, close).trim();\n\t\ti = close;\n\t}\n\twhile (i < cssText.length && /\\s/.test(cssText[i] ?? '')) i++;\n\tif (cssText[i] !== ')') return null;\n\treturn { end: i + 1, url: unescapeCSSValue(raw) };\n}\n\n/** Rewrites one parsed `url()` token, keeping it verbatim when not rebasable. */\nfunction rebaseURLToken(original: string, url: string, baseURL: string): string {\n\tif (!url || !isRebasableURL(url)) return original;\n\ttry {\n\t\treturn `url(\"${new URL(url, baseURL).href}\")`;\n\t} catch {\n\t\treturn original;\n\t}\n}\n\n/**\n * Rewrites relative `url()` references to absolute URLs against the source\n * stylesheet's URL. Copied `cssText` keeps URLs as authored; in the print\n * document they would re-resolve against the page URL instead of the\n * stylesheet's location, breaking fonts and images from stylesheets that live\n * in another directory. The scan is string-aware: a value that merely mentions\n * `url(...)` inside a CSS string (`content: \"url(info)\"`) is left untouched —\n * rewriting inside it would inject quotes and invalidate the declaration.\n */\nfunction rebaseCSSURLs(cssText: string, baseURL: string): string {\n\tif (!cssText.toLowerCase().includes('url(')) return cssText;\n\tlet result = '';\n\tlet i = 0;\n\twhile (i < cssText.length) {\n\t\tconst ch: string = cssText[i] ?? '';\n\t\tif (ch === '\"' || ch === \"'\") {\n\t\t\tconst end: number = skipString(cssText, i);\n\t\t\tresult += cssText.slice(i, end);\n\t\t\ti = end;\n\t\t\tcontinue;\n\t\t}\n\t\tif (isURLTokenStart(cssText, i)) {\n\t\t\tconst token: URLToken | null = parseURLToken(cssText, i);\n\t\t\tif (token) {\n\t\t\t\tresult += rebaseURLToken(cssText.slice(i, token.end), token.url, baseURL);\n\t\t\t\ti = token.end;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tresult += ch;\n\t\ti++;\n\t}\n\treturn result;\n}\n\n/** Returns a unique sublayer name for a hoisted anonymous import layer. */\nfunction anonymousLayerName(state: CopyState): string {\n\tstate.anonymousLayerCount += 1;\n\treturn `notectl-anonymous-${state.anonymousLayerCount}`;\n}\n\n/** Appends rule text, coalescing with a preceding rules segment. */\nfunction pushRules(state: CopyState, css: string): void {\n\tconst last: HostStyleSegment | undefined = state.segments[state.segments.length - 1];\n\tif (last?.kind === 'rules') {\n\t\tstate.segments[state.segments.length - 1] = { kind: 'rules', css: `${last.css}\\n${css}` };\n\t\treturn;\n\t}\n\tstate.segments.push({ kind: 'rules', css });\n}\n\n/**\n * Accumulated cascade context enclosing a hoisted cross-origin `@import`: the\n * media, cascade-layer, and `supports()` conditions of every stylesheet and\n * import rule between the `notectl-host` layer and the re-referenced sheet. A\n * hoisted `@import` is emitted at the top level, outside the `@layer`/`@media`/\n * `@supports` wrappers its inlined siblings receive, so it must carry this\n * context on the statement itself or the re-referenced sheet lands in the wrong\n * cascade layer and ignores the enclosing conditions.\n */\ninterface ImportContext {\n\t/** Media conditions, outermost first; ANDed on emit. */\n\treadonly media: readonly string[];\n\t/** Layer chain under `notectl-host`, outermost first; `null` = anonymous. */\n\treadonly layers: readonly (string | null)[];\n\t/** `supports()` conditions, outermost first; ANDed on emit. */\n\treadonly supports: readonly string[];\n}\n\nconst EMPTY_IMPORT_CONTEXT: ImportContext = { media: [], layers: [], supports: [] };\n\n/**\n * Extends a context with one nesting level's own media/layer/supports. `all`\n * and empty media impose no condition and are dropped; anonymous layers are\n * kept as `null` placeholders and only named at emit time, so the shared\n * anonymous-layer counter advances solely on real hoists, not on readable\n * imports that are inlined.\n */\nfunction extendImportContext(\n\tparent: ImportContext,\n\tmediaText: string,\n\tlayerName: string | null,\n\tsupportsText: string | null,\n): ImportContext {\n\tconst media: string = mediaText.trim();\n\tconst supports: string = supportsText?.trim() ?? '';\n\treturn {\n\t\tmedia: media && media !== 'all' ? [...parent.media, media] : parent.media,\n\t\tlayers:\n\t\t\tlayerName === null ? parent.layers : [...parent.layers, layerName === '' ? null : layerName],\n\t\tsupports: supports ? [...parent.supports, supports] : parent.supports,\n\t};\n}\n\n/**\n * Combines accumulated `supports()` conditions into one `@import` supports\n * clause. A single condition stays bare (`supports(display: grid)`); multiple\n * conditions are each parenthesized and ANDed, since the `supports()` grammar\n * only permits `and` between parenthesized conditions.\n */\nfunction combineSupports(conditions: readonly string[]): string {\n\tif (conditions.length === 0) return '';\n\tif (conditions.length === 1) return ` supports(${conditions[0]})`;\n\treturn ` supports(${conditions.map((condition: string): string => `(${condition})`).join(' and ')})`;\n}\n\n/**\n * Re-references a stylesheet whose rules are not readable, carrying the\n * enclosing cascade context (media, layer chain, `supports()`) on the hoisted\n * statement so the re-referenced sheet keeps the same layer, media, and feature\n * gating it had live — nested layers order before the parent's direct rules,\n * mirroring how layered import content loses to unlayered page rules. Media\n * conditions are ANDed with `and`; a comma-separated media list at one level is\n * not distributed across the `and` (a rare edge that would need a cartesian\n * expansion). The statement is pushed as an ordered segment so the sheet keeps\n * its live source-order position.\n */\nfunction hoistImport(state: CopyState, href: string, context: ImportContext): void {\n\tconst layerChain: string[] = [HOST_STYLE_LAYER];\n\tfor (const layer of context.layers) {\n\t\tlayerChain.push(layer ?? anonymousLayerName(state));\n\t}\n\tconst supports: string = combineSupports(context.supports);\n\tconst media: string = context.media.length ? ` ${context.media.join(' and ')}` : '';\n\tstate.segments.push({\n\t\tkind: 'import',\n\t\tstatement: `@import url(\"${escapeImportURL(href)}\") layer(${layerChain.join('.')})${supports}${media};`,\n\t});\n}\n\n/** Wraps serialized sheet text in the sheet's own media condition, if any. */\nfunction wrapInSheetMedia(text: string, mediaText: string): string {\n\tconst media: string = mediaText.trim();\n\tif (!media || media === 'all') return text;\n\treturn `@media ${media} {\\n${text}\\n}`;\n}\n\nfunction serializeSheet(sheet: CSSStyleSheet, state: CopyState): void {\n\tif (state.seen.has(sheet)) return;\n\tstate.seen.add(sheet);\n\tif (sheet.disabled) return;\n\n\t// The sheet's own media (from its <link>/@import) is the enclosing context\n\t// for any cross-origin import it holds: its readable rules are wrapped in the\n\t// same @media below, so a hoisted import must carry it too.\n\tconst sheetContext: ImportContext = extendImportContext(\n\t\tEMPTY_IMPORT_CONTEXT,\n\t\tsheet.media.mediaText,\n\t\tnull,\n\t\tnull,\n\t);\n\n\tlet cssRules: CSSRuleList;\n\ttry {\n\t\tcssRules = sheet.cssRules;\n\t} catch {\n\t\t// Cross-origin — rules are not readable. Re-reference so the print\n\t\t// document loads the stylesheet itself.\n\t\tif (sheet.href) hoistImport(state, sheet.href, sheetContext);\n\t\treturn;\n\t}\n\n\tconst base: string = sheet.href ?? state.baseURL;\n\tconst body: string[] = [];\n\tfor (const rule of cssRules) {\n\t\tif (rule.type === IMPORT_RULE_TYPE) {\n\t\t\t// `@import` precedes every other rule of its sheet, so hoisted\n\t\t\t// statements emitted now stay ahead of this sheet's rule chunk.\n\t\t\tserializeImportRule(rule as CSSImportRule, state, body, sheetContext);\n\t\t\tcontinue;\n\t\t}\n\t\tbody.push(rebaseCSSURLs(rule.cssText, base));\n\t}\n\n\tconst text: string = body.join('\\n');\n\tif (text) pushRules(state, wrapInSheetMedia(text, sheet.media.mediaText));\n}\n\n/**\n * Inlines a readable `@import` target in place; unreadable targets are hoisted\n * as layered `@import` statements (`@import` is not valid inside a layer\n * block, so it cannot be copied verbatim). The import's own cascade-layer\n * assignment and `supports()` condition survive inlining as nested `@layer`\n * and `@supports` blocks — without them, layered import content would compete\n * on specificity against page rules it loses to live.\n */\nfunction serializeImportRule(\n\trule: CSSImportRule,\n\tstate: CopyState,\n\tbody: string[],\n\tparentContext: ImportContext,\n): void {\n\tconst layerName: string | null = rule.layerName ?? null;\n\tconst supportsText: string | null = rule.supportsText ?? null;\n\t// This import's own media/layer/supports extend the parent context. Readable\n\t// targets pass it to their nested imports; an unreadable target is hoisted\n\t// under it.\n\tconst context: ImportContext = extendImportContext(\n\t\tparentContext,\n\t\trule.media.mediaText,\n\t\tlayerName,\n\t\tsupportsText,\n\t);\n\tconst imported: CSSStyleSheet | null = rule.styleSheet;\n\tif (imported && !state.seen.has(imported)) {\n\t\tlet importedRules: CSSRuleList | null;\n\t\ttry {\n\t\t\timportedRules = imported.cssRules;\n\t\t} catch {\n\t\t\timportedRules = null;\n\t\t}\n\t\tif (importedRules) {\n\t\t\tstate.seen.add(imported);\n\t\t\tconst base: string = imported.href ?? state.baseURL;\n\t\t\tconst inner: string[] = [];\n\t\t\tfor (const importedRule of importedRules) {\n\t\t\t\tif (importedRule.type === IMPORT_RULE_TYPE) {\n\t\t\t\t\tserializeImportRule(importedRule as CSSImportRule, state, inner, context);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tinner.push(rebaseCSSURLs(importedRule.cssText, base));\n\t\t\t}\n\t\t\tlet text: string = inner.join('\\n');\n\t\t\tif (text) {\n\t\t\t\tif (layerName !== null) {\n\t\t\t\t\t// Anonymous import layers stay anonymous via a nameless block.\n\t\t\t\t\ttext = layerName === '' ? `@layer {\\n${text}\\n}` : `@layer ${layerName} {\\n${text}\\n}`;\n\t\t\t\t}\n\t\t\t\tif (supportsText?.trim()) {\n\t\t\t\t\t// supports(display: grid) allows a bare declaration; the @supports\n\t\t\t\t\t// rule grammar does not, so the condition is parenthesized.\n\t\t\t\t\ttext = `@supports (${supportsText.trim()}) {\\n${text}\\n}`;\n\t\t\t\t}\n\t\t\t\tbody.push(wrapInSheetMedia(text, rule.media.mediaText));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\tconst href: string | null = imported?.href ?? rule.href;\n\tif (href) hoistImport(state, href, context);\n}\n\n/**\n * Copies all stylesheets that can target this editor (document-level plus any\n * enclosing shadow roots, including adopted sheets) into an ordered list of\n * verbatim CSS segments for the print document.\n */\nexport function collectHostStyleSegments(host: HTMLElement): readonly HostStyleSegment[] {\n\tconst state: CopyState = {\n\t\tsegments: [],\n\t\tseen: new Set(),\n\t\tbaseURL: host.ownerDocument.baseURI ?? '',\n\t\tanonymousLayerCount: 0,\n\t};\n\tfor (const root of styleRootsOf(host)) {\n\t\tfor (const sheet of sheetsOfRoot(root)) {\n\t\t\tserializeSheet(sheet, state);\n\t\t}\n\t}\n\treturn state.segments;\n}\n","/**\n * Collects and aggregates CSS for print output.\n *\n * The print document preserves the editor's shadow boundary (declarative\n * shadow DOM), so styles split into two scopes:\n *\n * - Shadow scope (inside the template): the editor's own adopted styles\n * (base styles behind a cascade layer, runtime style-token rules\n * unlayered), print content rules, and `customCSS` as the final same-tree\n * override.\n * - Document scope: print guards (host-element reset, `html`/`body` page\n * reset, and forced light theme — `!important` inside the `notectl-print`\n * layer so they hold even against `!important` host rules such as\n * `@media print { body * { visibility: hidden } }`), the carried\n * theme-token snapshot (unlayered, so it beats the layered host copy), body\n * typography snapshot, `@page` setup, and two `customCSS` copies: unlayered\n * for normal-strength page-level rules (`@page`, `body`) and inside the\n * earliest `notectl-custom` layer so consumer `!important` rules outrank\n * the print guards.\n *\n * Document layer order is `notectl-custom, notectl-print, notectl-host`\n * (declared in {@link buildHTMLDocument}). For normal declarations unlayered\n * rules win over all layers; for `!important` declarations the layer order\n * reverses, so earlier layers win: customCSS > print guards > host copy.\n *\n * Two document-scope builders exist: {@link buildDocumentCSS} for the\n * internal print iframe (full page fidelity — `html`/`body` reset, body\n * typography, `@page`) and {@link buildExportDocumentCSS} for the export\n * variant, whose inline rules are all qualified with the replica marker\n * attribute so embedding the export into a live page (documented\n * innerHTML/setHTMLUnsafe flow) cannot restyle the consumer's document. The\n * export regains full page fidelity in standalone documents through the\n * script-hoisted standalone style bundle (see PrintServiceImpl).\n */\n\nimport { generateThemeCSS } from '../../editor/theme/ThemeEngine.js';\nimport { LIGHT_THEME } from '../../editor/theme/ThemeTokens.js';\nimport {\n\tPAPER_MARGIN_HORIZONTAL_PX,\n\tPAPER_MARGIN_TOP_PX,\n\tgetPaperCSSSize,\n} from '../../model/PaperSize.js';\nimport { isRuntimeStyleSheet } from '../../style/StyleRuntime.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Cascade layer that holds the editor's own base styles in print output. */\nconst BASE_STYLE_LAYER = 'notectl-base';\n\n/**\n * Document-level cascade layer holding the print guards (host reset, forced\n * light theme). Declared before the host-copy layer, so its `!important`\n * declarations beat `!important` host rules.\n */\nexport const PRINT_STYLE_LAYER = 'notectl-print';\n\n/**\n * Earliest document-level cascade layer, holding a `customCSS` copy. Its\n * `!important` declarations are the strongest in the print document — the\n * consumer's escape hatch over the print guards and host rules.\n */\nexport const CUSTOM_STYLE_LAYER = 'notectl-custom';\n\n/**\n * Appends `!important` to every declaration of generated CSS. Only safe for\n * CSS this module generates itself (one declaration per line, no semicolons\n * inside values).\n */\nfunction markDeclarationsImportant(css: string): string {\n\treturn css.replace(/;$/gm, ' !important;');\n}\n\n/** Adopted shadow styles split by role for print emission. */\nexport interface AdoptedStylePartition {\n\t/** Editor base styles — emitted inside the print cascade layer. */\n\treadonly base: string;\n\t/**\n\t * Runtime style-token rules (strict-CSP mode) carrying user-applied content\n\t * formatting — emitted unlayered so they keep their cascade strength.\n\t */\n\treadonly runtime: string;\n}\n\n/**\n * Extracts CSS text from all adopted stylesheets on a ShadowRoot, separating\n * editor base styles from runtime style-token sheets. The distinction matters\n * for print: base styles go into a cascade layer so consumer overrides win\n * (the documented #202 semantic: `customCSS` overrides built-in element\n * styling regardless of selector specificity — the flip side, also\n * documented, is that broad customCSS resets such as `* { padding: 0 }`\n * override base styling too), but token rules represent user content\n * formatting (inline styles in non-CSP mode) and must not be demoted with\n * them.\n */\nexport function partitionAdoptedStyles(shadowRoot: ShadowRoot): AdoptedStylePartition {\n\tconst base: string[] = [];\n\tconst runtime: string[] = [];\n\tfor (const sheet of shadowRoot.adoptedStyleSheets) {\n\t\tconst target: string[] = isRuntimeStyleSheet(sheet) ? runtime : base;\n\t\tfor (const rule of sheet.cssRules) {\n\t\t\ttarget.push(rule.cssText);\n\t\t}\n\t}\n\treturn { base: base.join('\\n'), runtime: runtime.join('\\n') };\n}\n\n/**\n * Generates light theme custom properties targeting `selector` (a full\n * selector list). The internal print iframe passes `:root` plus the host\n * element, so page-level `customCSS` rules\n * (`body { background: var(--notectl-bg) }`) keep resolving while the host\n * element re-pins the tokens closer than the shadow theme sheet's `:host`\n * defaults; the export variant passes only the marker-qualified replica so\n * nothing can leak into an embedding page. Every declaration is `!important`;\n * emitted inside the `notectl-print` layer, it beats copied host-page token\n * overrides (even `!important` ones) and the shadow theme sheet (tree\n * context), guaranteeing readable print output regardless of the active\n * editor theme.\n */\nexport function generateLightThemeTokens(selector: string): string {\n\tconst css: string = generateThemeCSS(LIGHT_THEME).replace(':host {', `${selector} {`);\n\treturn markDeclarationsImportant(css);\n}\n\n/**\n * Serializes an element's inline `--notectl-*` declarations. Tokens set via\n * the `style` attribute or JS `setProperty` (runtime theme switchers) cannot\n * travel through the stylesheet copy; re-emitting them as inline style on the\n * print document's corresponding element preserves their live cascade\n * strength — inline declarations beat every copied stylesheet rule, exactly\n * as on the live page.\n */\nexport function collectInlineThemeTokens(el: Element | null): string {\n\tif (!(el instanceof HTMLElement)) return '';\n\tconst declarations: string[] = [];\n\tfor (let i = 0; i < el.style.length; i++) {\n\t\tconst prop: string = el.style[i] ?? '';\n\t\tif (!prop.startsWith('--notectl-')) continue;\n\t\tconst value: string = el.style.getPropertyValue(prop).trim();\n\t\tif (value) declarations.push(`${prop}: ${value}`);\n\t}\n\treturn declarations.join('; ');\n}\n\n/**\n * Snapshots all computed `--notectl-*` tokens from the host element when\n * carrying the live theme (`forceLightTheme: false`). The computed values are\n * the ground truth of what the user saw: tokens set via the host's inline\n * `style` attribute (stripped from the print replica), via JS `setProperty`,\n * or via rules scoped to wrapper elements that do not exist in the print\n * document cannot travel through the stylesheet copy. Targeted at `selector`\n * (a full selector list: the host element, plus `:root` in the internal\n * variant so page-level `customCSS` keeps resolving the tokens) and emitted\n * unlayered: unlayered normal declarations beat the layered host copy, so a\n * host-page rule that matches differently in the print document (its wrapper\n * ancestors are not replicated) cannot override the live values.\n * Print-specific token overrides therefore need `!important` in the host\n * page or `customCSS`.\n */\nexport function snapshotThemeTokens(host: HTMLElement, selector: string): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst tokens: string[] = [];\n\n\tfor (let i = 0; i < computed.length; i++) {\n\t\tconst prop: string = computed[i] ?? '';\n\t\tif (prop.startsWith('--notectl-')) {\n\t\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\t\tif (value) {\n\t\t\t\ttokens.push(` ${prop}: ${value};`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tokens.length === 0) return '';\n\treturn `${selector} {\\n${tokens.join('\\n')}\\n}`;\n}\n\n/** Computed background-color values that mean \"no own background\". */\nconst TRANSPARENT_BACKGROUNDS: readonly string[] = ['', 'transparent', 'rgba(0, 0, 0, 0)'];\n\n/**\n * Resolves the background the editor content visually sits on, for carrying\n * the live theme into print (`forceLightTheme: false`). Walks up from the\n * content container (crossing shadow boundaries) through the page body up to\n * the root element — dark themes commonly paint `html` and leave `body`\n * transparent — returning the first non-transparent computed\n * background-color. Falls back to white so print output never inherits an\n * undefined background.\n */\nexport function resolveCarriedBackground(container: HTMLElement): string {\n\tlet el: HTMLElement | null = container;\n\twhile (el) {\n\t\tconst background: string = getComputedStyle(el).getPropertyValue('background-color').trim();\n\t\tif (!TRANSPARENT_BACKGROUNDS.includes(background)) return background;\n\t\tconst root: Node = el.getRootNode();\n\t\tel = el.parentElement ?? (root instanceof ShadowRoot ? (root.host as HTMLElement) : null);\n\t}\n\treturn '#ffffff';\n}\n\n/**\n * Snapshots computed typography from the host element into a rule for\n * `selector` (the page body in the print iframe, the replica host in the\n * export variant). Copied host-page styles are layered and `body` rules from\n * the host page are meant for the host application, so print pins typography\n * explicitly to what the editor computed live. The background is pinned to\n * `background` — white when the light theme is forced, the carried theme\n * background otherwise — so dark-theme output never renders light text on\n * white paper.\n */\nexport function snapshotTypography(\n\thost: HTMLElement,\n\tcolorOverride?: string,\n\tbackground = '#ffffff',\n\tselector = 'body',\n): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst props: string[] = [\n\t\t'font-family',\n\t\t'font-size',\n\t\t'font-weight',\n\t\t'line-height',\n\t\t'letter-spacing',\n\t\t'word-spacing',\n\t\t'color',\n\t];\n\tconst rules: string[] = [' margin: 0;', ` background: ${background};`];\n\tfor (const prop of props) {\n\t\tif (prop === 'color' && colorOverride) {\n\t\t\trules.push(` color: ${colorOverride};`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\tif (value) {\n\t\t\trules.push(` ${prop}: ${value};`);\n\t\t}\n\t}\n\treturn `${selector} {\\n${rules.join('\\n')}\\n}`;\n}\n\n/** Declarations that neutralize screen-widget chrome on the print host. */\nconst HOST_RESET_DECLARATIONS: readonly string[] = [\n\t'display: block',\n\t'position: static',\n\t'inset: auto',\n\t'width: auto',\n\t'height: auto',\n\t'min-width: 0',\n\t'min-height: 0',\n\t'max-width: none',\n\t'max-height: none',\n\t'margin: 0',\n\t'padding: 0',\n\t'border: none',\n\t'border-radius: 0',\n\t'outline: none',\n\t'box-shadow: none',\n\t'background: transparent',\n\t'overflow: visible',\n\t'transform: none',\n\t'filter: none',\n\t'opacity: 1',\n\t'contain: none',\n\t'float: none',\n\t'visibility: visible',\n\t'clip: auto',\n\t'clip-path: none',\n\t'content-visibility: visible',\n];\n\n/**\n * Declarations that keep the print page itself visible and unclipped. Host\n * pages commonly hide or clip at the page level — the classic\n * `@media print { body * { visibility: hidden } }` trick or app-shell\n * `html, body { height: 100%; overflow: hidden }` — and those rules are\n * copied verbatim into the host layer. Only hide/clip-capable properties are\n * guarded; box properties like `margin` stay overridable via plain customCSS.\n */\nconst PAGE_RESET_DECLARATIONS: readonly string[] = [\n\t'display: block',\n\t'visibility: visible',\n\t'opacity: 1',\n\t'position: static',\n\t'height: auto',\n\t'min-height: 0',\n\t'max-height: none',\n\t'overflow: visible',\n\t'transform: none',\n\t'filter: none',\n\t'contain: none',\n\t'clip: auto',\n\t'clip-path: none',\n\t'content-visibility: visible',\n];\n\n/**\n * Neutralizes page-level hiding and clipping from copied host rules on\n * `html`/`body`. Every declaration is `!important`; emitted inside the\n * `notectl-print` layer it beats the host copy even against `!important`\n * host rules, while `customCSS` (earlier `notectl-custom` layer) still wins.\n */\nexport function generatePageResetCSS(): string {\n\treturn [\n\t\t'html, body {',\n\t\t...PAGE_RESET_DECLARATIONS.map((declaration: string): string => ` ${declaration} !important;`),\n\t\t'}',\n\t].join('\\n');\n}\n\n/**\n * Neutralizes screen-widget chrome on the print host element. Copied\n * host-page rules like `notectl-editor { height: 400px; border: … }` style\n * the live widget but must not constrain the paginated print flow. Every\n * declaration is `!important`; emitted inside the `notectl-print` layer, the\n * reset beats the host copy even against `!important` host rules. Inherited\n * properties (fonts, color) are deliberately not touched; `customCSS` can\n * reclaim any of these via `!important` (earlier `notectl-custom` layer).\n */\nexport function generateHostResetCSS(hostSelector: string): string {\n\treturn [\n\t\t`${hostSelector} {`,\n\t\t...HOST_RESET_DECLARATIONS.map((declaration: string): string => ` ${declaration} !important;`),\n\t\t'}',\n\t].join('\\n');\n}\n\n/** Generates the `@page` rule based on PrintOptions. */\nexport function generatePageCSS(options: PrintOptions): string {\n\tconst pageProps: string[] = [];\n\tif (options.margin) {\n\t\tpageProps.push(` margin: ${options.margin};`);\n\t} else if (options.paperSize) {\n\t\t// WYSIWYG: zero @page margin so body = full paper width;\n\t\t// document margins are applied as content padding below.\n\t\tpageProps.push(' margin: 0;');\n\t}\n\tif (options.paperSize || options.orientation) {\n\t\tconst sizeKeyword: string = options.paperSize ? getPaperCSSSize(options.paperSize) : 'A4';\n\t\tconst sizeParts: string[] = [sizeKeyword];\n\t\tif (options.orientation) {\n\t\t\tsizeParts.push(options.orientation);\n\t\t}\n\t\tpageProps.push(` size: ${sizeParts.join(' ')};`);\n\t}\n\tif (pageProps.length === 0) return '';\n\treturn `@page {\\n${pageProps.join('\\n')}\\n}`;\n}\n\n/** Generates print-specific content rules; emitted inside the shadow scope. */\nexport function generateContentPrintCSS(options: PrintOptions): string {\n\tconst parts: string[] = [];\n\n\t// Print flows the full document: screen scroll constraints on the content\n\t// area (the --notectl-content-max-height token or host ::part(content)\n\t// height rules) must not clip it to one scroll fold. Shadow-tree\n\t// `!important` beats document-tree `!important`, so this holds even\n\t// against host `::part()` rules; the shadow customCSS copy is emitted\n\t// later in source order and can still override.\n\tparts.push(\n\t\t'.notectl-content { height: auto !important; max-height: none !important; ' +\n\t\t\t'min-height: 0 !important; overflow: visible !important; }',\n\t);\n\n\t// WYSIWYG: apply paper-mode document margins to print content\n\tif (options.paperSize) {\n\t\tparts.push(\n\t\t\t`.notectl-content { padding: ${PAPER_MARGIN_TOP_PX}px ${PAPER_MARGIN_HORIZONTAL_PX}px !important; }`,\n\t\t);\n\t}\n\n\t// Print media rules\n\tconst printRules: string[] = [];\n\n\t// Hide non-printable elements\n\tprintRules.push('[data-notectl-no-print] { display: none !important; }');\n\n\t// Code blocks: preserve background, force wrapping\n\tprintRules.push(\n\t\t'.notectl-code-block { white-space: pre-wrap !important; ' +\n\t\t\t'word-break: break-all !important; page-break-inside: avoid; }',\n\t);\n\n\t// Images: avoid page breaks\n\tprintRules.push('img { page-break-inside: avoid; }');\n\n\t// Tables: avoid page breaks\n\tprintRules.push('.notectl-table { break-inside: avoid; }');\n\n\t// Preserve background colors and images in print output (WYSIWYG default).\n\t// Only omitted when the consumer explicitly opts out via printBackground: false.\n\tif (options.printBackground !== false) {\n\t\tprintRules.push(\n\t\t\t'* { -webkit-print-color-adjust: exact !important; ' +\n\t\t\t\t'print-color-adjust: exact !important; }',\n\t\t);\n\t}\n\n\tparts.push(`@media print {\\n ${printRules.join('\\n ')}\\n}`);\n\n\treturn parts.join('\\n\\n');\n}\n\n/**\n * Builds the CSS placed inside the print document's declarative shadow root:\n * editor base styles behind a cascade layer (so consumer overrides win),\n * runtime style-token rules unlayered, print content rules, and customCSS as\n * the final same-tree override.\n */\nexport function buildShadowCSS(shadowRoot: ShadowRoot, options: PrintOptions): string {\n\tconst parts: string[] = [];\n\n\tconst adopted: AdoptedStylePartition = partitionAdoptedStyles(shadowRoot);\n\tif (adopted.base) parts.push(`@layer ${BASE_STYLE_LAYER} {\\n${adopted.base}\\n}`);\n\tif (adopted.runtime) parts.push(adopted.runtime);\n\n\tconst contentCSS: string = generateContentPrintCSS(options);\n\tif (contentCSS) parts.push(contentCSS);\n\n\tif (options.customCSS) {\n\t\tparts.push(options.customCSS);\n\t}\n\n\treturn parts.join('\\n\\n');\n}\n\n/** The print-color-adjust guard; document-level, because the shadow-scope copy cannot reach document-tree elements. */\nconst COLOR_ADJUST_GUARD: string =\n\t'* {\\n -webkit-print-color-adjust: exact !important;\\n print-color-adjust: exact !important;\\n}';\n\n/**\n * Builds the document-level CSS of the internal print iframe: the print\n * guards (host reset, `html`/`body` page reset, and forced light theme —\n * `!important` inside the `notectl-print` layer), the unlayered theme-token\n * snapshot, body typography, `@page`, and two copies of customCSS. The\n * unlayered copy carries page-level custom rules (`@page`, `body` — they\n * cannot live inside the shadow scope) at normal strength; the\n * `notectl-custom` layer copy makes consumer `!important` rules outrank the\n * print guards and `!important` host rules.\n */\nexport function buildDocumentCSS(\n\thost: HTMLElement,\n\tcontainer: HTMLElement,\n\toptions: PrintOptions,\n): string {\n\tconst hostSelector: string = host.tagName.toLowerCase();\n\tconst parts: string[] = [];\n\n\tconst forceLightTheme: boolean = options.forceLightTheme !== false;\n\tconst guards: string[] = [generateHostResetCSS(hostSelector), generatePageResetCSS()];\n\tif (forceLightTheme) {\n\t\tguards.push(generateLightThemeTokens(`:root, ${hostSelector}`));\n\t}\n\t// Without the document-level copy of this guard, the pinned body background\n\t// (the carried theme background for forceLightTheme: false) is stripped by\n\t// the browser's default \"no background graphics\" print behavior.\n\tif (options.printBackground !== false) {\n\t\tguards.push(COLOR_ADJUST_GUARD);\n\t}\n\tparts.push(`@layer ${PRINT_STYLE_LAYER} {\\n${guards.join('\\n\\n')}\\n}`);\n\n\tif (!forceLightTheme) {\n\t\tconst themeTokens: string = snapshotThemeTokens(host, `:root, ${hostSelector}`);\n\t\tif (themeTokens) parts.push(themeTokens);\n\t}\n\n\tconst colorOverride: string | undefined = forceLightTheme\n\t\t? LIGHT_THEME.primitives.foreground\n\t\t: undefined;\n\tconst background: string = forceLightTheme ? '#ffffff' : resolveCarriedBackground(container);\n\tparts.push(snapshotTypography(host, colorOverride, background));\n\n\tconst pageCSS: string = generatePageCSS(options);\n\tif (pageCSS) parts.push(pageCSS);\n\n\tif (options.customCSS) {\n\t\tparts.push(options.customCSS);\n\t\tparts.push(`@layer ${CUSTOM_STYLE_LAYER} {\\n${options.customCSS}\\n}`);\n\t}\n\n\treturn parts.join('\\n\\n');\n}\n\n/**\n * Builds the inline document-level CSS of the export variant (`toHTML()`,\n * `AFTER_PRINT`). Every selector is qualified with `markerSelector` (the\n * static-replica marker attribute), so the rules can only ever match a\n * replica: embedding the export into a live page via the documented\n * innerHTML/setHTMLUnsafe flow cannot restyle the consumer's document, hide\n * its live editors, or force them light. (`@scope` cannot express this: its\n * implicit `:where(:scope)` descendant prefix excludes the scoping root\n * itself, and shadow content — every `::part()` subject — is outside the\n * scope.) Page-level rules (`html`/`body` reset, `body` typography, `@page`,\n * `:root` tokens, the customCSS document copies) are not emitted here; they\n * ship in the script-gated standalone style bundle and otherwise apply in the\n * `print()` iframe. Instead the typography and background snapshot is emitted\n * `!important` after the host reset in the same layer, so the replica paints\n * its own canvas even without scripts.\n */\nexport function buildExportDocumentCSS(\n\thost: HTMLElement,\n\tcontainer: HTMLElement,\n\toptions: PrintOptions,\n\tmarkerAttribute: string,\n): string {\n\tconst markedSelector: string = `${host.tagName.toLowerCase()}[${markerAttribute}]`;\n\tconst forceLightTheme: boolean = options.forceLightTheme !== false;\n\n\tconst guards: string[] = [generateHostResetCSS(markedSelector)];\n\tif (forceLightTheme) {\n\t\t// No `:root` copy here: `!important` tokens on the embedding page's root\n\t\t// would force every live editor light (they beat the shadow `:host`\n\t\t// theme sheet). The `:root` copy for page-level customCSS var() support\n\t\t// lives in the standalone bundle.\n\t\tguards.push(generateLightThemeTokens(markedSelector));\n\t}\n\tif (options.printBackground !== false) {\n\t\tguards.push(\n\t\t\t`${markedSelector}, ${markedSelector} * {\\n -webkit-print-color-adjust: exact !important;\\n print-color-adjust: exact !important;\\n}`,\n\t\t);\n\t}\n\tconst colorOverride: string | undefined = forceLightTheme\n\t\t? LIGHT_THEME.primitives.foreground\n\t\t: undefined;\n\tconst background: string = forceLightTheme ? '#ffffff' : resolveCarriedBackground(container);\n\t// Emitted after the host reset in the same layer: the source-order tie\n\t// lets the snapshot's background beat the reset's `background: transparent`.\n\tguards.push(\n\t\tmarkDeclarationsImportant(snapshotTypography(host, colorOverride, background, markedSelector)),\n\t);\n\n\tconst parts: string[] = [`@layer ${PRINT_STYLE_LAYER} {\\n${guards.join('\\n\\n')}\\n}`];\n\n\tif (!forceLightTheme) {\n\t\tconst themeTokens: string = snapshotThemeTokens(host, markedSelector);\n\t\tif (themeTokens) parts.push(themeTokens);\n\t}\n\n\treturn parts.join('\\n\\n');\n}\n","/**\n * PrintService implementation.\n *\n * Builds a print document that preserves the editor's shadow boundary via\n * declarative shadow DOM: the host page's stylesheets are copied verbatim\n * (layered), the editor's own styles live inside the shadow template, and the\n * cloned content keeps its `part` attributes. Host `::part()` rules,\n * specificity, custom properties, and conditional rules therefore behave\n * exactly as in the live editor — nothing is translated or re-emulated.\n *\n * Two document variants are built from the same inputs:\n *\n * - The export variant (returned by `toHTML()`, broadcast via `AFTER_PRINT`)\n * is embed-safe: its inline document-level CSS is qualified with the static\n * replica marker, while everything page-level (host-CSS copy, hoisted\n * `@import`s, `html`/`body`/`@page` rules) ships inside an inert\n * `<template>` bundle that the fallback script activates only when the\n * export is rendered as its own document — so injecting the output into a\n * live page (documented innerHTML/setHTMLUnsafe flow) cannot restyle or\n * break the consumer's document. It carries a static light-DOM fallback for\n * parsers without declarative shadow DOM, and never carries the page's CSP\n * nonce, which is a secret that must not be persisted into serialized HTML.\n * - The internal variant (written into the transient print iframe) inlines\n * the full page-fidelity CSS (`html`/`body` reset, body typography,\n * `@page`, unscoped host-CSS copy, hoisted imports) and carries the style\n * nonce so it renders under the inherited CSP. It omits fallback, bundle,\n * and script: the iframe is parsed by the same modern browser, where DSD is\n * guaranteed.\n */\n\nimport { escapeAttr, escapeHTML } from '../../model/HTMLUtils.js';\nimport { getStyleNonceForNode, setStyleText } from '../../style/StyleRuntime.js';\nimport type { PluginEventBus } from '../Plugin.js';\nimport { prepare } from './PrintContentPreparer.js';\nimport {\n\ttype PrintDestinationProjection,\n\tnamespacePrintFallbackTargets,\n\tprojectPrintDestinations,\n} from './PrintDestinationBridge.js';\nimport {\n\tHOST_STYLE_LAYER,\n\ttype HostStyleSegment,\n\tcollectHostStyleSegments,\n} from './PrintHostStyles.js';\nimport {\n\tCUSTOM_STYLE_LAYER,\n\tPRINT_STYLE_LAYER,\n\tbuildDocumentCSS,\n\tbuildExportDocumentCSS,\n\tbuildShadowCSS,\n\tcollectInlineThemeTokens,\n} from './PrintStyleCollector.js';\nimport {\n\tAFTER_PRINT,\n\ttype AfterPrintEvent,\n\tBEFORE_PRINT,\n\ttype BeforePrintEvent,\n\ttype PrintOptions,\n\ttype PrintService,\n} from './PrintTypes.js';\nimport { STATIC_HOST_ATTRIBUTE } from './StaticHostMarker.js';\n\n/**\n * Upper bound for waiting on the print iframe's load event. Referenced host\n * stylesheets (hoisted cross-origin `@import`) load asynchronously and are\n * worth a short wait so the first printed paint is styled, but a hanging\n * stylesheet must never block the print dialog indefinitely.\n */\nconst PRINT_LOAD_TIMEOUT_MS = 4000;\n\n/** Marker attribute on the static light-DOM fallback of the export variant. */\nexport const PRINT_FALLBACK_ATTRIBUTE = 'data-notectl-print-fallback';\n\n/**\n * Marker attribute on the inert `<template>` carrying the export variant's\n * standalone style bundle (page-level CSS and the verbatim host-CSS copy).\n */\nexport const PRINT_STYLE_BUNDLE_ATTRIBUTE = 'data-notectl-print-styles';\n\n/**\n * `<meta name>` marking the export document itself. The fallback script only\n * activates the standalone style bundle when this meta sits in\n * `document.head` — true when the export is the document being rendered\n * (file, iframe `srcdoc`, `document.write`, HTML-to-PDF engines), never when\n * it was inlined into a consumer page (fragment parsing keeps the meta inside\n * the injected subtree, outside `document.head`).\n */\nexport const PRINT_EXPORT_META_NAME = 'notectl-print-export';\n\n/**\n * Fallback for consumers that render the export variant with a parser that\n * does not attach declarative shadow roots but does execute scripts (older\n * WebViews, headless HTML-to-PDF engines). When the export is the document\n * itself (its marker meta sits in `document.head`), the inert standalone\n * style bundle (page-level CSS, verbatim host-CSS copy, hoisted imports) is\n * moved into the head, restoring full page fidelity; inlined into a consumer\n * page the meta never reaches the head, so the bundle stays inert and cannot\n * restyle the page. The shadow-attach step is strictly scoped to marked\n * replicas: only a `template[shadowrootmode]` that is a direct child of a\n * `[data-notectl-static]` host is attached — a document-wide sweep would\n * consume declarative templates belonging to the consumer's own components\n * when the export is inlined into a live page. Once a shadow root exists the\n * static light-DOM fallback is removed so extracted text is not doubled;\n * engines without Shadow DOM keep the rendered fallback. Native DSD parsing\n * leaves no template behind, making the attach branch a no-op. Kept ES5-safe\n * for legacy engines; must not contain a literal `</`. Deliberately emitted\n * without a nonce: the export variant never embeds the page's CSP secrets,\n * and if a consumer's CSP blocks the script the static fallback still\n * renders.\n */\nconst DSD_FALLBACK_SCRIPT: string = [\n\t'(function () {',\n\t' var head = document.head;',\n\t' if (head && head.querySelector(\\'meta[name=\"notectl-print-export\"]\\')) {',\n\t\" var bundles = document.querySelectorAll('template[data-notectl-print-styles]');\",\n\t' for (var b = 0; b < bundles.length; b++) {',\n\t' if (bundles[b].content) head.appendChild(bundles[b].content);',\n\t' bundles[b].parentNode.removeChild(bundles[b]);',\n\t' }',\n\t' }',\n\t\" var statics = document.querySelectorAll('[data-notectl-static]');\",\n\t' for (var i = 0; i < statics.length; i++) {',\n\t' var host = statics[i];',\n\t' if (!host.shadowRoot && host.attachShadow) {',\n\t' for (var j = 0; j < host.children.length; j++) {',\n\t' var child = host.children[j];',\n\t\" if (child.tagName !== 'TEMPLATE') continue;\",\n\t\" if (!child.getAttribute('shadowrootmode') || !child.content) continue;\",\n\t\" host.attachShadow({ mode: 'open' }).appendChild(child.content);\",\n\t' host.removeChild(child);',\n\t' break;',\n\t' }',\n\t' }',\n\t' if (!host.shadowRoot) continue;',\n\t\" var fallbacks = host.querySelectorAll('[data-notectl-print-fallback]');\",\n\t' for (var k = 0; k < fallbacks.length; k++) {',\n\t' fallbacks[k].parentNode.removeChild(fallbacks[k]);',\n\t' }',\n\t' }',\n\t'})();',\n].join('\\n');\n\n/**\n * Escapes `</` in CSS embedded into a `<style>` element. The HTML parser ends\n * the element at any literal `</style`, even inside a CSS string such as\n * `content: \"</style>\"`, which would break the print document. `\\/` is a\n * valid CSS escape for `/`, so the stylesheet semantics are unchanged.\n */\nfunction escapeStyleText(css: string): string {\n\treturn css.replace(/<\\//g, '<\\\\/');\n}\n\n/** Serializes an element's attributes matched by `include`, with a leading space. */\nfunction serializeFilteredAttributes(el: Element, include: (name: string) => boolean): string {\n\tconst parts: string[] = [];\n\tfor (const attribute of Array.from(el.attributes)) {\n\t\tif (!include(attribute.name)) continue;\n\t\tparts.push(\n\t\t\tattribute.value === ''\n\t\t\t\t? attribute.name\n\t\t\t\t: `${attribute.name}=\"${escapeAttr(attribute.value)}\"`,\n\t\t);\n\t}\n\treturn parts.length > 0 ? ` ${parts.join(' ')}` : '';\n}\n\n/**\n * Serializes an element's attributes for the print document. The `style`\n * attribute is stripped from the host element: element-attached declarations\n * would beat every stylesheet rule, defeating the print host reset.\n */\nfunction serializeAttributes(el: Element, skip: readonly string[]): string {\n\treturn serializeFilteredAttributes(el, (name: string): boolean => !skip.includes(name));\n}\n\n/**\n * Serializes theme-context attributes (`class` and `data-*`) so selectors\n * like `html.dark notectl-editor::part(x)` keep matching when the live theme\n * is carried into print (`forceLightTheme: false`).\n */\nfunction serializeThemeContextAttributes(el: Element | null): string {\n\tif (!el) return '';\n\treturn serializeFilteredAttributes(\n\t\tel,\n\t\t(name: string): boolean => name === 'class' || name.startsWith('data-'),\n\t);\n}\n\n/**\n * Serializes an element's inline `--notectl-*` tokens as a `style` attribute\n * (empty string when the element carries none). Used when the live theme is\n * carried: inline tokens beat every copied stylesheet rule, exactly as live.\n */\nfunction serializeInlineTokenStyle(el: Element | null): string {\n\tconst declarations: string = collectInlineThemeTokens(el);\n\treturn declarations ? ` style=\"${escapeAttr(declarations)}\"` : '';\n}\n\n/** Everything needed to assemble the print document. */\nexport interface PrintDocumentInput {\n\t/**\n\t * Document-level CSS matching the variant: full page fidelity for\n\t * `internal` ({@link buildDocumentCSS}), marker-qualified inline baseline\n\t * for `export` ({@link buildExportDocumentCSS}).\n\t */\n\treadonly documentCSS: string;\n\t/**\n\t * Full-fidelity page CSS ({@link buildDocumentCSS}) shipped by the export\n\t * variant inside the inert standalone style bundle; the fallback script\n\t * activates it only when the export is rendered as its own document.\n\t */\n\treadonly standaloneCSS: string;\n\t/** Source-ordered host-page CSS copy (rule chunks and hoisted `@import`s). */\n\treadonly hostSegments: readonly HostStyleSegment[];\n\t/** CSS placed inside the declarative shadow root. */\n\treadonly shadowCSS: string;\n\t/** The live editor host element; its tag and attributes are replicated. */\n\treadonly host: HTMLElement;\n\t/** Serialized print content projected into the declarative shadow root. */\n\treadonly contentHTML: string;\n\t/** Unmodified prepared content used by the export's no-DSD light-DOM fallback. */\n\treadonly fallbackContentHTML: string;\n\t/** Slotted document-tree markers for fragment navigation and PDF destinations. */\n\treadonly destinationMarkersHTML: string;\n\treadonly title: string;\n\treadonly lang: string;\n\t/** Copy html/body theme-context attributes (only when the live theme is carried). */\n\treadonly carryThemeContext: boolean;\n\t/**\n\t * `export` (`toHTML()`, `AFTER_PRINT`) is embed-safe: its inline styles are\n\t * marker-qualified, and everything page-level — the host-CSS copy, hoisted\n\t * `@import`s, and `standaloneCSS` — ships inside an inert `<template>`\n\t * bundle that the replica-scoped fallback script activates only when the\n\t * export is rendered as its own document. A consumer page embedding the\n\t * output can neither load foreign stylesheets nor have its own elements\n\t * restyled. `internal` (the transient print iframe) inlines the unscoped\n\t * copy and the imports directly and omits fallback, bundle, and script: the\n\t * iframe is parsed by the same modern browser, where declarative shadow DOM\n\t * is guaranteed.\n\t */\n\treadonly variant: 'export' | 'internal';\n\t/**\n\t * CSP nonce applied to every embedded `<style>` element so the internal\n\t * print iframe renders under an inherited `style-src` nonce policy. Never\n\t * set on the export variant: serialized HTML must not persist the page's\n\t * live nonce.\n\t */\n\treadonly styleNonce?: string;\n}\n\n/** Builds the complete print document as an HTML string. */\nexport function buildHTMLDocument(input: PrintDocumentInput): string {\n\tconst doc: Document = input.host.ownerDocument;\n\tconst hostTag: string = input.host.tagName.toLowerCase();\n\tconst isExport: boolean = input.variant === 'export';\n\t// The static marker keeps the replica from booting a live editor when the\n\t// document is injected into a page where the component is registered. The\n\t// export variant also drops the id: embedded next to the live editor it\n\t// would be a duplicate, and getElementById would resolve to the replica.\n\t// The internal iframe is its own document, so it keeps the id and host\n\t// rules like `#editor::part(cell)` stay matching.\n\tconst skippedHostAttributes: readonly string[] = isExport\n\t\t? ['style', 'id', STATIC_HOST_ATTRIBUTE]\n\t\t: ['style', STATIC_HOST_ATTRIBUTE];\n\tconst hostAttributes: string = serializeAttributes(input.host, skippedHostAttributes);\n\tconst hostTokens: string = input.carryThemeContext ? serializeInlineTokenStyle(input.host) : '';\n\n\tconst htmlContext: string = input.carryThemeContext\n\t\t? serializeThemeContextAttributes(doc.documentElement) +\n\t\t\tserializeInlineTokenStyle(doc.documentElement)\n\t\t: '';\n\tconst bodyContext: string = input.carryThemeContext\n\t\t? serializeThemeContextAttributes(doc.body) + serializeInlineTokenStyle(doc.body)\n\t\t: '';\n\n\tconst nonceAttribute: string = input.styleNonce ? ` nonce=\"${escapeAttr(input.styleNonce)}\"` : '';\n\tconst head: string[] = ['<meta charset=\"utf-8\">', `<title>${escapeHTML(input.title)}</title>`];\n\tif (isExport) {\n\t\t// Standalone marker: only reachable inside document.head when this\n\t\t// export IS the rendered document (see PRINT_EXPORT_META_NAME).\n\t\thead.push(`<meta name=\"${PRINT_EXPORT_META_NAME}\">`);\n\t}\n\t// The layer-order statement must be the document's first style rule: layer\n\t// order is fixed by first appearance, and for `!important` declarations\n\t// earlier layers win — customCSS > print guards > host copy. It stays\n\t// inline even in the export variant; on an embedding page it merely pins\n\t// the relative order of these notectl-prefixed layers, which only ever\n\t// hold marker-qualified rules there.\n\thead.push(\n\t\t`<style${nonceAttribute}>@layer ${CUSTOM_STYLE_LAYER}, ${PRINT_STYLE_LAYER}, ${HOST_STYLE_LAYER};</style>`,\n\t);\n\thead.push(`<style${nonceAttribute}>${escapeStyleText(input.documentCSS)}</style>`);\n\t// One `<style>` per segment: `@import` must precede every other rule of its\n\t// stylesheet, so interleaving imports and rule chunks as separate elements\n\t// is the only way to keep the live source order — which decides\n\t// equal-specificity cascade ties inside the `notectl-host` layer. The\n\t// export variant ships all segments (and the page-level standaloneCSS)\n\t// inside the inert style bundle instead: copied host selectors and hoisted\n\t// imports must never act on a page that merely embeds the export.\n\tconst segmentStyles: string[] = input.hostSegments.map((segment: HostStyleSegment): string => {\n\t\tconst css: string =\n\t\t\tsegment.kind === 'import'\n\t\t\t\t? segment.statement\n\t\t\t\t: `@layer ${HOST_STYLE_LAYER} {\\n${segment.css}\\n}`;\n\t\treturn `<style${nonceAttribute}>${escapeStyleText(css)}</style>`;\n\t});\n\tif (!isExport) head.push(...segmentStyles);\n\n\tconst styleBundle: string = isExport\n\t\t? `<template ${PRINT_STYLE_BUNDLE_ATTRIBUTE}><style>${escapeStyleText(input.standaloneCSS)}</style>${segmentStyles.join('')}</template>`\n\t\t: '';\n\n\t// The static fallback renders only when no shadow root is attached (a\n\t// shadow host's unslotted light DOM is never rendered): consumers that\n\t// inject via innerHTML — no DSD parsing, no script execution — get\n\t// readable, statically styled output instead of a blank page. Its style\n\t// copy is wrapped in @scope: a <style> element applies document-wide even\n\t// while its subtree is not rendered, and without the scope the shadow CSS\n\t// (including customCSS body rules) would leak onto a consumer page that\n\t// embeds this document via setHTMLUnsafe. Engines without @scope drop the\n\t// block and render the fallback unstyled but readable.\n\tconst fallback: string = isExport\n\t\t? `<div ${PRINT_FALLBACK_ATTRIBUTE}><style>@scope ([${PRINT_FALLBACK_ATTRIBUTE}]) {\\n${escapeStyleText(input.shadowCSS)}\\n}</style>${input.fallbackContentHTML}</div>`\n\t\t: '';\n\tconst fallbackScript: string = isExport ? `<script>${DSD_FALLBACK_SCRIPT}</script>` : '';\n\n\tconst body: string[] = [\n\t\t`<${hostTag}${hostAttributes}${hostTokens} ${STATIC_HOST_ATTRIBUTE}>`,\n\t\t'<template shadowrootmode=\"open\">',\n\t\t`<style${nonceAttribute}>${escapeStyleText(input.shadowCSS)}</style>`,\n\t\tinput.contentHTML,\n\t\t'</template>',\n\t\t...(fallback ? [fallback] : []),\n\t\t...(input.destinationMarkersHTML ? [input.destinationMarkersHTML] : []),\n\t\t`</${hostTag}>`,\n\t\t...(styleBundle ? [styleBundle] : []),\n\t\t...(fallbackScript ? [fallbackScript] : []),\n\t];\n\n\treturn [\n\t\t'<!DOCTYPE html>',\n\t\t`<html lang=\"${escapeAttr(input.lang)}\"${htmlContext}>`,\n\t\t'<head>',\n\t\t...head,\n\t\t'</head>',\n\t\t`<body${bodyContext}>`,\n\t\t...body,\n\t\t'</body>',\n\t\t'</html>',\n\t].join('\\n');\n}\n\n/** PrintService plus internal lifecycle hooks (not part of the public service API). */\nexport interface ManagedPrintService extends PrintService {\n\t/** Cancels pending print triggers and removes parked print iframes. */\n\tdispose(): void;\n}\n\n/** Creates and returns the PrintService implementation. */\nexport function createPrintService(\n\tshadowRoot: ShadowRoot,\n\thost: HTMLElement,\n\tcontainer: HTMLElement,\n\teventBus: PluginEventBus,\n): ManagedPrintService {\n\t/** Cancel callbacks for prints still waiting on their iframe's load event. */\n\tconst pendingPrints = new Set<() => void>();\n\n\tfunction mergeOptions(options?: PrintOptions): PrintOptions {\n\t\treturn options ?? {};\n\t}\n\n\t/** The export document plus the inputs to rebuild the internal variant. */\n\tinterface PrintDocumentBuild {\n\t\treadonly html: string;\n\t\treadonly input: PrintDocumentInput;\n\t}\n\n\tfunction executePrint(options: PrintOptions): PrintDocumentBuild | null {\n\t\t// 1. Emit BEFORE_PRINT — listeners can mutate options or cancel\n\t\tconst beforeEvent: BeforePrintEvent = {\n\t\t\toptions,\n\t\t\tcancelled: false,\n\t\t};\n\t\teventBus.emit(BEFORE_PRINT, beforeEvent);\n\n\t\tif (beforeEvent.cancelled) return null;\n\n\t\tconst finalOptions: PrintOptions = beforeEvent.options;\n\n\t\t// 2. Collect styles for both scopes\n\t\tconst shadowCSS: string = buildShadowCSS(shadowRoot, finalOptions);\n\t\tconst hostSegments: readonly HostStyleSegment[] = collectHostStyleSegments(host);\n\n\t\t// 3. Prepare content\n\t\tconst clone: HTMLElement = prepare(container, finalOptions);\n\t\tconst fallbackClone: HTMLElement = clone.cloneNode(true) as HTMLElement;\n\t\tnamespacePrintFallbackTargets(fallbackClone);\n\t\tconst fallbackContentHTML: string = fallbackClone.outerHTML;\n\t\tconst projection: PrintDestinationProjection = projectPrintDestinations(clone);\n\t\tconst contentHTML: string = clone.outerHTML;\n\t\tconst destinationMarkersHTML: string = projection.markers\n\t\t\t.map((marker: HTMLAnchorElement): string => marker.outerHTML)\n\t\t\t.join('');\n\n\t\t// 4. Build the export document (no nonce — serialized output must not\n\t\t// persist the page's CSP secret; inline document CSS marker-qualified,\n\t\t// page-level CSS in the inert standalone bundle — embedding the output\n\t\t// must not restyle the consumer's page)\n\t\tconst title: string = finalOptions.title ?? '';\n\t\tconst ownerDocument: Document = host.ownerDocument;\n\t\tconst lang: string =\n\t\t\thost.closest('[lang]')?.getAttribute('lang') ?? (ownerDocument.documentElement.lang || 'en');\n\t\tconst input: PrintDocumentInput = {\n\t\t\tdocumentCSS: buildExportDocumentCSS(host, container, finalOptions, STATIC_HOST_ATTRIBUTE),\n\t\t\tstandaloneCSS: buildDocumentCSS(host, container, finalOptions),\n\t\t\thostSegments,\n\t\t\tshadowCSS,\n\t\t\thost,\n\t\t\tcontentHTML,\n\t\t\tfallbackContentHTML,\n\t\t\tdestinationMarkersHTML,\n\t\t\ttitle,\n\t\t\tlang,\n\t\t\tcarryThemeContext: finalOptions.forceLightTheme === false,\n\t\t\tvariant: 'export',\n\t\t};\n\t\tconst html: string = buildHTMLDocument(input);\n\n\t\t// 5. Emit AFTER_PRINT\n\t\tconst afterEvent: AfterPrintEvent = { html };\n\t\teventBus.emit(AFTER_PRINT, afterEvent);\n\n\t\treturn { html, input };\n\t}\n\n\treturn {\n\t\tprint(options?: PrintOptions): void {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\tconst build: PrintDocumentBuild | null = executePrint(resolved);\n\t\t\tif (!build) return;\n\n\t\t\t// The iframe is parsed by the same browser, so the fallback is dead\n\t\t\t// weight there; the nonce keeps the styles alive under a CSP\n\t\t\t// inherited by the about:blank iframe. The internal variant inlines\n\t\t\t// the full-fidelity page CSS (html/body reset, body typography,\n\t\t\t// @page) that the embed-safe export ships only in its inert bundle.\n\t\t\tconst printHTML: string = buildHTMLDocument({\n\t\t\t\t...build.input,\n\t\t\t\tdocumentCSS: build.input.standaloneCSS,\n\t\t\t\tvariant: 'internal',\n\t\t\t\tstyleNonce: getStyleNonceForNode(container),\n\t\t\t});\n\n\t\t\t// Create hidden iframe\n\t\t\tconst iframe: HTMLIFrameElement = document.createElement('iframe');\n\t\t\tsetStyleText(iframe, 'position:fixed;left:-9999px;width:0;height:0;border:none');\n\t\t\tdocument.body.appendChild(iframe);\n\n\t\t\tconst iframeDoc: Document | null = iframe.contentDocument;\n\t\t\tconst iframeWindow: Window | null = iframe.contentWindow;\n\t\t\tif (!iframeDoc || !iframeWindow) {\n\t\t\t\tdocument.body.removeChild(iframe);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tiframeDoc.open();\n\t\t\tiframeDoc.write(printHTML);\n\t\t\tiframeDoc.close();\n\n\t\t\tconst cleanup = (): void => {\n\t\t\t\tiframe.remove();\n\t\t\t};\n\n\t\t\tconst triggerPrint = (): void => {\n\t\t\t\tiframeWindow.addEventListener('afterprint', cleanup, { once: true });\n\t\t\t\tiframeWindow.print();\n\t\t\t};\n\n\t\t\t// Referenced host stylesheets (cross-origin @import) load\n\t\t\t// asynchronously; wait for them so the first paint printed is styled.\n\t\t\t// A hanging stylesheet must not block the dialog forever, so the wait\n\t\t\t// is bounded — on timeout, printing proceeds with the styles loaded\n\t\t\t// so far. The pending trigger is cancellable: after the editor is\n\t\t\t// destroyed the dialog must not pop up over an unrelated view.\n\t\t\tif (iframeDoc.readyState === 'complete') {\n\t\t\t\ttriggerPrint();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet triggered = false;\n\t\t\tconst triggerOnce = (): void => {\n\t\t\t\tif (triggered) return;\n\t\t\t\ttriggered = true;\n\t\t\t\tpendingPrints.delete(cancelPending);\n\t\t\t\twindow.clearTimeout(timeoutId);\n\t\t\t\ttriggerPrint();\n\t\t\t};\n\t\t\tconst cancelPending = (): void => {\n\t\t\t\ttriggered = true;\n\t\t\t\twindow.clearTimeout(timeoutId);\n\t\t\t\tiframeWindow.removeEventListener('load', triggerOnce);\n\t\t\t\tiframe.remove();\n\t\t\t};\n\t\t\tconst timeoutId: number = window.setTimeout(triggerOnce, PRINT_LOAD_TIMEOUT_MS);\n\t\t\tpendingPrints.add(cancelPending);\n\t\t\tiframeWindow.addEventListener('load', triggerOnce, { once: true });\n\t\t},\n\n\t\ttoHTML(options?: PrintOptions): string {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\treturn executePrint(resolved)?.html ?? '';\n\t\t},\n\n\t\tdispose(): void {\n\t\t\tfor (const cancel of pendingPrints) {\n\t\t\t\tcancel();\n\t\t\t}\n\t\t\tpendingPrints.clear();\n\t\t},\n\t};\n}\n","/**\n * PrintPlugin: provides print functionality for the notectl editor.\n * Registers a command, keymap, toolbar item, and exposes a PrintService.\n * Orchestrator only — delegates all logic to PrintServiceImpl, PrintStyleCollector,\n * and PrintContentPreparer.\n */\n\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { PRINT_LOCALE_EN, type PrintLocale, loadPrintLocale } from './PrintLocale.js';\nimport { type ManagedPrintService, createPrintService } from './PrintServiceImpl.js';\nimport type { PrintOptions, PrintPluginConfig, PrintService } from './PrintTypes.js';\nimport { PRINT_SERVICE_KEY } from './PrintTypes.js';\n\nconst PRINT_ICON: string =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">' +\n\t'<path d=\"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3' +\n\t' 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z\"/>' +\n\t'</svg>';\n\n/** No-op fallback service for environments without ShadowRoot. */\nconst NOOP_SERVICE: ManagedPrintService = {\n\tprint(): void {},\n\ttoHTML(): string {\n\t\treturn '';\n\t},\n\tdispose(): void {},\n};\n\nexport class PrintPlugin implements Plugin {\n\treadonly id = 'print';\n\treadonly name = 'Print';\n\n\tprivate readonly config: PrintPluginConfig;\n\tprivate service: ManagedPrintService | null = null;\n\tprivate locale!: PrintLocale;\n\n\tconstructor(config?: PrintPluginConfig) {\n\t\tthis.config = config ?? {};\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tPRINT_LOCALE_EN,\n\t\t\tloadPrintLocale,\n\t\t);\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tconst rootNode: Node = container.getRootNode();\n\n\t\tif (rootNode instanceof ShadowRoot) {\n\t\t\tconst host: HTMLElement = rootNode.host as HTMLElement;\n\t\t\tconst eventBus = context.getEventBus();\n\t\t\tthis.service = createPrintService(rootNode, host, container, eventBus);\n\t\t} else {\n\t\t\tthis.service = NOOP_SERVICE;\n\t\t}\n\n\t\tcontext.registerService(PRINT_SERVICE_KEY, this.service);\n\n\t\tconst defaults: PrintOptions = this.config.defaults ?? {};\n\t\tconst service: PrintService = this.service;\n\n\t\tconst printLocale = this.locale;\n\t\tcontext.registerCommand('print', () => {\n\t\t\tcontext.announce(printLocale.printingAnnouncement);\n\t\t\tservice.print(defaults);\n\t\t\treturn true;\n\t\t});\n\n\t\tconst keyBinding: string = this.config.keyBinding ?? 'Mod-P';\n\t\tcontext.registerKeymap({\n\t\t\t[keyBinding]: () => {\n\t\t\t\tcontext.executeCommand('print');\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\n\t\tif (this.config.showToolbarItem !== false) {\n\t\t\tconst shortcut: string = formatShortcut(keyBinding);\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: 'print',\n\t\t\t\tgroup: 'actions',\n\t\t\t\tlabel: this.locale.label,\n\t\t\t\ttooltip: this.locale.tooltip(shortcut),\n\t\t\t\ticon: PRINT_ICON,\n\t\t\t\tcommand: 'print',\n\t\t\t});\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\t// A print still waiting on its iframe's load event must not pop the\n\t\t// dialog after the editor is gone (e.g. after an SPA navigation).\n\t\tthis.service?.dispose();\n\t\tthis.service = null;\n\t}\n}\n"],"mappings":"yYAcA,IAAa,EAA+B,CAC3C,MAAO,QACP,QAAU,GAAqB,UAAU,KACzC,qBAAsB,YAKjB,iBAA8C,OAAA,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,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,sBAC7B,EAAQ,MAAM,IACP,IAGR,MAAM,EAAqB,KAAK,OAAO,YAAc,QAQrD,GAPA,EAAQ,eAAe,CAAA,CACrB,GAAA,KACA,EAAQ,eAAe,UAChB,MAI2B,IAAhC,KAAK,OAAO,gBAA2B,CAC1C,MAAM,EAAmB,EAAe,GACxC,EAAQ,oBAAoB,CAC3B,GAAI,QACJ,MAAO,UACP,MAAO,KAAK,OAAO,MACnB,QAAS,KAAK,OAAO,QAAQ,GAC7B,KAvEH,sPAwEG,QAAS,SAEX,CACD,CAEA,OAAA,GAGC,KAAK,SAAS,UACd,KAAK,QAAU,IAChB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaRegistry-Cs7rxafF.mjs","names":[],"sources":["../../src/model/StyleClassRegistry.ts","../../src/model/SchemaRegistry.ts"],"sourcesContent":["/**\n * The style classes of one editor and the rules they follow: one class per\n * declaration and one declaration per class, each a plain CSS class name\n * outside notectl's reserved prefix. Registering the same pair again (for\n * example from a second plugin) is counted, so every registrant can remove its\n * own registration without taking the class from the others.\n */\n\nimport {\n\ttype CSSDeclaration,\n\ttype StyleClass,\n\tformatDeclaration,\n\tparseDeclaration,\n} from './StyleClass.js';\n\n/** Reserved for the class names notectl generates itself (`notectl-align-*`, `notectl-s-*`). */\nconst RESERVED_PREFIX = 'notectl-';\n\n/** One CSS identifier that is valid in a `class` attribute and a selector without escaping. */\nconst CLASS_NAME_PATTERN: RegExp = /^-?[A-Za-z_][A-Za-z0-9_-]*$/;\n\ninterface StyleClassEntry {\n\treadonly styleClass: StyleClass;\n\tregistrations: number;\n}\n\nexport class StyleClassRegistry {\n\tprivate readonly byClassName = new Map<string, StyleClassEntry>();\n\tprivate readonly byDeclaration = new Map<string, StyleClassEntry>();\n\n\t/** Number of distinct registered style classes. */\n\tget size(): number {\n\t\treturn this.byClassName.size;\n\t}\n\n\t/**\n\t * Registers a style class. Throws a `TypeError` when it is invalid, when its\n\t * class already stands for another declaration, or when its declaration\n\t * already has another class.\n\t */\n\tregister(styleClass: StyleClass): void {\n\t\tconst { className, declaration }: StyleClass = validateStyleClass(styleClass);\n\t\tconst sameClass: StyleClassEntry | undefined = this.byClassName.get(className);\n\t\tif (sameClass && sameClass.styleClass.declaration !== declaration) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Class \"${className}\" already stands for \"${sameClass.styleClass.declaration}\"; give \"${declaration}\" its own class.`,\n\t\t\t);\n\t\t}\n\t\tconst sameDeclaration: StyleClassEntry | undefined = this.byDeclaration.get(declaration);\n\t\tif (sameDeclaration && sameDeclaration.styleClass.className !== className) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`\"${declaration}\" already has the class \"${sameDeclaration.styleClass.className}\"; a declaration can have only one class.`,\n\t\t\t);\n\t\t}\n\t\tif (sameClass) {\n\t\t\tsameClass.registrations++;\n\t\t\treturn;\n\t\t}\n\t\tconst entry: StyleClassEntry = {\n\t\t\tstyleClass: Object.freeze({ className, declaration }),\n\t\t\tregistrations: 1,\n\t\t};\n\t\tthis.byClassName.set(className, entry);\n\t\tthis.byDeclaration.set(declaration, entry);\n\t}\n\n\t/** Removes one registration of `styleClass`; others keep the class registered. */\n\tremove(styleClass: StyleClass): void {\n\t\tconst entry: StyleClassEntry | undefined = this.byClassName.get(styleClass.className);\n\t\tif (!entry || !this.isSameDeclaration(entry, styleClass)) return;\n\t\tentry.registrations--;\n\t\tif (entry.registrations > 0) return;\n\t\tthis.byClassName.delete(entry.styleClass.className);\n\t\tthis.byDeclaration.delete(entry.styleClass.declaration);\n\t}\n\n\t/** Returns the style class with this class name, or `undefined`. */\n\tget(className: string): StyleClass | undefined {\n\t\treturn this.byClassName.get(className)?.styleClass;\n\t}\n\n\t/** Returns all style classes in registration order. */\n\tlist(): readonly StyleClass[] {\n\t\treturn [...this.byClassName.values()].map((entry: StyleClassEntry) => entry.styleClass);\n\t}\n\n\tclear(): void {\n\t\tthis.byClassName.clear();\n\t\tthis.byDeclaration.clear();\n\t}\n\n\tprivate isSameDeclaration(entry: StyleClassEntry, styleClass: StyleClass): boolean {\n\t\tconst parsed: CSSDeclaration | undefined =\n\t\t\ttypeof styleClass.declaration === 'string'\n\t\t\t\t? parseDeclaration(styleClass.declaration)\n\t\t\t\t: undefined;\n\t\treturn parsed !== undefined && formatDeclaration(parsed) === entry.styleClass.declaration;\n\t}\n}\n\n/**\n * Validates a style class and returns a frozen copy with its declaration in\n * `property: value` form. Throws a `TypeError` that explains how to fix the\n * first problem it finds.\n */\nexport function validateStyleClass(styleClass: StyleClass): StyleClass {\n\tconst declaration: unknown = styleClass?.declaration;\n\tconst parsed: CSSDeclaration | undefined =\n\t\ttypeof declaration === 'string' ? parseDeclaration(declaration) : undefined;\n\tif (!parsed) {\n\t\tthrow new TypeError(\n\t\t\t`Invalid declaration ${JSON.stringify(declaration)}: use one CSS declaration such as \"color: #e03131\".`,\n\t\t);\n\t}\n\tconst normalized: string = formatDeclaration(parsed);\n\tconst className: unknown = styleClass.className;\n\tif (typeof className !== 'string' || !CLASS_NAME_PATTERN.test(className)) {\n\t\tthrow new TypeError(\n\t\t\t`Invalid class name ${JSON.stringify(className)} for \"${normalized}\": use one CSS class name of letters, digits, \"-\" and \"_\", not starting with a digit.`,\n\t\t);\n\t}\n\tif (className.startsWith(RESERVED_PREFIX)) {\n\t\tthrow new TypeError(\n\t\t\t`Class \"${className}\" for \"${normalized}\" uses the reserved prefix \"${RESERVED_PREFIX}\".`,\n\t\t);\n\t}\n\treturn Object.freeze({ className, declaration: normalized });\n}\n","/**\n * SchemaRegistry: central registry for node specs, mark specs,\n * and inline node specs registered by plugins.\n *\n * Model-only — no imports from input/, plugins/, or view/ layers.\n */\n\nimport type { InlineNodeSpec } from './InlineNodeSpec.js';\nimport type { MarkSpec } from './MarkSpec.js';\nimport type { NodeSpec } from './NodeSpec.js';\nimport type { ParseRule } from './ParseRule.js';\nimport type { ElementSanitizeValidator } from './SanitizeConfig.js';\nimport type { StyleClass } from './StyleClass.js';\nimport { StyleClassRegistry } from './StyleClassRegistry.js';\n\n/** Priority assigned to parse rules that do not declare an explicit `priority`. */\nconst DEFAULT_PARSE_PRIORITY = 50;\n\n/** Declarative transformation applied after a target NodeSpec is registered. */\nexport type NodeSpecExtension = (spec: NodeSpec) => NodeSpec;\n\nexport class SchemaRegistry {\n\tprivate readonly _nodeSpecs = new Map<string, NodeSpec>();\n\tprivate readonly _nodeSpecExtensions = new Map<string, NodeSpecExtension[]>();\n\tprivate _finalizedNodeSpecs: Map<string, NodeSpec> | null = null;\n\tprivate readonly _markSpecs = new Map<string, MarkSpec>();\n\tprivate readonly _inlineNodeSpecs = new Map<string, InlineNodeSpec>();\n\tprivate readonly _styleClasses = new StyleClassRegistry();\n\n\t// --- NodeSpec ---\n\n\tregisterNodeSpec<T extends string>(spec: NodeSpec<T>): void {\n\t\tif (this._nodeSpecs.has(spec.type)) {\n\t\t\tthrow new Error(`NodeSpec for type \"${spec.type}\" is already registered.`);\n\t\t}\n\t\tthis._nodeSpecs.set(spec.type, spec);\n\t\tthis.invalidateFinalizedNodeSpecs();\n\t}\n\n\tgetNodeSpec(type: string): NodeSpec | undefined {\n\t\treturn this.getFinalizedNodeSpecs().get(type);\n\t}\n\n\tremoveNodeSpec(type: string): void {\n\t\tif (this._nodeSpecs.delete(type)) this.invalidateFinalizedNodeSpecs();\n\t}\n\n\tgetNodeTypes(): string[] {\n\t\treturn [...this._nodeSpecs.keys()];\n\t}\n\n\t/**\n\t * Registers a composable NodeSpec extension independently of target order.\n\t * Extensions may be declared before their target plugin and are materialized\n\t * together by {@link finalize}. The function identity is also the cleanup key.\n\t */\n\tregisterNodeSpecExtension(type: string, extension: NodeSpecExtension): void {\n\t\tconst extensions = this._nodeSpecExtensions.get(type) ?? [];\n\t\textensions.push(extension);\n\t\tthis._nodeSpecExtensions.set(type, extensions);\n\t\tthis.invalidateFinalizedNodeSpecs();\n\t}\n\n\t/** Removes one previously registered NodeSpec extension by identity. */\n\tremoveNodeSpecExtension(type: string, extension: NodeSpecExtension): void {\n\t\tconst extensions = this._nodeSpecExtensions.get(type);\n\t\tif (!extensions) return;\n\t\tconst index = extensions.indexOf(extension);\n\t\tif (index === -1) return;\n\t\textensions.splice(index, 1);\n\t\tif (extensions.length === 0) this._nodeSpecExtensions.delete(type);\n\t\tthis.invalidateFinalizedNodeSpecs();\n\t}\n\n\t/**\n\t * Materializes the complete schema after all plugins have declared their base\n\t * specs and extensions. Calling it again after registrations change rebuilds\n\t * the snapshot; reads also finalize lazily for standalone registry consumers.\n\t */\n\tfinalize(): void {\n\t\tconst finalized = new Map<string, NodeSpec>();\n\t\tfor (const [type, baseSpec] of this._nodeSpecs) {\n\t\t\tlet resolved: NodeSpec = baseSpec;\n\t\t\tfor (const extension of this._nodeSpecExtensions.get(type) ?? []) {\n\t\t\t\tresolved = extension(resolved);\n\t\t\t\tif (resolved.type !== type) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`NodeSpec extension for \"${type}\" must preserve node type; received \"${resolved.type}\".`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfinalized.set(type, resolved);\n\t\t}\n\t\tthis._finalizedNodeSpecs = finalized;\n\t}\n\n\t// --- MarkSpec ---\n\n\tregisterMarkSpec<T extends string>(spec: MarkSpec<T>): void {\n\t\tif (this._markSpecs.has(spec.type)) {\n\t\t\tthrow new Error(`MarkSpec for type \"${spec.type}\" is already registered.`);\n\t\t}\n\t\tthis._markSpecs.set(spec.type, spec);\n\t}\n\n\tgetMarkSpec(type: string): MarkSpec | undefined {\n\t\treturn this._markSpecs.get(type);\n\t}\n\n\tremoveMarkSpec(type: string): void {\n\t\tthis._markSpecs.delete(type);\n\t}\n\n\tgetMarkTypes(): string[] {\n\t\treturn [...this._markSpecs.keys()];\n\t}\n\n\t// --- InlineNodeSpec ---\n\n\tregisterInlineNodeSpec<T extends string>(spec: InlineNodeSpec<T>): void {\n\t\tif (this._inlineNodeSpecs.has(spec.type)) {\n\t\t\tthrow new Error(`InlineNodeSpec for type \"${spec.type}\" is already registered.`);\n\t\t}\n\t\tthis._inlineNodeSpecs.set(spec.type, spec);\n\t}\n\n\tgetInlineNodeSpec(type: string): InlineNodeSpec | undefined {\n\t\treturn this._inlineNodeSpecs.get(type);\n\t}\n\n\tremoveInlineNodeSpec(type: string): void {\n\t\tthis._inlineNodeSpecs.delete(type);\n\t}\n\n\tgetInlineNodeTypes(): string[] {\n\t\treturn [...this._inlineNodeSpecs.keys()];\n\t}\n\n\t// --- Style Classes ---\n\n\t/**\n\t * Registers an application CSS class for one CSS declaration (#269).\n\t * Class-based HTML export writes the class wherever it would write the\n\t * declaration, and HTML import and paste read the class back as the\n\t * declaration. Throws a `TypeError` when the class is invalid or contradicts a\n\t * registered one; registering the same pair again is counted.\n\t */\n\tregisterStyleClass(styleClass: StyleClass): void {\n\t\tthis._styleClasses.register(styleClass);\n\t}\n\n\t/** Removes one registration of `styleClass`; the class stays while others registered it too. */\n\tremoveStyleClass(styleClass: StyleClass): void {\n\t\tthis._styleClasses.remove(styleClass);\n\t}\n\n\t/** Returns the style class with this class name, or `undefined`. */\n\tgetStyleClass(className: string): StyleClass | undefined {\n\t\treturn this._styleClasses.get(className);\n\t}\n\n\t/** Returns all style classes in registration order. */\n\tgetStyleClasses(): readonly StyleClass[] {\n\t\treturn this._styleClasses.list();\n\t}\n\n\t// --- Parse Rules & Sanitize Config ---\n\n\t/** Returns all NodeSpec parseHTML rules, sorted by priority descending. */\n\tgetBlockParseRules(): readonly { readonly rule: ParseRule; readonly type: string }[] {\n\t\treturn this.collectParseRules(this.getFinalizedNodeSpecs());\n\t}\n\n\t/** Returns all InlineNodeSpec parseHTML rules, sorted by priority descending. */\n\tgetInlineParseRules(): readonly { readonly rule: ParseRule; readonly type: string }[] {\n\t\treturn this.collectParseRules(this._inlineNodeSpecs);\n\t}\n\n\t/** Returns all MarkSpec parseHTML rules, sorted by priority descending. */\n\tgetMarkParseRules(): readonly { readonly rule: ParseRule; readonly type: string }[] {\n\t\treturn this.collectParseRules(this._markSpecs);\n\t}\n\n\t/** Returns all allowed HTML tags from base defaults + all spec sanitize configs. */\n\tgetAllowedTags(): string[] {\n\t\treturn [\n\t\t\t...this.collectSanitizeValues(\n\t\t\t\tnew Set(['p', 'br', 'div', 'span']),\n\t\t\t\t(spec) => spec.sanitize?.tags,\n\t\t\t),\n\t\t];\n\t}\n\n\t/**\n\t * Returns all allowed HTML attributes from base defaults + all spec sanitize configs.\n\t * `class` is allowed while content HTML can carry classes that import reads back.\n\t */\n\tgetAllowedAttrs(): string[] {\n\t\tconst base = new Set<string>(['style', 'dir', 'id']);\n\t\tif (this.readsClasses()) base.add('class');\n\t\treturn [...this.collectSanitizeValues(base, (spec) => spec.sanitize?.attrs)];\n\t}\n\n\t/** Returns registry-owned, per-tag element validators for one sanitize operation. */\n\tgetElementSanitizeValidators(): ReadonlyMap<string, readonly ElementSanitizeValidator[]> {\n\t\tconst validators = new Map<string, ElementSanitizeValidator[]>();\n\t\tfor (const specMap of this.getAllFinalizedSpecMaps()) {\n\t\t\tfor (const spec of specMap.values()) {\n\t\t\t\tfor (const [tag, validator] of Object.entries(spec.sanitize?.elementValidators ?? {})) {\n\t\t\t\t\tconst normalizedTag = tag.toLowerCase();\n\t\t\t\t\tconst entries = validators.get(normalizedTag) ?? [];\n\t\t\t\t\tentries.push(validator);\n\t\t\t\t\tvalidators.set(normalizedTag, entries);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn validators;\n\t}\n\n\tprivate collectParseRules(\n\t\tspecs: ReadonlyMap<string, { readonly parseHTML?: readonly ParseRule[] }>,\n\t): { readonly rule: ParseRule; readonly type: string }[] {\n\t\tconst results: { readonly rule: ParseRule; readonly type: string }[] = [];\n\t\tfor (const [type, spec] of specs) {\n\t\t\tif (spec.parseHTML) {\n\t\t\t\tfor (const rule of spec.parseHTML) {\n\t\t\t\t\tresults.push({ rule, type });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results.sort(\n\t\t\t(a, b) =>\n\t\t\t\t(b.rule.priority ?? DEFAULT_PARSE_PRIORITY) - (a.rule.priority ?? DEFAULT_PARSE_PRIORITY),\n\t\t);\n\t}\n\n\t/**\n\t * Whether content HTML can carry classes that import reads back: registered\n\t * style classes, or the `notectl-align-*` classes class-based export writes\n\t * for every block type that declares `align` (#275).\n\t */\n\tprivate readsClasses(): boolean {\n\t\tif (this._styleClasses.size > 0) return true;\n\t\tfor (const spec of this.getFinalizedNodeSpecs().values()) {\n\t\t\tif (spec.attrs?.align) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate collectSanitizeValues(\n\t\tinitial: Set<string>,\n\t\textractor: (spec: {\n\t\t\treadonly sanitize?: { readonly tags?: readonly string[]; readonly attrs?: readonly string[] };\n\t\t}) => readonly string[] | undefined,\n\t): Set<string> {\n\t\tconst allSpecs: readonly ReadonlyMap<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\treadonly sanitize?: {\n\t\t\t\t\treadonly tags?: readonly string[];\n\t\t\t\t\treadonly attrs?: readonly string[];\n\t\t\t\t};\n\t\t\t}\n\t\t>[] = this.getAllFinalizedSpecMaps();\n\t\tfor (const specMap of allSpecs) {\n\t\t\tfor (const spec of specMap.values()) {\n\t\t\t\tconst values: readonly string[] | undefined = extractor(spec);\n\t\t\t\tif (values) {\n\t\t\t\t\tfor (const value of values) initial.add(value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn initial;\n\t}\n\n\tprivate getFinalizedNodeSpecs(): ReadonlyMap<string, NodeSpec> {\n\t\tif (!this._finalizedNodeSpecs) this.finalize();\n\t\treturn this._finalizedNodeSpecs ?? new Map();\n\t}\n\n\tprivate getAllFinalizedSpecMaps(): readonly ReadonlyMap<\n\t\tstring,\n\t\t{\n\t\t\treadonly sanitize?: {\n\t\t\t\treadonly tags?: readonly string[];\n\t\t\t\treadonly attrs?: readonly string[];\n\t\t\t\treadonly elementValidators?: Readonly<Record<string, ElementSanitizeValidator>>;\n\t\t\t};\n\t\t}\n\t>[] {\n\t\treturn [this.getFinalizedNodeSpecs(), this._inlineNodeSpecs, this._markSpecs];\n\t}\n\n\tprivate invalidateFinalizedNodeSpecs(): void {\n\t\tthis._finalizedNodeSpecs = null;\n\t}\n\n\t// --- Bulk ---\n\n\tclear(): void {\n\t\tthis._nodeSpecs.clear();\n\t\tthis._nodeSpecExtensions.clear();\n\t\tthis._finalizedNodeSpecs = null;\n\t\tthis._markSpecs.clear();\n\t\tthis._inlineNodeSpecs.clear();\n\t\tthis._styleClasses.clear();\n\t}\n}\n"],"mappings":"0DAgBA,IAAM,EAAkB,WAGlB,EAA6B,8BAOtB,EAAb,MACC,2BAA+B,IAAI,IACnC,6BAAiC,IAAI,IAGrC,QAAI,GACH,OAAO,KAAK,YAAY,IACzB,CAOA,QAAA,CAAS,GACR,MAAM,UAAE,EAAA,YAAW,GAgErB,SAAmC,GAClC,MAAM,EAAuB,GAAY,YACnC,EACkB,iBAAhB,EAA2B,EAAiB,QAAe,EACnE,IAAK,EACJ,MAAM,IAAI,UACT,uBAAuB,KAAK,UAAU,yDAGxC,MAAM,EAAqB,EAAkB,GACvC,EAAqB,EAAW,UACtC,GAAyB,iBAAd,IAA2B,EAAmB,KAAK,GAC7D,MAAM,IAAI,UACT,sBAAsB,KAAK,UAAU,WAAmB,0FAG1D,GAAI,EAAU,WAAW,GACxB,MAAM,IAAI,UACT,UAAU,WAAmB,gCAAyC,OAGxE,OAAO,OAAO,OAAO,CAAE,YAAW,YAAa,GAChD,CAtFiD,CAAmB,GAC5D,EAAyC,KAAK,YAAY,IAAI,GACpE,GAAI,GAAa,EAAU,WAAW,cAAgB,EACrD,MAAM,IAAI,UACT,UAAU,0BAAkC,EAAU,WAAW,uBAAuB,qBAG1F,MAAM,EAA+C,KAAK,cAAc,IAAI,GAC5E,GAAI,GAAmB,EAAgB,WAAW,YAAc,EAC/D,MAAM,IAAI,UACT,IAAI,6BAAuC,EAAgB,WAAW,sDAGxE,GAAI,EAEH,YADA,EAAU,gBAGX,MAAM,EAAy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,MAAM,EAQA,KAAK,0BACX,IAAK,MAAM,KAAW,EACrB,IAAK,MAAM,KAAQ,EAAQ,SAAU,CACpC,MAAM,EAAwC,EAAU,GACxD,GAAI,EACH,IAAK,MAAM,KAAS,EAAQ,EAAQ,IAAI,EAE1C,CAED,OAAO,CACR,CAEA,qBAAA,GAEC,OADK,KAAK,qBAAqB,KAAK,WAC7B,KAAK,oCAAuB,IAAI,GACxC,CAEA,uBAAA,GAUC,MAAO,CAAC,KAAK,wBAAyB,KAAK,iBAAkB,KAAK,WACnE,CAEA,4BAAA,GACC,KAAK,oBAAsB,IAC5B,CAIA,KAAA,GACC,KAAK,WAAW,QAChB,KAAK,oBAAoB,QACzB,KAAK,oBAAsB,KAC3B,KAAK,WAAW,QAChB,KAAK,iBAAiB,QACtB,KAAK,cAAc,OACpB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectionSync-BkjCwGp-.mjs","names":[],"sources":["../../src/view/InlineContentDOM.ts","../../src/view/SelectionSync.ts"],"sourcesContent":["/**\n * Classification of the DOM that renders a block's inline content.\n *\n * Shared by selection mapping and rendered-text reading so both agree on\n * which DOM nodes are document content: text nodes count their length, inline\n * node elements count one position, and view chrome counts nothing.\n */\n\n/** Attribute marking the temporary IME cursor wrapper (see `CursorWrapper`). */\nexport const CURSOR_WRAPPER_ATTR = 'data-cursor-wrapper';\n\n/** Zero-width space the cursor wrapper holds so the browser can compose into it. */\nexport const ZERO_WIDTH_SPACE = '​';\n\n/**\n * True when `node` is an InlineNode element — rendered `contenteditable=\"false\"`\n * and counted as width 1 in state offset space.\n */\nexport function isInlineNodeEl(node: Node | null | undefined): node is HTMLElement {\n\treturn node instanceof HTMLElement && node.getAttribute('contenteditable') === 'false';\n}\n\n/**\n * True when `node` is a view-chrome widget (`data-widget`), such as the checklist\n * checkbox marker. Widgets are rendered into the editable DOM for accessibility\n * but are not document content, so they count as zero width in offset space.\n */\nexport function isWidgetEl(node: Node | null | undefined): node is HTMLElement {\n\treturn node instanceof HTMLElement && node.hasAttribute('data-widget');\n}\n\n/** True when `node` is the temporary IME cursor wrapper element. */\nexport function isCursorWrapperEl(node: Node | null | undefined): node is HTMLElement {\n\treturn node instanceof HTMLElement && node.hasAttribute(CURSOR_WRAPPER_ATTR);\n}\n\n/**\n * Resolves the content root for inline content walking.\n * If the block element has a contentDOM (marked with data-content-dom),\n * returns it so the walker skips NodeView structural elements (headers, etc.).\n */\nexport function resolveContentRoot(blockEl: Element): Element {\n\tconst contentDOM: Element | null = blockEl.querySelector('[data-content-dom]');\n\treturn contentDOM ?? blockEl;\n}\n\nexport interface InlineContentWalkerOptions {\n\t/**\n\t * Descend into the IME cursor wrapper instead of skipping it. Selection\n\t * mapping skips it because its zero-width space is not content; reading\n\t * composed text needs it because the browser composes inside it.\n\t */\n\treadonly includeCursorWrapper?: boolean;\n}\n\n/**\n * Creates a TreeWalker that visits text nodes and contentEditable=\"false\"\n * inline elements within a block, skipping mark wrappers and nested blocks.\n */\nexport function createInlineContentWalker(\n\tblockEl: Element,\n\toptions: InlineContentWalkerOptions = {},\n): TreeWalker {\n\tconst includeCursorWrapper: boolean = options.includeCursorWrapper ?? false;\n\treturn document.createTreeWalker(blockEl, NodeFilter.SHOW_ALL, {\n\t\tacceptNode: (n: Node) => {\n\t\t\t// The cursor wrapper holds a ZWS for stored marks during IME composition\n\t\t\tif (isCursorWrapperEl(n)) {\n\t\t\t\treturn includeCursorWrapper ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_REJECT;\n\t\t\t}\n\t\t\t// Skip view-chrome widgets (e.g. the checklist checkbox marker). They are\n\t\t\t// contentEditable=\"false\" but not document content, so they carry zero\n\t\t\t// width in offset space and must never become a caret position.\n\t\t\tif (isWidgetEl(n)) return NodeFilter.FILTER_REJECT;\n\t\t\t// Skip anything inside an inline element (contentEditable=\"false\")\n\t\t\tif (isInsideInlineElement(n, blockEl)) return NodeFilter.FILTER_REJECT;\n\t\t\t// Skip nested block elements and their descendants\n\t\t\tif (n instanceof HTMLElement && n.hasAttribute('data-block-id') && n !== blockEl) {\n\t\t\t\treturn NodeFilter.FILTER_REJECT;\n\t\t\t}\n\t\t\t// Accept text nodes\n\t\t\tif (n.nodeType === Node.TEXT_NODE) return NodeFilter.FILTER_ACCEPT;\n\t\t\t// Accept inline elements (contentEditable=\"false\")\n\t\t\tif (isInlineNodeEl(n)) {\n\t\t\t\treturn NodeFilter.FILTER_ACCEPT;\n\t\t\t}\n\t\t\t// Skip other elements (mark wrappers, decoration wrappers) — descend\n\t\t\treturn NodeFilter.FILTER_SKIP;\n\t\t},\n\t});\n}\n\n/** Checks if a node is inside a contentEditable=\"false\" inline element. */\nfunction isInsideInlineElement(node: Node, root: Element): boolean {\n\tlet parent: Node | null = node.parentNode;\n\twhile (parent && parent !== root) {\n\t\tif (isInlineNodeEl(parent)) {\n\t\t\treturn true;\n\t\t}\n\t\tparent = parent.parentNode;\n\t}\n\treturn false;\n}\n","/**\n * Selection synchronization between editor state and DOM.\n */\n\nimport type { EditorSelection, Position, Selection } from '../model/Selection.js';\nimport {\n\tcreatePosition,\n\tcreateSelection,\n\tisGapCursor,\n\tisNodeSelection,\n} from '../model/Selection.js';\nimport { blockId as toBlockId } from '../model/TypeBrands.js';\nimport { buildBlockPath, findBlockAncestor } from './DomUtils.js';\nimport {\n\tcreateInlineContentWalker,\n\tisInlineNodeEl,\n\tisWidgetEl,\n\tresolveContentRoot,\n} from './InlineContentDOM.js';\n\ninterface DOMPosition {\n\tnode: Node;\n\toffset: number;\n}\n\n/**\n * Returns the lone `<br>` placeholder of an empty block, ignoring view-chrome\n * widgets. Returns null when the block holds real inline content.\n */\nfunction findPlaceholderBr(contentEl: Element): Node | null {\n\tlet br: Node | null = null;\n\tfor (const child of Array.from(contentEl.childNodes)) {\n\t\tif (isWidgetEl(child)) continue;\n\t\tif (br) return null;\n\t\tif (child.nodeName === 'BR') {\n\t\t\tbr = child;\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n\treturn br;\n}\n\n/** Gets the selection object for writing (collapse, setBaseAndExtent). */\nexport function getSelection(): globalThis.Selection | null {\n\treturn window.getSelection();\n}\n\n/**\n * Endpoints returned by reading selection via getComposedRanges().\n * Used to correctly read selection inside Shadow DOM on Safari 17+,\n * Chrome 137+, and Firefox 142+.\n */\nexport interface SelectionEndpoints {\n\tanchorNode: Node;\n\tanchorOffset: number;\n\tfocusNode: Node;\n\tfocusOffset: number;\n}\n\n/**\n * Reads the selection endpoints using getComposedRanges() when inside a\n * Shadow DOM. Returns null if not in a shadow root or the API is unavailable.\n *\n * Handles two call signatures:\n * - Modern (Chrome 137+, Firefox 142+): sel.getComposedRanges({ shadowRoots: [root] })\n * - Legacy (Safari 17+): sel.getComposedRanges(root)\n *\n * StaticRange always uses document order. When `Selection.direction` is\n * `\"backward\"`, anchor/focus are swapped to reconstruct the correct\n * directional endpoints. When direction is `\"none\"` or absent the\n * forward (document-order) mapping is used.\n *\n * Note: Safari 17–18 supports getComposedRanges but not\n * Selection.direction — backward selections will be read as forward.\n */\nexport function readComposedSelection(\n\tcontainer: HTMLElement,\n\tsel: globalThis.Selection,\n): SelectionEndpoints | null {\n\tconst root = container.getRootNode();\n\tif (!(root instanceof ShadowRoot)) return null;\n\tif (!('getComposedRanges' in sel)) return null;\n\n\tlet ranges: StaticRange[];\n\ttry {\n\t\t// Modern syntax (Chrome 137+, Firefox 142+)\n\t\tranges = (\n\t\t\tsel as unknown as {\n\t\t\t\tgetComposedRanges(opts: { shadowRoots: ShadowRoot[] }): StaticRange[];\n\t\t\t}\n\t\t).getComposedRanges({ shadowRoots: [root] });\n\t} catch {\n\t\ttry {\n\t\t\t// Legacy syntax (Safari 17+)\n\t\t\tranges = (\n\t\t\t\tsel as unknown as {\n\t\t\t\t\tgetComposedRanges(...roots: ShadowRoot[]): StaticRange[];\n\t\t\t\t}\n\t\t\t).getComposedRanges(root);\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tconst range = ranges[0];\n\tif (!range) return null;\n\n\tconst isBackward: boolean =\n\t\t'direction' in sel && (sel as unknown as { direction: string }).direction === 'backward';\n\n\treturn {\n\t\tanchorNode: isBackward ? range.endContainer : range.startContainer,\n\t\tanchorOffset: isBackward ? range.endOffset : range.startOffset,\n\t\tfocusNode: isBackward ? range.startContainer : range.endContainer,\n\t\tfocusOffset: isBackward ? range.startOffset : range.endOffset,\n\t};\n}\n\n/**\n * Reads the DOM selection endpoints, preferring `getComposedRanges()` when\n * the container is inside a Shadow DOM.\n *\n * Returns `null` when `anchorNode` is unavailable (no selection).\n *\n * In Shadow DOM mode the endpoints come from a `StaticRange` which uses\n * document order. `Selection.direction` is used to reconstruct anchor/focus\n * for backward selections.\n */\nexport function readDOMSelectionEndpoints(\n\tcontainer: HTMLElement,\n\tdomSel: globalThis.Selection,\n): SelectionEndpoints | null {\n\tconst composed: SelectionEndpoints | null = readComposedSelection(container, domSel);\n\tif (composed) return composed;\n\n\tconst anchorNode: Node | null = domSel.anchorNode;\n\tif (!anchorNode) return null;\n\tconst focusNode: Node | null = domSel.focusNode;\n\tif (!focusNode) return null;\n\n\treturn {\n\t\tanchorNode,\n\t\tanchorOffset: domSel.anchorOffset,\n\t\tfocusNode,\n\t\tfocusOffset: domSel.focusOffset,\n\t};\n}\n\n/** Syncs the editor state selection to the DOM. */\nexport function syncSelectionToDOM(container: HTMLElement, selection: EditorSelection): void {\n\tconst domSel = getSelection();\n\tif (!domSel) return;\n\n\t// GapCursor: clear browser selection (gap cursor has no DOM equivalent)\n\tif (isGapCursor(selection)) {\n\t\tdomSel.removeAllRanges();\n\t\treturn;\n\t}\n\n\t// NodeSelection: select the entire block element\n\tif (isNodeSelection(selection)) {\n\t\tconst blockEl = container.querySelector(`[data-block-id=\"${selection.nodeId}\"]`);\n\t\tif (!blockEl) return;\n\t\tconst parent = blockEl.parentNode;\n\t\tif (!parent) return;\n\t\tconst childIdx = childIndexOf(parent, blockEl);\n\t\ttry {\n\t\t\tdomSel.setBaseAndExtent(parent, childIdx, parent, childIdx + 1);\n\t\t} catch {\n\t\t\t// Selection may fail if DOM is not yet rendered\n\t\t}\n\t\treturn;\n\t}\n\n\tconst anchorPos = statePositionToDOM(container, selection.anchor);\n\tconst headPos = statePositionToDOM(container, selection.head);\n\n\tif (!anchorPos || !headPos) return;\n\n\ttry {\n\t\tdomSel.setBaseAndExtent(anchorPos.node, anchorPos.offset, headPos.node, headPos.offset);\n\t} catch {\n\t\t// Selection may fail if DOM is not yet rendered\n\t}\n}\n\n/** Reads the current DOM selection and converts it to a state selection. */\nexport function readSelectionFromDOM(container: HTMLElement): Selection | null {\n\tconst domSel = getSelection();\n\tif (!domSel || domSel.rangeCount === 0) return null;\n\n\tconst endpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\tif (!endpoints) return null;\n\n\tif (!container.contains(endpoints.anchorNode) || !container.contains(endpoints.focusNode)) {\n\t\treturn null;\n\t}\n\n\tconst anchor = domPositionToState(container, endpoints.anchorNode, endpoints.anchorOffset);\n\tconst head = domPositionToState(container, endpoints.focusNode, endpoints.focusOffset);\n\n\tif (!anchor || !head) return null;\n\n\treturn createSelection(anchor, head);\n}\n\n/**\n * Converts a DOM range (e.g. a `StaticRange` from `InputEvent.getTargetRanges()`)\n * to a state selection. Returns `null` when either endpoint lies outside the\n * container or cannot be mapped to a block position.\n */\nexport function domRangeToState(container: HTMLElement, range: AbstractRange): Selection | null {\n\tif (!container.contains(range.startContainer) || !container.contains(range.endContainer)) {\n\t\treturn null;\n\t}\n\n\tconst anchor = domPositionToState(container, range.startContainer, range.startOffset);\n\tconst head = domPositionToState(container, range.endContainer, range.endOffset);\n\tif (!anchor || !head) return null;\n\n\treturn createSelection(anchor, head);\n}\n\n/** Converts a state position (blockId + offset) to a DOM position (node + offset). */\nfunction statePositionToDOM(container: HTMLElement, pos: Position): DOMPosition | null {\n\t// If path is available, navigate directly to the leaf block\n\tlet blockEl: Element | null = null;\n\tif (pos.path && pos.path.length > 0) {\n\t\tlet current: Element = container;\n\t\tfor (const id of pos.path) {\n\t\t\tconst found = current.querySelector(`:scope [data-block-id=\"${id}\"]`);\n\t\t\tif (!found) break;\n\t\t\tcurrent = found;\n\t\t}\n\t\tif (current !== container && current.getAttribute('data-block-id') === pos.blockId) {\n\t\t\tblockEl = current;\n\t\t}\n\t}\n\tblockEl ??= container.querySelector(`[data-block-id=\"${pos.blockId}\"]`);\n\tif (!blockEl) return null;\n\n\t// Use contentDOM if available (NodeView blocks like code_block)\n\tconst contentEl: Element = resolveContentRoot(blockEl);\n\n\t// Handle empty blocks rendered as a single <br> placeholder. View-chrome\n\t// widgets (e.g. the checklist marker) are ignored, so the caret lands after\n\t// the widget and before the <br> rather than at the very start of the block.\n\tconst placeholderBr = findPlaceholderBr(contentEl);\n\tif (placeholderBr) {\n\t\treturn { node: contentEl, offset: childIndexOf(contentEl, placeholderBr) };\n\t}\n\n\t// Walk through text nodes and inline elements to find the correct position\n\tlet remaining = pos.offset;\n\tconst walker = createInlineContentWalker(contentEl);\n\n\tlet current = walker.nextNode();\n\twhile (current) {\n\t\tif (current.nodeType === Node.TEXT_NODE) {\n\t\t\tconst len = current.textContent?.length ?? 0;\n\t\t\tif (remaining <= len) {\n\t\t\t\treturn { node: current, offset: remaining };\n\t\t\t}\n\t\t\tremaining -= len;\n\t\t} else if (isInlineNodeEl(current)) {\n\t\t\t// InlineNode element — width 1 in state offset space\n\t\t\tif (remaining === 0) {\n\t\t\t\t// Position before this inline element\n\t\t\t\tconst parent = current.parentNode;\n\t\t\t\tif (parent) {\n\t\t\t\t\tconst childIndex = childIndexOf(parent, current);\n\t\t\t\t\treturn { node: parent, offset: childIndex };\n\t\t\t\t}\n\t\t\t}\n\t\t\tremaining -= 1;\n\t\t}\n\t\tcurrent = walker.nextNode();\n\t}\n\n\t// Fallback: position at end of block\n\tconst lastChild = contentEl.lastChild;\n\tif (lastChild) {\n\t\tif (lastChild.nodeType === Node.TEXT_NODE) {\n\t\t\treturn { node: lastChild, offset: lastChild.textContent?.length ?? 0 };\n\t\t}\n\t\treturn { node: contentEl, offset: contentEl.childNodes.length };\n\t}\n\n\treturn { node: contentEl, offset: 0 };\n}\n\n/** Converts a DOM position to a state position, including nested path. */\nexport function domPositionToState(\n\tcontainer: HTMLElement,\n\tnode: Node,\n\tdomOffset: number,\n): Position | null {\n\t// Find the innermost block element\n\tconst blockEl = findBlockAncestor(container, node);\n\tif (!blockEl) return null;\n\n\tconst rawBlockId = blockEl.getAttribute('data-block-id');\n\tif (!rawBlockId) return null;\n\tconst bid = toBlockId(rawBlockId);\n\n\t// Build path by collecting all data-block-id ancestors from leaf to root\n\tconst path = buildBlockPath(container, blockEl);\n\n\t// Use contentDOM if available (NodeView blocks like code_block)\n\tconst contentEl: Element = resolveContentRoot(blockEl);\n\n\t// Handle clicks on the block or content element itself (e.g. empty paragraph with <br>)\n\tif (node === blockEl || node === contentEl) {\n\t\tconst targetEl: Element = node === contentEl ? contentEl : blockEl;\n\t\tlet childOffset = 0;\n\t\tlet childIdx = 0;\n\t\tfor (const child of Array.from(targetEl.childNodes)) {\n\t\t\tif (childIdx >= domOffset) break;\n\t\t\tchildOffset += inlineContentWidth(child);\n\t\t\tchildIdx++;\n\t\t}\n\t\treturn createPosition(bid, childOffset, path.length > 1 ? path : undefined);\n\t}\n\n\t// If node is outside the contentDOM (e.g. in NodeView header), map to offset 0\n\tif (contentEl !== blockEl && !contentEl.contains(node)) {\n\t\treturn createPosition(bid, 0, path.length > 1 ? path : undefined);\n\t}\n\n\t// Calculate offset by walking text nodes and inline elements\n\tlet offset = 0;\n\tconst walker = createInlineContentWalker(contentEl);\n\n\tlet walkerNode = walker.nextNode();\n\twhile (walkerNode) {\n\t\tif (walkerNode === node) {\n\t\t\tif (walkerNode.nodeType === Node.TEXT_NODE) {\n\t\t\t\treturn createPosition(bid, offset + domOffset, path.length > 1 ? path : undefined);\n\t\t\t}\n\t\t\t// Node is an inline element — return offset at its start\n\t\t\treturn createPosition(bid, offset, path.length > 1 ? path : undefined);\n\t\t}\n\t\tif (walkerNode.nodeType === Node.TEXT_NODE) {\n\t\t\toffset += walkerNode.textContent?.length ?? 0;\n\t\t} else if (isInlineNodeEl(walkerNode)) {\n\t\t\toffset += 1;\n\t\t}\n\t\twalkerNode = walker.nextNode();\n\t}\n\n\t// If the node is not a text node, try to find the offset from element context\n\tif (node.nodeType === Node.ELEMENT_NODE) {\n\t\tconst childOffset = inlineOffsetForChildIndex(node, domOffset);\n\t\tconst offsetBeforeNode = inlineOffsetBeforeNode(contentEl, node);\n\t\tconst totalOffset = offsetBeforeNode === null ? childOffset : offsetBeforeNode + childOffset;\n\t\treturn createPosition(bid, totalOffset, path.length > 1 ? path : undefined);\n\t}\n\n\treturn createPosition(bid, 0, path.length > 1 ? path : undefined);\n}\n\n/** Counts inline width for the first `childIndex` children of an element. */\nfunction inlineOffsetForChildIndex(node: Node, childIndex: number): number {\n\tlet childOffset = 0;\n\tlet childIdx = 0;\n\tfor (const child of Array.from(node.childNodes)) {\n\t\tif (childIdx >= childIndex) break;\n\t\tchildOffset += inlineContentWidth(child);\n\t\tchildIdx++;\n\t}\n\treturn childOffset;\n}\n\n/** Returns the inline offset from `root` to the start of `node`, or null when unrelated. */\nfunction inlineOffsetBeforeNode(root: Element, node: Node): number | null {\n\tlet offset = 0;\n\tlet current: Node | null = node;\n\n\twhile (current && current !== root) {\n\t\tconst parent: Node | null = current.parentNode;\n\t\tif (!parent) return null;\n\n\t\tfor (const sibling of Array.from(parent.childNodes) as Node[]) {\n\t\t\tif (sibling === current) break;\n\t\t\toffset += inlineContentWidth(sibling);\n\t\t}\n\n\t\tcurrent = parent;\n\t}\n\n\treturn current === root ? offset : null;\n}\n\n/** Returns the child index of a node within its parent. */\nfunction childIndexOf(parent: Node, child: Node): number {\n\tlet idx = 0;\n\tfor (const c of Array.from(parent.childNodes)) {\n\t\tif (c === child) return idx;\n\t\tidx++;\n\t}\n\treturn idx;\n}\n\n/** Counts the inline content width of a DOM node (text length + 1 per inline element). */\nfunction inlineContentWidth(node: Node): number {\n\tif (node.nodeType === Node.TEXT_NODE) {\n\t\treturn node.textContent?.length ?? 0;\n\t}\n\t// View-chrome widgets (e.g. the checklist marker) are not document content.\n\tif (isWidgetEl(node)) {\n\t\treturn 0;\n\t}\n\tif (isInlineNodeEl(node)) {\n\t\treturn 1;\n\t}\n\t// Mark wrapper or other element — sum children\n\tlet width = 0;\n\tfor (const child of Array.from(node.childNodes)) {\n\t\twidth += inlineContentWidth(child);\n\t}\n\treturn width;\n}\n"],"mappings":"mKASA,IAAa,EAAsB,sBASnC,SAAgB,EAAe,GAC9B,OAAO,aAAgB,aAAwD,UAAzC,EAAK,aAAa,kBACzD,CAOA,SAAgB,EAAW,GAC1B,OAAO,aAAgB,aAAe,EAAK,aAAa,cACzD,CAGA,SAAgB,EAAkB,GACjC,OAAO,aAAgB,aAAe,EAAK,aAAA,sBAC5C,CAOA,SAAgB,EAAmB,GAElC,OADmC,EAAQ,cAAc,uBACpC,CACtB,CAeA,SAAgB,EACf,EACA,EAAsC,CAAC,GAEvC,MAAM,EAAgC,EAAQ,uBAAwB,EACtE,OAAO,SAAS,iBAAiB,EAAS,WAAW,SAAU,CAC9D,WAAa,GAER,EAAkB,GACd,EAAuB,WAAW,YAAc,WAAW,cAK/D,EAAW,IAoBlB,SAA+B,EAAY,GAC1C,IAAI,EAAsB,EAAK,WAC/B,KAAO,GAAU,IAAW,GAAM,CACjC,GAAI,EAAe,GAClB,OAAO,EAER,EAAS,EAAO,UACjB,CACA,OAAO,CACR,CA3BO,CAAsB,EAAG,IAEzB,aAAa,aAAe,EAAE,aAAa,kBAAoB,IAAM,EAJ/C,WAAW,cAQjC,EAAE,WAAa,KAAK,WAEpB,EAAe,GAFuB,WAAW,cAM9C,WAAW,aAGrB,CC9CA,SAAgB,IACf,OAAO,OAAO,cACf,CA8BA,SAAgB,EACf,EACA,GAEA,MAAM,EAAO,EAAU,cACvB,KAAM,aAAgB,YAAa,OAAO,KAC1C,KAAM,sBAAuB,GAAM,OAAO,KAE1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B,OAAO,EAGR,IAAI,EAAQ,EACZ,IAAK,MAAM,KAAS,MAAM,KAAK,EAAK,YACnC,GAAS,EAAmB,GAE7B,OAAO,CACR"}
@@ -1,2 +0,0 @@
1
- import{i as o}from"./TypeBrands-Ch9856Gb.mjs";import{i as r,t as e}from"./MarkCommands-C0ps9h0z.mjs";import{n as t}from"./PluginHelpers-B3gk3VB3.mjs";function a(a,m){const i=o(m.markSpec.type);a.registerMarkSpec(m.markSpec),a.registerCommand(m.command,()=>t(a,r(a.getState(),i))),m.keyBinding&&a.registerKeymap({[m.keyBinding]:()=>a.executeCommand(m.command)}),m.toolbar&&a.registerToolbarItem({id:m.toolbar.id,group:m.toolbar.group,icon:m.toolbar.icon,label:m.toolbar.label,tooltip:m.toolbar.tooltip,command:m.command,isActive:o=>e(o,i)})}export{a as t};
2
- //# sourceMappingURL=SimpleMark-D6vz3Nfd.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SimpleMark-D6vz3Nfd.mjs","names":[],"sources":["../../src/plugins/shared/SimpleMark.ts"],"sourcesContent":["/**\n * Registers the common core of a simple toggle mark: its MarkSpec, a toggle\n * command, an optional keyboard shortcut, and an optional toolbar button.\n *\n * Plugins that need more (input rules, exclusivity middleware, config-driven\n * variants) layer those on top after calling this — it deliberately models only\n * the shared core, not every mark plugin.\n */\n\nimport { isMarkActive, toggleMark } from '../../commands/Commands.js';\nimport type { MarkSpec } from '../../model/MarkSpec.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { dispatchIfPresent } from './PluginHelpers.js';\n\nexport interface SimpleMarkToolbar {\n\treadonly id: string;\n\treadonly group: string;\n\treadonly icon: string;\n\treadonly label: string;\n\treadonly tooltip: string;\n}\n\nexport interface SimpleMarkDefinition {\n\t/** The mark spec to register (defines DOM/HTML rendering and parsing). */\n\treadonly markSpec: MarkSpec;\n\t/** Toggle command name, e.g. `'toggleStrikethrough'`. */\n\treadonly command: string;\n\t/** Keyboard shortcut bound to the command; omit or `null` to skip. */\n\treadonly keyBinding?: string | null;\n\t/** Toolbar button; omit to skip. */\n\treadonly toolbar?: SimpleMarkToolbar;\n}\n\n/** Registers a simple toggle mark's spec, command, keymap, and toolbar item. */\nexport function registerSimpleMark(context: PluginContext, def: SimpleMarkDefinition): void {\n\tconst type = markType(def.markSpec.type);\n\n\tcontext.registerMarkSpec(def.markSpec);\n\n\tcontext.registerCommand(def.command, () =>\n\t\tdispatchIfPresent(context, toggleMark(context.getState(), type)),\n\t);\n\n\tif (def.keyBinding) {\n\t\tcontext.registerKeymap({ [def.keyBinding]: () => context.executeCommand(def.command) });\n\t}\n\n\tif (def.toolbar) {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: def.toolbar.id,\n\t\t\tgroup: def.toolbar.group,\n\t\t\ticon: def.toolbar.icon,\n\t\t\tlabel: def.toolbar.label,\n\t\t\ttooltip: def.toolbar.tooltip,\n\t\t\tcommand: def.command,\n\t\t\tisActive: (state) => isMarkActive(state, type),\n\t\t});\n\t}\n}\n"],"mappings":"sJAmCA,SAAgB,EAAmB,EAAwB,GAC1D,MAAM,EAAO,EAAS,EAAI,SAAS,MAEnC,EAAQ,iBAAiB,EAAI,UAE7B,EAAQ,gBAAgB,EAAI,QAAA,IAC3B,EAAkB,EAAS,EAAW,EAAQ,WAAY,KAGvD,EAAI,YACP,EAAQ,eAAe,CAAA,CAAG,EAAI,YAAA,IAAmB,EAAQ,eAAe,EAAI,WAGzE,EAAI,SACP,EAAQ,oBAAoB,CAC3B,GAAI,EAAI,QAAQ,GAChB,MAAO,EAAI,QAAQ,MACnB,KAAM,EAAI,QAAQ,KAClB,MAAO,EAAI,QAAQ,MACnB,QAAS,EAAI,QAAQ,QACrB,QAAS,EAAI,QACb,SAAW,GAAU,EAAa,EAAO,IAG5C"}
@@ -1,2 +0,0 @@
1
- import{E as t,_ as e,p as n}from"./Document-ssR6hBzG.mjs";import{c as o,f as s,n as c,u as r}from"./Selection-DC6AOGgF.mjs";import{a as i}from"./TypeBrands-Ch9856Gb.mjs";import{a,d as l,o as d,p as u,u as h}from"./BlockInsertion-CxKdCKJd.mjs";import{t as m}from"./Commands-DBBCAYBn.mjs";import{n as g}from"./TypedKeys-CA4bfw9O.mjs";import{c as f,o as p}from"./PluginHelpers-B3gk3VB3.mjs";import{o as x}from"./xml-BsV44TrJ.mjs";import{i as k,o as C,r as j,t as b}from"./XmlSupport-3Za6SIqF.mjs";var B=/\n(?:[ \t]*\n)+/;function y(t,e){return!t.detection&&!e.detection||!(!t.detection||!e.detection)&&t.detection.language===e.detection.language}function P(t,e){const n=`${t.text}\n\n${e.text}`;if(!t.detection&&!e.detection)return{text:n,detection:null};const o=t.detection,s=e.detection;return{text:n,detection:{language:o.language,formattedText:`${o.formattedText}\n\n${s.formattedText}`,confidence:Math.max(o.confidence,s.confidence)}}}var T={detectedAsCodeBlock:t=>`Pasted as ${t} code block with syntax highlighting.`,detectedMixedContent:(t,e,n)=>{const o=[];if(t>0&&o.push(`${t} paragraph${t>1?"s":""}`),e>0){const t=n.join(", ");o.push(`${e} code block${e>1?"s":""} (${t})`)}return`Pasted as ${o.join(" and ")}.`}},I=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BWOue6jG.mjs"),"./locales/de.ts":()=>import("./de-CTzAMkXC.mjs"),"./locales/es.ts":()=>import("./es-DDoqchUq.mjs"),"./locales/fr.ts":()=>import("./fr-eC0UdAPu.mjs"),"./locales/hi.ts":()=>import("./hi-DY55FuDK.mjs"),"./locales/pt.ts":()=>import("./pt-Bu7Mbz67.mjs"),"./locales/ru.ts":()=>import("./ru-DyCTlhjg.mjs"),"./locales/zh.ts":()=>import("./zh-D1HSmSOf.mjs")});async function S(t){return f(I,t,T)}var $=new g("smartPaste"),M=[C,k,j,b],N=class{id="smart-paste";name="Smart Paste";dependencies=["code-block"];config;detectors=[];context=null;locale=T;constructor(t){this.config={...t}}async init(t){this.context=t,this.locale=await p(t,this.config.locale,T,S);const e=t.getService(x);if(e){for(const t of M){const n=e.get(t.id);e.register(n?{...n,detection:t.detection}:t)}e.onRegister(t=>{t.detection&&this.detectors.push(t.detection)})}if(this.config.detectors)for(const n of this.config.detectors)this.detectors.push(n);t.registerPasteInterceptor(this.handlePaste,{name:"smart-paste",priority:50}),t.registerService($,{registerDetector:t=>{this.detectors.push(t)}})}destroy(){this.context=null,this.detectors.length=0}handlePaste=(t,e,n)=>{if(this.isCursorInCodeBlock(n))return null;const o=function(t,e){const n=t.split(B).map(t=>t.trim()).filter(t=>t.length>0);if(0===n.length)return null;let o=!1;const s=n.map(t=>{const n=function(t,e){let n=null;for(const o of e){const e=o.detect(t);e&&(null===n||e.confidence>n.confidence||e.confidence===n.confidence&&e.language<n.language)&&(n=e)}return n}(t,e);return n&&(o=!0),{text:t,detection:n}});return o?function(t){if(t.length<=1)return t;const e=[t[0]];for(let n=1;n<t.length;n++){const o=t[n],s=e[e.length-1];y(s,o)?e[e.length-1]=P(s,o):e.push(o)}return e}(s):null}(t,this.detectors);return o?1===o.length&&o[0]?.detection?this.handleSingleCodeBlock(n,o[0].detection):this.handleMixedContent(n,o):null};isCursorInCodeBlock(t){const e=t.selection;return!!s(e)&&"code_block"===t.getBlock(e.anchor.blockId)?.type}handleSingleCodeBlock(t,e){const n=this.buildCodeBlockTransaction(t,e);return n&&this.context&&this.context.announce(this.locale.detectedAsCodeBlock(e.language)),n}buildCodeBlockTransaction(r,a){const l=r.selection,u=r.transaction("paste");let g;g=s(l)&&!o(l)?m(r,u)??l.anchor.blockId:h(l);const f=t(),p=n(i("code_block"),[e(a.formattedText)],f,{language:a.language,backgroundColor:""});return d(r,u,g,p,l,this.context?.getSchemaRegistry())?(u.setSelection(c(f,a.formattedText.length)),u.build()):null}handleMixedContent(t,e){const n=this.buildMultiBlockTransaction(t,e);return n&&this.context&&this.announceMixedContent(e),n}buildMultiBlockTransaction(t,e){const n=t.selection,i=t.transaction("paste");let d;d=s(n)&&!o(n)?m(t,i)??n.anchor.blockId:h(n);const g=a(t,d),f=this.context?.getSchemaRegistry(),p=g?l(t,d,g,f):u(t,d,f);if(!p)return null;const x=!g&&r(n)&&"before"===n.side?0:1;let k,C=p.anchorIndex+x,j=0;for(const o of e){const t=o.detection?this.createCodeBlockNode(o.detection):this.createParagraphNode(o.text);i.insertNode(p.parentPath,C,t),C++,k=t.id,j=o.detection?o.detection.formattedText.length:o.text.length}return(g?p.isAnchorEmpty&&p.anchorIndex>=0:p.isAnchorEmpty&&!r(n))&&i.removeNode(p.parentPath,p.anchorIndex),k&&i.setSelection(c(k,j)),i.build()}createCodeBlockNode(o){return n(i("code_block"),[e(o.formattedText)],t(),{language:o.language,backgroundColor:""})}createParagraphNode(o){return n(i("paragraph"),[e(o)],t())}announceMixedContent(t){let e=0,n=0;const o=[];for(const s of t)s.detection?(n++,o.includes(s.detection.language)||o.push(s.detection.language)):e++;this.context?.announce(this.locale.detectedMixedContent(e,n,o))}};export{S as i,$ as n,T as r,N as t};
2
- //# sourceMappingURL=SmartPastePlugin-C3SVKkWK.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SmartPastePlugin-C3SVKkWK.mjs","names":[],"sources":["../../src/plugins/smart-paste/ContentSplitter.ts","../../src/plugins/smart-paste/SmartPasteLocale.ts","../../src/plugins/smart-paste/SmartPasteTypes.ts","../../src/plugins/smart-paste/SmartPastePlugin.ts"],"sourcesContent":["/**\n * Splits pasted text at blank-line boundaries and classifies each segment\n * using content detectors. Adjacent segments of the same type are merged.\n */\n\nimport type { ContentDetector, DetectionResult, PasteSegment } from './SmartPasteTypes.js';\n\n/** Pattern matching one or more consecutive blank lines (may contain whitespace). */\nconst BLANK_LINE_SPLIT: RegExp = /\\n(?:[ \\t]*\\n)+/;\n\n/**\n * Splits text at blank-line boundaries and classifies each segment\n * using the provided detectors. Returns null if no code is detected\n * in any segment (the paste should fall through to default handling).\n */\nexport function splitAndClassify(\n\ttext: string,\n\tdetectors: readonly ContentDetector[],\n): readonly PasteSegment[] | null {\n\tconst rawSegments: readonly string[] = text.split(BLANK_LINE_SPLIT);\n\tconst trimmed: readonly string[] = rawSegments\n\t\t.map((s: string) => s.trim())\n\t\t.filter((s: string) => s.length > 0);\n\n\tif (trimmed.length === 0) return null;\n\n\tlet hasCode = false;\n\tconst segments: PasteSegment[] = trimmed.map((segmentText: string): PasteSegment => {\n\t\tconst detection: DetectionResult | null = detectBest(segmentText, detectors);\n\t\tif (detection) hasCode = true;\n\t\treturn { text: segmentText, detection };\n\t});\n\n\tif (!hasCode) return null;\n\n\treturn mergeAdjacentSegments(segments);\n}\n\n/**\n * Merges adjacent segments that share the same classification:\n * consecutive text segments become one paragraph, consecutive code\n * segments of the same language become one code block.\n */\nexport function mergeAdjacentSegments(segments: readonly PasteSegment[]): readonly PasteSegment[] {\n\tif (segments.length <= 1) return segments;\n\n\tconst merged: PasteSegment[] = [segments[0] as PasteSegment];\n\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tconst current: PasteSegment = segments[i] as PasteSegment;\n\t\tconst previous: PasteSegment = merged[merged.length - 1] as PasteSegment;\n\n\t\tif (canMerge(previous, current)) {\n\t\t\tmerged[merged.length - 1] = merge(previous, current);\n\t\t} else {\n\t\t\tmerged.push(current);\n\t\t}\n\t}\n\n\treturn merged;\n}\n\n/**\n * Picks the highest-confidence detection result from all detectors.\n * Ties are broken deterministically by lexicographic language id so the\n * outcome does not depend on detector registration order.\n */\nfunction detectBest(text: string, detectors: readonly ContentDetector[]): DetectionResult | null {\n\tlet best: DetectionResult | null = null;\n\n\tfor (const detector of detectors) {\n\t\tconst result: DetectionResult | null = detector.detect(text);\n\t\tif (!result) continue;\n\t\tif (\n\t\t\tbest === null ||\n\t\t\tresult.confidence > best.confidence ||\n\t\t\t(result.confidence === best.confidence && result.language < best.language)\n\t\t) {\n\t\t\tbest = result;\n\t\t}\n\t}\n\n\treturn best;\n}\n\n/** Two segments can merge if both are text or both are code of the same language. */\nfunction canMerge(a: PasteSegment, b: PasteSegment): boolean {\n\tif (!a.detection && !b.detection) return true;\n\tif (a.detection && b.detection) return a.detection.language === b.detection.language;\n\treturn false;\n}\n\n/** Merges two compatible segments into one. */\nfunction merge(a: PasteSegment, b: PasteSegment): PasteSegment {\n\tconst joinedText: string = `${a.text}\\n\\n${b.text}`;\n\n\tif (!a.detection && !b.detection) {\n\t\treturn { text: joinedText, detection: null };\n\t}\n\n\tconst detA: DetectionResult = a.detection as DetectionResult;\n\tconst detB: DetectionResult = b.detection as DetectionResult;\n\n\treturn {\n\t\ttext: joinedText,\n\t\tdetection: {\n\t\t\tlanguage: detA.language,\n\t\t\tformattedText: `${detA.formattedText}\\n\\n${detB.formattedText}`,\n\t\t\tconfidence: Math.max(detA.confidence, detB.confidence),\n\t\t},\n\t};\n}\n","/** Locale interface and default English locale for the SmartPastePlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\nexport interface SmartPasteLocale {\n\treadonly detectedAsCodeBlock: (language: string) => string;\n\treadonly detectedMixedContent: (\n\t\ttextCount: number,\n\t\tcodeCount: number,\n\t\tlanguages: readonly string[],\n\t) => string;\n}\n\nexport const SMART_PASTE_LOCALE_EN: SmartPasteLocale = {\n\tdetectedAsCodeBlock: (language: string) =>\n\t\t`Pasted as ${language} code block with syntax highlighting.`,\n\tdetectedMixedContent: (textCount: number, codeCount: number, languages: readonly string[]) => {\n\t\tconst parts: string[] = [];\n\t\tif (textCount > 0) {\n\t\t\tparts.push(`${textCount} paragraph${textCount > 1 ? 's' : ''}`);\n\t\t}\n\t\tif (codeCount > 0) {\n\t\t\tconst langList: string = languages.join(', ');\n\t\t\tparts.push(`${codeCount} code block${codeCount > 1 ? 's' : ''} (${langList})`);\n\t\t}\n\t\treturn `Pasted as ${parts.join(' and ')}.`;\n\t},\n};\n\nconst localeModules: LocaleModuleMap<SmartPasteLocale> = import.meta.glob<{\n\tdefault: SmartPasteLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadSmartPasteLocale(lang: string): Promise<SmartPasteLocale> {\n\treturn loadLocaleModule(localeModules, lang, SMART_PASTE_LOCALE_EN);\n}\n","/**\n * Types for the smart paste plugin — content detection and formatting.\n */\n\nimport { ServiceKey } from '../Plugin.js';\nimport type { SmartPasteLocale } from './SmartPasteLocale.js';\n\n/** Result of detecting structured content in pasted text. */\nexport interface DetectionResult {\n\treadonly language: string;\n\treadonly formattedText: string;\n\treadonly confidence: number;\n}\n\n/** A classified segment of pasted text — either plain text or detected code. */\nexport interface PasteSegment {\n\treadonly text: string;\n\treadonly detection: DetectionResult | null;\n}\n\n/** Interface for content detectors that identify and format pasted text. */\nexport interface ContentDetector {\n\treadonly id: string;\n\tdetect(text: string): DetectionResult | null;\n}\n\n/** Configuration for the SmartPastePlugin. */\nexport interface SmartPasteConfig {\n\treadonly detectors?: readonly ContentDetector[];\n\treadonly locale?: SmartPasteLocale;\n}\n\n/** Public service for registering additional content detectors at runtime. */\nexport interface SmartPasteService {\n\tregisterDetector(detector: ContentDetector): void;\n}\n\nexport const SMART_PASTE_SERVICE_KEY = new ServiceKey<SmartPasteService>('smartPaste');\n","/**\n * SmartPastePlugin: detects structured content in clipboard text\n * and inserts it as formatted code blocks with syntax highlighting.\n * Mixed content (text + code) is split into separate blocks.\n */\n\nimport {\n\ttype InsertionContext,\n\tfindTableCellAncestor,\n\tinsertBlockAfterAnchor,\n\tresolveAnchorBlockId,\n\tresolveCellInsertionContext,\n\tresolveRootInsertionContext,\n} from '../../commands/BlockInsertion.js';\nimport { addDeleteSelectionSteps } from '../../commands/Commands.js';\nimport {\n\ttype BlockNode,\n\tcreateBlockNode,\n\tcreateTextNode,\n\tgenerateBlockId,\n} from '../../model/Document.js';\nimport {\n\tcreateCollapsedSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisTextSelection,\n} from '../../model/Selection.js';\nimport type { BlockId, NodeTypeName } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { PasteInterceptor, Plugin, PluginContext } from '../Plugin.js';\nimport { LANGUAGE_REGISTRY_SERVICE_KEY } from '../language/LanguageTypes.js';\nimport {\n\tJAVA_SUPPORT,\n\tJSON_SUPPORT,\n\tTYPESCRIPT_SUPPORT,\n\tXML_SUPPORT,\n} from '../language/bundles/index.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { splitAndClassify } from './ContentSplitter.js';\nimport {\n\tSMART_PASTE_LOCALE_EN,\n\ttype SmartPasteLocale,\n\tloadSmartPasteLocale,\n} from './SmartPasteLocale.js';\nimport type {\n\tContentDetector,\n\tDetectionResult,\n\tPasteSegment,\n\tSmartPasteConfig,\n} from './SmartPasteTypes.js';\nimport { SMART_PASTE_SERVICE_KEY } from './SmartPasteTypes.js';\n\nconst BUILTIN_LANGUAGE_SUPPORTS = [\n\tJAVA_SUPPORT,\n\tJSON_SUPPORT,\n\tTYPESCRIPT_SUPPORT,\n\tXML_SUPPORT,\n] as const;\n\nexport class SmartPastePlugin implements Plugin {\n\treadonly id = 'smart-paste';\n\treadonly name = 'Smart Paste';\n\treadonly dependencies = ['code-block'] as const;\n\n\tprivate readonly config: SmartPasteConfig;\n\tprivate readonly detectors: ContentDetector[] = [];\n\tprivate context: PluginContext | null = null;\n\tprivate locale: SmartPasteLocale = SMART_PASTE_LOCALE_EN;\n\n\tconstructor(config?: Partial<SmartPasteConfig>) {\n\t\tthis.config = { ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.context = context;\n\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tSMART_PASTE_LOCALE_EN,\n\t\t\tloadSmartPasteLocale,\n\t\t);\n\n\t\t// Detection belongs to Smart Paste, while Code Block contributes only\n\t\t// highlighting. Preserve those existing capabilities when adding detectors.\n\t\tconst registry = context.getService(LANGUAGE_REGISTRY_SERVICE_KEY);\n\t\tif (registry) {\n\t\t\tfor (const support of BUILTIN_LANGUAGE_SUPPORTS) {\n\t\t\t\tconst existing = registry.get(support.id);\n\t\t\t\tregistry.register(existing ? { ...existing, detection: support.detection } : support);\n\t\t\t}\n\t\t\tregistry.onRegister((support) => {\n\t\t\t\tif (support.detection) {\n\t\t\t\t\tthis.detectors.push(support.detection);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// Register config-provided detectors\n\t\tif (this.config.detectors) {\n\t\t\tfor (const detector of this.config.detectors) {\n\t\t\t\tthis.detectors.push(detector);\n\t\t\t}\n\t\t}\n\n\t\t// Register paste interceptor\n\t\tcontext.registerPasteInterceptor(this.handlePaste, { name: 'smart-paste', priority: 50 });\n\n\t\t// Register service for external detector registration\n\t\tcontext.registerService(SMART_PASTE_SERVICE_KEY, {\n\t\t\tregisterDetector: (detector: ContentDetector) => {\n\t\t\t\tthis.detectors.push(detector);\n\t\t\t},\n\t\t});\n\t}\n\n\tdestroy(): void {\n\t\tthis.context = null;\n\t\tthis.detectors.length = 0;\n\t}\n\n\t// --- Paste Interceptor ---\n\n\tprivate readonly handlePaste: PasteInterceptor = (\n\t\tplainText: string,\n\t\t_html: string,\n\t\tstate: EditorState,\n\t): Transaction | null => {\n\t\tif (this.isCursorInCodeBlock(state)) return null;\n\n\t\tconst segments: readonly PasteSegment[] | null = splitAndClassify(plainText, this.detectors);\n\t\tif (!segments) return null;\n\n\t\t// Single code-only segment: use existing fast path\n\t\tif (segments.length === 1 && segments[0]?.detection) {\n\t\t\treturn this.handleSingleCodeBlock(state, segments[0].detection);\n\t\t}\n\n\t\t// Mixed content: create multiple blocks\n\t\treturn this.handleMixedContent(state, segments);\n\t};\n\n\tprivate isCursorInCodeBlock(state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\treturn block?.type === 'code_block';\n\t}\n\n\t// --- Single Code Block (existing behavior) ---\n\n\tprivate handleSingleCodeBlock(\n\t\tstate: EditorState,\n\t\tdetection: DetectionResult,\n\t): Transaction | null {\n\t\tconst tr: Transaction | null = this.buildCodeBlockTransaction(state, detection);\n\t\tif (tr && this.context) {\n\t\t\tthis.context.announce(this.locale.detectedAsCodeBlock(detection.language));\n\t\t}\n\t\treturn tr;\n\t}\n\n\tprivate buildCodeBlockTransaction(\n\t\tstate: EditorState,\n\t\tdetection: DetectionResult,\n\t): Transaction | null {\n\t\tconst sel = state.selection;\n\t\tconst builder = state.transaction('paste');\n\n\t\t// Delete selection if range-selected\n\t\tlet anchorBlockId: BlockId;\n\t\tif (isTextSelection(sel) && !isCollapsed(sel)) {\n\t\t\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\t\t\tanchorBlockId = landingId ?? sel.anchor.blockId;\n\t\t} else {\n\t\t\tanchorBlockId = resolveAnchorBlockId(sel);\n\t\t}\n\n\t\t// Create the code block node\n\t\tconst newBlockId: BlockId = generateBlockId();\n\t\tconst codeBlock: BlockNode = createBlockNode(\n\t\t\tnodeType('code_block') as NodeTypeName,\n\t\t\t[createTextNode(detection.formattedText)],\n\t\t\tnewBlockId,\n\t\t\t{ language: detection.language, backgroundColor: '' },\n\t\t);\n\n\t\t// Insert at cursor (handles cell vs root, empty anchor removal)\n\t\tconst inserted: boolean = insertBlockAfterAnchor(\n\t\t\tstate,\n\t\t\tbuilder,\n\t\t\tanchorBlockId,\n\t\t\tcodeBlock,\n\t\t\tsel,\n\t\t\tthis.context?.getSchemaRegistry(),\n\t\t);\n\t\tif (!inserted) return null;\n\n\t\tbuilder.setSelection(createCollapsedSelection(newBlockId, detection.formattedText.length));\n\n\t\treturn builder.build();\n\t}\n\n\t// --- Mixed Content (multiple blocks) ---\n\n\tprivate handleMixedContent(\n\t\tstate: EditorState,\n\t\tsegments: readonly PasteSegment[],\n\t): Transaction | null {\n\t\tconst tr: Transaction | null = this.buildMultiBlockTransaction(state, segments);\n\t\tif (tr && this.context) {\n\t\t\tthis.announceMixedContent(segments);\n\t\t}\n\t\treturn tr;\n\t}\n\n\tprivate buildMultiBlockTransaction(\n\t\tstate: EditorState,\n\t\tsegments: readonly PasteSegment[],\n\t): Transaction | null {\n\t\tconst sel = state.selection;\n\t\tconst builder = state.transaction('paste');\n\n\t\tlet anchorBlockId: BlockId;\n\t\tif (isTextSelection(sel) && !isCollapsed(sel)) {\n\t\t\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\t\t\tanchorBlockId = landingId ?? sel.anchor.blockId;\n\t\t} else {\n\t\t\tanchorBlockId = resolveAnchorBlockId(sel);\n\t\t}\n\n\t\tconst cellId: BlockId | undefined = findTableCellAncestor(state, anchorBlockId);\n\t\tconst schemaRegistry = this.context?.getSchemaRegistry();\n\n\t\tconst ctx: InsertionContext | undefined = cellId\n\t\t\t? resolveCellInsertionContext(state, anchorBlockId, cellId, schemaRegistry)\n\t\t\t: resolveRootInsertionContext(state, anchorBlockId, schemaRegistry);\n\t\tif (!ctx) return null;\n\n\t\tconst insertOffset: number = !cellId && isGapCursor(sel) && sel.side === 'before' ? 0 : 1;\n\t\tlet insertIndex: number = ctx.anchorIndex + insertOffset;\n\t\tlet lastBlockId: BlockId | undefined;\n\t\tlet lastBlockTextLen = 0;\n\n\t\tfor (const segment of segments) {\n\t\t\tconst block: BlockNode = segment.detection\n\t\t\t\t? this.createCodeBlockNode(segment.detection)\n\t\t\t\t: this.createParagraphNode(segment.text);\n\n\t\t\tbuilder.insertNode(ctx.parentPath, insertIndex, block);\n\t\t\tinsertIndex++;\n\t\t\tlastBlockId = block.id;\n\t\t\tlastBlockTextLen = segment.detection\n\t\t\t\t? segment.detection.formattedText.length\n\t\t\t\t: segment.text.length;\n\t\t}\n\n\t\tconst shouldRemoveAnchor: boolean = cellId\n\t\t\t? ctx.isAnchorEmpty && ctx.anchorIndex >= 0\n\t\t\t: ctx.isAnchorEmpty && !isGapCursor(sel);\n\n\t\tif (shouldRemoveAnchor) {\n\t\t\tbuilder.removeNode(ctx.parentPath, ctx.anchorIndex);\n\t\t}\n\n\t\tif (lastBlockId) {\n\t\t\tbuilder.setSelection(createCollapsedSelection(lastBlockId, lastBlockTextLen));\n\t\t}\n\n\t\treturn builder.build();\n\t}\n\n\tprivate createCodeBlockNode(detection: DetectionResult): BlockNode {\n\t\treturn createBlockNode(\n\t\t\tnodeType('code_block') as NodeTypeName,\n\t\t\t[createTextNode(detection.formattedText)],\n\t\t\tgenerateBlockId(),\n\t\t\t{ language: detection.language, backgroundColor: '' },\n\t\t);\n\t}\n\n\tprivate createParagraphNode(text: string): BlockNode {\n\t\treturn createBlockNode(\n\t\t\tnodeType('paragraph') as NodeTypeName,\n\t\t\t[createTextNode(text)],\n\t\t\tgenerateBlockId(),\n\t\t);\n\t}\n\n\tprivate announceMixedContent(segments: readonly PasteSegment[]): void {\n\t\tlet textCount = 0;\n\t\tlet codeCount = 0;\n\t\tconst languages: string[] = [];\n\n\t\tfor (const segment of segments) {\n\t\t\tif (segment.detection) {\n\t\t\t\tcodeCount++;\n\t\t\t\tif (!languages.includes(segment.detection.language)) {\n\t\t\t\t\tlanguages.push(segment.detection.language);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttextCount++;\n\t\t\t}\n\t\t}\n\n\t\tthis.context?.announce(this.locale.detectedMixedContent(textCount, codeCount, languages));\n\t}\n}\n"],"mappings":"8eAQA,IAAM,EAA2B,kBA8EjC,SAAS,EAAS,EAAiB,GAClC,OAAK,EAAE,YAAc,EAAE,cACnB,EAAE,YAAa,EAAE,YAAkB,EAAE,UAAU,WAAa,EAAE,UAAU,QAE7E,CAGA,SAAS,EAAM,EAAiB,GAC/B,MAAM,EAAqB,GAAG,EAAE,WAAW,EAAE,OAE7C,IAAK,EAAE,YAAc,EAAE,UACtB,MAAO,CAAE,KAAM,EAAY,UAAW,MAGvC,MAAM,EAAwB,EAAE,UAC1B,EAAwB,EAAE,UAEhC,MAAO,CACN,KAAM,EACN,UAAW,CACV,SAAU,EAAK,SACf,cAAe,GAAG,EAAK,o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I,EACxF,IACI,EADA,EAAsB,EAAI,YAAc,EAExC,EAAmB,EAEvB,IAAK,MAAM,KAAW,EAAU,CAC/B,MAAM,EAAmB,EAAQ,UAC9B,KAAK,oBAAoB,EAAQ,WACjC,KAAK,oBAAoB,EAAQ,MAEpC,EAAQ,WAAW,EAAI,WAAY,EAAa,GAChD,IACA,EAAc,EAAM,GACpB,EAAmB,EAAQ,UACxB,EAAQ,UAAU,cAAc,OAChC,EAAQ,KAAK,MACjB,CAcA,OAZoC,EACjC,EAAI,eAAiB,EAAI,aAAe,EACxC,EAAI,gBAAkB,EAAY,KAGpC,EAAQ,WAAW,EAAI,WAAY,EAAI,aAGpC,GACH,EAAQ,aAAa,EAAyB,EAAa,IAGrD,EAAQ,OAChB,CAEA,mBAAA,CAA4B,GAC3B,OAAO,EACN,EAAS,cACT,CAAC,EAAe,EAAU,gBAC1B,IACA,CAAE,SAAU,EAAU,SAAU,gBAAiB,IAEnD,CAEA,mBAAA,CAA4B,GAC3B,OAAO,EACN,EAAS,aACT,CAAC,EAAe,IAChB,IAEF,CAEA,oBAAA,CAA6B,GAC5B,IAAI,EAAY,EACZ,EAAY,EAChB,MAAM,EAAsB,GAE5B,IAAK,MAAM,KAAW,EACjB,EAAQ,WACX,IACK,EAAU,SAAS,EAAQ,UAAU,WACzC,EAAU,KAAK,EAAQ,UAAU,WAGlC,IAIF,KAAK,SAAS,SAAS,KAAK,OAAO,qBAAqB,EAAW,EAAW,GAC/E"}
@@ -1,2 +0,0 @@
1
- import{c as t,o as s}from"./PluginHelpers-B3gk3VB3.mjs";import{t as o}from"./MarkInputRule-DNneF2gp.mjs";import{t as r}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as i}from"./SimpleMark-D6vz3Nfd.mjs";var e={label:"Strikethrough",tooltip:t=>`Strikethrough (${t})`},a=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-XmSFrtmd.mjs"),"./locales/de.ts":()=>import("./de-DViI26lG.mjs"),"./locales/es.ts":()=>import("./es-paXY7HFt.mjs"),"./locales/fr.ts":()=>import("./fr-ZsRdLuys.mjs"),"./locales/hi.ts":()=>import("./hi-CTWubxLY.mjs"),"./locales/pt.ts":()=>import("./pt-paXY7HFt.mjs"),"./locales/ru.ts":()=>import("./ru-Y11wuxOB.mjs"),"./locales/zh.ts":()=>import("./zh-C7iCgCRP.mjs")});async function l(s){return t(a,s,e)}var h={},m=class{id="strikethrough";name="Strikethrough";priority=22;config;locale;constructor(t){this.config={...h,...t}}async init(t){this.locale=await s(t,this.config.locale,e,l),i(t,{markSpec:{type:"strikethrough",rank:3,toDOM:()=>document.createElement("s"),toHTMLString:(t,s)=>`<s>${s}</s>`,parseHTML:[{tag:"s"},{tag:"strike"},{tag:"del"},{tag:"span",getAttrs:t=>!!t.style.textDecoration.includes("line-through")&&{}}],sanitize:{tags:["s"]}},command:"toggleStrikethrough",keyBinding:"Mod-Shift-X",toolbar:{id:"strikethrough",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(r("Mod-Shift-X"))}}),!1!==this.config.inputRule&&t.registerInputRule(o("strikethrough","~~"))}};export{e as n,l as r,m as t};
2
- //# sourceMappingURL=StrikethroughPlugin-v-VJZzUZ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StrikethroughPlugin-v-VJZzUZ.mjs","names":[],"sources":["../../src/plugins/strikethrough/StrikethroughLocale.ts","../../src/plugins/strikethrough/StrikethroughPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the StrikethroughPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface StrikethroughLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const STRIKETHROUGH_LOCALE_EN: StrikethroughLocale = {\n\tlabel: 'Strikethrough',\n\ttooltip: (shortcut: string) => `Strikethrough (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<StrikethroughLocale> = import.meta.glob<{\n\tdefault: StrikethroughLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadStrikethroughLocale(lang: string): Promise<StrikethroughLocale> {\n\treturn loadLocaleModule(localeModules, lang, STRIKETHROUGH_LOCALE_EN);\n}\n","/**\n * StrikethroughPlugin: registers a strikethrough inline mark with MarkSpec,\n * toggle command, keyboard shortcut (Mod-Shift-X), and a toolbar button.\n */\n\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { createMarkInputRule } from '../shared/MarkInputRule.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { registerSimpleMark } from '../shared/SimpleMark.js';\nimport {\n\tSTRIKETHROUGH_LOCALE_EN,\n\ttype StrikethroughLocale,\n\tloadStrikethroughLocale,\n} from './StrikethroughLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tstrikethrough: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface StrikethroughConfig {\n\t/** Live Markdown shortcut: `~~x~~` to strikethrough. Default true. */\n\treadonly inputRule?: boolean;\n\treadonly locale?: StrikethroughLocale;\n}\n\nconst DEFAULT_CONFIG: StrikethroughConfig = {};\n\n// --- Plugin ---\n\nexport class StrikethroughPlugin implements Plugin {\n\treadonly id = 'strikethrough';\n\treadonly name = 'Strikethrough';\n\treadonly priority = 22;\n\n\tprivate readonly config: StrikethroughConfig;\n\tprivate locale!: StrikethroughLocale;\n\n\tconstructor(config?: Partial<StrikethroughConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tSTRIKETHROUGH_LOCALE_EN,\n\t\t\tloadStrikethroughLocale,\n\t\t);\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z\"/></svg>';\n\n\t\tregisterSimpleMark(context, {\n\t\t\tmarkSpec: {\n\t\t\t\ttype: 'strikethrough',\n\t\t\t\trank: 3,\n\t\t\t\ttoDOM() {\n\t\t\t\t\treturn document.createElement('s');\n\t\t\t\t},\n\t\t\t\ttoHTMLString: (_mark, content) => `<s>${content}</s>`,\n\t\t\t\tparseHTML: [\n\t\t\t\t\t{ tag: 's' },\n\t\t\t\t\t{ tag: 'strike' },\n\t\t\t\t\t{ tag: 'del' },\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'span',\n\t\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\t\treturn el.style.textDecoration.includes('line-through') ? {} : false;\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tsanitize: { tags: ['s'] },\n\t\t\t},\n\t\t\tcommand: 'toggleStrikethrough',\n\t\t\tkeyBinding: 'Mod-Shift-X',\n\t\t\ttoolbar: {\n\t\t\t\tid: 'strikethrough',\n\t\t\t\tgroup: 'format',\n\t\t\t\ticon,\n\t\t\t\tlabel: this.locale.label,\n\t\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-Shift-X')),\n\t\t\t},\n\t\t});\n\n\t\tif (this.config.inputRule !== false) {\n\t\t\tcontext.registerInputRule(createMarkInputRule('strikethrough', '~~'));\n\t\t}\n\t}\n}\n"],"mappings":"6MAeA,IAAa,EAA+C,CAC3D,MAAO,gBACP,QAAU,GAAqB,kBAAkB,MAK5C,iBAAsD,OAAA,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,uBAI5D,eAAsB,EAAwB,GAC7C,OAAO,EAAiB,EAAe,EAAM,EAC9C,CCIA,IAAM,EAAsC,CAAC,EAIhC,EAAb,MACC,GAAc,gBACd,KAAgB,gBAChB,SAAoB,GAEpB,OACA,OAEA,WAAA,CAAY,GACX,KAAK,OAAS,IAAK,KAAmB,EACvC,CAEA,UAAM,CAAK,GACV,KAAK,aAAe,EACnB,EACA,KAAK,OAAO,OACZ,EACA,GAKD,EAAmB,EAAS,CAC3B,SAAU,CACT,KAAM,gBACN,KAAM,EACN,MAAA,IACQ,SAAS,cAAc,KAE/B,aAAA,CAAe,EAAO,IAAY,MAAM,QACxC,UAAW,CACV,CAAE,IAAK,KACP,CAAE,IAAK,UACP,CAAE,IAAK,OACP,CACC,IAAK,OACL,SAAW,KACH,EAAG,MAAM,eAAe,SAAS,iBAAkB,CAAC,IAI9D,SAAU,CAAE,KAAM,CAAC,OAEpB,QAAS,sBACT,WAAY,cACZ,QAAS,CACR,GAAI,gBACJ,MAAO,SACP,KAAA,uIACA,MAAO,KAAK,OAAO,MACnB,QAAS,KAAK,OAAO,QAAQ,EAAe,oBAIhB,IAA1B,KAAK,OAAO,WACf,EAAQ,kBAAkB,EAAoB,gBAAiB,MAEjE"}
@@ -1,2 +0,0 @@
1
- import{i as s}from"./TypeBrands-Ch9856Gb.mjs";import{i as t,t as e}from"./MarkCommands-C0ps9h0z.mjs";import{c as i,n as r,o,s as p}from"./PluginHelpers-B3gk3VB3.mjs";import{t as c}from"./ShortcutFormatting-TwiufqeV.mjs";var a={superscriptLabel:"Superscript",superscriptTooltip:s=>`Superscript (${s})`,subscriptLabel:"Subscript",subscriptTooltip:s=>`Subscript (${s})`},n=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-NV_puwI2.mjs"),"./locales/de.ts":()=>import("./de-BX4y4PlH.mjs"),"./locales/es.ts":()=>import("./es-BdpTTRuX.mjs"),"./locales/fr.ts":()=>import("./fr-CKjH6tJI.mjs"),"./locales/hi.ts":()=>import("./hi-DsdXcOB6.mjs"),"./locales/pt.ts":()=>import("./pt-OXa_IR4Q.mjs"),"./locales/ru.ts":()=>import("./ru-d68SZpEe.mjs"),"./locales/zh.ts":()=>import("./zh-BP97XjlS.mjs")});async function l(s){return i(n,s,a)}var u={superscript:!0,subscript:!0},m=[{type:"superscript",opposite:"subscript",configKey:"superscript",rank:4,tag:"sup",icon:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">','<path d="M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z"',' fill="none"/>','<path d="M9.64 7.64c.23-.5.36-1.05.36-1.64'," 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9"," 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83"," 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83",' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z" fill="none"/>','<path d="M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49'," 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02","-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88"," 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34"," 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53"," 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54","-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96"," 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56","-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46",'-.59-.46-.94z"/>','<path d="M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38',' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z"/>',"</svg>"].join(""),keyBinding:"Mod-.",toHTMLString:s=>`<sup>${s}</sup>`,parseHTML:[{tag:"sup"}],sanitize:{tags:["sup"]}},{type:"subscript",opposite:"superscript",configKey:"subscript",rank:4,tag:"sub",icon:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">','<path d="M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49'," 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02","-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88"," 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34"," 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53"," 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54","-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96"," 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56","-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46",'-.59-.46-.94z"/>','<path d="M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38',' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z"/>',"</svg>"].join(""),keyBinding:"Mod-,",toHTMLString:s=>`<sub>${s}</sub>`,parseHTML:[{tag:"sub"}],sanitize:{tags:["sub"]}}],g=class{id="super-sub";name="Superscript & Subscript";priority=23;config;locale;constructor(s){this.config={...u,...s}}async init(s){this.locale=await o(s,this.config.locale,a,l);const t=m.filter(s=>this.config[s.configKey]);for(const e of t)this.registerMark(s,e);this.registerKeymaps(s,t),this.registerExclusivityMiddleware(s,t),this.registerDisabledToolbarItems(s)}registerMark(i,o){const a=p(o.type),n=this.isToolbarVisible(o.configKey);if(i.registerMarkSpec({type:o.type,rank:o.rank,toDOM:()=>document.createElement(o.tag),toHTMLString:(s,t)=>o.toHTMLString(t),parseHTML:o.parseHTML,sanitize:o.sanitize}),i.registerCommand(a,()=>r(i,t(i.getState(),s(o.type)))),n){const t="superscript"===o.type?this.locale.superscriptLabel:this.locale.subscriptLabel,r="superscript"===o.type?this.locale.superscriptTooltip(c(o.keyBinding)):this.locale.subscriptTooltip(c(o.keyBinding));i.registerToolbarItem({id:o.type,group:"format",icon:o.icon,label:t,tooltip:r,command:a,isActive:t=>e(t,s(o.type))})}}registerKeymaps(s,t){const e={};for(const i of t){const t=p(i.type);e[i.keyBinding]=()=>s.executeCommand(t)}Object.keys(e).length>0&&s.registerKeymap(e)}registerExclusivityMiddleware(t,e){e.some(s=>"superscript"===s.type)&&e.some(s=>"subscript"===s.type)&&t.registerMiddleware((t,e,i)=>{let r=!1;const o=[];for(const c of t.steps){if("addMark"!==c.type){o.push(c);continue}const t=c.mark.type,e=m.find(s=>s.type===t);if(!e){o.push(c);continue}r=!0;const i={type:"removeMark",blockId:c.blockId,from:c.from,to:c.to,mark:{type:s(e.opposite)},...c.path?{path:c.path}:{}};o.push(i,c)}let p=t.storedMarksAfter;if(p){const s=p.some(s=>"superscript"===s.type),t=p.some(s=>"subscript"===s.type);if(s&&t){const s=p.findLastIndex(s=>"superscript"===s.type)>p.findLastIndex(s=>"subscript"===s.type)?"subscript":"superscript";p=p.filter(t=>t.type!==s),r=!0}}i(r?{...t,steps:o,storedMarksAfter:p}:t)},{name:"super-sub:exclusivity"})}registerDisabledToolbarItems(s){if(this.config.toolbar)for(const t of m){const e=this.config[t.configKey],i=this.config.toolbar[t.configKey]??!0;if(!e&&i){const e="superscript"===t.type?this.locale.superscriptLabel:this.locale.subscriptLabel;s.registerToolbarItem({id:t.type,group:"format",icon:t.icon,label:e,command:p(t.type),isEnabled:()=>!1})}}}isToolbarVisible(s){return!this.config.toolbar||(this.config.toolbar[s]??!0)}};export{a as n,l as r,g as t};
2
- //# sourceMappingURL=SuperSubPlugin-x1iPnZyt.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SuperSubPlugin-x1iPnZyt.mjs","names":[],"sources":["../../src/plugins/super-sub/SuperSubLocale.ts","../../src/plugins/super-sub/SuperSubPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the SuperSubPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface SuperSubLocale {\n\treadonly superscriptLabel: string;\n\treadonly superscriptTooltip: (shortcut: string) => string;\n\treadonly subscriptLabel: string;\n\treadonly subscriptTooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const SUPER_SUB_LOCALE_EN: SuperSubLocale = {\n\tsuperscriptLabel: 'Superscript',\n\tsuperscriptTooltip: (shortcut: string) => `Superscript (${shortcut})`,\n\tsubscriptLabel: 'Subscript',\n\tsubscriptTooltip: (shortcut: string) => `Subscript (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<SuperSubLocale> = import.meta.glob<{\n\tdefault: SuperSubLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadSuperSubLocale(lang: string): Promise<SuperSubLocale> {\n\treturn loadLocaleModule(localeModules, lang, SUPER_SUB_LOCALE_EN);\n}\n","/**\n * SuperSubPlugin: registers superscript and subscript inline marks with\n * MarkSpecs, toggle commands, keyboard shortcuts, toolbar buttons, and\n * a middleware that enforces mutual exclusivity between the two marks.\n *\n * Data-driven — each mark type is defined declaratively and all\n * registrations are derived from the same definition table.\n */\n\nimport { isMarkActive, toggleMark } from '../../commands/Commands.js';\nimport type { Mark } from '../../model/Document.js';\nimport type { ParseRule } from '../../model/ParseRule.js';\nimport type { SanitizeConfig } from '../../model/SanitizeConfig.js';\nimport { markType as mkType } from '../../model/TypeBrands.js';\nimport type { RemoveMarkStep, Step } from '../../state/Transaction.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { dispatchIfPresent, resolveLocale, toCommandName } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { SUPER_SUB_LOCALE_EN, type SuperSubLocale, loadSuperSubLocale } from './SuperSubLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tsuperscript: Record<string, never>;\n\t\tsubscript: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\n/** Controls toolbar button visibility per mark. */\nexport interface SuperSubToolbarConfig {\n\treadonly superscript?: boolean;\n\treadonly subscript?: boolean;\n}\n\n/** Controls which marks are enabled and which toolbar buttons are shown. */\nexport interface SuperSubConfig {\n\treadonly superscript: boolean;\n\treadonly subscript: boolean;\n\treadonly toolbar?: SuperSubToolbarConfig;\n\treadonly locale?: SuperSubLocale;\n}\n\nconst DEFAULT_CONFIG: SuperSubConfig = {\n\tsuperscript: true,\n\tsubscript: true,\n};\n\n// --- Mark Definitions ---\n\ninterface MarkDefinition {\n\treadonly type: 'superscript' | 'subscript';\n\treadonly opposite: 'superscript' | 'subscript';\n\treadonly configKey: keyof Omit<SuperSubConfig, 'toolbar' | 'locale'>;\n\treadonly rank: number;\n\treadonly tag: string;\n\treadonly icon: string;\n\treadonly keyBinding: string;\n\treadonly toHTMLString: (content: string) => string;\n\treadonly parseHTML: readonly ParseRule[];\n\treadonly sanitize: SanitizeConfig;\n}\n\nconst SUPERSCRIPT_ICON: string = [\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">',\n\t'<path d=\"M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z\"',\n\t' fill=\"none\"/>',\n\t'<path d=\"M9.64 7.64c.23-.5.36-1.05.36-1.64',\n\t' 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9',\n\t' 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83',\n\t' 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83',\n\t' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z\" fill=\"none\"/>',\n\t'<path d=\"M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49',\n\t' 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02',\n\t'-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88',\n\t' 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34',\n\t' 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53',\n\t' 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54',\n\t'-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96',\n\t' 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56',\n\t'-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46',\n\t'-.59-.46-.94z\"/>',\n\t'<path d=\"M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38',\n\t' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z\"/>',\n\t'</svg>',\n].join('');\n\nconst SUBSCRIPT_ICON: string = [\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">',\n\t'<path d=\"M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49',\n\t' 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02',\n\t'-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88',\n\t' 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34',\n\t' 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53',\n\t' 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54',\n\t'-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96',\n\t' 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56',\n\t'-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46',\n\t'-.59-.46-.94z\"/>',\n\t'<path d=\"M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38',\n\t' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z\"/>',\n\t'</svg>',\n].join('');\n\nconst MARK_DEFINITIONS: readonly MarkDefinition[] = [\n\t{\n\t\ttype: 'superscript',\n\t\topposite: 'subscript',\n\t\tconfigKey: 'superscript',\n\t\trank: 4,\n\t\ttag: 'sup',\n\t\ticon: SUPERSCRIPT_ICON,\n\t\tkeyBinding: 'Mod-.',\n\t\ttoHTMLString: (content) => `<sup>${content}</sup>`,\n\t\tparseHTML: [{ tag: 'sup' }],\n\t\tsanitize: { tags: ['sup'] },\n\t},\n\t{\n\t\ttype: 'subscript',\n\t\topposite: 'superscript',\n\t\tconfigKey: 'subscript',\n\t\trank: 4,\n\t\ttag: 'sub',\n\t\ticon: SUBSCRIPT_ICON,\n\t\tkeyBinding: 'Mod-,',\n\t\ttoHTMLString: (content) => `<sub>${content}</sub>`,\n\t\tparseHTML: [{ tag: 'sub' }],\n\t\tsanitize: { tags: ['sub'] },\n\t},\n];\n\n// --- Plugin ---\n\nexport class SuperSubPlugin implements Plugin {\n\treadonly id = 'super-sub';\n\treadonly name = 'Superscript & Subscript';\n\treadonly priority = 23;\n\n\tprivate readonly config: SuperSubConfig;\n\tprivate locale!: SuperSubLocale;\n\n\tconstructor(config?: Partial<SuperSubConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tSUPER_SUB_LOCALE_EN,\n\t\t\tloadSuperSubLocale,\n\t\t);\n\n\t\tconst enabledMarks: MarkDefinition[] = MARK_DEFINITIONS.filter(\n\t\t\t(def) => this.config[def.configKey],\n\t\t);\n\n\t\tfor (const def of enabledMarks) {\n\t\t\tthis.registerMark(context, def);\n\t\t}\n\n\t\tthis.registerKeymaps(context, enabledMarks);\n\t\tthis.registerExclusivityMiddleware(context, enabledMarks);\n\t\tthis.registerDisabledToolbarItems(context);\n\t}\n\n\tprivate registerMark(context: PluginContext, def: MarkDefinition): void {\n\t\tconst commandName: string = toCommandName(def.type);\n\t\tconst toolbarVisible: boolean = this.isToolbarVisible(def.configKey);\n\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: def.type,\n\t\t\trank: def.rank,\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement(def.tag);\n\t\t\t},\n\t\t\ttoHTMLString: (_mark, content) => def.toHTMLString(content),\n\t\t\tparseHTML: def.parseHTML,\n\t\t\tsanitize: def.sanitize,\n\t\t});\n\n\t\tcontext.registerCommand(commandName, () =>\n\t\t\tdispatchIfPresent(context, toggleMark(context.getState(), mkType(def.type))),\n\t\t);\n\n\t\tif (toolbarVisible) {\n\t\t\tconst label: string =\n\t\t\t\tdef.type === 'superscript' ? this.locale.superscriptLabel : this.locale.subscriptLabel;\n\t\t\tconst tooltip: string =\n\t\t\t\tdef.type === 'superscript'\n\t\t\t\t\t? this.locale.superscriptTooltip(formatShortcut(def.keyBinding))\n\t\t\t\t\t: this.locale.subscriptTooltip(formatShortcut(def.keyBinding));\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: def.type,\n\t\t\t\tgroup: 'format',\n\t\t\t\ticon: def.icon,\n\t\t\t\tlabel,\n\t\t\t\ttooltip,\n\t\t\t\tcommand: commandName,\n\t\t\t\tisActive: (state) => isMarkActive(state, mkType(def.type)),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate registerKeymaps(context: PluginContext, marks: readonly MarkDefinition[]): void {\n\t\tconst keymap: Record<string, () => boolean> = {};\n\t\tfor (const def of marks) {\n\t\t\tconst commandName: string = toCommandName(def.type);\n\t\t\tkeymap[def.keyBinding] = () => context.executeCommand(commandName);\n\t\t}\n\t\tif (Object.keys(keymap).length > 0) {\n\t\t\tcontext.registerKeymap(keymap);\n\t\t}\n\t}\n\n\t/**\n\t * Ensures superscript and subscript are mutually exclusive.\n\t * When an addMark step for one type is found, a removeMark step\n\t * for the opposite type is injected. For stored marks, the opposite\n\t * mark is filtered out.\n\t */\n\tprivate registerExclusivityMiddleware(\n\t\tcontext: PluginContext,\n\t\tenabledMarks: readonly MarkDefinition[],\n\t): void {\n\t\tconst bothEnabled: boolean =\n\t\t\tenabledMarks.some((d) => d.type === 'superscript') &&\n\t\t\tenabledMarks.some((d) => d.type === 'subscript');\n\n\t\tif (!bothEnabled) return;\n\n\t\tcontext.registerMiddleware(\n\t\t\t(tr, _state, next) => {\n\t\t\t\tlet patched = false;\n\n\t\t\t\t// Handle addMark steps: inject removeMark for the opposite type\n\t\t\t\tconst patchedSteps: Step[] = [];\n\t\t\t\tfor (const step of tr.steps) {\n\t\t\t\t\tif (step.type !== 'addMark') {\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst markName: string = step.mark.type;\n\t\t\t\t\tconst def: MarkDefinition | undefined = MARK_DEFINITIONS.find((d) => d.type === markName);\n\t\t\t\t\tif (!def) {\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tpatched = true;\n\t\t\t\t\tconst removeStep: RemoveMarkStep = {\n\t\t\t\t\t\ttype: 'removeMark',\n\t\t\t\t\t\tblockId: step.blockId,\n\t\t\t\t\t\tfrom: step.from,\n\t\t\t\t\t\tto: step.to,\n\t\t\t\t\t\tmark: { type: mkType(def.opposite) },\n\t\t\t\t\t\t...(step.path ? { path: step.path } : {}),\n\t\t\t\t\t};\n\t\t\t\t\tpatchedSteps.push(removeStep, step);\n\t\t\t\t}\n\n\t\t\t\t// Handle stored marks: remove the opposite mark\n\t\t\t\tlet storedMarksAfter: readonly Mark[] | null = tr.storedMarksAfter;\n\t\t\t\tif (storedMarksAfter) {\n\t\t\t\t\tconst hasSup: boolean = storedMarksAfter.some((m) => m.type === 'superscript');\n\t\t\t\t\tconst hasSub: boolean = storedMarksAfter.some((m) => m.type === 'subscript');\n\n\t\t\t\t\tif (hasSup && hasSub) {\n\t\t\t\t\t\t// Keep the one that was most recently added (last in array)\n\t\t\t\t\t\tconst lastSupIdx: number = storedMarksAfter.findLastIndex(\n\t\t\t\t\t\t\t(m) => m.type === 'superscript',\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst lastSubIdx: number = storedMarksAfter.findLastIndex(\n\t\t\t\t\t\t\t(m) => m.type === 'subscript',\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst removeType: string = lastSupIdx > lastSubIdx ? 'subscript' : 'superscript';\n\n\t\t\t\t\t\tstoredMarksAfter = storedMarksAfter.filter((m) => m.type !== removeType);\n\t\t\t\t\t\tpatched = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnext(patched ? { ...tr, steps: patchedSteps, storedMarksAfter } : tr);\n\t\t\t},\n\t\t\t{ name: 'super-sub:exclusivity' },\n\t\t);\n\t}\n\n\t/**\n\t * Registers disabled toolbar buttons for marks whose feature is disabled\n\t * but whose toolbar button is explicitly requested.\n\t */\n\tprivate registerDisabledToolbarItems(context: PluginContext): void {\n\t\tif (!this.config.toolbar) return;\n\n\t\tfor (const def of MARK_DEFINITIONS) {\n\t\t\tconst featureEnabled: boolean = this.config[def.configKey];\n\t\t\tconst toolbarVisible: boolean = this.config.toolbar[def.configKey] ?? true;\n\n\t\t\tif (!featureEnabled && toolbarVisible) {\n\t\t\t\tconst label: string =\n\t\t\t\t\tdef.type === 'superscript' ? this.locale.superscriptLabel : this.locale.subscriptLabel;\n\t\t\t\tcontext.registerToolbarItem({\n\t\t\t\t\tid: def.type,\n\t\t\t\t\tgroup: 'format',\n\t\t\t\t\ticon: def.icon,\n\t\t\t\t\tlabel,\n\t\t\t\t\tcommand: toCommandName(def.type),\n\t\t\t\t\tisEnabled: () => false,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate isToolbarVisible(configKey: keyof Omit<SuperSubConfig, 'toolbar' | 'locale'>): boolean {\n\t\tif (!this.config.toolbar) return true;\n\t\treturn this.config.toolbar[configKey] ?? true;\n\t}\n}\n"],"mappings":"4NAiBA,IAAa,EAAsC,CAClD,iBAAkB,cAClB,mBAAqB,GAAqB,gBAAgB,KAC1D,eAAgB,YAChB,iBAAmB,GAAqB,cAAc,MAKjD,iBAAiD,OAAA,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,uBAIvD,eAAsB,EAAmB,GACxC,OAAO,EAAiB,EAAe,EAAM,EAC9C,CCaA,IAAM,EAAiC,CACtC,aAAa,EACb,WAAW,GA2DN,EAA8C,CACnD,CACC,KAAM,cACN,SAAU,YACV,UAAW,cACX,KAAM,EACN,IAAK,MACL,KAhD+B,CAChC,+DACA,0DACA,iBACA,6CACA,+CACA,o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