@notectl/core 2.4.2 → 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 (415) hide show
  1. package/dist/chunks/AlignmentPlugin-C26pIVcw.mjs +2 -0
  2. package/dist/chunks/{AlignmentPlugin-Cp7HYGaH.mjs.map → AlignmentPlugin-C26pIVcw.mjs.map} +1 -1
  3. package/dist/chunks/BidiIsolationPlugin-nWd1NEF-.mjs +2 -0
  4. package/dist/chunks/{BidiIsolationPlugin-GWukKdgJ.mjs.map → BidiIsolationPlugin-nWd1NEF-.mjs.map} +1 -1
  5. package/dist/chunks/BlockquotePlugin-Bag42Zc0.mjs +2 -0
  6. package/dist/chunks/{BlockquotePlugin-CSL_7Yit.mjs.map → BlockquotePlugin-Bag42Zc0.mjs.map} +1 -1
  7. package/dist/chunks/CaretNavigationPlugin-DUAoHygg.mjs +2 -0
  8. package/dist/chunks/{CaretNavigationPlugin-BQPqqK4n.mjs.map → CaretNavigationPlugin-DUAoHygg.mjs.map} +1 -1
  9. package/dist/chunks/CodeBlockPlugin-Dk_J8NAl.mjs +2 -0
  10. package/dist/chunks/{CodeBlockPlugin-B4AcDJRK.mjs.map → CodeBlockPlugin-Dk_J8NAl.mjs.map} +1 -1
  11. package/dist/chunks/Commands-vqbwh6Ic.mjs +2 -0
  12. package/dist/chunks/{Commands-Bk7Cl1nH.mjs.map → Commands-vqbwh6Ic.mjs.map} +1 -1
  13. package/dist/chunks/DocumentParser-D4g5npEi.mjs +2 -0
  14. package/dist/chunks/DocumentParser-D4g5npEi.mjs.map +1 -0
  15. package/dist/chunks/EditorUI-DrQI95FW.mjs +2 -0
  16. package/dist/chunks/EditorUI-DrQI95FW.mjs.map +1 -0
  17. package/dist/chunks/FontPlugin-Bzlluh1_.mjs +2 -0
  18. package/dist/chunks/{FontPlugin-BcXNFqqO.mjs.map → FontPlugin-Bzlluh1_.mjs.map} +1 -1
  19. package/dist/chunks/FontSizePlugin-kv3zHG0f.mjs +2 -0
  20. package/dist/chunks/{FontSizePlugin-Dswra3oU.mjs.map → FontSizePlugin-kv3zHG0f.mjs.map} +1 -1
  21. package/dist/chunks/FormulaPlugin-20vW4Gge.mjs +2 -0
  22. package/dist/chunks/{FormulaPlugin-DVpLaKi5.mjs.map → FormulaPlugin-20vW4Gge.mjs.map} +1 -1
  23. package/dist/chunks/GapCursorPlugin-BPyNXY4H.mjs +2 -0
  24. package/dist/chunks/{GapCursorPlugin-QDGwnaRR.mjs.map → GapCursorPlugin-BPyNXY4H.mjs.map} +1 -1
  25. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs +2 -0
  26. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs.map +1 -0
  27. package/dist/chunks/{HardBreakPlugin-gjCq8prD.mjs → HardBreakPlugin-lo8Mcg9G.mjs} +2 -2
  28. package/dist/chunks/{HardBreakPlugin-gjCq8prD.mjs.map → HardBreakPlugin-lo8Mcg9G.mjs.map} +1 -1
  29. package/dist/chunks/HeadingPlugin-CEZF5DBM.mjs +2 -0
  30. package/dist/chunks/{HeadingPlugin-B7EfynaH.mjs.map → HeadingPlugin-CEZF5DBM.mjs.map} +1 -1
  31. package/dist/chunks/HighlightPlugin-yH44UWoe.mjs +2 -0
  32. package/dist/chunks/{HighlightPlugin-LdO0INtJ.mjs.map → HighlightPlugin-yH44UWoe.mjs.map} +1 -1
  33. package/dist/chunks/HorizontalRulePlugin-SNNum-9V.mjs +2 -0
  34. package/dist/chunks/{HorizontalRulePlugin-YywXVZYr.mjs.map → HorizontalRulePlugin-SNNum-9V.mjs.map} +1 -1
  35. package/dist/chunks/ImagePlugin-aeqHr5zx.mjs +2 -0
  36. package/dist/chunks/{ImagePlugin-BAhZuVdE.mjs.map → ImagePlugin-aeqHr5zx.mjs.map} +1 -1
  37. package/dist/chunks/InlineCodePlugin-CIks06ti.mjs +2 -0
  38. package/dist/chunks/{InlineCodePlugin-Bu9-rE4B.mjs.map → InlineCodePlugin-CIks06ti.mjs.map} +1 -1
  39. package/dist/chunks/LinkPlugin-CFw22a9X.mjs +2 -0
  40. package/dist/chunks/LinkPlugin-CFw22a9X.mjs.map +1 -0
  41. package/dist/chunks/ListPlugin-ZNEx8pvk.mjs +2 -0
  42. package/dist/chunks/{ListPlugin-U1r4p_fE.mjs.map → ListPlugin-ZNEx8pvk.mjs.map} +1 -1
  43. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs +2 -0
  44. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs.map +1 -0
  45. package/dist/chunks/{MarkdownHTMLRegistry-BunUDiza.mjs → MarkdownHTMLRegistry-Cj7N2wqs.mjs} +2 -2
  46. package/dist/chunks/{MarkdownHTMLRegistry-BunUDiza.mjs.map → MarkdownHTMLRegistry-Cj7N2wqs.mjs.map} +1 -1
  47. package/dist/chunks/{MarkdownParser-uX1p_GQk.mjs → MarkdownParser-JOfPSvGv.mjs} +2 -2
  48. package/dist/chunks/{MarkdownParser-uX1p_GQk.mjs.map → MarkdownParser-JOfPSvGv.mjs.map} +1 -1
  49. package/dist/chunks/{MarkdownSerializer--MrgJTdJ.mjs → MarkdownSerializer-Y6saYClE.mjs} +2 -2
  50. package/dist/chunks/{MarkdownSerializer--MrgJTdJ.mjs.map → MarkdownSerializer-Y6saYClE.mjs.map} +1 -1
  51. package/dist/chunks/PopupManager-DpxoBl54.mjs +2 -0
  52. package/dist/chunks/PopupManager-DpxoBl54.mjs.map +1 -0
  53. package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
  54. package/dist/chunks/PrintPlugin-CYkdUy-m.mjs +2 -0
  55. package/dist/chunks/{PrintPlugin-DAEiEyKQ.mjs.map → PrintPlugin-CYkdUy-m.mjs.map} +1 -1
  56. package/dist/chunks/{SchemaRegistry-Cs7rxafF.mjs → SchemaRegistry-CT3T7S1i.mjs} +2 -2
  57. package/dist/chunks/{SchemaRegistry-Cs7rxafF.mjs.map → SchemaRegistry-CT3T7S1i.mjs.map} +1 -1
  58. package/dist/chunks/{SelectionReplacement-vC1xhFS0.mjs → SelectionReplacement-Cj4FLlPz.mjs} +2 -2
  59. package/dist/chunks/{SelectionReplacement-vC1xhFS0.mjs.map → SelectionReplacement-Cj4FLlPz.mjs.map} +1 -1
  60. package/dist/chunks/{SelectionSync-BkjCwGp-.mjs → SelectionSync-8y0nbBHZ.mjs} +2 -2
  61. package/dist/chunks/{SelectionSync-BkjCwGp-.mjs.map → SelectionSync-8y0nbBHZ.mjs.map} +1 -1
  62. package/dist/chunks/SimpleMark-DPTsIl9w.mjs +2 -0
  63. package/dist/chunks/{SimpleMark-D6vz3Nfd.mjs.map → SimpleMark-DPTsIl9w.mjs.map} +1 -1
  64. package/dist/chunks/SmartPastePlugin-BSMHDDQ2.mjs +2 -0
  65. package/dist/chunks/{SmartPastePlugin-BHsYKbgd.mjs.map → SmartPastePlugin-BSMHDDQ2.mjs.map} +1 -1
  66. package/dist/chunks/StrikethroughPlugin-CqqIF3Zk.mjs +2 -0
  67. package/dist/chunks/{StrikethroughPlugin-v-VJZzUZ.mjs.map → StrikethroughPlugin-CqqIF3Zk.mjs.map} +1 -1
  68. package/dist/chunks/SuperSubPlugin-5ZFM6wdU.mjs +2 -0
  69. package/dist/chunks/{SuperSubPlugin-x1iPnZyt.mjs.map → SuperSubPlugin-5ZFM6wdU.mjs.map} +1 -1
  70. package/dist/chunks/{TableDimensions-BSEOEox2.mjs → TableDimensions-B-OWjTuW.mjs} +2 -2
  71. package/dist/chunks/{TableDimensions-BSEOEox2.mjs.map → TableDimensions-B-OWjTuW.mjs.map} +1 -1
  72. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs +2 -0
  73. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs.map +1 -0
  74. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs +2 -0
  75. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs.map +1 -0
  76. package/dist/chunks/TextColorPlugin-Dwp7eW7F.mjs +2 -0
  77. package/dist/chunks/{TextColorPlugin-Bnl9of9E.mjs.map → TextColorPlugin-Dwp7eW7F.mjs.map} +1 -1
  78. package/dist/chunks/{TextDirectionAutoPlugin-DOH5cfyy.mjs → TextDirectionAutoPlugin-CkIETM5n.mjs} +2 -2
  79. package/dist/chunks/{TextDirectionAutoPlugin-DOH5cfyy.mjs.map → TextDirectionAutoPlugin-CkIETM5n.mjs.map} +1 -1
  80. package/dist/chunks/TextDirectionPlugin-DAcPR5Qc.mjs +2 -0
  81. package/dist/chunks/{TextDirectionPlugin-JwlR-R-b.mjs.map → TextDirectionPlugin-DAcPR5Qc.mjs.map} +1 -1
  82. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +2 -0
  83. package/dist/chunks/{TextDirectionService-BcX07mw2.mjs.map → TextDirectionService-OFOU6r_s.mjs.map} +1 -1
  84. package/dist/chunks/TextFormattingPlugin-vml-lduV.mjs +2 -0
  85. package/dist/chunks/{TextFormattingPlugin-Kc_UNoOz.mjs.map → TextFormattingPlugin-vml-lduV.mjs.map} +1 -1
  86. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs +2 -0
  87. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs.map +1 -0
  88. package/dist/chunks/VideoPlugin-lZCBlIon.mjs +2 -0
  89. package/dist/chunks/{VideoPlugin-DJXfuNA9.mjs.map → VideoPlugin-lZCBlIon.mjs.map} +1 -1
  90. package/dist/chunks/ar-Dp1oBWyG.mjs +2 -0
  91. package/dist/chunks/ar-Dp1oBWyG.mjs.map +1 -0
  92. package/dist/chunks/de-D3J8XPCR.mjs +2 -0
  93. package/dist/chunks/de-D3J8XPCR.mjs.map +1 -0
  94. package/dist/chunks/es-Bbz885DZ.mjs +2 -0
  95. package/dist/chunks/es-Bbz885DZ.mjs.map +1 -0
  96. package/dist/chunks/fr-GEgM1j3w.mjs +2 -0
  97. package/dist/chunks/fr-GEgM1j3w.mjs.map +1 -0
  98. package/dist/chunks/full-wDTdOuGt.mjs +2 -0
  99. package/dist/chunks/{full-BsWAZr1w.mjs.map → full-wDTdOuGt.mjs.map} +1 -1
  100. package/dist/chunks/hi-CKg8i4Mm.mjs +2 -0
  101. package/dist/chunks/hi-CKg8i4Mm.mjs.map +1 -0
  102. package/dist/chunks/minimal-FfmHwMGU.mjs +2 -0
  103. package/dist/chunks/{minimal-DO7LiFTa.mjs.map → minimal-FfmHwMGU.mjs.map} +1 -1
  104. package/dist/chunks/nl-2IdjTNeJ.mjs +2 -0
  105. package/dist/chunks/nl-2IdjTNeJ.mjs.map +1 -0
  106. package/dist/chunks/nl-B1i04NvZ.mjs +2 -0
  107. package/dist/chunks/nl-B1i04NvZ.mjs.map +1 -0
  108. package/dist/chunks/nl-BEmzpzKO.mjs +2 -0
  109. package/dist/chunks/nl-BEmzpzKO.mjs.map +1 -0
  110. package/dist/chunks/nl-B_U0D3Qq.mjs +2 -0
  111. package/dist/chunks/nl-B_U0D3Qq.mjs.map +1 -0
  112. package/dist/chunks/nl-C437Xz6z.mjs +2 -0
  113. package/dist/chunks/nl-C437Xz6z.mjs.map +1 -0
  114. package/dist/chunks/nl-C5P8Fogm.mjs +2 -0
  115. package/dist/chunks/nl-C5P8Fogm.mjs.map +1 -0
  116. package/dist/chunks/nl-CST62bzx.mjs +2 -0
  117. package/dist/chunks/nl-CST62bzx.mjs.map +1 -0
  118. package/dist/chunks/nl-CWQT-W-6.mjs +2 -0
  119. package/dist/chunks/nl-CWQT-W-6.mjs.map +1 -0
  120. package/dist/chunks/nl-CdpcDkbM.mjs +2 -0
  121. package/dist/chunks/nl-CdpcDkbM.mjs.map +1 -0
  122. package/dist/chunks/nl-CgYWZnga.mjs +2 -0
  123. package/dist/chunks/nl-CgYWZnga.mjs.map +1 -0
  124. package/dist/chunks/nl-Cr--x8bX.mjs +2 -0
  125. package/dist/chunks/nl-Cr--x8bX.mjs.map +1 -0
  126. package/dist/chunks/nl-Cwl5dxFZ.mjs +2 -0
  127. package/dist/chunks/nl-Cwl5dxFZ.mjs.map +1 -0
  128. package/dist/chunks/nl-Czjd9Bw9.mjs +2 -0
  129. package/dist/chunks/nl-Czjd9Bw9.mjs.map +1 -0
  130. package/dist/chunks/nl-DUOT2ZMQ.mjs +2 -0
  131. package/dist/chunks/nl-DUOT2ZMQ.mjs.map +1 -0
  132. package/dist/chunks/nl-DYnRYvZ5.mjs +2 -0
  133. package/dist/chunks/nl-DYnRYvZ5.mjs.map +1 -0
  134. package/dist/chunks/nl-DaNJ-ffX.mjs +2 -0
  135. package/dist/chunks/nl-DaNJ-ffX.mjs.map +1 -0
  136. package/dist/chunks/nl-DeOJ64xy.mjs +2 -0
  137. package/dist/chunks/nl-DeOJ64xy.mjs.map +1 -0
  138. package/dist/chunks/nl-DwZajfpP.mjs +2 -0
  139. package/dist/chunks/nl-DwZajfpP.mjs.map +1 -0
  140. package/dist/chunks/nl-Dyjc9M7o.mjs +2 -0
  141. package/dist/chunks/nl-Dyjc9M7o.mjs.map +1 -0
  142. package/dist/chunks/nl-GBpv7W4L.mjs +2 -0
  143. package/dist/chunks/nl-GBpv7W4L.mjs.map +1 -0
  144. package/dist/chunks/nl-HFfWJOEo.mjs +2 -0
  145. package/dist/chunks/nl-HFfWJOEo.mjs.map +1 -0
  146. package/dist/chunks/nl-KqmiCeD7.mjs +2 -0
  147. package/dist/chunks/nl-KqmiCeD7.mjs.map +1 -0
  148. package/dist/chunks/nl-_QT7e2Qt.mjs +2 -0
  149. package/dist/chunks/nl-_QT7e2Qt.mjs.map +1 -0
  150. package/dist/chunks/nl-i79IajbC.mjs +2 -0
  151. package/dist/chunks/nl-i79IajbC.mjs.map +1 -0
  152. package/dist/chunks/nl-lcZvrAz6.mjs +2 -0
  153. package/dist/chunks/nl-lcZvrAz6.mjs.map +1 -0
  154. package/dist/chunks/nl-tWJ2imhe.mjs +2 -0
  155. package/dist/chunks/nl-tWJ2imhe.mjs.map +1 -0
  156. package/dist/chunks/nl-xfiNOCgg.mjs +2 -0
  157. package/dist/chunks/nl-xfiNOCgg.mjs.map +1 -0
  158. package/dist/chunks/pt-DP5c76Vo.mjs +2 -0
  159. package/dist/chunks/pt-DP5c76Vo.mjs.map +1 -0
  160. package/dist/chunks/register-DSRtHVkk.mjs +3 -0
  161. package/dist/chunks/register-DSRtHVkk.mjs.map +1 -0
  162. package/dist/chunks/ru--iYEtsT5.mjs +2 -0
  163. package/dist/chunks/ru--iYEtsT5.mjs.map +1 -0
  164. package/dist/chunks/src-DDkRstYh.mjs +2 -0
  165. package/dist/chunks/src-DDkRstYh.mjs.map +1 -0
  166. package/dist/chunks/zh-DUS7JduA.mjs +2 -0
  167. package/dist/chunks/zh-DUS7JduA.mjs.map +1 -0
  168. package/dist/commands/Commands.d.ts +3 -0
  169. package/dist/commands/Commands.d.ts.map +1 -1
  170. package/dist/commands/CompositionCommands.d.ts +14 -8
  171. package/dist/commands/CompositionCommands.d.ts.map +1 -1
  172. package/dist/commands/CompositionFallback.d.ts +13 -0
  173. package/dist/commands/CompositionFallback.d.ts.map +1 -0
  174. package/dist/commands/CompositionRebase.d.ts +17 -10
  175. package/dist/commands/CompositionRebase.d.ts.map +1 -1
  176. package/dist/editor/locales/nl.d.ts +4 -0
  177. package/dist/editor/locales/nl.d.ts.map +1 -0
  178. package/dist/editor/styles/link.d.ts +2 -2
  179. package/dist/editor/styles/link.d.ts.map +1 -1
  180. package/dist/fonts.mjs +1 -1
  181. package/dist/full.mjs +1 -1
  182. package/dist/html.mjs +1 -1
  183. package/dist/i18n/Locale.d.ts +1 -0
  184. package/dist/i18n/Locale.d.ts.map +1 -1
  185. package/dist/input/CompositionController.d.ts.map +1 -1
  186. package/dist/input/HTMLLineBreaks.d.ts +14 -0
  187. package/dist/input/HTMLLineBreaks.d.ts.map +1 -0
  188. package/dist/input/HTMLParser.d.ts +1 -7
  189. package/dist/input/HTMLParser.d.ts.map +1 -1
  190. package/dist/input/PasteHTMLHandler.d.ts +0 -1
  191. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  192. package/dist/markdown.mjs +1 -1
  193. package/dist/notectl-core.mjs +1 -1
  194. package/dist/notectl-core.umd.js +1 -1
  195. package/dist/notectl-core.umd.js.map +1 -1
  196. package/dist/plugins/PluginContextFactory.d.ts +1 -0
  197. package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
  198. package/dist/plugins/PluginManager.d.ts +5 -0
  199. package/dist/plugins/PluginManager.d.ts.map +1 -1
  200. package/dist/plugins/alignment/locales/nl.d.ts +4 -0
  201. package/dist/plugins/alignment/locales/nl.d.ts.map +1 -0
  202. package/dist/plugins/alignment.mjs +1 -1
  203. package/dist/plugins/bidi-isolation/locales/nl.d.ts +4 -0
  204. package/dist/plugins/bidi-isolation/locales/nl.d.ts.map +1 -0
  205. package/dist/plugins/bidi-isolation.mjs +1 -1
  206. package/dist/plugins/blockquote/locales/nl.d.ts +4 -0
  207. package/dist/plugins/blockquote/locales/nl.d.ts.map +1 -0
  208. package/dist/plugins/blockquote.mjs +1 -1
  209. package/dist/plugins/caret-navigation/locales/nl.d.ts +4 -0
  210. package/dist/plugins/caret-navigation/locales/nl.d.ts.map +1 -0
  211. package/dist/plugins/caret-navigation.mjs +1 -1
  212. package/dist/plugins/code-block/locales/nl.d.ts +4 -0
  213. package/dist/plugins/code-block/locales/nl.d.ts.map +1 -0
  214. package/dist/plugins/code-block.mjs +1 -1
  215. package/dist/plugins/editor-ui/EditorUI.d.ts +50 -0
  216. package/dist/plugins/editor-ui/EditorUI.d.ts.map +1 -0
  217. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts +44 -0
  218. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts.map +1 -0
  219. package/dist/plugins/editor-ui/index.d.ts +6 -0
  220. package/dist/plugins/editor-ui/index.d.ts.map +1 -0
  221. package/dist/plugins/font/locales/nl.d.ts +4 -0
  222. package/dist/plugins/font/locales/nl.d.ts.map +1 -0
  223. package/dist/plugins/font-size/locales/nl.d.ts +4 -0
  224. package/dist/plugins/font-size/locales/nl.d.ts.map +1 -0
  225. package/dist/plugins/font-size.mjs +1 -1
  226. package/dist/plugins/font.mjs +1 -1
  227. package/dist/plugins/formula/locales/nl.d.ts +4 -0
  228. package/dist/plugins/formula/locales/nl.d.ts.map +1 -0
  229. package/dist/plugins/formula.mjs +1 -1
  230. package/dist/plugins/gap-cursor/locales/nl.d.ts +4 -0
  231. package/dist/plugins/gap-cursor/locales/nl.d.ts.map +1 -0
  232. package/dist/plugins/gap-cursor.mjs +1 -1
  233. package/dist/plugins/hard-break.mjs +1 -1
  234. package/dist/plugins/heading/locales/nl.d.ts +4 -0
  235. package/dist/plugins/heading/locales/nl.d.ts.map +1 -0
  236. package/dist/plugins/heading.mjs +1 -1
  237. package/dist/plugins/highlight/locales/nl.d.ts +4 -0
  238. package/dist/plugins/highlight/locales/nl.d.ts.map +1 -0
  239. package/dist/plugins/highlight.mjs +1 -1
  240. package/dist/plugins/horizontal-rule/locales/nl.d.ts +4 -0
  241. package/dist/plugins/horizontal-rule/locales/nl.d.ts.map +1 -0
  242. package/dist/plugins/horizontal-rule.mjs +1 -1
  243. package/dist/plugins/image/locales/nl.d.ts +4 -0
  244. package/dist/plugins/image/locales/nl.d.ts.map +1 -0
  245. package/dist/plugins/image.mjs +1 -1
  246. package/dist/plugins/inline-code/locales/nl.d.ts +4 -0
  247. package/dist/plugins/inline-code/locales/nl.d.ts.map +1 -0
  248. package/dist/plugins/inline-code.mjs +1 -1
  249. package/dist/plugins/link/{LinkPreview.d.ts → LinkBubble.d.ts} +10 -7
  250. package/dist/plugins/link/LinkBubble.d.ts.map +1 -0
  251. package/dist/plugins/link/LinkBubbleContent.d.ts +4 -0
  252. package/dist/plugins/link/LinkBubbleContent.d.ts.map +1 -0
  253. package/dist/plugins/link/LinkInteractionController.d.ts +17 -3
  254. package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -1
  255. package/dist/plugins/link/LinkLocale.d.ts +3 -0
  256. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  257. package/dist/plugins/link/LinkPlugin.d.ts +0 -1
  258. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  259. package/dist/plugins/link/LinkRange.d.ts +12 -0
  260. package/dist/plugins/link/LinkRange.d.ts.map +1 -0
  261. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  262. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  263. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  264. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  265. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  266. package/dist/plugins/link/locales/nl.d.ts +4 -0
  267. package/dist/plugins/link/locales/nl.d.ts.map +1 -0
  268. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  269. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  270. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  271. package/dist/plugins/link.mjs +1 -1
  272. package/dist/plugins/list/locales/nl.d.ts +4 -0
  273. package/dist/plugins/list/locales/nl.d.ts.map +1 -0
  274. package/dist/plugins/list.mjs +1 -1
  275. package/dist/plugins/print/locales/nl.d.ts +4 -0
  276. package/dist/plugins/print/locales/nl.d.ts.map +1 -0
  277. package/dist/plugins/print.mjs +1 -1
  278. package/dist/plugins/shared/PopupManager.d.ts +15 -2
  279. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  280. package/dist/plugins/shared/PopupPositioning.d.ts +2 -6
  281. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
  282. package/dist/plugins/shared/index.d.ts +1 -1
  283. package/dist/plugins/shared/index.d.ts.map +1 -1
  284. package/dist/plugins/shared.mjs +1 -1
  285. package/dist/plugins/smart-paste/locales/nl.d.ts +4 -0
  286. package/dist/plugins/smart-paste/locales/nl.d.ts.map +1 -0
  287. package/dist/plugins/smart-paste.mjs +1 -1
  288. package/dist/plugins/strikethrough/locales/nl.d.ts +4 -0
  289. package/dist/plugins/strikethrough/locales/nl.d.ts.map +1 -0
  290. package/dist/plugins/strikethrough.mjs +1 -1
  291. package/dist/plugins/super-sub/locales/nl.d.ts +4 -0
  292. package/dist/plugins/super-sub/locales/nl.d.ts.map +1 -0
  293. package/dist/plugins/super-sub.mjs +1 -1
  294. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
  295. package/dist/plugins/table/TableSelection.d.ts +4 -20
  296. package/dist/plugins/table/TableSelection.d.ts.map +1 -1
  297. package/dist/plugins/table/TableSelectionTypes.d.ts +21 -0
  298. package/dist/plugins/table/TableSelectionTypes.d.ts.map +1 -0
  299. package/dist/plugins/table/locales/nl.d.ts +4 -0
  300. package/dist/plugins/table/locales/nl.d.ts.map +1 -0
  301. package/dist/plugins/table.mjs +1 -1
  302. package/dist/plugins/text-color/locales/nl.d.ts +4 -0
  303. package/dist/plugins/text-color/locales/nl.d.ts.map +1 -0
  304. package/dist/plugins/text-color.mjs +1 -1
  305. package/dist/plugins/text-direction/locales/nl.d.ts +4 -0
  306. package/dist/plugins/text-direction/locales/nl.d.ts.map +1 -0
  307. package/dist/plugins/text-direction-auto.mjs +1 -1
  308. package/dist/plugins/text-direction.mjs +1 -1
  309. package/dist/plugins/text-formatting/locales/nl.d.ts +4 -0
  310. package/dist/plugins/text-formatting/locales/nl.d.ts.map +1 -0
  311. package/dist/plugins/text-formatting.mjs +1 -1
  312. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +2 -2
  313. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
  314. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +2 -1
  315. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  316. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +8 -3
  317. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  318. package/dist/plugins/toolbar/ToolbarRegistry.d.ts +4 -0
  319. package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -1
  320. package/dist/plugins/toolbar/locales/nl.d.ts +4 -0
  321. package/dist/plugins/toolbar/locales/nl.d.ts.map +1 -0
  322. package/dist/plugins/toolbar.mjs +1 -1
  323. package/dist/plugins/video/locales/nl.d.ts +4 -0
  324. package/dist/plugins/video/locales/nl.d.ts.map +1 -0
  325. package/dist/plugins/video.mjs +1 -1
  326. package/dist/presets/full.mjs +1 -1
  327. package/dist/presets/minimal.mjs +1 -1
  328. package/dist/presets.mjs +1 -1
  329. package/dist/register.mjs +1 -1
  330. package/dist/serialization/DocumentParser.d.ts +2 -2
  331. package/dist/serialization/DocumentParser.d.ts.map +1 -1
  332. package/dist/serialization/HTMLParseRules.d.ts.map +1 -1
  333. package/dist/serialization/HTMLSanitization.d.ts +6 -0
  334. package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
  335. package/dist/serialization/PreformattedText.d.ts +3 -0
  336. package/dist/serialization/PreformattedText.d.ts.map +1 -0
  337. package/dist/state/RangeMapping.d.ts +10 -0
  338. package/dist/state/RangeMapping.d.ts.map +1 -0
  339. package/dist/ui.d.ts +3 -0
  340. package/dist/ui.d.ts.map +1 -0
  341. package/dist/ui.mjs +1 -0
  342. package/dist/view/EditorInteraction.d.ts +23 -0
  343. package/dist/view/EditorInteraction.d.ts.map +1 -0
  344. package/dist/view/EditorView.d.ts +2 -0
  345. package/dist/view/EditorView.d.ts.map +1 -1
  346. package/dist/view/SelectionGeometry.d.ts +29 -0
  347. package/dist/view/SelectionGeometry.d.ts.map +1 -0
  348. package/dist/view/SelectionObserver.d.ts +19 -0
  349. package/dist/view/SelectionObserver.d.ts.map +1 -0
  350. package/dist/view/SelectionSync.d.ts +7 -0
  351. package/dist/view/SelectionSync.d.ts.map +1 -1
  352. package/package.json +6 -2
  353. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +0 -2
  354. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +0 -2
  355. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +0 -2
  356. package/dist/chunks/CaretNavigationPlugin-BQPqqK4n.mjs +0 -2
  357. package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs +0 -2
  358. package/dist/chunks/Commands-Bk7Cl1nH.mjs +0 -2
  359. package/dist/chunks/DocumentParser-C99N0MWF.mjs +0 -2
  360. package/dist/chunks/DocumentParser-C99N0MWF.mjs.map +0 -1
  361. package/dist/chunks/FontPlugin-BcXNFqqO.mjs +0 -2
  362. package/dist/chunks/FontSizePlugin-Dswra3oU.mjs +0 -2
  363. package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs +0 -2
  364. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +0 -2
  365. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +0 -2
  366. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +0 -1
  367. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +0 -2
  368. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +0 -2
  369. package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs +0 -2
  370. package/dist/chunks/ImagePlugin-BAhZuVdE.mjs +0 -2
  371. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +0 -2
  372. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs +0 -2
  373. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs.map +0 -1
  374. package/dist/chunks/ListPlugin-U1r4p_fE.mjs +0 -2
  375. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +0 -2
  376. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +0 -1
  377. package/dist/chunks/PopupManager-Dxv0OVMo.mjs +0 -2
  378. package/dist/chunks/PopupManager-Dxv0OVMo.mjs.map +0 -1
  379. package/dist/chunks/PrintPlugin-DAEiEyKQ.mjs +0 -2
  380. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +0 -2
  381. package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs +0 -2
  382. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs +0 -2
  383. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs +0 -2
  384. package/dist/chunks/TablePlugin-CjKThPug.mjs +0 -2
  385. package/dist/chunks/TablePlugin-CjKThPug.mjs.map +0 -1
  386. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +0 -2
  387. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs +0 -2
  388. package/dist/chunks/TextDirectionService-BcX07mw2.mjs +0 -2
  389. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs +0 -2
  390. package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs +0 -2
  391. package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs.map +0 -1
  392. package/dist/chunks/VideoPlugin-DJXfuNA9.mjs +0 -2
  393. package/dist/chunks/ar-DhwCFHql.mjs +0 -2
  394. package/dist/chunks/ar-DhwCFHql.mjs.map +0 -1
  395. package/dist/chunks/de-CjLUbQmg.mjs +0 -2
  396. package/dist/chunks/de-CjLUbQmg.mjs.map +0 -1
  397. package/dist/chunks/es-CMSzvjOT.mjs +0 -2
  398. package/dist/chunks/es-CMSzvjOT.mjs.map +0 -1
  399. package/dist/chunks/fr-DB_OvHWH.mjs +0 -2
  400. package/dist/chunks/fr-DB_OvHWH.mjs.map +0 -1
  401. package/dist/chunks/full-BsWAZr1w.mjs +0 -2
  402. package/dist/chunks/hi-ChNQZZ1z.mjs +0 -2
  403. package/dist/chunks/hi-ChNQZZ1z.mjs.map +0 -1
  404. package/dist/chunks/minimal-DO7LiFTa.mjs +0 -2
  405. package/dist/chunks/pt-CI8t6oul.mjs +0 -2
  406. package/dist/chunks/pt-CI8t6oul.mjs.map +0 -1
  407. package/dist/chunks/register-DXLu8Njp.mjs +0 -3
  408. package/dist/chunks/register-DXLu8Njp.mjs.map +0 -1
  409. package/dist/chunks/ru-9WtNGZtl.mjs +0 -2
  410. package/dist/chunks/ru-9WtNGZtl.mjs.map +0 -1
  411. package/dist/chunks/src-5GKFQ2mQ.mjs +0 -2
  412. package/dist/chunks/src-5GKFQ2mQ.mjs.map +0 -1
  413. package/dist/chunks/zh-BrqJ4ywP.mjs +0 -2
  414. package/dist/chunks/zh-BrqJ4ywP.mjs.map +0 -1
  415. package/dist/plugins/link/LinkPreview.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"DocumentParser-C99N0MWF.mjs","names":["normalizeHTMLId","SAFE_URI_REGEXP","getInlineChildren","createTextNode","createInlineNode","createDocument","createBlockNode","isInlineNode","nodeType","markType","inlineType","hoistDisallowedBlocks","adoptBlockId","splitDeclarations","readElementAlignment","readTableDimensionPx","VALID_DIRECTIONS","rehydrateStyleClasses","createClassDeclarationResolver","TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE","normalizeTableColumnWidthsPx","TABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE","parseTableColumnSpan","MAX_SERIALIZED_TABLE_COLUMNS","sanitizeHTML","preserveHTMLIdSanitizeConfig","BLOCK_TAGS","Set","matchHTMLParseRule","element","rules","tag","tagName","toLowerCase","rule","type","attrs","getAttrs","parseHTMLMarks","el","currentMarks","markRules","marks","some","mark","push","Object","keys","length","isHTMLBlockElement","blockRules","inlineRules","blockTags","has","hasHTMLBlockDescendants","createBlockDescendantCheck","known","WeakMap","check","cached","get","result","Array","from","children","child","set","COLLAPSIBLE_WHITESPACE","FLOW_BLOCK_TAGS","PRESERVE_TAGS","PRESERVE_WHITESPACE_VALUES","normalizeHTMLWhitespace","root","normalizeContext","container","state","lastTextNode","collapsePending","childNodes","processNode","trimTrailingSpace","node","Node","TEXT_NODE","text","data","replace","startsWith","slice","endsWith","collapseTextNode","ELEMENT_NODE","whiteSpace","style","isPreserveElement","endInlineRun","isFlowBlockElement","rehydrateStyles","resolveClass","querySelectorAll","inlineStyleOf","getAttribute","cssText","restoreInlineStyles","parseHTMLToDocument","html","registry","options","allowedTags","getAllowedTags","allowedAttrs","getAllowedAttrs","includes","styleMap","template","document","createElement","innerHTML","ALLOWED_TAGS","ALLOWED_ATTR","ALLOWED_URI_REGEXP","content","session","getBlockParseRules","getInlineParseRules","getMarkParseRules","ownMarks","marksOf","parent","parentElement","adoptedIds","hasBlockDescendants","ancestorMarks","createHTMLParseSession","blocks","parseChildNode","doc","listType","listDir","parseListElement","tableEl","rows","columnWidthsPx","widths","appendColumnElementWidths","groupEl","groupWidth","readTableColumnWidthPx","columns","filter","column","appendRepeatedWidth","extractTableColumnWidthsPx","cellsAlign","getNodeSpec","align","rowElements","nested","collectTableRows","trEl","cells","cellChild","cellTag","cellEl","cellContent","parseTableCellContent","cellAttrs","extractCellSpanAttrs","extractAlignment","cellBlock","extractHTMLId","rowAttrs","extractTableRowMinHeight","tableAttrs","match","BORDER_COLOR_RE","exec","borderColor","extractTableBorderColor","parseTableElement","innerBlocks","parseBlockContainerChildren","extractDirection","parseBlockquoteElement","inherited","block","inheritBlockAttrs","parseWrapperElement","spec","isVoid","parseElementToInlineContent","dir","textContent","trim","listEl","depth","parentDir","li","checkbox","querySelector","indent","checked","hasAttribute","liDir","effectiveDir","parseListItemBlock","liChild","liChildTag","nestedType","nestedDir","htmlId","isHoistedList","isBlockLevelChild","inlineContent","only","inheritedWidth","width","span","remaining","count","Math","min","max","index","row","minHeightPx","colspan","value","rowspan","cellBlocks","skip","inlineRun","flushInlineRun","nodes","inlineRunHasContent","parseNodesToInlineContent","changed","name","entries","id","skipNestedLists","walkElement","inlineMatch","styleDir","direction"],"sources":["../../src/serialization/HTMLParseRules.ts","../../src/serialization/HTMLParseSession.ts","../../src/serialization/HTMLWhitespace.ts","../../src/serialization/StyleRehydration.ts","../../src/serialization/DocumentParser.ts"],"sourcesContent":["import type { Mark } from '../model/Document.js';\nimport type { ParseRule } from '../model/ParseRule.js';\nimport { markType } from '../model/TypeBrands.js';\n\n/** Parse rules with the node, mark or inline type they produce, in priority order. */\nexport type ParseRules = readonly { readonly rule: ParseRule; readonly type: string }[];\n\n/** Structural tags handled by the document parser independently of schema rules. */\nconst BLOCK_TAGS: ReadonlySet<string> = new Set(['p', 'div', 'ul', 'ol', 'table', 'blockquote']);\n\n/** Returns the first accepting rule in priority order, including its parsed attributes. */\nexport function matchHTMLParseRule(\n\telement: HTMLElement,\n\trules: ParseRules,\n): { readonly type: string; readonly attrs?: Record<string, unknown> } | null {\n\tconst tag: string = element.tagName.toLowerCase();\n\tfor (const { rule, type } of rules) {\n\t\tif (rule.tag !== tag) continue;\n\t\tconst attrs = rule.getAttrs?.(element);\n\t\tif (attrs !== false) return { type, ...(attrs ? { attrs } : {}) };\n\t}\n\treturn null;\n}\n\n/** Reads the element's own marks, shared by the inline walker and wrappers. */\nexport function parseHTMLMarks(\n\tel: HTMLElement,\n\tcurrentMarks: readonly Mark[],\n\tmarkRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n): Mark[] {\n\tconst tag: string = el.tagName.toLowerCase();\n\tconst marks: Mark[] = [...currentMarks];\n\n\tfor (const { rule, type } of markRules) {\n\t\tif (rule.tag !== tag || marks.some((mark) => mark.type === type)) continue;\n\t\tconst attrs = rule.getAttrs?.(el);\n\t\tif (attrs === false) continue;\n\t\tmarks.push({\n\t\t\ttype: markType(type),\n\t\t\t...(attrs && Object.keys(attrs).length > 0 ? { attrs } : {}),\n\t\t} as Mark);\n\t}\n\n\treturn marks;\n}\n\n/** Inline node rules take precedence, just as they do when parsing inline content. */\nexport function isHTMLBlockElement(\n\telement: HTMLElement,\n\tblockRules: ParseRules,\n\tinlineRules: ParseRules,\n\tblockTags: ReadonlySet<string> = BLOCK_TAGS,\n): boolean {\n\tif (matchHTMLParseRule(element, inlineRules)) return false;\n\treturn (\n\t\tblockTags.has(element.tagName.toLowerCase()) || matchHTMLParseRule(element, blockRules) !== null\n\t);\n}\n\n/**\n * Looks through transparent intermediate wrappers for block content. Atomic\n * inline nodes own their markup, so their descendants must never be unwrapped.\n */\nexport function hasHTMLBlockDescendants(\n\telement: HTMLElement,\n\tblockRules: ParseRules,\n\tinlineRules: ParseRules,\n\tblockTags: ReadonlySet<string> = BLOCK_TAGS,\n): boolean {\n\treturn createBlockDescendantCheck(blockRules, inlineRules, blockTags)(element);\n}\n\n/**\n * Creates a {@link hasHTMLBlockDescendants} check that remembers every\n * element's answer. Parsers ask it for each level of nested wrappers, so\n * without the memo a deep wrapper chain rescans the same subtree at every\n * level (#263). Use one check per parse, while the DOM does not change.\n */\nexport function createBlockDescendantCheck(\n\tblockRules: ParseRules,\n\tinlineRules: ParseRules,\n\tblockTags: ReadonlySet<string> = BLOCK_TAGS,\n): (element: HTMLElement) => boolean {\n\tconst known = new WeakMap<Element, boolean>();\n\tconst check = (element: HTMLElement): boolean => {\n\t\tconst cached: boolean | undefined = known.get(element);\n\t\tif (cached !== undefined) return cached;\n\t\tconst result: boolean =\n\t\t\t!matchHTMLParseRule(element, inlineRules) &&\n\t\t\tArray.from(element.children).some((child) => {\n\t\t\t\tconst el = child as HTMLElement;\n\t\t\t\treturn isHTMLBlockElement(el, blockRules, inlineRules, blockTags) || check(el);\n\t\t\t});\n\t\tknown.set(element, result);\n\t\treturn result;\n\t};\n\treturn check;\n}\n","/**\n * State shared by one HTML import: the registry's parse rules, read once, the\n * block ids adopted so far, and per-element answers the parser needs again and\n * again. Transparent wrappers (#223) make the parser ask about the same\n * elements at every nesting level, so each answer is computed once per element\n * instead of once per level (#263).\n */\n\nimport type { Mark } from '../model/Document.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { type ParseRules, createBlockDescendantCheck, parseHTMLMarks } from './HTMLParseRules.js';\n\nexport interface HTMLParseSession {\n\treadonly registry?: SchemaRegistry;\n\treadonly blockRules: ParseRules;\n\treadonly inlineRules: ParseRules;\n\treadonly markRules: ParseRules;\n\t/** HTML block ids adopted so far, so a repeated id gets a fresh one. */\n\treadonly adoptedIds: Set<string>;\n\t/** Whether `element` wraps block-level content, looking through transparent wrappers. */\n\thasBlockDescendants(element: HTMLElement): boolean;\n\t/** The marks the ancestors of `node` apply to it, such as a wrapper's link or color. */\n\tancestorMarks(node: Node): readonly Mark[];\n}\n\n/**\n * Creates the session for one parse. The DOM must not change while it is in\n * use, because answers are remembered per element.\n */\nexport function createHTMLParseSession(registry?: SchemaRegistry): HTMLParseSession {\n\tconst blockRules: ParseRules = registry?.getBlockParseRules() ?? [];\n\tconst inlineRules: ParseRules = registry?.getInlineParseRules() ?? [];\n\tconst markRules: ParseRules = registry?.getMarkParseRules() ?? [];\n\tconst ownMarks = new WeakMap<Element, readonly Mark[]>();\n\n\tconst marksOf = (element: HTMLElement): readonly Mark[] => {\n\t\tconst cached: readonly Mark[] | undefined = ownMarks.get(element);\n\t\tif (cached) return cached;\n\t\tconst parent: HTMLElement | null = element.parentElement;\n\t\tconst marks: readonly Mark[] = parseHTMLMarks(\n\t\t\telement,\n\t\t\tparent ? marksOf(parent) : [],\n\t\t\tmarkRules,\n\t\t);\n\t\townMarks.set(element, marks);\n\t\treturn marks;\n\t};\n\n\treturn {\n\t\tregistry,\n\t\tblockRules,\n\t\tinlineRules,\n\t\tmarkRules,\n\t\tadoptedIds: new Set<string>(),\n\t\thasBlockDescendants: createBlockDescendantCheck(blockRules, inlineRules),\n\t\tancestorMarks: (node: Node): readonly Mark[] =>\n\t\t\tnode.parentElement ? marksOf(node.parentElement) : [],\n\t};\n}\n","/**\n * HTML whitespace normalization, shared by the paste parser (`HTMLParser`) and the\n * `setContentHTML` parser (`DocumentParser`).\n *\n * Per the CSS Text / HTML whitespace processing model for `white-space: normal`,\n * whitespace in normal flow content is *insignificant*: runs of ASCII whitespace\n * (space, tab, line feed, carriage return, form feed) collapse to a single space,\n * and whitespace at the edges of a block collapses away entirely. Only `<br>` is a\n * real line break. Source-formatted HTML (server-rendered, hand-indented, or\n * hard-wrapped by a browser's clipboard serializer) therefore carries newlines and\n * indentation that must NOT survive parsing.\n *\n * This pass rewrites text-node data in place so both parsers can walk a tree whose\n * whitespace already matches what a browser would render. It only touches\n * `Text.data`; marks, block ids, and attributes are left untouched.\n */\n\n/**\n * ASCII whitespace per the HTML spec. Deliberately NOT `\\s`: `\\s` also matches\n * non-breaking space (` `) and other Unicode spaces, which are significant\n * content and must be preserved verbatim.\n */\nconst COLLAPSIBLE_WHITESPACE: RegExp = /[ \\t\\n\\r\\f]+/g;\n\n/**\n * Tags that establish a block formatting context in normal flow. Each starts a\n * fresh inline run whose leading/trailing whitespace is trimmed independently.\n * Self-contained (not coupled to the parsers' tag sets); unknown tags are treated\n * as inline.\n */\nconst FLOW_BLOCK_TAGS: ReadonlySet<string> = new Set([\n\t'P',\n\t'DIV',\n\t'H1',\n\t'H2',\n\t'H3',\n\t'H4',\n\t'H5',\n\t'H6',\n\t'BLOCKQUOTE',\n\t'UL',\n\t'OL',\n\t'LI',\n\t'TABLE',\n\t'THEAD',\n\t'TBODY',\n\t'TFOOT',\n\t'TR',\n\t'TD',\n\t'TH',\n\t'HR',\n\t'FIGURE',\n\t'FIGCAPTION',\n\t'SECTION',\n\t'ARTICLE',\n\t'HEADER',\n\t'FOOTER',\n\t'MAIN',\n\t'ASIDE',\n\t'NAV',\n\t'DL',\n\t'DT',\n\t'DD',\n]);\n\n/** Tags whose descendant whitespace is significant and must be preserved verbatim. */\nconst PRESERVE_TAGS: ReadonlySet<string> = new Set(['PRE', 'TEXTAREA']);\n\n/** `white-space` values that preserve whitespace (the `pre*` family). */\nconst PRESERVE_WHITESPACE_VALUES: ReadonlySet<string> = new Set([\n\t'pre',\n\t'pre-wrap',\n\t'pre-line',\n\t'break-spaces',\n]);\n\n/** Mutable state threaded through a single inline formatting context. */\ninterface CollapseState {\n\t/** Most recent non-empty text node in this context, for trailing-space trimming. */\n\tlastTextNode: Text | null;\n\t/**\n\t * Whether a leading space on the next text node should be dropped. True at the\n\t * start of a context and after any text node that ended with a space.\n\t */\n\tcollapsePending: boolean;\n}\n\n/**\n * Collapses insignificant HTML whitespace throughout `root`, mutating text-node\n * data in place. Call once on a (disposable) parsed fragment before walking it.\n */\nexport function normalizeHTMLWhitespace(root: DocumentFragment | HTMLElement): void {\n\tnormalizeContext(root);\n}\n\n/** Processes one inline formatting context, then trims its trailing whitespace. */\nfunction normalizeContext(container: DocumentFragment | HTMLElement): void {\n\tconst state: CollapseState = { lastTextNode: null, collapsePending: true };\n\tfor (const child of Array.from(container.childNodes)) {\n\t\tprocessNode(child, state);\n\t}\n\ttrimTrailingSpace(state.lastTextNode);\n}\n\nfunction processNode(node: ChildNode, state: CollapseState): void {\n\tif (node.nodeType === Node.TEXT_NODE) {\n\t\tcollapseTextNode(node as Text, state);\n\t\treturn;\n\t}\n\tif (node.nodeType !== Node.ELEMENT_NODE) return;\n\n\tconst el = node as HTMLElement;\n\n\t// Whitespace-preserving subtree (code blocks etc.): end the current inline run\n\t// and leave the subtree untouched.\n\tif (isPreserveElement(el)) {\n\t\tendInlineRun(state);\n\t\treturn;\n\t}\n\n\t// Block element: the current inline run ends here; recurse as a fresh context.\n\tif (isFlowBlockElement(el)) {\n\t\tendInlineRun(state);\n\t\tnormalizeContext(el);\n\t\treturn;\n\t}\n\n\t// Inline element: keep collapsing within the same context.\n\tfor (const child of Array.from(el.childNodes)) {\n\t\tprocessNode(child, state);\n\t}\n}\n\n/** Collapses whitespace runs in a text node and drops a leading space when pending. */\nfunction collapseTextNode(text: Text, state: CollapseState): void {\n\tlet data: string = text.data.replace(COLLAPSIBLE_WHITESPACE, ' ');\n\tif (state.collapsePending && data.startsWith(' ')) {\n\t\tdata = data.slice(1);\n\t}\n\ttext.data = data;\n\n\t// Fully collapsed away (e.g. a whitespace-only node): leave `collapsePending` as\n\t// is so a later node still drops its leading space.\n\tif (data.length === 0) return;\n\n\tstate.collapsePending = data.endsWith(' ');\n\tstate.lastTextNode = text;\n}\n\n/** Ends the current inline run at a block/preserve boundary and resets state. */\nfunction endInlineRun(state: CollapseState): void {\n\ttrimTrailingSpace(state.lastTextNode);\n\tstate.lastTextNode = null;\n\tstate.collapsePending = true;\n}\n\n/** Removes the single (already-collapsed) trailing space from a text node, if any. */\nfunction trimTrailingSpace(node: Text | null): void {\n\tif (node?.data.endsWith(' ')) {\n\t\tnode.data = node.data.slice(0, -1);\n\t}\n}\n\nfunction isFlowBlockElement(el: HTMLElement): boolean {\n\treturn FLOW_BLOCK_TAGS.has(el.tagName);\n}\n\nfunction isPreserveElement(el: HTMLElement): boolean {\n\tif (PRESERVE_TAGS.has(el.tagName)) return true;\n\tconst whiteSpace: string = (el.style?.whiteSpace ?? '').toLowerCase();\n\treturn PRESERVE_WHITESPACE_VALUES.has(whiteSpace);\n}\n","/**\n * Style rehydration for HTML import and paste: before the parse rules run,\n * every style the HTML gives an element becomes readable through the CSSOM\n * (`el.style`), which is where the rules read it. Import and both paste routes\n * share this one step, so they read styles alike on every page.\n */\n\nimport { splitDeclarations } from '../model/StyleClass.js';\nimport { type ClassDeclarationResolver, rehydrateStyleClasses } from './StyleClassHTML.js';\n\n/**\n * The most declarations rehydrated on one element, from its `style` attribute\n * and from its classes each. Formatting needs far fewer. Input with more is not\n * formatting, and Chromium applies many distinct custom properties through the\n * CSSOM in superlinear time, so such an element keeps those styles unapplied\n * (#274).\n */\nexport const MAX_REHYDRATED_DECLARATIONS = 256;\n\n/**\n * Rehydrates the styles of parsed content HTML in cascade order: first each\n * element's own `style` attribute, then the declarations its classes stand for,\n * which only fill properties the element does not set inline (#269).\n */\nexport function rehydrateStyles(root: ParentNode, resolveClass: ClassDeclarationResolver): void {\n\trestoreInlineStyles(root);\n\trehydrateStyleClasses(root, resolveClass, MAX_REHYDRATED_DECLARATIONS);\n}\n\n/**\n * Applies `style` attributes the browser kept out of the CSSOM. Under a strict\n * CSP (`style-src-attr 'none'`) Chromium keeps the attribute text but leaves\n * `el.style` empty, even in inert template content (#272), while CSSOM writes\n * stay allowed. Without such a policy the CSSOM already holds the declarations,\n * so only an attribute the browser rejected entirely is parsed again, which\n * yields no declarations either. Afterwards the attribute holds the browser's\n * serialization, so code that needs the raw text reads it before this step.\n */\nfunction restoreInlineStyles(root: ParentNode): void {\n\tfor (const element of Array.from(root.querySelectorAll('[style]'))) {\n\t\tconst style: CSSStyleDeclaration | undefined = inlineStyleOf(element);\n\t\tif (!style || style.length > 0) continue;\n\t\tconst text: string = element.getAttribute('style') ?? '';\n\t\tif (splitDeclarations(text).length > MAX_REHYDRATED_DECLARATIONS) continue;\n\t\t// One write through the browser's own CSS parser, which reads priorities,\n\t\t// shorthands and comments as it reads the attribute on a page without a CSP.\n\t\tstyle.cssText = text;\n\t}\n}\n\n/** The CSSOM declaration of an element, unless its namespace has none. */\nfunction inlineStyleOf(element: Element): CSSStyleDeclaration | undefined {\n\treturn (element as Partial<ElementCSSInlineStyle>).style;\n}\n","/**\n * DocumentParser: converts sanitized HTML strings into immutable Document instances.\n * Pure functions — no class state, no DOM mutation beyond a temporary `<template>`.\n */\n\nimport type { BlockAlignment } from '../model/BlockAlignment.js';\nimport { hoistDisallowedBlocks } from '../model/ContentModel.js';\nimport type {\n\tBlockAttrValue,\n\tBlockNode,\n\tDocument,\n\tInlineNode,\n\tMark,\n\tTextNode,\n} from '../model/Document.js';\nimport {\n\tcreateBlockNode,\n\tcreateDocument,\n\tcreateInlineNode,\n\tcreateTextNode,\n\tgetInlineChildren,\n\tisInlineNode,\n} from '../model/Document.js';\nimport { SAFE_URI_REGEXP, normalizeHTMLId } from '../model/HTMLUtils.js';\nimport type { ParseRule } from '../model/ParseRule.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { type InlineTypeName, inlineType, nodeType } from '../model/TypeBrands.js';\nimport { readElementAlignment } from './AlignmentHTML.js';\nimport { adoptBlockId } from './BlockIdHTML.js';\nimport { VALID_DIRECTIONS } from './DocumentSerializer.js';\nimport { isHTMLBlockElement, matchHTMLParseRule, parseHTMLMarks } from './HTMLParseRules.js';\nimport { type HTMLParseSession, createHTMLParseSession } from './HTMLParseSession.js';\nimport { preserveHTMLIdSanitizeConfig, sanitizeHTML } from './HTMLSanitization.js';\nimport { normalizeHTMLWhitespace } from './HTMLWhitespace.js';\nimport { createClassDeclarationResolver } from './StyleClassHTML.js';\nimport { rehydrateStyles } from './StyleRehydration.js';\nimport {\n\tMAX_SERIALIZED_TABLE_COLUMNS,\n\tTABLE_COLUMN_WIDTH_DATA_ATTRIBUTE,\n\tTABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE,\n\tnormalizeTableColumnWidthsPx,\n\tparseTableColumnSpan,\n\treadTableDimensionPx,\n} from './TableDimensions.js';\n\n/** Options for `parseHTMLToDocument` when importing class-based HTML. */\nexport interface ParseHTMLOptions {\n\t/**\n\t * Style map from a previous `getContentHTML({ cssMode: 'classes' })` call.\n\t * Used to rehydrate class-based HTML back into styled content. Registered\n\t * style classes and notectl's alignment classes need no style map.\n\t */\n\treadonly styleMap?: ReadonlyMap<string, string>;\n}\n\n/** Parses an HTML string into a Document, applying sanitization and schema parse rules. */\nexport function parseHTMLToDocument(\n\thtml: string,\n\tregistry?: SchemaRegistry,\n\toptions?: ParseHTMLOptions,\n): Document {\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'dir', 'id'];\n\n\t// `data-block-id` carries block identity across `setContentHTML(getContentHTML())`.\n\t// Whitelist it through DOMPurify so the adoption logic below sees it.\n\tif (!allowedAttrs.includes('data-block-id')) {\n\t\tallowedAttrs.push('data-block-id');\n\t}\n\n\t// When a styleMap is provided, also allow `class` through DOMPurify\n\t// so we can read class names and rehydrate styles before parsing.\n\tif (options?.styleMap && !allowedAttrs.includes('class')) {\n\t\tallowedAttrs.push('class');\n\t}\n\n\tconst template = document.createElement('template');\n\ttemplate.innerHTML = sanitizeHTML(\n\t\thtml,\n\t\t{\n\t\t\tALLOWED_TAGS: allowedTags,\n\t\t\tALLOWED_ATTR: allowedAttrs,\n\t\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t\t\t...preserveHTMLIdSanitizeConfig(),\n\t\t},\n\t\tregistry,\n\t);\n\tconst root: DocumentFragment = template.content;\n\n\t// Make inline styles and classes readable through the CSSOM, where parse rules read them.\n\trehydrateStyles(root, createClassDeclarationResolver(registry, options?.styleMap));\n\n\t// Collapse insignificant HTML whitespace so source-formatted/indented input does\n\t// not leave stray newlines and indentation inside block text content.\n\tnormalizeHTMLWhitespace(root);\n\n\tconst session: HTMLParseSession = createHTMLParseSession(registry);\n\tconst blocks: BlockNode[] = [];\n\n\tfor (const child of Array.from(root.childNodes)) {\n\t\tparseChildNode(child, blocks, session);\n\t}\n\n\tif (blocks.length === 0) return createDocument();\n\tconst doc: Document = createDocument(blocks);\n\t// Repair schema-invalid nesting an importer may have produced (e.g. a `<table>`\n\t// inside an `<li>` builds `list_item > table`, which the flat-with-indent item\n\t// model forbids): the disallowed block is hoisted to a valid ancestor (#194).\n\treturn registry ? hoistDisallowedBlocks(doc, registry) : doc;\n}\n\n/**\n * Parses a single child node into block(s), handling all supported block types:\n * lists, tables, block parse rules (headings, blockquotes, code blocks, images, hr),\n * and fallback paragraphs. Used by both top-level parsing and table cell content parsing.\n */\nfunction parseChildNode(child: ChildNode, blocks: BlockNode[], session: HTMLParseSession): void {\n\tconst { adoptedIds, registry } = session;\n\tif (child.nodeType === Node.ELEMENT_NODE) {\n\t\tconst el = child as HTMLElement;\n\t\tconst tag: string = el.tagName.toLowerCase();\n\n\t\t// Lists need cross-element logic — handle before parse rules\n\t\tif (tag === 'ul' || tag === 'ol') {\n\t\t\tconst listType: string = tag === 'ol' ? 'ordered' : 'bullet';\n\t\t\tconst listDir: string | null = el.getAttribute('dir');\n\t\t\tconst parentDir: string | undefined =\n\t\t\t\tlistDir && VALID_DIRECTIONS.has(listDir) ? listDir : undefined;\n\t\t\tparseListElement(el, listType, 0, blocks, session, parentDir);\n\t\t\treturn;\n\t\t}\n\n\t\t// Tables produce nested block structure: table > table_row > table_cell > paragraph\n\t\tif (tag === 'table') {\n\t\t\tparseTableElement(el, blocks, session);\n\t\t\treturn;\n\t\t}\n\n\t\t// Blockquotes are container blocks (issue #136): parse their children\n\t\t// recursively into block nodes instead of flattening to inline content.\n\t\tif (tag === 'blockquote') {\n\t\t\tparseBlockquoteElement(el, blocks, session);\n\t\t\treturn;\n\t\t}\n\n\t\t// Try block parse rules\n\t\tconst match = matchHTMLParseRule(el, session.blockRules);\n\n\t\t// A paragraph cannot hold blocks. An element that resolves to `paragraph`\n\t\t// (the generic `<div>` rule or the fallback below) but wraps block-level\n\t\t// children is a transparent wrapper, the shape web pages, Google Docs and\n\t\t// Word put around their content: its children become sibling blocks\n\t\t// instead of being flattened into one inline run (#223).\n\t\tif ((match?.type ?? 'paragraph') === 'paragraph' && session.hasBlockDescendants(el)) {\n\t\t\tparseWrapperElement(el, blocks, session);\n\t\t\treturn;\n\t\t}\n\n\t\tconst spec = match ? registry?.getNodeSpec(match.type) : undefined;\n\t\tconst children: (TextNode | InlineNode)[] = spec?.isVoid\n\t\t\t? [createTextNode('')]\n\t\t\t: parseElementToInlineContent(el, session);\n\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t...(match?.attrs as Record<string, string | number | boolean> | undefined),\n\t\t};\n\t\t// Known block types only accept declared attributes. The paragraph\n\t\t// fallback retains the permissive behavior of registry-free import.\n\t\tif (!match || spec?.attrs?.align) extractAlignment(el, attrs);\n\t\tif (!match || spec?.attrs?.dir) extractDirection(el, attrs);\n\t\tblocks.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType(match?.type ?? 'paragraph'),\n\t\t\t\tchildren,\n\t\t\t\tadoptBlockId(el, adoptedIds),\n\t\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\n\t\t\t\textractHTMLId(el),\n\t\t\t),\n\t\t);\n\t} else if (child.nodeType === Node.TEXT_NODE && child.textContent?.trim()) {\n\t\tblocks.push(createBlockNode(nodeType('paragraph'), [createTextNode(child.textContent.trim())]));\n\t}\n}\n\n/**\n * Recursively parses a list element (`<ul>` or `<ol>`), creating list_item blocks\n * with correct indent depth. Handles nested lists inside `<li>` elements.\n */\nfunction parseListElement(\n\tlistEl: Element,\n\tlistType: string,\n\tdepth: number,\n\tblocks: BlockNode[],\n\tsession: HTMLParseSession,\n\tparentDir?: string,\n): void {\n\tfor (const child of Array.from(listEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\n\t\tif (tag === 'li') {\n\t\t\tconst li: HTMLElement = child as HTMLElement;\n\n\t\t\t// Check for checklist: <input type=\"checkbox\">\n\t\t\tconst checkbox: HTMLInputElement | null = li.querySelector(':scope > input[type=\"checkbox\"]');\n\t\t\tconst isChecklist: boolean = checkbox !== null;\n\t\t\tconst checked: boolean = checkbox?.hasAttribute('checked') ?? false;\n\n\t\t\tconst resolvedType: string = isChecklist ? 'checklist' : listType;\n\n\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\tlistType: resolvedType,\n\t\t\t\tindent: depth,\n\t\t\t\tchecked,\n\t\t\t};\n\n\t\t\t// Propagate direction: item's own dir > parent list dir\n\t\t\tconst liDir: string | null = li.getAttribute('dir');\n\t\t\tconst effectiveDir: string | undefined =\n\t\t\t\tliDir && VALID_DIRECTIONS.has(liDir) ? liDir : parentDir;\n\t\t\tif (effectiveDir) {\n\t\t\t\tattrs.dir = effectiveDir;\n\t\t\t}\n\n\t\t\tblocks.push(parseListItemBlock(li, attrs, checkbox, session));\n\n\t\t\t// Check for nested lists inside this <li>\n\t\t\tfor (const liChild of Array.from(li.children)) {\n\t\t\t\tconst liChildTag: string = liChild.tagName.toLowerCase();\n\t\t\t\tif (liChildTag === 'ul' || liChildTag === 'ol') {\n\t\t\t\t\tconst nestedType: string = liChildTag === 'ol' ? 'ordered' : 'bullet';\n\t\t\t\t\tconst nestedDir: string | null = liChild.getAttribute('dir');\n\t\t\t\t\tconst nestedEffectiveDir: string | undefined =\n\t\t\t\t\t\tnestedDir && VALID_DIRECTIONS.has(nestedDir) ? nestedDir : effectiveDir;\n\t\t\t\t\tparseListElement(liChild, nestedType, depth + 1, blocks, session, nestedEffectiveDir);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (tag === 'ul' || tag === 'ol') {\n\t\t\t// Direct nested list without wrapping <li> — increment depth\n\t\t\tconst nestedType: string = tag === 'ol' ? 'ordered' : 'bullet';\n\t\t\tconst nestedDir: string | null = child.getAttribute('dir');\n\t\t\tconst nestedEffectiveDir: string | undefined =\n\t\t\t\tnestedDir && VALID_DIRECTIONS.has(nestedDir) ? nestedDir : parentDir;\n\t\t\tparseListElement(child, nestedType, depth + 1, blocks, session, nestedEffectiveDir);\n\t\t}\n\t}\n}\n\n/**\n * Parses one `<li>` into its `list_item` block (#194). An item whose children\n * are inline-only stays a leaf; block-level children other than nested lists\n * (a second paragraph, code, a quote, a heading) make it a container with\n * block children. Nested `<ul>`/`<ol>` are excluded here — the caller hoists\n * them into flat siblings one indent deeper. A lone plain paragraph unwraps\n * back to a leaf so the common tight/loose single-paragraph item keeps its\n * inline shape.\n */\nfunction parseListItemBlock(\n\tli: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n\tcheckbox: HTMLInputElement | null,\n\tsession: HTMLParseSession,\n): BlockNode {\n\tconst { adoptedIds } = session;\n\tconst htmlId: string | undefined = extractHTMLId(li);\n\tconst isHoistedList = (node: ChildNode): boolean => {\n\t\tif (node.nodeType !== Node.ELEMENT_NODE) return false;\n\t\tconst tag: string = (node as Element).tagName.toLowerCase();\n\t\treturn tag === 'ul' || tag === 'ol';\n\t};\n\tconst hasBlockContent: boolean = Array.from(li.childNodes).some(\n\t\t(node) => !isHoistedList(node) && isBlockLevelChild(node, session),\n\t);\n\n\tif (!hasBlockContent) {\n\t\tconst inlineContent = parseElementToInlineContent(li, session, true);\n\t\treturn createBlockNode(\n\t\t\tnodeType('list_item'),\n\t\t\tinlineContent,\n\t\t\tadoptBlockId(li, adoptedIds),\n\t\t\tattrs,\n\t\t\thtmlId,\n\t\t);\n\t}\n\n\tconst skip = (node: ChildNode): boolean => isHoistedList(node) || node === checkbox;\n\tconst innerBlocks: BlockNode[] = parseBlockContainerChildren(li, session, skip);\n\n\t// A lone attribute-less paragraph is the leaf shape in disguise.\n\tconst only: BlockNode | undefined = innerBlocks.length === 1 ? innerBlocks[0] : undefined;\n\tif (only && only.type === 'paragraph' && !only.attrs && !only.htmlId) {\n\t\treturn createBlockNode(\n\t\t\tnodeType('list_item'),\n\t\t\tgetInlineChildren(only),\n\t\t\tadoptBlockId(li, adoptedIds),\n\t\t\tattrs,\n\t\t\thtmlId,\n\t\t);\n\t}\n\n\tif (innerBlocks.length === 0) {\n\t\treturn createBlockNode(\n\t\t\tnodeType('list_item'),\n\t\t\t[createTextNode('')],\n\t\t\tadoptBlockId(li, adoptedIds),\n\t\t\tattrs,\n\t\t\thtmlId,\n\t\t);\n\t}\n\n\treturn createBlockNode(\n\t\tnodeType('list_item'),\n\t\tinnerBlocks,\n\t\tadoptBlockId(li, adoptedIds),\n\t\tattrs,\n\t\thtmlId,\n\t);\n}\n\n/**\n * Parses a `<table>` element into nested block structure:\n * table > table_row > table_cell > paragraph.\n * Handles `<thead>`, `<tbody>`, `<tfoot>` transparently.\n */\nfunction parseTableElement(tableEl: Element, blocks: BlockNode[], session: HTMLParseSession): void {\n\tconst { adoptedIds, registry } = session;\n\tconst rows: BlockNode[] = [];\n\tconst columnWidthsPx: readonly (number | null)[] | undefined =\n\t\textractTableColumnWidthsPx(tableEl);\n\t// Like every other block, a cell takes alignment only when its spec declares it.\n\tconst cellsAlign: boolean = !registry || !!registry.getNodeSpec('table_cell')?.attrs?.align;\n\n\t// Collect <tr> elements, handling <thead>/<tbody>/<tfoot> wrappers\n\tconst rowElements: Element[] = collectTableRows(tableEl);\n\n\tfor (const trEl of rowElements) {\n\t\tconst cells: BlockNode[] = [];\n\n\t\tfor (const cellChild of Array.from(trEl.children)) {\n\t\t\tconst cellTag: string = cellChild.tagName.toLowerCase();\n\t\t\tif (cellTag !== 'td' && cellTag !== 'th') continue;\n\n\t\t\tconst cellEl: HTMLElement = cellChild as HTMLElement;\n\t\t\tconst cellContent: BlockNode[] = parseTableCellContent(cellEl, session);\n\t\t\tconst cellAttrs: Record<string, string | number | boolean> = {};\n\t\t\textractCellSpanAttrs(cellEl, cellAttrs);\n\t\t\tif (cellsAlign) extractAlignment(cellEl, cellAttrs);\n\t\t\tconst cellBlock: BlockNode = createBlockNode(\n\t\t\t\tnodeType('table_cell'),\n\t\t\t\tcellContent,\n\t\t\t\tadoptBlockId(cellEl, adoptedIds),\n\t\t\t\tObject.keys(cellAttrs).length > 0 ? cellAttrs : undefined,\n\t\t\t\textractHTMLId(cellEl),\n\t\t\t);\n\t\t\tcells.push(cellBlock);\n\t\t}\n\n\t\tconst rowAttrs: Record<string, string | number | boolean> = {};\n\t\textractTableRowMinHeight(trEl as HTMLElement, rowAttrs);\n\t\t// Preserve empty rows. Besides retaining authored table structure, an empty\n\t\t// `<tr>` may carry the canonical minimum-height metadata by itself.\n\t\trows.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('table_row'),\n\t\t\t\tcells,\n\t\t\t\tadoptBlockId(trEl, adoptedIds),\n\t\t\t\tObject.keys(rowAttrs).length > 0 ? rowAttrs : undefined,\n\t\t\t\textractHTMLId(trEl as HTMLElement),\n\t\t\t),\n\t\t);\n\t}\n\n\tif (rows.length > 0) {\n\t\tconst tableAttrs: Record<string, BlockAttrValue> = {};\n\t\textractTableBorderColor(tableEl as HTMLElement, tableAttrs);\n\t\tif (columnWidthsPx) tableAttrs.columnWidthsPx = columnWidthsPx;\n\t\tblocks.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('table'),\n\t\t\t\trows,\n\t\t\t\tadoptBlockId(tableEl, adoptedIds),\n\t\t\t\tObject.keys(tableAttrs).length > 0 ? tableAttrs : undefined,\n\t\t\t\textractHTMLId(tableEl as HTMLElement),\n\t\t\t),\n\t\t);\n\t}\n}\n\n/** Collects canonical logical column widths from direct `<colgroup>/<col>` children. */\nfunction extractTableColumnWidthsPx(tableEl: Element): readonly (number | null)[] | undefined {\n\tconst widths: (number | null)[] = [];\n\n\tfor (const child of Array.from(tableEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\t\tif (tag === 'col') {\n\t\t\tappendColumnElementWidths(child as HTMLElement, undefined, widths);\n\t\t\tcontinue;\n\t\t}\n\t\tif (tag !== 'colgroup') continue;\n\n\t\tconst groupEl: HTMLElement = child as HTMLElement;\n\t\tconst groupWidth: number | undefined = readTableColumnWidthPx(groupEl);\n\t\tconst columns: HTMLElement[] = Array.from(groupEl.children).filter(\n\t\t\t(element): element is HTMLElement => element.tagName.toLowerCase() === 'col',\n\t\t);\n\t\tif (columns.length === 0) {\n\t\t\tappendRepeatedWidth(groupWidth, parseTableColumnSpan(groupEl.getAttribute('span')), widths);\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const column of columns) appendColumnElementWidths(column, groupWidth, widths);\n\t}\n\n\treturn normalizeTableColumnWidthsPx(widths);\n}\n\nfunction appendColumnElementWidths(\n\tcolumn: HTMLElement,\n\tinheritedWidth: number | undefined,\n\twidths: (number | null)[],\n): void {\n\tconst width: number | undefined = readTableColumnWidthPx(column) ?? inheritedWidth;\n\tappendRepeatedWidth(width, parseTableColumnSpan(column.getAttribute('span')), widths);\n}\n\nfunction appendRepeatedWidth(\n\twidth: number | undefined,\n\tspan: number,\n\twidths: (number | null)[],\n): void {\n\tconst remaining: number = MAX_SERIALIZED_TABLE_COLUMNS - widths.length;\n\tconst count: number = Math.min(span, Math.max(0, remaining));\n\tfor (let index = 0; index < count; index++) widths.push(width ?? null);\n}\n\nfunction readTableColumnWidthPx(element: HTMLElement): number | undefined {\n\treturn readTableDimensionPx(element, TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE, ['width'], 'width');\n}\n\n/** Extracts one row's validated minimum height from canonical or conventional HTML. */\nfunction extractTableRowMinHeight(\n\trow: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n): void {\n\tconst minHeightPx: number | undefined = readTableDimensionPx(\n\t\trow,\n\t\tTABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE,\n\t\t['min-height', 'height'],\n\t\t'height',\n\t);\n\tif (minHeightPx !== undefined) attrs.minHeightPx = minHeightPx;\n}\n\n/** Collects `<tr>` elements from a table, traversing through `<thead>`/`<tbody>`/`<tfoot>`. */\nfunction collectTableRows(tableEl: Element): Element[] {\n\tconst rows: Element[] = [];\n\tfor (const child of Array.from(tableEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\t\tif (tag === 'tr') {\n\t\t\trows.push(child);\n\t\t} else if (tag === 'thead' || tag === 'tbody' || tag === 'tfoot') {\n\t\t\tfor (const nested of Array.from(child.children)) {\n\t\t\t\tif (nested.tagName.toLowerCase() === 'tr') {\n\t\t\t\t\trows.push(nested);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn rows;\n}\n\n/** Regex to extract the `--ntbl-bc` CSS custom property from inline styles. */\nconst BORDER_COLOR_RE = /--ntbl-bc:\\s*(#[0-9a-fA-F]{3,8}|transparent)/;\n\n/** Extracts `borderColor` from a table element's inline style (`--ntbl-bc` CSS variable). */\nfunction extractTableBorderColor(el: HTMLElement, attrs: Record<string, BlockAttrValue>): void {\n\tconst style: string = el.getAttribute('style') ?? '';\n\tconst match: RegExpMatchArray | null = BORDER_COLOR_RE.exec(style);\n\tif (!match?.[1]) return;\n\tattrs.borderColor = match[1] === 'transparent' ? 'none' : match[1];\n}\n\n/** Extracts `colspan` and `rowspan` attributes from a table cell element. */\nfunction extractCellSpanAttrs(\n\tel: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n): void {\n\tconst colspan: string | null = el.getAttribute('colspan');\n\tif (colspan) {\n\t\tconst value: number = parseTableColumnSpan(colspan);\n\t\tif (value > 1) attrs.colspan = value;\n\t}\n\tconst rowspan: string | null = el.getAttribute('rowspan');\n\tif (rowspan) {\n\t\tconst value: number = parseTableColumnSpan(rowspan);\n\t\tif (value > 1) attrs.rowspan = value;\n\t}\n}\n\n/**\n * Parses a `<blockquote>` into a container block whose children are block nodes\n * (issue #136). Block-level children (lists, paragraphs, headings, nested quotes)\n * are parsed recursively; a quote holding only inline content becomes a single\n * paragraph child so the container invariant (block children only) always holds.\n */\nfunction parseBlockquoteElement(\n\tel: HTMLElement,\n\tblocks: BlockNode[],\n\tsession: HTMLParseSession,\n): void {\n\tconst innerBlocks: BlockNode[] = parseBlockContainerChildren(el, session);\n\n\t// Empty or whitespace-only blockquote: keep a single empty paragraph so the\n\t// container always holds editable content.\n\tif (innerBlocks.length === 0) {\n\t\tinnerBlocks.push(createBlockNode(nodeType('paragraph'), [createTextNode('')]));\n\t}\n\n\t// Preserve direction/alignment on the container so the HTML round-trip is stable.\n\tconst attrs: Record<string, string | number | boolean> = {};\n\textractAlignment(el, attrs);\n\textractDirection(el, attrs);\n\n\tblocks.push(\n\t\tcreateBlockNode(\n\t\t\tnodeType('blockquote'),\n\t\t\tinnerBlocks,\n\t\t\tadoptBlockId(el, session.adoptedIds),\n\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\n\t\t\textractHTMLId(el),\n\t\t),\n\t);\n}\n\n/** Parses a table cell's content into blocks, supporting all block types (lists, quotes, etc.). */\nfunction parseTableCellContent(cellEl: HTMLElement, session: HTMLParseSession): BlockNode[] {\n\tconst cellBlocks: BlockNode[] = parseBlockContainerChildren(cellEl, session);\n\n\t// No blocks produced: treat the cell as one empty paragraph.\n\tif (cellBlocks.length === 0) {\n\t\tcellBlocks.push(createBlockNode(nodeType('paragraph'), [createTextNode('')]));\n\t}\n\n\treturn cellBlocks;\n}\n\n/**\n * Parses the children of a block container (blockquote, table cell, multi-block\n * list item, transparent wrapper) into block nodes. Consecutive inline content\n * (text nodes and inline elements such as\n * `<em>`, `<strong>`, `<a>`) is coalesced into a single paragraph with its marks\n * intact, while genuine block children (paragraphs, headings, lists, tables,\n * nested blockquotes) are parsed recursively. This preserves the common quote\n * shape that mixes text with inline marks as one paragraph (issue #141).\n */\nfunction parseBlockContainerChildren(\n\tel: HTMLElement,\n\tsession: HTMLParseSession,\n\tskip?: (node: ChildNode) => boolean,\n): BlockNode[] {\n\tconst blocks: BlockNode[] = [];\n\tlet inlineRun: ChildNode[] = [];\n\n\tconst flushInlineRun = (): void => {\n\t\tif (inlineRunHasContent(inlineRun)) {\n\t\t\tblocks.push(\n\t\t\t\tcreateBlockNode(nodeType('paragraph'), parseNodesToInlineContent(inlineRun, session)),\n\t\t\t);\n\t\t}\n\t\tinlineRun = [];\n\t};\n\n\tfor (const child of Array.from(el.childNodes)) {\n\t\tif (skip?.(child)) continue;\n\t\tif (isBlockLevelChild(child, session)) {\n\t\t\tflushInlineRun();\n\t\t\tparseChildNode(child, blocks, session);\n\t\t} else {\n\t\t\tinlineRun.push(child);\n\t\t}\n\t}\n\tflushInlineRun();\n\n\treturn blocks;\n}\n\n/**\n * Both blocks and transparent wrappers around blocks end an inline run.\n * Ordinary inline elements and atomic inline nodes stay inside that run.\n */\nfunction isBlockLevelChild(node: ChildNode, session: HTMLParseSession): boolean {\n\tif (node.nodeType !== Node.ELEMENT_NODE) return false;\n\tconst el = node as HTMLElement;\n\treturn (\n\t\tisHTMLBlockElement(el, session.blockRules, session.inlineRules) ||\n\t\tsession.hasBlockDescendants(el)\n\t);\n}\n\n/**\n * Parses a transparent wrapper (a `<div>` or an unknown element around\n * block-level children) into the blocks it wraps (#223). The wrapper itself\n * yields no block, so its `id` is not adopted as an `htmlId` (wrapper-only\n * elements never own one). Its `dir` and `text-align`, which CSS inherits into\n * every child, are carried onto child blocks that accept the attribute but do\n * not set their own.\n */\nfunction parseWrapperElement(\n\tel: HTMLElement,\n\tblocks: BlockNode[],\n\tsession: HTMLParseSession,\n): void {\n\tconst inherited: Record<string, string | number | boolean> = {};\n\textractAlignment(el, inherited);\n\textractDirection(el, inherited);\n\n\tconst innerBlocks: BlockNode[] = parseBlockContainerChildren(el, session);\n\tfor (const block of innerBlocks) {\n\t\tblocks.push(inheritBlockAttrs(block, inherited, session.registry));\n\t}\n}\n\n/**\n * Returns the block extended with every inherited attribute it accepts but does\n * not set itself. With a registry, a block accepts an attribute only when its\n * NodeSpec declares it (mirroring the block parse rule path); without one, all\n * attributes are accepted (mirroring the paragraph fallback path).\n */\nfunction inheritBlockAttrs(\n\tblock: BlockNode,\n\tinherited: Record<string, string | number | boolean>,\n\tregistry?: SchemaRegistry,\n): BlockNode {\n\tconst spec = registry?.getNodeSpec(block.type);\n\tconst attrs: Record<string, BlockAttrValue> = { ...block.attrs };\n\tlet changed = false;\n\tfor (const [name, value] of Object.entries(inherited)) {\n\t\tif (attrs[name] !== undefined) continue;\n\t\tif (registry && !spec?.attrs?.[name]) continue;\n\t\tattrs[name] = value;\n\t\tchanged = true;\n\t}\n\tif (!changed) return block;\n\treturn createBlockNode(block.type, block.children, block.id, attrs, block.htmlId);\n}\n\n/** Whether an inline run carries meaningful content (non-whitespace text or any element). */\nfunction inlineRunHasContent(nodes: readonly ChildNode[]): boolean {\n\tfor (const node of nodes) {\n\t\tif (node.nodeType === Node.ELEMENT_NODE) return true;\n\t\tif (node.nodeType === Node.TEXT_NODE && node.textContent?.trim()) return true;\n\t}\n\treturn false;\n}\n\n/**\n * Parses an HTML element's inline children into (TextNode | InlineNode)[].\n * Applies mark parse rules and inline node parse rules.\n */\nfunction parseElementToInlineContent(\n\tel: HTMLElement,\n\tsession: HTMLParseSession,\n\tskipNestedLists?: boolean,\n): (TextNode | InlineNode)[] {\n\treturn parseNodesToInlineContent([el], session, skipNestedLists);\n}\n\n/**\n * Walks a list of sibling DOM nodes into inline content, applying mark and\n * inline-node parse rules. DOM ancestors retain the formatting of transparent\n * wrappers even after those wrappers cease to be model blocks. Mixed text and\n * inline elements still coalesce into one sequence with their own marks intact.\n */\nfunction parseNodesToInlineContent(\n\tnodes: readonly ChildNode[],\n\tsession: HTMLParseSession,\n\tskipNestedLists?: boolean,\n): (TextNode | InlineNode)[] {\n\tconst result: (TextNode | InlineNode)[] = [];\n\tfor (const node of nodes) {\n\t\twalkElement(\n\t\t\tnode,\n\t\t\tsession.ancestorMarks(node),\n\t\t\tresult,\n\t\t\tsession.markRules,\n\t\t\tsession.inlineRules,\n\t\t\tskipNestedLists,\n\t\t);\n\t}\n\n\t// A lone <br> as the only content of a block is a placeholder for an empty\n\t// paragraph (e.g. `<p><br></p>`), not a real hard break. Normalize to empty text.\n\tif (result.length === 1 && isInlineNode(result[0]) && result[0].inlineType === 'hard_break') {\n\t\treturn [createTextNode('')];\n\t}\n\n\treturn result.length > 0 ? result : [createTextNode('')];\n}\n\n/**\n * Recursively walks DOM nodes, collecting marks from parse rules,\n * matching inline node parse rules, and producing TextNodes/InlineNodes.\n */\nfunction walkElement(\n\tnode: Node,\n\tcurrentMarks: readonly Mark[],\n\tresult: (TextNode | InlineNode)[],\n\tmarkRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tinlineRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tskipNestedLists?: boolean,\n): void {\n\tif (node.nodeType === Node.TEXT_NODE) {\n\t\tconst text: string = node.textContent ?? '';\n\t\tif (text) {\n\t\t\tresult.push(createTextNode(text, [...currentMarks]));\n\t\t}\n\t\treturn;\n\t}\n\n\tif (node.nodeType !== Node.ELEMENT_NODE) return;\n\n\tconst el = node as HTMLElement;\n\tconst tag: string = el.tagName.toLowerCase();\n\n\t// Skip nested lists inside <li> (handled by parseListElement)\n\tif (skipNestedLists && (tag === 'ul' || tag === 'ol')) return;\n\n\t// Skip checkbox inputs inside list items (already handled by parseListElement)\n\tif (skipNestedLists && tag === 'input' && el.getAttribute('type') === 'checkbox') return;\n\n\t// Inline nodes are atomic and take precedence over descendant markup.\n\tconst inlineMatch = matchHTMLParseRule(el, inlineRules);\n\tif (inlineMatch) {\n\t\tresult.push(\n\t\t\tcreateInlineNode(\n\t\t\t\tinlineType(inlineMatch.type) as InlineTypeName,\n\t\t\t\tinlineMatch.attrs as Readonly<Record<string, string | number | boolean>> | undefined,\n\t\t\t\tcurrentMarks,\n\t\t\t),\n\t\t);\n\t\treturn;\n\t}\n\n\tconst marks: Mark[] = parseHTMLMarks(el, currentMarks, markRules);\n\tfor (const child of Array.from(el.childNodes)) {\n\t\twalkElement(child, marks, result, markRules, inlineRules, skipNestedLists);\n\t}\n}\n\n/** Extracts a validated `dir` attribute or inline `direction` style from an element. */\nfunction extractDirection(el: HTMLElement, attrs: Record<string, string | number | boolean>): void {\n\tconst dir: string | null = el.getAttribute('dir');\n\tif (dir && VALID_DIRECTIONS.has(dir)) {\n\t\tattrs.dir = dir;\n\t\treturn;\n\t}\n\n\t// Fallback: check inline style `direction: rtl/ltr` (common in paste from Word/Docs)\n\tconst styleDir: string = el.style?.direction ?? '';\n\tif (styleDir && VALID_DIRECTIONS.has(styleDir)) {\n\t\tattrs.dir = styleDir;\n\t}\n}\n\n/** Reads a conforming document-local HTML target from a block element. */\nfunction extractHTMLId(el: HTMLElement): string | undefined {\n\treturn normalizeHTMLId(el.getAttribute('id'));\n}\n\n/**\n * Adds the element's validated alignment to attrs: its inline `text-align`,\n * which rehydration also derives from alignment classes.\n */\nfunction extractAlignment(el: HTMLElement, attrs: Record<string, string | number | boolean>): void {\n\tconst align: BlockAlignment | undefined = readElementAlignment(el);\n\tif (align) attrs.align = align;\n}\n"],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- import{i as t}from"./TypeBrands-Ch9856Gb.mjs";import{i as e,n as o,r as n,t as i}from"./AttributedMarkCommands-DKHuhZA7.mjs";import{c as s,n as r,o as a}from"./PluginHelpers-B3gk3VB3.mjs";import{c as l,n as c}from"./StyleRuntime-C0RSqKzG.mjs";import{r as m}from"./ColorValidation-ZBKZ_gTr.mjs";import{n as f,t as p}from"./InlineStyleMarkSpec-BhfGgfH9.mjs";import{t as d}from"./StyleClassNames-BsAx7k5T.mjs";var h={label:"Font",tooltip:"Font Family"},g=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-DahJwMI9.mjs"),"./locales/de.ts":()=>import("./de-DiPz7abS.mjs"),"./locales/es.ts":()=>import("./es-CCQFu1t1.mjs"),"./locales/fr.ts":()=>import("./fr-BwWrFThE.mjs"),"./locales/hi.ts":()=>import("./hi-B-ZuX4aN.mjs"),"./locales/pt.ts":()=>import("./pt-Dg2ctkug.mjs"),"./locales/ru.ts":()=>import("./ru-DJMpeuey.mjs"),"./locales/zh.ts":()=>import("./zh-CRsDvfPR.mjs")});async function u(t){return s(g,t,h)}var y={type:"font",rank:6,valueAttr:"family",domStyleProperty:"fontFamily",cssProperty:"font-family",validate:m,transformParsed:t=>t.replace(/"/g,"'")},v=class{id="font";name="Font";priority=22;config;locale;injectedStyleElement=null;context=null;constructor(t){this.config=t}async init(t){this.locale=await a(t,this.config.locale,h,u),t.registerStyleSheet(".notectl-toolbar-btn--font{min-width:100px;max-width:160px}.notectl-font-picker{min-width:200px;max-height:320px;overflow-y:auto}.notectl-font-picker__list{padding:4px 0}.notectl-font-picker__item{cursor:pointer;width:100%;color:var(--notectl-fg);text-align:start;white-space:nowrap;background:0 0;border:none;align-items:center;gap:8px;padding:7px 12px;font-family:inherit;font-size:14px;line-height:1.4;transition:background .1s;display:flex}@media (hover:hover){.notectl-font-picker__item:hover{background:var(--notectl-hover-bg)}}.notectl-font-picker__item--active{background:var(--notectl-active-bg);color:var(--notectl-accent-fg)}@media (hover:hover){.notectl-font-picker__item--active:hover{background:var(--notectl-active-bg)}}.notectl-font-picker__check{width:16px;color:var(--notectl-accent-fg);flex-shrink:0;justify-content:center;align-items:center;font-size:13px;font-weight:600;display:inline-flex}.notectl-font-picker__label{flex:1}.notectl-font-picker__separator{background:var(--notectl-border);height:1px;margin:4px 8px}"),this.context=t,this.registerMarkSpec(t),this.registerStyleClasses(t),this.registerCommands(t),this.config.fonts.length>0&&this.registerToolbarItem(t),this.injectFontFaces()}destroy(){this.injectedStyleElement?.remove(),this.injectedStyleElement=null,this.context=null}registerMarkSpec(t){const e=this.config.fonts.map(t=>t.family);t.registerMarkSpec(p({...y,knownValues:e}))}registerStyleClasses(t){d(t,"FontPlugin",this.config.styleClasses,t=>f(y.cssProperty,this.familyOf(t)))}familyOf(t){const e=this.config.fonts.find(e=>e.name===t);if(e)return e.family;const o=this.config.fonts.map(t=>`"${t.name}"`).join(", ")||"none";throw new TypeError(`"${t}" is not the name of a configured font; configured: ${o}.`)}registerCommands(t){t.registerCommand("removeFont",()=>{const e=t.getState();return this.removeFont(t,e)}),t.registerCommand("setFont",()=>!1)}get defaultFont(){if(this.config.defaultFont){const t=this.config.fonts.find(t=>t.name===this.config.defaultFont);if(t)return t}return this.config.fonts[0]}registerToolbarItem(t){t.registerToolbarItem({id:"font",group:"format",label:this.locale.label,tooltip:this.locale.tooltip,command:"removeFont",popupType:"combobox",getLabel:t=>this.resolveFontName(this.getActiveFont(t)),renderPopup:(t,e,o)=>{this.renderFontPopup(t,e,o)},isActive:t=>this.isFontActive(t)})}resolveFontName(t){return t?this.config.fonts.find(e=>e.family===t)?.name??(t.split(",")[0]??"").trim().replace(/['"]/g,""):this.defaultFont?.name??this.locale.label}isFontActive(t){return n(t,"font")}getActiveFont(t){return o(t,"font",t=>t.attrs.family??null)}applyFont(e,o,n){const s={type:t("font"),attrs:{family:n}};return r(e,i(o,s))}removeFont(o,n){return r(o,e(n,t("font")))}injectFontFaces(){const t=[];for(const n of this.config.fonts)if(n.fontFaces?.length)for(const e of n.fontFaces){const o=[`font-family: '${(n.family.split(",")[0]??"").trim().replace(/['"]/g,"")}'`,`src: ${e.src}`];e.weight&&o.push(`font-weight: ${e.weight}`),e.style&&o.push(`font-style: ${e.style}`),o.push(`font-display: ${e.display??"swap"}`),t.push(`@font-face {\n\t${o.join(";\n\t")};\n}`)}if(0===t.length)return;const e=document.createElement("style");e.setAttribute("data-notectl-fonts","");const o=this.context?c(this.context.getContainer()):void 0;o&&e.setAttribute("nonce",o),e.textContent=t.join("\n\n"),document.head.appendChild(e),this.injectedStyleElement=e}renderFontPopup(t,e,o){t.classList.add("notectl-font-picker");const n=e.getState(),i=this.getActiveFont(n),s=this.defaultFont?.family,r=e.getContainer(),a=document.createElement("div");a.className="notectl-font-picker__list",a.setAttribute("role","listbox"),a.setAttribute("aria-label",this.locale.label);for(const l of this.config.fonts){const t=void 0!==s&&l.family===s,n=t&&!i||i===l.family,c=this.createFontItem(l.name,l.family,n,()=>{t?e.executeCommand("removeFont"):this.applyFont(e,e.getState(),l.family),o({restoreFocusTo:r})});l.category&&c.setAttribute("data-category",l.category),a.appendChild(c)}t.appendChild(a)}createFontItem(t,e,o,n){const i=document.createElement("button");i.type="button",i.className="notectl-font-picker__item",i.setAttribute("role","option"),i.setAttribute("aria-selected",String(o)),o&&i.classList.add("notectl-font-picker__item--active");const s=document.createElement("span");s.className="notectl-font-picker__check",s.textContent=o?"✓":"",i.appendChild(s);const r=document.createElement("span");return r.className="notectl-font-picker__label",r.textContent=t,e&&l(r,"fontFamily",e),i.appendChild(r),i.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),i.addEventListener("click",n),i}};export{h as n,u as r,v as t};
2
- //# sourceMappingURL=FontPlugin-BcXNFqqO.mjs.map
@@ -1,2 +0,0 @@
1
- import{J as t,P as e,V as n,k as o,z as i}from"./Document-ssR6hBzG.mjs";import{c as r,d as s,f as c,p as a}from"./Selection-DC6AOGgF.mjs";import{i as l}from"./TypeBrands-Ch9856Gb.mjs";import{i as f,n as u,r as d,t as p}from"./AttributedMarkCommands-DKHuhZA7.mjs";import{c as m,n as h,o as k}from"./PluginHelpers-B3gk3VB3.mjs";import{c as g}from"./StyleRuntime-C0RSqKzG.mjs";import{i as z}from"./ColorValidation-ZBKZ_gTr.mjs";import{n as b,t as S}from"./InlineStyleMarkSpec-BhfGgfH9.mjs";import{t as v}from"./StyleClassNames-BsAx7k5T.mjs";var x={label:"Font Size",tooltip:"Font Size",customFontSizeAria:"Custom font size",fontSizesAria:"Font sizes"},y=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BzqAYGER.mjs"),"./locales/de.ts":()=>import("./de-C-Yf378-.mjs"),"./locales/es.ts":()=>import("./es-CUKJujcb.mjs"),"./locales/fr.ts":()=>import("./fr-D0MDdoir.mjs"),"./locales/hi.ts":()=>import("./hi-B2uhiPCN.mjs"),"./locales/pt.ts":()=>import("./pt-BCXgUDiU.mjs"),"./locales/ru.ts":()=>import("./ru-DV-lgEtM.mjs"),"./locales/zh.ts":()=>import("./zh-oZl1P_p0.mjs")});async function _(t){return m(y,t,x)}function w(t){return void 0!==t?.attrs?.fontSize}function I(n){const o=n.selection;if(s(o)){const t=n.getBlock(o.nodeId);return t&&w(n.schema.getNodeSpec?.(t.type))?{kind:"block",path:n.getNodePath(o.nodeId)??[o.nodeId],attrs:t.attrs??{}}:null}const a=function(n){const o=n.selection;if(!c(o)||r(o))return null;if(o.anchor.blockId!==o.head.blockId)return null;const s=Math.min(o.anchor.offset,o.head.offset);if(Math.max(o.anchor.offset,o.head.offset)-s!==1)return null;const a=n.getBlock(o.anchor.blockId);if(!a)return null;for(const{child:r,from:c}of t(e(a)))if(c===s&&i(r))return{node:r,blockId:o.anchor.blockId,offset:s};return null}(n);return a&&w(n.schema.getInlineNodeSpec?.(a.node.inlineType))?{kind:"inline",blockId:a.blockId,offset:a.offset,attrs:a.node.attrs}:null}function N(t){const e=t?.fontSize;return"string"==typeof e&&e.length>0?e:null}function C(t,e){return{...t??{},fontSize:e}}function A(t){return N(t.attrs)}function j(t,e,n,o){const i=e.transaction("command");return"block"===n.kind?i.setNodeAttr(n.path,C(n.attrs,o)):i.setInlineNodeAttr(n.blockId,n.offset,C(n.attrs,o)),t.dispatch(i.build()),!0}var E=l("fontSize");function F(t){const e=t.selection;if(!c(e))return[];const n=t.getBlockOrder(),i=a(e,n),r=n.indexOf(i.from.blockId),s=n.indexOf(i.to.blockId),l=[];for(let c=r;c<=s;c++){const e=n[c];if(!e)continue;const a=t.getBlock(e);if(!a)continue;const f=c===r?i.from.offset:0,u=c===s?i.to.offset:o(a);w(t.schema.getNodeSpec?.(a.type))?l.push({kind:"blockNode",path:t.getNodePath(e)??[e],attrs:a.attrs??{}}):f!==u&&T(t,a,e,f,u,l)}return l}function T(t,o,i,r,s,c){let a,l=0,f=!1;for(const u of e(o))if(n(u)){const t=l+u.text.length;u.text.length>0&&t>r&&l<s&&(f=!0,a||(a=u.marks.find(t=>t.type===E))),l=t}else l>=r&&l<s&&w(t.schema.getInlineNodeSpec?.(u.inlineType))&&c.push({kind:"inlineNode",blockId:i,offset:l,attrs:u.attrs}),l+=1;f&&c.push({kind:"text",blockId:i,from:r,to:s,mark:a})}function M(t,e,n){const o=F(e);if(0===o.length)return!1;const i=e.transaction("command");let r=!1;for(const s of o){if("text"===s.kind){""===n?s.mark&&(i.removeMark(s.blockId,s.from,s.to,s.mark),r=!0):(s.mark&&i.removeMark(s.blockId,s.from,s.to,s.mark),i.addMark(s.blockId,s.from,s.to,{type:E,attrs:{size:n}}),r=!0);continue}const t=N(s.attrs);n===t||""===n&&null===t||("blockNode"===s.kind?i.setNodeAttr(s.path,C(s.attrs,n)):i.setInlineNodeAttr(s.blockId,s.offset,C(s.attrs,n)),r=!0)}return!!r&&(i.setSelection(e.selection),t.dispatch(i.build()),!0)}function P(t){const e=F(t).filter(t=>"text"!==t.kind).map(t=>t.attrs);return 0===e.length?null:new Set(e.map(t=>N(t)??""))}function L(t){return`${t}px`}function D(t,e){const n=function(t){const e=I(t);if(e)return A(e);const n=P(t);if(n&&1===n.size){const[t]=n;if(t)return t}return u(t,"fontSize",t=>t.attrs.size??null)}(t);if(!n)return e;const o=Number.parseInt(n,10);return Number.isNaN(o)?e:o}function O(t,e,n){const o=I(e);if(o)return j(t,e,o,n);const i=e.selection;if(!c(i))return!1;if(r(i)){const o={type:l("fontSize"),attrs:{size:n}};return h(t,p(e,o))}return M(t,e,n)}function B(t,e){const n=I(e);if(n)return null!==A(n)&&j(t,e,n,"");const o=e.selection;return!!c(o)&&(r(o)?h(t,f(e,l("fontSize"))):M(t,e,""))}function $(t,e,n,o,i){const r=function(t,e,n){if("up"===e){for(const e of n)if(e>t)return e;return null}for(let o=n.length-1;o>=0;o--){const e=n[o];if(void 0!==e&&e<t)return e}return null}(D(e,i),n,o);return null!==r&&(r===i?B(t,e):O(t,e,L(r)))}function V(t,e,n){e===n?t.executeCommand("removeFontSize"):O(t,t.getState(),L(e))}function K(t,e){const n=document.createElement("button");n.type="button",n.id=`notectl-font-size-option-${t}`,n.className="notectl-font-size-picker__item",n.setAttribute("role","option"),n.setAttribute("aria-selected",String(e)),e&&n.classList.add("notectl-font-size-picker__item--active");const o=document.createElement("span");o.className="notectl-font-size-picker__check",o.textContent=e?"✓":"",n.appendChild(o);const i=document.createElement("span");return i.className="notectl-font-size-picker__label",i.textContent=String(t),n.appendChild(i),n}var q=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,64,72,96],H={type:"fontSize",rank:4,valueAttr:"size",domStyleProperty:"fontSize",cssProperty:"font-size",validate:z},J=/^[1-9]\d*$/,R=class{id="fontSize";name="Font Size";priority=21;config;sizes;defaultSize;locale;constructor(t){var e;this.config={...t},this.sizes=function(t){if(!t||0===t.length)return q;const e=[...new Set(t)].filter(t=>Number.isInteger(t)&&t>0);return e.sort((t,e)=>t-e),e.length>0?e:q}(t?.sizes),this.defaultSize=(e=t?.defaultSize,void 0===e?16:Number.isInteger(e)&&e>0?e:16)}async init(t){this.locale=await k(t,this.config.locale,x,_),t.registerStyleSheet(".notectl-toolbar-btn--fontSize{min-width:60px;max-width:80px}.notectl-font-size-picker{flex-direction:column;min-width:140px;display:flex}.notectl-font-size-picker__input-wrapper{padding:8px 8px 4px}.notectl-font-size-picker__input{border:1px solid var(--notectl-border);width:100%;color:var(--notectl-fg);background:var(--notectl-surface-overlay);box-sizing:border-box;-moz-appearance:textfield;border-radius:4px;outline:none;padding:6px 8px;font-family:inherit;font-size:13px}.notectl-font-size-picker__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.notectl-font-size-picker__input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.notectl-font-size-picker__input:focus{border-color:var(--notectl-border-focus);box-shadow:0 0 0 2px var(--notectl-focus-ring)}.notectl-font-size-picker__list{max-height:280px;padding:4px 0;overflow-y:auto}.notectl-font-size-picker__item{cursor:pointer;width:100%;color:var(--notectl-fg);text-align:start;white-space:nowrap;background:0 0;border:none;outline:none;align-items:center;gap:8px;padding:7px 12px;font-family:inherit;font-size:14px;line-height:1.4;transition:background .1s;display:flex}@media (hover:hover){.notectl-font-size-picker__item:hover{background:var(--notectl-hover-bg)}}.notectl-font-size-picker__item--active{background:var(--notectl-active-bg);color:var(--notectl-accent-fg)}@media (hover:hover){.notectl-font-size-picker__item--active:hover{background:var(--notectl-active-bg)}}.notectl-font-size-picker__item--focused{outline:2px solid var(--notectl-primary);outline-offset:-2px}.notectl-font-size-picker__check{width:16px;color:var(--notectl-accent-fg);flex-shrink:0;justify-content:center;align-items:center;font-size:13px;font-weight:600;display:inline-flex}.notectl-font-size-picker__label{flex:1}"),this.registerMarkSpec(t),this.registerStyleClasses(t),this.registerCommands(t),this.registerKeymaps(t),this.registerToolbarItem(t),this.applyDefaultSizeToContainer(t)}destroy(){}registerMarkSpec(t){t.registerMarkSpec(S(H))}registerStyleClasses(t){v(t,"FontSizePlugin",this.config.styleClasses,t=>b(H.cssProperty,L(function(t){if(!J.test(t))throw new TypeError(`"${t}" is not a font size; use whole pixel numbers such as 18.`);return Number(t)}(t))))}registerCommands(t){t.registerCommand("removeFontSize",()=>B(t,t.getState())),t.registerCommand("setFontSize",()=>!1),t.registerCommand("increaseFontSize",()=>$(t,t.getState(),"up",this.sizes,this.defaultSize)),t.registerCommand("decreaseFontSize",()=>$(t,t.getState(),"down",this.sizes,this.defaultSize))}registerKeymaps(t){t.registerKeymap({"Mod-Shift-+":()=>$(t,t.getState(),"up",this.sizes,this.defaultSize),"Mod-Shift-_":()=>$(t,t.getState(),"down",this.sizes,this.defaultSize)})}registerToolbarItem(t){t.registerToolbarItem({id:"fontSize",group:"format",label:this.locale.label,tooltip:this.locale.tooltip,command:"removeFontSize",popupType:"combobox",getLabel:t=>String(D(t,this.defaultSize)),renderPopup:(t,e,n)=>{!function(t,e,n){t.classList.add("notectl-font-size-picker");const o=D(e.getState(),n.defaultSize),i=function(t,e){const n=document.createElement("input");return n.type="number",n.className="notectl-font-size-picker__input",n.min=String(1),n.max=String(400),n.value=String(t),n.setAttribute("aria-label",e.locale.customFontSizeAria),n}(o,n);!function(t,e){const n=document.createElement("div");n.className="notectl-font-size-picker__input-wrapper",n.appendChild(e),t.appendChild(n)}(t,i);const{list:r,items:s}=function(t,e,n,o){const i=document.createElement("div");i.className="notectl-font-size-picker__list",i.setAttribute("role","listbox"),i.setAttribute("aria-label",o.locale.fontSizesAria);const r=[];for(const s of t){const t=K(s,s===e);t.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),t.addEventListener("click",()=>{V(n,s,o.defaultSize),o.onClose({restoreFocusTo:o.contentElement})}),r.push(t),i.appendChild(t)}return{list:i,items:r}}(n.sizes,o,e,n);t.appendChild(r),function(t,e,n,o){const i=e.indexOf(n);if(i<0)return;const r=t[i];r&&(requestAnimationFrame(()=>{r.scrollIntoView({block:"nearest"})}),o.setAttribute("aria-activedescendant",r.id))}(s,n.sizes,o,r),function(t,e,n,o,i){let r=-1;const s=t=>{r>=0&&r<n.length&&n[r]?.classList.remove("notectl-font-size-picker__item--focused"),r=t;const o=n[r];r>=0&&r<n.length&&o&&(o.classList.add("notectl-font-size-picker__item--focused"),o.scrollIntoView({block:"nearest"}),e.setAttribute("aria-activedescendant",o.id))},c=t=>{t.preventDefault(),t.stopPropagation()};t.addEventListener("keydown",e=>{if("Enter"===e.key){c(e);const n=Number.parseInt(t.value,10);!Number.isNaN(n)&&n>=1&&n<=400&&(V(o,n,i.defaultSize),i.onClose({restoreFocusTo:i.contentElement}))}else"ArrowDown"===e.key?(c(e),s(0),n[0]?.focus()):"Escape"===e.key&&(c(e),i.onClose({restoreFocusTo:i.contentElement}))}),e.addEventListener("keydown",e=>{"ArrowDown"===e.key?(c(e),r<n.length-1&&(s(r+1),n[r]?.focus())):"ArrowUp"===e.key?(c(e),r>0?(s(r-1),n[r]?.focus()):(s(-1),t.focus())):"Enter"===e.key?(c(e),n[r]?.click()):"Escape"===e.key&&(c(e),i.onClose({restoreFocusTo:i.contentElement}))})}(i,r,s,e,n)}(t,e,{sizes:this.sizes,defaultSize:this.defaultSize,onClose:n,contentElement:e.getContainer(),locale:this.locale})},isActive:t=>function(t){const e=I(t);if(e)return null!==A(e);const n=P(t);return!(!n||![...n].some(t=>t.length>0))||d(t,"fontSize")}(t)})}applyDefaultSizeToContainer(t){const e=t.getContainer();g(e,"fontSize",`${this.defaultSize}px`)}};export{x as n,_ as r,R as t};
2
- //# sourceMappingURL=FontSizePlugin-Dswra3oU.mjs.map
@@ -1,2 +0,0 @@
1
- import{J as t,P as e,g as n,p as i,z as a}from"./Document-ssR6hBzG.mjs";import{c as r,d as o,f as l,i as s,n as c,u as p}from"./Selection-DC6AOGgF.mjs";import{a as u,r as d}from"./TypeBrands-Ch9856Gb.mjs";import{o as m}from"./BlockInsertion-CXfXqUZl.mjs";import{n as h}from"./HTMLSanitization-Ce9dVT1q.mjs";import{c as f,o as b}from"./PluginHelpers-B3gk3VB3.mjs";import{n as g}from"./SelectionReplacement-vC1xhFS0.mjs";import{n as v}from"./DomUtils-Bf7JLFlx.mjs";import{t as x}from"./SelectionSync-BkjCwGp-.mjs";import{a as y}from"./PopupPositioning-CIqgpqlW.mjs";import{i as w}from"./ColorValidation-ZBKZ_gTr.mjs";var L={"&":"&amp;","<":"&lt;",">":"&gt;"},k={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function S(t){return t.replace(/[&<>]/g,t=>L[t]??t)}function C(t){return t.replace(/[&<>"]/g,t=>k[t]??t)}function $(t){if(!t)return"";let e="";for(const[n,i]of Object.entries(t))!1!==i&&null!=i&&(e+=!0!==i?` ${n}="${C(String(i))}"`:` ${n}="true"`);return e}function A(t,e,n){return`<${t}${$(n)}>${e}</${t}>`}function z(t,e){return A("mi",S(t),e)}function _(t,e){return A("mn",S(t),e)}function E(t,e){return A("mo",S(t),e)}function B(t,e){return A("mtext",S(t),e)}function I(t){return function(t,e){return`<${t}${$(e)}></${t}>`}("mspace",t)}function O(t,e){return A("mrow",t,e)}function P(t){return 0===t.length?"":1===t.length?t[0]??"":O(t.join(""))}function D(t,e,n){return A("mfrac",`${t}${e}`,n)}function N(t,e,n){return A("mover",`${t}${e}`,n)}function F(t,e,n){return A("munder",`${t}${e}`,n)}function q(t){return A("mtd",t)}function R(t){return A("mtr",t.map(q).join(""))}var T={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'","&#39;":"'"};function j(t){const e=t.display?"block":"inline",n=t.alt?` alttext="${C(t.alt)}"`:"",i=void 0!==t.latex&&""!==t.latex,a=`<annotation encoding="application/x-tex">${S(t.latex??"")}</annotation>`;return`<math display="${e}"${n}>${i?`<semantics>${t.presentation}${a}</semantics>`:t.presentation}</math>`}function M(t){const e=t.match(/<annotation\b[^>]*\bencoding=["']application\/x-tex["'][^>]*>([\s\S]*?)<\/annotation>/i);var n;if(e&&void 0!==e[1])return(n=e[1],n.replace(/&(?:amp|lt|gt|quot|apos|#39);/g,t=>T[t]??t)).trim()}function H(t){return t.replace(/^(<math\b[^>]*?)\s+mathsize=(?:"[^"]*"|'[^']*')/i,"$1")}var G=/<math[\s>]/i;function U(t){return G.test(t.mathml)?function(t,e){const n=t.replace(/^(<math\b[^>]*?)\s+alttext=["'][^"']*["']/i,"$1");return e?n.replace(/^<math\b/i,`<math alttext="${C(e)}"`):n}(t.mathml,t.alt):""}function K(t,e){const n=U(e);n?t.innerHTML=n:t.textContent=e.latex||e.alt||"⊡"}function W(t,e){const n="string"==typeof e?.fontSize?e.fontSize:"";t.style.fontSize=n}function V(t){return{mathml:"string"==typeof t?.mathml?t.mathml:"",latex:"string"==typeof t?.latex?t.latex:"",alt:"string"==typeof t?.alt?t.alt:"",fontSize:"string"==typeof t?.fontSize?t.fontSize:""}}function Z(t){const e=U(t);return e?function(t,e){const n=H(t);return e?n.replace(/^<math\b/i,`<math mathsize="${C(e)}"`):n}(e,w(t.fontSize)?t.fontSize:""):e}function X(t){const e=t.getAttribute("mathsize")??"";return w(e)?e:""}function Q(t,e){if("block"===t.getAttribute("display")!==e)return!1;const n=H(function(t){return t.replace(/^(<math\b[^>]*?)\s+data-block-id=(?:"[^"]*"|'[^']*')/i,"$1")}(t.outerHTML));return{mathml:n,latex:M(n)??"",alt:t.getAttribute("alttext")??"",fontSize:X(t)}}var J="math_inline",Y="math_display",tt={insertInline:"Mod-Shift-E",insertDisplay:"Mod-Shift-M"},et=[12,16,20,24,32,40,48,64,96],nt={},it=["math","semantics","annotation","mrow","mi","mn","mo","mtext","ms","mspace","mfrac","msqrt","mroot","msup","msub","msubsup","mover","munder","munderover","mmultiscripts","mprescripts","none","mtable","mtr","mlabeledtr","mtd","mpadded","mphantom","mstyle","merror","menclose","mfenced","maction"],at=["display","encoding","mathvariant","mathsize","mathcolor","mathbackground","displaystyle","scriptlevel","scriptminsize","scriptsizemultiplier","stretchy","symmetric","largeop","movablelimits","accent","accentunder","form","fence","separator","lspace","rspace","voffset","minsize","maxsize","linethickness","columnalign","rowalign","columnspacing","rowspacing","columnlines","rowlines","columnspan","rowspan","align","open","close","separators","notation","alttext","depth","width","height"];function rt(t){const e=t.selection;if(!o(e))return null;const n=t.getBlock(e.nodeId);return n&&"math_display"===n.type?e.nodeId:null}function ot(t){return{mathml:t.mathml,latex:t.latex,alt:t.alt,fontSize:t.fontSize}}function lt(t,e){if(0===e.length||!l(t.selection))return null;const i=t.transaction("command"),a=g(t,i);let r=a.offset;for(const o of e)i.insertInlineNode(a.blockId,r,n(d(J),ot(o))),r+=1;return i.setSelection(c(a.blockId,r)),i.build()}function st(t,e){if(0===e.length||p(t.selection))return null;const n=e.map(t=>i(u(Y),[],void 0,ot(t))),a=t.transaction("command"),r=g(t,a);if(!m(r.state,a,r.blockId,n))return null;const o=n[n.length-1];return o?(a.setSelection(s(o.id,[])),a.build()):null}function ct(t){return{mathml:t.mathml,latex:t.latex,alt:t.alt,fontSize:t.fontSize}}function pt(t,e,n){const i=ct(n);n.display?function(t,e){const n=function(t,e){return st(t,[e])}(t.getState(),e);!!n&&t.dispatch(n)}(t,i):function(t,e){const n=function(t,e){return lt(t,[e])}(t.getState(),e);!!n&&t.dispatch(n)}(t,i),t.announce(e.inserted)}function ut(t,e){return void 0===e?{node:t}:{node:t,kind:e}}function dt(t,e,n=!1){return{node:t,kind:e,bigOp:!0,intLike:n}}function mt(t,e){return Object.hasOwn(t,e)?t[e]:void 0}var ht=/* @__PURE__ */function(t){return t.Ordinary="ordinary",t.Binary="binary",t.Relation="relation",t.Arrow="arrow",t.Open="open",t.Close="close",t.Function="function",t.BigOp="bigop",t.Punct="punct",t}({});function ft(t,e){return{char:t,kind:e}}var bt="ordinary",gt="binary",vt="relation",xt="arrow",yt="function",wt="bigop",Lt="punct",kt={alpha:ft("α",bt),beta:ft("β",bt),gamma:ft("γ",bt),delta:ft("δ",bt),epsilon:ft("ϵ",bt),varepsilon:ft("ε",bt),zeta:ft("ζ",bt),eta:ft("η",bt),theta:ft("θ",bt),vartheta:ft("ϑ",bt),iota:ft("ι",bt),kappa:ft("κ",bt),lambda:ft("λ",bt),mu:ft("μ",bt),nu:ft("ν",bt),xi:ft("ξ",bt),omicron:ft("ο",bt),pi:ft("π",bt),varpi:ft("ϖ",bt),rho:ft("ρ",bt),varrho:ft("ϱ",bt),sigma:ft("σ",bt),varsigma:ft("ς",bt),tau:ft("τ",bt),upsilon:ft("υ",bt),phi:ft("ϕ",bt),varphi:ft("φ",bt),chi:ft("χ",bt),psi:ft("ψ",bt),omega:ft("ω",bt),Gamma:ft("Γ",bt),Delta:ft("Δ",bt),Theta:ft("Θ",bt),Lambda:ft("Λ",bt),Xi:ft("Ξ",bt),Pi:ft("Π",bt),Sigma:ft("Σ",bt),Upsilon:ft("Υ",bt),Phi:ft("Φ",bt),Psi:ft("Ψ",bt),Omega:ft("Ω",bt)},St={sin:ft("sin",yt),cos:ft("cos",yt),tan:ft("tan",yt),cot:ft("cot",yt),sec:ft("sec",yt),csc:ft("csc",yt),sinh:ft("sinh",yt),cosh:ft("cosh",yt),tanh:ft("tanh",yt),coth:ft("coth",yt),arcsin:ft("arcsin",yt),arccos:ft("arccos",yt),arctan:ft("arctan",yt),log:ft("log",yt),ln:ft("ln",yt),lg:ft("lg",yt),exp:ft("exp",yt),deg:ft("deg",yt),det:ft("det",yt),dim:ft("dim",yt),hom:ft("hom",yt),ker:ft("ker",yt),arg:ft("arg",yt),Pr:ft("Pr",yt)},Ct={sum:ft("∑",wt),prod:ft("∏",wt),coprod:ft("∐",wt),int:ft("∫",wt),iint:ft("∬",wt),iiint:ft("∭",wt),oint:ft("∮",wt),bigcup:ft("⋃",wt),bigcap:ft("⋂",wt),bigsqcup:ft("⨆",wt),bigvee:ft("⋁",wt),bigwedge:ft("⋀",wt),bigoplus:ft("⨁",wt),bigotimes:ft("⨂",wt),bigodot:ft("⨀",wt),biguplus:ft("⨄",wt),lim:ft("lim",wt),limsup:ft("lim sup",wt),liminf:ft("lim inf",wt),injlim:ft("inj lim",wt),projlim:ft("proj lim",wt),max:ft("max",wt),min:ft("min",wt),sup:ft("sup",wt),inf:ft("inf",wt),gcd:ft("gcd",wt)},$t={times:ft("×",gt),div:ft("÷",gt),pm:ft("±",gt),mp:ft("∓",gt),cdot:ft("⋅",gt),ast:ft("∗",gt),star:ft("⋆",gt),circ:ft("∘",gt),bullet:ft("∙",gt),oplus:ft("⊕",gt),ominus:ft("⊖",gt),otimes:ft("⊗",gt),oslash:ft("⊘",gt),odot:ft("⊙",gt),cap:ft("∩",gt),cup:ft("∪",gt),uplus:ft("⊎",gt),sqcap:ft("⊓",gt),sqcup:ft("⊔",gt),wedge:ft("∧",gt),land:ft("∧",gt),vee:ft("∨",gt),lor:ft("∨",gt),setminus:ft("∖",gt),wr:ft("≀",gt),diamond:ft("⋄",gt),bigtriangleup:ft("△",gt),bigtriangledown:ft("▽",gt),triangleleft:ft("◁",gt),triangleright:ft("▷",gt),amalg:ft("⨿",gt),dagger:ft("†",gt),ddagger:ft("‡",gt)},At={leq:ft("≤",vt),le:ft("≤",vt),geq:ft("≥",vt),ge:ft("≥",vt),neq:ft("≠",vt),ne:ft("≠",vt),equiv:ft("≡",vt),sim:ft("∼",vt),simeq:ft("≃",vt),cong:ft("≅",vt),approx:ft("≈",vt),propto:ft("∝",vt),prec:ft("≺",vt),succ:ft("≻",vt),preceq:ft("⪯",vt),succeq:ft("⪰",vt),ll:ft("≪",vt),gg:ft("≫",vt),lll:ft("⋘",vt),ggg:ft("⋙",vt),subset:ft("⊂",vt),supset:ft("⊃",vt),subseteq:ft("⊆",vt),supseteq:ft("⊇",vt),subsetneq:ft("⊊",vt),supsetneq:ft("⊋",vt),sqsubseteq:ft("⊑",vt),sqsupseteq:ft("⊒",vt),in:ft("∈",vt),ni:ft("∋",vt),notin:ft("∉",vt),mid:ft("∣",vt),parallel:ft("∥",vt),perp:ft("⊥",vt),models:ft("⊨",vt),vdash:ft("⊢",vt),dashv:ft("⊣",vt),doteq:ft("≐",vt),asymp:ft("≍",vt),bowtie:ft("⋈",vt),smile:ft("⌣",vt),frown:ft("⌢",vt)},zt={leftarrow:ft("←",xt),gets:ft("←",xt),rightarrow:ft("→",xt),to:ft("→",xt),leftrightarrow:ft("↔",xt),Leftarrow:ft("⇐",xt),Rightarrow:ft("⇒",xt),Leftrightarrow:ft("⇔",xt),mapsto:ft("↦",xt),longrightarrow:ft("⟶",xt),longleftarrow:ft("⟵",xt),longleftrightarrow:ft("⟷",xt),Longrightarrow:ft("⟹",xt),Longleftarrow:ft("⟸",xt),Longleftrightarrow:ft("⟺",xt),implies:ft("⟹",xt),iff:ft("⟺",xt),uparrow:ft("↑",xt),downarrow:ft("↓",xt),updownarrow:ft("↕",xt),nearrow:ft("↗",xt),searrow:ft("↘",xt),swarrow:ft("↙",xt),nwarrow:ft("↖",xt),hookleftarrow:ft("↩",xt),hookrightarrow:ft("↪",xt),rightharpoonup:ft("⇀",xt),rightharpoondown:ft("⇁",xt),leftharpoonup:ft("↼",xt),leftharpoondown:ft("↽",xt),nleftarrow:ft("↚",xt),nrightarrow:ft("↛",xt)},_t={langle:ft("⟨","open"),rangle:ft("⟩","close"),lceil:ft("⌈","open"),rceil:ft("⌉","close"),lfloor:ft("⌊","open"),rfloor:ft("⌋","close"),lbrace:ft("{","open"),rbrace:ft("}","close"),lbrack:ft("[","open"),rbrack:ft("]","close"),lvert:ft("|","open"),rvert:ft("|","close"),lVert:ft("‖","open"),rVert:ft("‖","close"),vert:ft("|","relation"),Vert:ft("‖","relation"),backslash:ft("\\",bt)},Et={infty:ft("∞",bt),partial:ft("∂",bt),nabla:ft("∇",bt),forall:ft("∀",bt),exists:ft("∃",bt),nexists:ft("∄",bt),emptyset:ft("∅",bt),varnothing:ft("∅",bt),aleph:ft("ℵ",bt),beth:ft("ℶ",bt),hbar:ft("ℏ",bt),ell:ft("ℓ",bt),Re:ft("ℜ",bt),Im:ft("ℑ",bt),wp:ft("℘",bt),prime:ft("′",bt),angle:ft("∠",bt),measuredangle:ft("∡",bt),triangle:ft("△",bt),neg:ft("¬",bt),lnot:ft("¬",bt),top:ft("⊤",bt),bot:ft("⊥",bt),flat:ft("♭",bt),natural:ft("♮",bt),sharp:ft("♯",bt),clubsuit:ft("♣",bt),diamondsuit:ft("♢",bt),heartsuit:ft("♡",bt),spadesuit:ft("♠",bt),surd:ft("√",bt),complement:ft("∁",bt),square:ft("□",bt),blacksquare:ft("■",bt),bigstar:ft("★",bt),checkmark:ft("✓",bt),degree:ft("°",bt),cdots:ft("⋯",bt),ldots:ft("…",bt),dots:ft("…",bt),dotsb:ft("⋯",bt),vdots:ft("⋮",bt),ddots:ft("⋱",bt)},Bt={colon:ft(":",Lt),cdotp:ft("·",Lt),ldotp:ft(".",Lt)},It={...kt,...St,...Ct,...$t,...At,...zt,..._t,...Et,...Bt},Ot={"(":ft("(","open"),")":ft(")","close"),"[":ft("[","open"),"]":ft("]","close"),"|":ft("|","relation"),"/":ft("/",bt)};function Pt(t){if("."===t)return ft("",bt);if(t.startsWith("\\")){const e=t.slice(1);return"{"===e?ft("{","open"):"}"===e?ft("}","close"):"|"===e?ft("‖","relation"):"\\"===e?ft("\\",bt):mt(_t,e)}return mt(Ot,t)}var Dt=/* @__PURE__ */function(t){return t.Command="command",t.GroupOpen="groupOpen",t.GroupClose="groupClose",t.Superscript="superscript",t.Subscript="subscript",t.Prime="prime",t.Ampersand="ampersand",t.RowBreak="rowBreak",t.NbSpace="nbSpace",t.Number="number",t.Char="char",t}({}),Nt=/* @__PURE__ */new Set(["{","}","%","$","#","&","_",",",":",";","!"," ","|","\\",".","/","'","~","^"]);function Ft(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}function qt(t){return t>="0"&&t<="9"}function Rt(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function Tt(t,e,n){return{type:t,value:e,position:n}}function jt(t,e){const n=t[e+1];if(void 0!==n&&!Ft(n))return"\\"===n?Tt("rowBreak","\\",e):Tt("command",n,e);let i=e+1;for(;i<t.length;){const e=t[i];if(void 0===e||!Ft(e))break;i+=1}return Tt("command",t.slice(e+1,i),e)}function Mt(t,e){let n=e;for(;n<t.length;){const e=t[n];if(void 0===e||!qt(e))break;n+=1}if("."===t[n]&&void 0!==t[n+1]&&qt(t[n+1]??""))for(n+=1;n<t.length;){const e=t[n];if(void 0===e||!qt(e))break;n+=1}return Tt("number",t.slice(e,n),e)}function Ht(t,e){switch(t){case"{":return Tt("groupOpen",t,e);case"}":return Tt("groupClose",t,e);case"^":return Tt("superscript",t,e);case"_":return Tt("subscript",t,e);case"'":return Tt("prime",t,e);case"&":return Tt("ampersand",t,e);case"~":return Tt("nbSpace",t,e);default:return Tt("char",t,e)}}function Gt(t,e){return{glyph:t,under:!1,stretchy:e}}function Ut(t,e){return{glyph:t,under:!0,stretchy:e}}var Kt={hat:Gt("^",!1),widehat:Gt("^",!0),check:Gt("ˇ",!1),tilde:Gt("~",!1),widetilde:Gt("~",!0),bar:Gt("‾",!1),overline:Gt("‾",!0),vec:Gt("→",!1),overrightarrow:Gt("→",!0),overleftarrow:Gt("←",!0),overleftrightarrow:Gt("↔",!0),dot:Gt("˙",!1),ddot:Gt("¨",!1),dddot:Gt("⃛",!1),acute:Gt("´",!1),grave:Gt("`",!1),breve:Gt("˘",!1),mathring:Gt("˚",!1),overbrace:Gt("⏞",!0),underline:Ut("_",!0),underbrace:Ut("⏟",!0),underrightarrow:Ut("→",!0),underleftarrow:Ut("←",!0)},Wt={matrix:{open:"",close:""},pmatrix:{open:"(",close:")"},bmatrix:{open:"[",close:"]"},Bmatrix:{open:"{",close:"}"},vmatrix:{open:"|",close:"|"},Vmatrix:{open:"‖",close:"‖"},cases:{open:"{",close:"",columnalign:"left"},aligned:{open:"",close:"",columnalign:"right left"},align:{open:"",close:"",columnalign:"right left"},gathered:{open:"",close:"",columnalign:"center"},smallmatrix:{open:"",close:""}};function Vt(t){return t.type===Dt.Command&&"end"===t.value}function Zt(t){return t.type===Dt.Ampersand||t.type===Dt.RowBreak||t.type===Dt.Command&&"end"===t.value}var Xt={",":"0.167em",":":"0.222em",";":"0.278em","!":"-0.167em"," ":"0.25em",quad:"1em",qquad:"2em",thinspace:"0.167em",medspace:"0.222em",thickspace:"0.278em",negthinspace:"-0.167em",negmedspace:"-0.222em",negthickspace:"-0.278em",enspace:"0.5em"};function Qt(t){return Object.hasOwn(Xt,t)}function Jt(t){const e=mt(Xt,t);if(void 0!==e)return I({width:e})}function Yt(){return I({width:"0.25em"})}function te(t){const e=t.parseRawArgument();return n=e,Object.hasOwn(Wt,n)||"array"===n?function(t,e){"array"===t&&(e.parseOptionalArgument(),e.parseRawArgument());const n=function(t,e){const n=[];let i=[],a=[];const r=()=>{i.push(O(a.join(""))),a=[]},o=()=>{r(),n.push(i),i=[]};for(;;){const n=e.peek();if(void 0===n){e.error({message:`Unterminated environment \\begin{${t}}`});break}if(Vt(n)){e.next(),e.parseRawArgument();break}if(n.type===Dt.Ampersand){e.next(),r();continue}if(n.type===Dt.RowBreak){e.next(),o();continue}if(n.type===Dt.GroupClose){e.next(),e.error({message:"Unmatched brace",position:n.position});continue}const i=e.parseAtomsUntil(Zt);a.push(...i.map(t=>t.node))}return(a.length>0||i.length>0)&&o(),0===n.length&&n.push([""]),n}(t,e).map(t=>t.map(t=>t)),i=mt(Wt,t)??{open:"",close:""},a=(r=i.columnalign?{columnalign:i.columnalign}:void 0,A("mtable",n.map(R).join(""),r));var r;return i.open||i.close?ut(O(`${i.open?E(i.open,{stretchy:!0,fence:!0}):""}${a}${i.close?E(i.close,{stretchy:!0,fence:!0}):""}`)):ut(a)}(e,t):(t.error({message:"Unknown environment",command:e}),ut(A("merror",B(e))));var n}function ee(t){return t.type===Dt.Command&&"right"===t.value}function ne(t){const e=t.next();if(void 0===e)return{kind:"fence",markup:""};const n=e.type===Dt.Command?`\\${e.value}`:e.value,i=Pt(n);return void 0===i?(t.error({message:"Unknown delimiter",command:n,position:e.position}),{kind:"error",markup:A("merror",B(n))}):{kind:"fence",markup:ie(i)}}function ie(t){return""===t.char?"":E(t.char,{fence:!0,stretchy:!0})}var ae={},re={"double-struck":{upperBase:120120,lowerBase:120146,digitBase:120792,holes:{C:8450,H:8461,N:8469,P:8473,Q:8474,R:8477,Z:8484}},script:{upperBase:119964,lowerBase:119990,holes:{B:8492,E:8496,F:8497,H:8459,I:8464,L:8466,M:8499,R:8475,e:8495,g:8458,o:8500}},fraktur:{upperBase:120068,lowerBase:120094,holes:{C:8493,H:8460,I:8465,R:8476,Z:8488}},bold:{upperBase:119808,lowerBase:119834,digitBase:120782,holes:ae},italic:{upperBase:119860,lowerBase:119886,holes:{h:8462}},"sans-serif":{upperBase:120224,lowerBase:120250,digitBase:120802,holes:ae},monospace:{upperBase:120432,lowerBase:120458,digitBase:120822,holes:ae}};function oe(t,e){if(1!==t.length)return null;const n=re[e],i=n.holes[t];return void 0!==i?String.fromCodePoint(i):function(t){return t>="A"&&t<="Z"}(t)?String.fromCodePoint(n.upperBase+(t.charCodeAt(0)-65)):function(t){return t>="a"&&t<="z"}(t)?String.fromCodePoint(n.lowerBase+(t.charCodeAt(0)-97)):function(t){return t>="0"&&t<="9"}(t)&&void 0!==n.digitBase?String.fromCodePoint(n.digitBase+(t.charCodeAt(0)-48)):null}var le=/<(mi|mn)>([^<]*)<\/\1>/g,se=/<mi>([^<]*)<\/mi>/g;var ce={mathbb:"double-struck",mathcal:"script",mathscr:"script",mathfrak:"fraktur",mathbf:"bold",mathit:"italic",mathsf:"sans-serif",mathtt:"monospace"},pe={boldsymbol:"bold-italic",bm:"bold-italic"},ue={text:void 0,textnormal:"normal",textrm:"normal",textbf:"bold",textit:"italic",textsf:"sans-serif",texttt:"monospace",mbox:void 0};function de(t,e){if("operatorname"===t)return ut(z(e.parseRawArgument(),{mathvariant:"normal"}));if(Object.hasOwn(ue,t)){const n=mt(ue,t),i=e.parseRawArgument();return ut(n?B(i,{mathvariant:n}):B(i))}const n=mt(ce,t);if(void 0!==n)return ut((i=e.parseArgument(),a=n,i.replace(le,(t,e,n)=>{const i=function(t,e){let n="";for(const i of t)n+=oe(i,e)??i;return n}(n,a);return"mn"===e?_(i):z(i)})));var i,a;if("mathrm"===t)return ut(e.parseArgument().replace(se,(t,e)=>z(e,{mathvariant:"normal"})));const r=mt(pe,t),o=e.parseArgument();return ut(void 0===r?o:A("mstyle",o,{mathvariant:r}))}var me=/* @__PURE__ */new Set(["frac","dfrac","tfrac","cfrac"]),he=/* @__PURE__ */new Set(["binom","dbinom","tbinom","choose"]),fe=/* @__PURE__ */new Set(["overset","underset","stackrel"]);var be=/* @__PURE__ */new Set(["∫","∬","∭","∮"]);var ge=class{source;tokens;pos=0;depth=0;depthExceeded=!1;errors=[];display;constructor(t,e,n){this.source=t,this.tokens=e,this.display=n}get collectedErrors(){return this.errors}peek(){return this.tokens[this.pos]}next(){const t=this.tokens[this.pos];return void 0!==t&&(this.pos+=1),t}error(t){this.errors.push(t)}parseTopLevel(){const t=[];for(;;){const e=this.peek();if(void 0===e)break;if(e.type===Dt.GroupClose){this.next(),this.error({message:"Unmatched brace",position:e.position});continue}const n=this.parseAtomWithScripts();void 0!==n&&t.push(n)}return t}parseExpression(t){const e=[];for(;;){const n=this.peek();if(void 0===n||t(n))break;if(n.type===Dt.GroupClose)break;const i=this.parseAtomWithScripts();void 0!==i&&e.push(i)}return e}parseAtomsUntil(t){return this.parseExpression(t)}parseAtomWithScripts(){const t=this.parseBaseAtom();if(void 0!==t)return this.attachScripts(t)}attachScripts(t){let e,n,i,a="";for(;;){const t=this.peek();if(void 0===t)break;if(t.type!==Dt.Prime)if(t.type!==Dt.Command||"limits"!==t.value)if(t.type!==Dt.Command||"nolimits"!==t.value)if(t.type!==Dt.Superscript){if(t.type!==Dt.Subscript)break;this.next(),e=this.combineSub(e,this.parseArgument())}else this.next(),n=this.combineSup(n,this.parseArgument());else this.next(),i="nolimits";else this.next(),i="limits";else this.next(),a+="′"}return a&&(n=void 0===n?E(a):O(`${E(a)}${n}`)),void 0===e&&void 0===n?t:ut(this.buildScripts(t,e,n,i))}combineSup(t,e){return void 0===t?e:(this.error({message:"Double superscript"}),O(`${t}${e}`))}combineSub(t,e){return void 0===t?e:(this.error({message:"Double subscript"}),O(`${t}${e}`))}buildScripts(t,e,n,i){const a=!0===t.bigOp&&!0!==t.intLike&&this.display;if("limits"===i||"nolimits"!==i&&a){if(void 0!==e&&void 0!==n)return function(t,e,n){return A("munderover",`${t}${e}${n}`)}(t.node,e,n);if(void 0!==e)return F(t.node,e);if(void 0!==n)return N(t.node,n)}return void 0!==e&&void 0!==n?function(t,e,n){return A("msubsup",`${t}${e}${n}`)}(t.node,e,n):void 0!==e?function(t,e){return A("msub",`${t}${e}`)}(t.node,e):void 0!==n?function(t,e){return A("msup",`${t}${e}`)}(t.node,n):t.node}parseBaseAtom(){if(this.depth>=256)return this.bailDeepNesting();this.depth+=1;try{return this.parseBaseAtomInner()}finally{this.depth-=1}}bailDeepNesting(){const t=this.next();if(void 0!==t&&!this.depthExceeded)return this.depthExceeded=!0,this.error({message:"Maximum nesting depth exceeded",position:t.position}),ut(A("merror",B("⋯")))}parseBaseAtomInner(){const t=this.next();if(void 0!==t)switch(t.type){case Dt.Number:return ut(_(t.value));case Dt.Char:return this.parseChar(t.value);case Dt.GroupOpen:return this.parseGroup();case Dt.NbSpace:return ut(Yt());case Dt.Command:return this.parseCommand(t);case Dt.Superscript:case Dt.Subscript:case Dt.Prime:return this.pos-=1,this.attachScripts(ut(O("")));case Dt.Ampersand:case Dt.RowBreak:case Dt.GroupClose:default:return}}parseGroup(){const t=this.parseExpression(()=>!1);return this.expect(Dt.GroupClose),ut(P(t.map(t=>t.node)))}parseChar(t){const e=Pt(t);return!e||e.kind!==ht.Open&&e.kind!==ht.Close?ut("+"===t||"-"===t||"*"===t||"="===t||"/"===t||"|"===t||","===t||";"===t||"."===t||":"===t||"!"===t||"?"===t||"<"===t||">"===t?E(t):z(t)):ut(E(t,{fence:!0}),e.kind)}parseCommand(t){const e=t.value,n=function(t){return mt(It,t)}(e);if(n)return this.symbolAtom(n);if(1===(i=e).length&&Nt.has(i))return this.controlSymbolAtom(e);var i;const a=this.dispatchStructural(e);if(void 0!==a)return a;const r=this.dispatchSpecial(e,t);return void 0!==r?r:(this.error({message:"Unknown command",command:`\\${e}`,position:t.position}),ut(A("merror",B(`\\${e}`))))}dispatchStructural(t){if(function(t){return me.has(t)}(t))return ut(D((e=this).parseArgument(),e.parseArgument()));var e;if(function(t){return he.has(t)}(t))return function(t){const e=D(t.parseArgument(),t.parseArgument(),{linethickness:0});return ut(O(`${E("(",{fence:!0})}${e}${E(")",{fence:!0})}`))}(this);if("sqrt"===t)return function(t){const e=t.parseOptionalArgument(),n=t.parseArgument();return ut(void 0===e||""===e?function(t){return A("msqrt",t)}(n):function(t,e){return A("mroot",`${t}${e}`)}(n,e))}(this);if(function(t){return fe.has(t)}(t))return function(t,e){const n=e.parseArgument(),i=e.parseArgument();return ut("underset"===t?F(i,n):N(i,n))}(t,this);if(function(t){return Object.hasOwn(Kt,t)}(t))return function(t,e){const n=mt(Kt,t);if(!n)return ut("");const i=e.parseArgument(),a=E(n.glyph,{stretchy:n.stretchy}),r=n.under?{accentunder:!0}:{accent:!0};return ut(n.under?F(i,a,r):N(i,a,r))}(t,this);if(function(t){return Object.hasOwn(ce,t)||Object.hasOwn(pe,t)||Object.hasOwn(ue,t)||"mathrm"===t||"operatorname"===t}(t))return de(t,this);if(Qt(t)){const e=Jt(t);return void 0===e?void 0:ut(e)}}dispatchSpecial(t,e){return"left"===t?function(t){const e=ne(t),n=t.parseAtomsUntil(ee),i=t.peek();let a="";return void 0!==i&&ee(i)?(t.next(),a=ne(t).markup):t.error({message:"Unmatched \\left"}),ut(P([e.markup,...n.map(t=>t.node),a]))}(this):"begin"===t?te(this):"pmod"===t?function(t){const e=t.parseArgument(),n=E("(",{fence:!0}),i=E(")",{fence:!0});return ut(O(`${n}${B("mod")}${Yt()}${e}${i}`))}(this):"bmod"===t||"mod"===t?ut(E("mod",{lspace:"0.222em",rspace:"0.222em"})):"substack"===t?function(t){!function(t){const e=t.peek();void 0!==e&&e.type===Dt.GroupOpen&&t.next()}(t);const e=[];let n=[];for(;;){const i=t.peek();if(void 0===i||i.type===Dt.GroupClose)break;if(i.type===Dt.RowBreak){t.next(),e.push(P(n)),n=[];continue}const a=t.parseAtomsUntil(t=>t.type===Dt.RowBreak);n.push(...a.map(t=>t.node))}!function(t){const e=t.peek();void 0!==e&&e.type===Dt.GroupClose&&t.next()}(t),e.push(P(n));const i=e.map(t=>A("mtr",A("mtd",t))).join("");return ut(A("mtable",i))}(this):"right"===t?function(t,e){const n=ne(t);return t.error({message:"Unmatched \\right",position:e}),ut("error"===n.kind?n.markup:P([]))}(this,e.position):void 0}symbolAtom(t){switch(t.kind){case ht.Ordinary:return ut(z(t.char),t.kind);case ht.Function:return ut(z(t.char,{mathvariant:"normal"}),t.kind);case ht.BigOp:return this.bigOperator(t);case ht.Open:case ht.Close:return ut(E(t.char,{fence:!0}),t.kind);default:return ut(E(t.char),t.kind)}}bigOperator(t){if(/[a-z]/i.test(t.char))return dt(E(t.char,{movablelimits:!0}),t.kind);const e=be.has(t.char);return dt(E(t.char,{movablelimits:!0,largeop:!0}),t.kind,e)}controlSymbolAtom(t){if(Qt(t)){const e=Jt(t);return void 0===e?void 0:ut(e)}return"{"===t?ut(E("{",{fence:!0}),ht.Open):"}"===t?ut(E("}",{fence:!0}),ht.Close):ut("|"===t?E("‖"):"\\"===t?E("\\"):"/"===t?E("/"):"'"===t?E("′"):"."===t?E("."):B(t))}parseArgument(){return""===(t=this.parseBaseAtom()?.node??"")?O(""):t;var t}parseOptionalArgument(){const t=this.peek();if(void 0===t||t.type!==Dt.Char||"["!==t.value)return;this.next();const e=this.parseExpression(t=>t.type===Dt.Char&&"]"===t.value),n=this.peek();return void 0!==n&&n.type===Dt.Char&&"]"===n.value&&this.next(),P(e.map(t=>t.node))}parseRawArgument(){const t=this.peek();if(void 0===t)return"";if(t.type!==Dt.GroupOpen)return this.next(),t.value;const e=t.position;this.next();let n=1,i=this.source.length;for(;;){const t=this.next();if(void 0===t)break;if(t.type===Dt.GroupOpen)n+=1;else if(t.type===Dt.GroupClose&&(n-=1,0===n)){i=t.position;break}}return this.source.slice(e+1,i)}expect(t){const e=this.peek();void 0===e||e.type!==t?t===Dt.GroupClose&&this.error({message:"Unmatched brace"}):this.next()}},ve="<mrow></mrow>";function xe(t,e){const n=e?.display??!1;if(""===t.trim())return{presentation:ve,errors:[]};const{atoms:i,errors:a}=function(t,e){const n=new ge(t,function(t){const e=[];let n=0;for(;n<t.length;){const i=t[n]??"";if("\\"===i){const i=jt(t,n);if(e.push(i),n+="rowBreak"===i.type?2:Math.max(1,i.value.length)+1,"command"===i.type&&Ft(i.value[0]??""))for(;n<t.length&&Rt(t[n]??"");)n+=1;continue}if(qt(i)){const i=Mt(t,n);e.push(i),n+=i.value.length;continue}if(Rt(i)){n+=1;continue}const a=Ht(i,n);a&&e.push(a),n+=1}return e}(t),e);return{atoms:n.parseTopLevel(),errors:n.collectedErrors}}(t,n);return{presentation:ye(i),errors:a}}function ye(t){if(0===t.length)return ve;if(1===t.length){const e=t[0];return e?e.node:ve}return O(t.map(t=>t.node).join(""))}var we=/(?<!\$)\$([^$\n\uFFFC]+)\$$/,Le=/\$\$([^$\n\uFFFC]+)\$\$$/;function ke(t,e){const n=t.getBlock(e);return void 0!==n&&"code_block"!==n.type}function Se(t,e){const n=t-e;return n<0?null:{from:n,to:t}}var Ce={insertInline:"Insert formula",insertInlineTooltip:"Insert inline formula",editFormula:"Edit formula",latexLabel:"LaTeX",latexPlaceholder:"e.g. \\frac{a}{b} + \\sqrt{x}",previewLabel:"Preview",insertButton:"Insert",updateButton:"Update",cancelButton:"Cancel",displayToggle:"Display (block) equation",sizeLabel:"Size",sizeDefault:"Default",altLabel:"Description",altPlaceholder:"Spoken description (optional)",paletteLabel:"Symbols and structures",emptyPreview:"Nothing to preview yet.",inserted:"Formula inserted.",updated:"Formula updated.",editing:"Editing formula.",selected:"Formula selected. Press Enter to edit.",unknownCommand:t=>`Unknown LaTeX command: ${t}`,groupFractions:"Fractions",groupScripts:"Scripts",groupRoots:"Roots",groupAccents:"Accents",groupOperators:"Operators",groupFunctions:"Functions",groupGreek:"Greek letters",groupRelations:"Relations",groupSets:"Sets",groupLogic:"Logic",groupArrows:"Arrows",groupDelimiters:"Brackets",groupDots:"Dots",groupMatrices:"Matrices"},$e=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-D1jFXqLJ.mjs"),"./locales/de.ts":()=>import("./de-DY3obIAF.mjs"),"./locales/es.ts":()=>import("./es-CtOtKQCP.mjs"),"./locales/fr.ts":()=>import("./fr-DjMZ-3K5.mjs"),"./locales/hi.ts":()=>import("./hi-4CiAKVjT.mjs"),"./locales/pt.ts":()=>import("./pt-BkpVtod-.mjs"),"./locales/ru.ts":()=>import("./ru-BotG0MFT.mjs"),"./locales/zh.ts":()=>import("./zh-CWGAPVei.mjs")});async function Ae(t){return f($e,t,Ce)}var ze=/^\s*\$\$([^\n]+?)\$\$\s*$/;function _e(t,e){const{presentation:n}=xe(t,{display:e});return{mathml:j({presentation:n,latex:t,display:e}),latex:t,alt:"",fontSize:""}}var Ee=class{root;buttons=[];activeIndex=0;constructor(t,e,n){this.root=document.createElement("div"),this.root.className="notectl-math-palette",this.root.setAttribute("role","toolbar"),this.root.setAttribute("aria-label",e);for(const i of t)this.root.appendChild(this.buildGroup(i,n));this.root.addEventListener("keydown",t=>this.onKeydown(t)),this.setActive(0)}focus(){this.buttons[this.activeIndex]?.focus()}activeButton(){return this.buttons[this.activeIndex]}buildGroup(t,e){const n=document.createElement("div");n.className="notectl-math-palette__group",n.setAttribute("role","group"),n.setAttribute("aria-label",t.label);for(const i of t.items){const t=document.createElement("button");t.type="button",t.className="notectl-math-palette__btn",t.textContent=i.label,t.setAttribute("aria-label",i.ariaLabel),t.tabIndex=-1,t.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),t.addEventListener("click",()=>e(i.snippet)),this.buttons.push(t),n.appendChild(t)}return n}onKeydown(t){if("Enter"===t.key||" "===t.key)return t.preventDefault(),t.stopPropagation(),void this.buttons[this.activeIndex]?.click();const e=this.buttons.length-1;let n=this.activeIndex;switch(t.key){case"ArrowRight":case"ArrowDown":n=this.activeIndex>=e?0:this.activeIndex+1;break;case"ArrowLeft":case"ArrowUp":n=this.activeIndex<=0?e:this.activeIndex-1;break;case"Home":n=0;break;case"End":n=e;break;default:return}t.preventDefault(),t.stopPropagation(),this.setActive(n),this.buttons[n]?.focus()}setActive(t){const e=this.buttons[this.activeIndex];e&&(e.tabIndex=-1);const n=this.buttons[t];n&&(n.tabIndex=0),this.activeIndex=t}},Be=0,Ie=class{root;options;textarea;preview;previewEmpty;errorsList;altInput;commitBtn;palette=null;displayCheckbox=null;cancelBtn=null;fontSizeSelect=null;display;lastErrorKey="";constructor(t){this.options=t,this.display=t.initialDisplay??!1;const e=++Be;this.root=document.createElement("div"),this.root.className="notectl-formula-editor",this.root.setAttribute("role","group"),this.root.setAttribute("aria-label",t.locale.latexLabel),t.palette&&t.palette.length>0&&(this.palette=new Ee(t.palette,t.locale.paletteLabel,t=>this.insertSnippet(t)),this.root.appendChild(this.palette.root)),this.textarea=this.buildLatexField(e),this.preview=document.createElement("div"),this.previewEmpty=document.createElement("div"),this.errorsList=document.createElement("ul"),this.altInput=this.buildAltField(e),this.commitBtn=document.createElement("button"),this.root.appendChild(this.buildPreview()),this.root.appendChild(this.errorsList),this.root.appendChild(this.altInput.parentElement),t.fontSizes&&t.fontSizes.length>0&&this.root.appendChild(this.buildSizeField(e)),"insert"===t.mode&&this.root.appendChild(this.buildDisplayToggle(e)),this.root.appendChild(this.buildActions()),this.errorsList.className="notectl-formula-editor__errors",this.errorsList.id=`notectl-formula-errors-${e}`,this.errorsList.setAttribute("aria-live","polite"),this.textarea.setAttribute("aria-describedby",this.errorsList.id),this.root.addEventListener("keydown",t=>this.onRootKeydown(t)),this.update()}focus(){this.textarea.focus(),this.textarea.setSelectionRange(this.textarea.value.length,this.textarea.value.length)}onRootKeydown(t){if("Escape"===t.key)return t.preventDefault(),t.stopPropagation(),void this.options.onCancel();"Tab"===t.key&&(t.preventDefault(),t.stopPropagation(),this.moveFocus(!t.shiftKey))}focusStops(){const t=[],e=this.palette?.activeButton();return e&&t.push(e),t.push(this.textarea,this.altInput),this.fontSizeSelect&&t.push(this.fontSizeSelect),this.displayCheckbox&&t.push(this.displayCheckbox),this.cancelBtn&&t.push(this.cancelBtn),t.push(this.commitBtn),t}moveFocus(t){const e=this.focusStops();if(0===e.length)return;const n=this.activeElement();let i=e.findIndex(t=>t===n);-1===i&&n&&this.palette?.root.contains(n)&&(i=0),-1===i&&(i=t?e.length-1:0),e[(i+(t?1:-1)+e.length)%e.length]?.focus()}activeElement(){let t=this.root.getRootNode().activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}getResult(){const t=this.textarea.value.trim(),e=this.altInput.value.trim(),{presentation:n}=xe(t,{display:this.display});return{latex:t,mathml:j({presentation:n,latex:t,display:this.display,alt:e||void 0}),alt:e,display:this.display,fontSize:this.fontSizeSelect?.value??""}}insertSnippet(t){const e=this.textarea.selectionStart??this.textarea.value.length,n=this.textarea.selectionEnd??e,i=t.indexOf("$0"),a=i>=0?t.replace("$0",""):t,r=i>=0?i:a.length,o=this.textarea.value;this.textarea.value=o.slice(0,e)+a+o.slice(n);const l=e+r;this.textarea.focus(),this.textarea.setSelectionRange(l,l),this.update()}buildLatexField(t){const e=document.createElement("div");e.className="notectl-formula-editor__field";const n=document.createElement("label");n.className="notectl-formula-editor__label",n.htmlFor=`notectl-formula-latex-${t}`,n.textContent=this.options.locale.latexLabel;const i=document.createElement("textarea");return i.id=`notectl-formula-latex-${t}`,i.className="notectl-formula-editor__input",i.placeholder=this.options.locale.latexPlaceholder,i.rows=2,i.spellcheck=!1,i.value=this.options.initialLatex??"",i.addEventListener("input",()=>this.update()),i.addEventListener("keydown",t=>this.onTextareaKeydown(t)),e.appendChild(n),e.appendChild(i),this.root.appendChild(e),i}buildPreview(){const t=document.createElement("div");t.className="notectl-formula-editor__field";const e=document.createElement("span");return e.className="notectl-formula-editor__label",e.textContent=this.options.locale.previewLabel,this.preview.className="notectl-formula-editor__preview",this.previewEmpty.className="notectl-formula-editor__preview-empty",this.previewEmpty.textContent=this.options.locale.emptyPreview,t.appendChild(e),t.appendChild(this.previewEmpty),t.appendChild(this.preview),t}buildAltField(t){const e=document.createElement("div");e.className="notectl-formula-editor__field";const n=document.createElement("label");n.className="notectl-formula-editor__label",n.htmlFor=`notectl-formula-alt-${t}`,n.textContent=this.options.locale.altLabel;const i=document.createElement("input");return i.id=`notectl-formula-alt-${t}`,i.type="text",i.className="notectl-formula-editor__alt",i.placeholder=this.options.locale.altPlaceholder,i.value=this.options.initialAlt??"",e.appendChild(n),e.appendChild(i),i}buildSizeField(t){const e=document.createElement("div");e.className="notectl-formula-editor__field";const n=document.createElement("label");n.className="notectl-formula-editor__label",n.htmlFor=`notectl-formula-size-${t}`,n.textContent=this.options.locale.sizeLabel;const i=document.createElement("select");i.id=`notectl-formula-size-${t}`,i.className="notectl-formula-editor__size";const a=this.options.initialFontSize??"";i.appendChild(this.buildSizeOption("",this.options.locale.sizeDefault));for(const r of this.options.fontSizes??[])i.appendChild(this.buildSizeOption(`${r}px`,String(r)));return a&&!Array.from(i.options).some(t=>t.value===a)&&i.appendChild(this.buildSizeOption(a,a.replace("px",""))),i.value=a,i.addEventListener("change",()=>this.applyPreviewFontSize()),this.fontSizeSelect=i,e.appendChild(n),e.appendChild(i),e}buildSizeOption(t,e){const n=document.createElement("option");return n.value=t,n.textContent=e,n}applyPreviewFontSize(){this.preview.style.fontSize=this.fontSizeSelect?.value||""}buildDisplayToggle(t){const e=document.createElement("label");e.className="notectl-formula-editor__toggle",e.htmlFor=`notectl-formula-display-${t}`;const n=document.createElement("input");n.id=`notectl-formula-display-${t}`,n.type="checkbox",n.checked=this.display,n.addEventListener("change",()=>{this.display=n.checked,this.update()}),this.displayCheckbox=n;const i=document.createElement("span");return i.textContent=this.options.locale.displayToggle,e.appendChild(n),e.appendChild(i),e}buildActions(){const t=document.createElement("div");t.className="notectl-formula-editor__actions";const e=document.createElement("button");return e.type="button",e.className="notectl-formula-editor__btn",e.textContent=this.options.locale.cancel,e.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),e.addEventListener("click",()=>this.options.onCancel()),this.cancelBtn=e,this.commitBtn.type="button",this.commitBtn.className="notectl-formula-editor__btn notectl-formula-editor__btn--primary",this.commitBtn.textContent="edit"===this.options.mode?this.options.locale.commitUpdate:this.options.locale.commitInsert,this.commitBtn.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),this.commitBtn.addEventListener("click",()=>this.commit()),t.appendChild(e),t.appendChild(this.commitBtn),t}onTextareaKeydown(t){"Enter"!==t.key||t.shiftKey||(t.preventDefault(),this.commit())}commit(){const t=this.getResult();t.latex?this.options.onCommit(t):this.options.onCancel()}update(){this.applyPreviewFontSize();const t=this.textarea.value.trim();if(!t)return this.preview.innerHTML="",this.previewEmpty.hidden=!1,void this.renderErrors([]);this.previewEmpty.hidden=!0;const{presentation:e,errors:n}=xe(t,{display:this.display});this.preview.innerHTML=j({presentation:e,display:this.display}),this.renderErrors(n.map(t=>t.command??t.message))}renderErrors(t){const e=t.join("");if(e!==this.lastErrorKey){this.lastErrorKey=e,this.errorsList.replaceChildren();for(const e of t){const t=document.createElement("li");t.textContent=e.startsWith("\\")?this.options.locale.unknownCommand(e):e,this.errorsList.appendChild(t)}}}};function Oe(t){return[{id:"fractions",label:(e={fractions:t.groupFractions,scripts:t.groupScripts,roots:t.groupRoots,accents:t.groupAccents,operators:t.groupOperators,functions:t.groupFunctions,greek:t.groupGreek,relations:t.groupRelations,sets:t.groupSets,logic:t.groupLogic,arrows:t.groupArrows,delimiters:t.groupDelimiters,dots:t.groupDots,matrices:t.groupMatrices}).fractions,items:[{label:"a╱b",ariaLabel:"Fraction",snippet:"\\frac{$0}{}"},{label:"⒞",ariaLabel:"Binomial coefficient",snippet:"\\binom{$0}{}"}]},{id:"scripts",label:e.scripts,items:[{label:"xⁿ",ariaLabel:"Superscript",snippet:"^{$0}"},{label:"xₙ",ariaLabel:"Subscript",snippet:"_{$0}"},{label:"xⁿₘ",ariaLabel:"Subscript and superscript",snippet:"_{$0}^{}"}]},{id:"roots",label:e.roots,items:[{label:"√",ariaLabel:"Square root",snippet:"\\sqrt{$0}"},{label:"ⁿ√",ariaLabel:"N-th root",snippet:"\\sqrt[$0]{}"}]},{id:"accents",label:e.accents,items:[{label:"→",ariaLabel:"Vector",snippet:"\\vec{$0}"},{label:"â",ariaLabel:"Hat",snippet:"\\hat{$0}"},{label:"ā",ariaLabel:"Overline",snippet:"\\overline{$0}"},{label:"ȧ",ariaLabel:"Dot above",snippet:"\\dot{$0}"},{label:"ã",ariaLabel:"Tilde",snippet:"\\tilde{$0}"}]},{id:"operators",label:e.operators,items:[{label:"∑",ariaLabel:"Sum with limits",snippet:"\\sum_{$0}^{}"},{label:"∏",ariaLabel:"Product with limits",snippet:"\\prod_{$0}^{}"},{label:"∫",ariaLabel:"Integral with limits",snippet:"\\int_{$0}^{}"},{label:"∬",ariaLabel:"Double integral",snippet:"\\iint "},{label:"∮",ariaLabel:"Contour integral",snippet:"\\oint "},{label:"lim",ariaLabel:"Limit",snippet:"\\lim_{$0}"},{label:"∂",ariaLabel:"Partial derivative",snippet:"\\partial "},{label:"∇",ariaLabel:"Nabla (del)",snippet:"\\nabla "},{label:"×",ariaLabel:"Times",snippet:"\\times "},{label:"·",ariaLabel:"Dot product",snippet:"\\cdot "},{label:"±",ariaLabel:"Plus or minus",snippet:"\\pm "},{label:"÷",ariaLabel:"Division",snippet:"\\div "},{label:"∞",ariaLabel:"Infinity",snippet:"\\infty "}]},{id:"functions",label:e.functions,items:[{label:"sin",ariaLabel:"Sine",snippet:"\\sin "},{label:"cos",ariaLabel:"Cosine",snippet:"\\cos "},{label:"tan",ariaLabel:"Tangent",snippet:"\\tan "},{label:"log",ariaLabel:"Logarithm",snippet:"\\log "},{label:"ln",ariaLabel:"Natural logarithm",snippet:"\\ln "},{label:"exp",ariaLabel:"Exponential function",snippet:"\\exp "}]},{id:"greek",label:e.greek,items:[{label:"α",ariaLabel:"Alpha",snippet:"\\alpha "},{label:"β",ariaLabel:"Beta",snippet:"\\beta "},{label:"γ",ariaLabel:"Gamma",snippet:"\\gamma "},{label:"δ",ariaLabel:"Delta",snippet:"\\delta "},{label:"ε",ariaLabel:"Epsilon",snippet:"\\varepsilon "},{label:"ζ",ariaLabel:"Zeta",snippet:"\\zeta "},{label:"η",ariaLabel:"Eta",snippet:"\\eta "},{label:"θ",ariaLabel:"Theta",snippet:"\\theta "},{label:"κ",ariaLabel:"Kappa",snippet:"\\kappa "},{label:"λ",ariaLabel:"Lambda",snippet:"\\lambda "},{label:"μ",ariaLabel:"Mu",snippet:"\\mu "},{label:"ν",ariaLabel:"Nu",snippet:"\\nu "},{label:"ξ",ariaLabel:"Xi",snippet:"\\xi "},{label:"π",ariaLabel:"Pi",snippet:"\\pi "},{label:"ρ",ariaLabel:"Rho",snippet:"\\rho "},{label:"σ",ariaLabel:"Sigma",snippet:"\\sigma "},{label:"τ",ariaLabel:"Tau",snippet:"\\tau "},{label:"φ",ariaLabel:"Phi",snippet:"\\varphi "},{label:"χ",ariaLabel:"Chi",snippet:"\\chi "},{label:"ψ",ariaLabel:"Psi",snippet:"\\psi "},{label:"ω",ariaLabel:"Omega",snippet:"\\omega "},{label:"Γ",ariaLabel:"Capital gamma",snippet:"\\Gamma "},{label:"Δ",ariaLabel:"Capital delta",snippet:"\\Delta "},{label:"Θ",ariaLabel:"Capital theta",snippet:"\\Theta "},{label:"Λ",ariaLabel:"Capital lambda",snippet:"\\Lambda "},{label:"Π",ariaLabel:"Capital pi",snippet:"\\Pi "},{label:"Σ",ariaLabel:"Capital sigma",snippet:"\\Sigma "},{label:"Φ",ariaLabel:"Capital phi",snippet:"\\Phi "},{label:"Ψ",ariaLabel:"Capital psi",snippet:"\\Psi "},{label:"Ω",ariaLabel:"Capital omega",snippet:"\\Omega "}]},{id:"relations",label:e.relations,items:[{label:"≤",ariaLabel:"Less than or equal to",snippet:"\\leq "},{label:"≥",ariaLabel:"Greater than or equal to",snippet:"\\geq "},{label:"≠",ariaLabel:"Not equal to",snippet:"\\neq "},{label:"≈",ariaLabel:"Approximately equal to",snippet:"\\approx "},{label:"≡",ariaLabel:"Equivalent to",snippet:"\\equiv "},{label:"∼",ariaLabel:"Similar to",snippet:"\\sim "},{label:"≅",ariaLabel:"Congruent to",snippet:"\\cong "},{label:"∝",ariaLabel:"Proportional to",snippet:"\\propto "}]},{id:"sets",label:e.sets,items:[{label:"∈",ariaLabel:"Element of",snippet:"\\in "},{label:"∉",ariaLabel:"Not an element of",snippet:"\\notin "},{label:"⊂",ariaLabel:"Subset of",snippet:"\\subset "},{label:"⊆",ariaLabel:"Subset of or equal to",snippet:"\\subseteq "},{label:"∪",ariaLabel:"Union",snippet:"\\cup "},{label:"∩",ariaLabel:"Intersection",snippet:"\\cap "},{label:"∅",ariaLabel:"Empty set",snippet:"\\emptyset "},{label:"ℝ",ariaLabel:"Real numbers",snippet:"\\mathbb{R}"},{label:"ℕ",ariaLabel:"Natural numbers",snippet:"\\mathbb{N}"},{label:"ℤ",ariaLabel:"Integers",snippet:"\\mathbb{Z}"},{label:"ℚ",ariaLabel:"Rational numbers",snippet:"\\mathbb{Q}"},{label:"ℂ",ariaLabel:"Complex numbers",snippet:"\\mathbb{C}"}]},{id:"logic",label:e.logic,items:[{label:"∀",ariaLabel:"For all",snippet:"\\forall "},{label:"∃",ariaLabel:"There exists",snippet:"\\exists "},{label:"¬",ariaLabel:"Logical not",snippet:"\\neg "},{label:"∧",ariaLabel:"Logical and",snippet:"\\land "},{label:"∨",ariaLabel:"Logical or",snippet:"\\lor "},{label:"⟹",ariaLabel:"Implies",snippet:"\\implies "},{label:"⟺",ariaLabel:"If and only if",snippet:"\\iff "}]},{id:"arrows",label:e.arrows,items:[{label:"→",ariaLabel:"Right arrow",snippet:"\\to "},{label:"⇒",ariaLabel:"Rightwards double arrow",snippet:"\\Rightarrow "},{label:"↔",ariaLabel:"Left-right arrow",snippet:"\\leftrightarrow "},{label:"↦",ariaLabel:"Maps to",snippet:"\\mapsto "}]},{id:"delimiters",label:e.delimiters,items:[{label:"( )",ariaLabel:"Auto-sized parentheses",snippet:"\\left($0\\right)"},{label:"[ ]",ariaLabel:"Auto-sized brackets",snippet:"\\left[$0\\right]"},{label:"{ }",ariaLabel:"Auto-sized braces",snippet:"\\left\\{$0\\right\\}"},{label:"|x|",ariaLabel:"Absolute value",snippet:"\\left|$0\\right|"},{label:"‖x‖",ariaLabel:"Norm",snippet:"\\left\\|$0\\right\\|"},{label:"⌊x⌋",ariaLabel:"Floor",snippet:"\\left\\lfloor $0\\right\\rfloor"},{label:"⌈x⌉",ariaLabel:"Ceiling",snippet:"\\left\\lceil $0\\right\\rceil"}]},{id:"dots",label:e.dots,items:[{label:"⋯",ariaLabel:"Centred ellipsis",snippet:"\\cdots "},{label:"…",ariaLabel:"Baseline ellipsis",snippet:"\\ldots "},{label:"⋮",ariaLabel:"Vertical ellipsis",snippet:"\\vdots "},{label:"⋱",ariaLabel:"Diagonal ellipsis",snippet:"\\ddots "}]},{id:"matrices",label:e.matrices,items:[{label:"[ ]",ariaLabel:"Bracket matrix",snippet:"\\begin{bmatrix} $0 & \\\\ & \\end{bmatrix}"},{label:"( )",ariaLabel:"Parenthesis matrix",snippet:"\\begin{pmatrix} $0 & \\\\ & \\end{pmatrix}"},{label:"{",ariaLabel:"Cases",snippet:"\\begin{cases} $0 & \\\\ & \\end{cases}"}]}];var e}function Pe(t,e){const n=new Ie({locale:(i=e.locale,{latexLabel:i.latexLabel,latexPlaceholder:i.latexPlaceholder,previewLabel:i.previewLabel,emptyPreview:i.emptyPreview,altLabel:i.altLabel,altPlaceholder:i.altPlaceholder,displayToggle:i.displayToggle,sizeLabel:i.sizeLabel,sizeDefault:i.sizeDefault,commitInsert:i.insertButton,commitUpdate:i.updateButton,cancel:i.cancelButton,paletteLabel:i.paletteLabel,unknownCommand:i.unknownCommand}),mode:e.mode,initialLatex:e.initialLatex,initialAlt:e.initialAlt,initialDisplay:e.initialDisplay,initialFontSize:e.initialFontSize,fontSizes:e.fontSizes,palette:Oe(e.locale),onCommit:e.onCommit,onCancel:e.onClose});var i;return t.appendChild(n.root),requestAnimationFrame(()=>n.focus()),n}var De=class{context;locale;fontSizes;panel=null;outsideHandler=null;constructor(t,e,n){this.context=t,this.locale=e,this.fontSizes=n}isOpen(){return null!==this.panel}openInsert(t){if(this.context.isReadOnly())return;const e=Ne();this.open({rect:e,mode:"insert",initialDisplay:t,onCommit:t=>{pt(this.context,this.locale,t),this.close(!0)}})}openEdit(t){this.context.isReadOnly()||(this.context.announce(this.locale.editing),this.open({rect:t.rect??Ne(),mode:"edit",initialLatex:t.latex,initialAlt:t.alt,initialDisplay:"display"===t.kind,initialFontSize:t.fontSize,onCommit:e=>{this.commitEdit(t,e),this.context.announce(this.locale.updated),this.close(!0)}}))}close(t){this.panel&&(this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler,!0),this.outsideHandler=null),this.panel.remove(),this.panel=null,t&&this.context.getContainer().focus())}commitEdit(t,e){const n=ct(e);"inline"===t.kind&&t.blockId&&void 0!==t.offset?function(t,e,n,i){const a=t.getState().transaction("command").setInlineNodeAttr(e,n,ot(i)).build();t.dispatch(a)}(this.context,t.blockId,t.offset,n):"display"===t.kind&&t.path&&function(t,e,n){const i=t.getState().transaction("command").setNodeAttr(e,ot(n)).build();t.dispatch(i)}(this.context,t.path,n)}open(t){this.close(!1);const e=document.createElement("div");e.className="notectl-formula-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-label","edit"===t.mode?this.locale.editFormula:this.locale.insertInline),this.panel=e,Pe(e,{context:this.context,locale:this.locale,mode:t.mode,initialLatex:t.initialLatex,initialAlt:t.initialAlt,initialDisplay:t.initialDisplay,initialFontSize:t.initialFontSize,fontSizes:this.fontSizes,onCommit:t.onCommit,onClose:()=>this.close(!0)}),this.context.getPluginContainer("top").appendChild(e),y(e),function(t,e){const n=e?e.bottom:window.innerHeight/3,i=e?e.left:window.innerWidth/3,a=t.offsetWidth||360,r=window.innerWidth-a-8,o=Math.max(8,Math.min(i,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(o)}px`,t.style.top=`${Math.round(s)}px`}(e,t.rect),this.installOutsideHandler()}installOutsideHandler(){const t=t=>{this.panel&&!t.composedPath().includes(this.panel)&&this.close(!1)};this.outsideHandler=t,requestAnimationFrame(()=>{this.outsideHandler&&document.addEventListener("mousedown",t,!0)})}};function Ne(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}function Fe(t){const e=document.createElement("template");return e.innerHTML=t,e.content}function qe(t){const e=function(t){const e=h(t,{ALLOWED_TAGS:[...it],ALLOWED_ATTR:[...at]});return/<math[\s>]/i.test(e)?e:null}(t.outerHTML);if(!e)return null;const n=H(e);return{mathml:n,latex:M(n)??"",alt:"",fontSize:X(t)}}var Re=class{id="formula";name="Formula";priority=46;config;resolvedKeymap;fontSizes;locale=Ce;overlay=null;context=null;clickHandler=null;constructor(t){this.config={...nt,...t},this.resolvedKeymap={...tt,...t?.keymap},this.fontSizes=this.config.fontSizes??et}async init(t){var e;if(this.context=t,this.locale=await b(t,this.config.locale,Ce,Ae),t.registerStyleSheet(".notectl-math math{font-family:Notectl Math,math}.notectl-math--inline{vertical-align:middle;cursor:pointer;border-radius:3px;padding:0 1px;display:inline-block}.notectl-math--inline:hover{background:var(--notectl-highlight,#0000000f)}.notectl-math--inline:focus-visible{outline:2px solid var(--notectl-primary);outline-offset:1px}.notectl-math--inline math{font-size:1.15em}.notectl-math--display{text-align:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin:12px 0;display:block}.notectl-math--display math{font-size:1.35em;display:inline-block}.notectl-math--display.notectl-math--selected{outline:2px solid var(--notectl-primary);outline-offset:4px;border-radius:6px}.notectl-math__error,.notectl-math merror{color:var(--notectl-danger,#c0392b);background:var(--notectl-danger-bg,#c0392b1a);border-radius:3px;padding:0 2px}"),t.registerStyleSheet(".notectl-formula-editor{box-sizing:border-box;flex-direction:column;gap:8px;min-width:320px;max-width:460px;padding:10px;display:flex}.notectl-formula-editor__field{flex-direction:column;gap:4px;display:flex}.notectl-formula-editor__label{color:var(--notectl-fg-muted,#555);font-size:12px;font-weight:600}.notectl-formula-editor__input{box-sizing:border-box;resize:vertical;border:1px solid var(--notectl-border);background:var(--notectl-surface-overlay,#fff);width:100%;min-height:56px;color:var(--notectl-fg);border-radius:4px;padding:6px 8px;font-family:SF Mono,Fira Code,Menlo,Consolas,monospace;font-size:13px;line-height:1.5}.notectl-formula-editor__alt{box-sizing:border-box;border:1px solid var(--notectl-border);background:var(--notectl-surface-overlay,#fff);width:100%;color:var(--notectl-fg);border-radius:4px;padding:5px 8px;font-size:13px}.notectl-formula-editor__size{box-sizing:border-box;border:1px solid var(--notectl-border);background:var(--notectl-surface-overlay,#fff);color:var(--notectl-fg);cursor:pointer;border-radius:4px;padding:5px 8px;font-size:13px}.notectl-formula-editor__size:focus-visible{outline:2px solid var(--notectl-primary);outline-offset:1px}.notectl-formula-editor__preview{border:1px dashed var(--notectl-border);background:var(--notectl-surface-raised,#fafafa);text-align:center;border-radius:4px;min-height:44px;padding:8px;overflow-x:auto}.notectl-formula-editor__preview math{font-family:Notectl Math,math;font-size:1.3em}.notectl-formula-editor__preview-empty{color:var(--notectl-fg-muted,#888);font-size:13px}.notectl-formula-editor__errors{color:var(--notectl-danger,#c0392b);margin:0;padding-inline-start:16px;font-size:12px}.notectl-formula-editor__row{align-items:center;gap:8px;display:flex}.notectl-formula-editor__toggle{color:var(--notectl-fg);align-items:center;gap:6px;font-size:13px;display:flex}.notectl-formula-editor__actions{justify-content:flex-end;gap:8px;margin-top:2px;display:flex}.notectl-formula-editor__btn{border:1px solid var(--notectl-border);background:var(--notectl-surface-raised);color:var(--notectl-fg);cursor:pointer;border-radius:4px;padding:6px 14px;font-size:13px}.notectl-formula-editor__btn--primary{background:var(--notectl-primary);border-color:var(--notectl-primary);color:var(--notectl-primary-fg,#fff)}.notectl-formula-editor__btn:focus-visible{outline:2px solid var(--notectl-primary);outline-offset:2px}.notectl-formula-overlay{z-index:1000;border:1px solid var(--notectl-border);background:var(--notectl-surface-overlay,#fff);border-radius:8px;position:fixed;box-shadow:0 6px 24px #0000002e}.notectl-math-palette{border-bottom:1px solid var(--notectl-border);flex-wrap:wrap;gap:8px;max-height:216px;margin-bottom:2px;padding:2px 2px 8px;display:flex;overflow-y:auto}.notectl-math-palette__group{flex-wrap:wrap;gap:2px;display:flex}.notectl-math-palette__group+.notectl-math-palette__group{border-inline-start:1px solid var(--notectl-border);padding-inline-start:6px}.notectl-math-palette__btn{min-width:30px;height:30px;color:var(--notectl-fg);cursor:pointer;background:0 0;border:1px solid #0000;border-radius:4px;padding:0 6px;font-size:15px;line-height:1}.notectl-math-palette__btn:hover{background:var(--notectl-surface-raised)}.notectl-math-palette__btn:focus-visible{outline:2px solid var(--notectl-primary);outline-offset:1px}"),this.config.mathFont&&t.registerStyleSheet(function(t){const e=(t.family.split(",")[0]??t.name).trim().replace(/['"]/g,"");return(t.fontFaces??[]).map(t=>{const n=[`font-family: '${e}'`,`src: ${t.src}`];return t.weight&&n.push(`font-weight: ${t.weight}`),t.style&&n.push(`font-style: ${t.style}`),n.push(`font-display: ${t.display??"swap"}`),`@font-face { ${n.join("; ")}; }`}).join("\n")}(this.config.mathFont)),t.registerInlineNodeSpec({type:J,attrs:{mathml:{default:""},latex:{default:""},alt:{default:""},fontSize:{default:""}},toDOM(t){const e=document.createElement("span");return e.className="notectl-math notectl-math--inline",e.setAttribute("contenteditable","false"),e.setAttribute("data-inline-type",J),K(e,V(t.attrs)),W(e,t.attrs),e},toHTMLString:t=>Z(V(t.attrs)),toMarkdown:t=>`$${String(t.attrs.latex??"")}$`,parseHTML:[{tag:"math",getAttrs:t=>Q(t,!1)}],sanitize:{tags:[...it],attrs:[...at]}}),t.registerNodeSpec({type:Y,group:"block",isVoid:!0,selectable:!0,attrs:{mathml:{default:""},latex:{default:""},alt:{default:""},fontSize:{default:""}},toDOM(t){const e=v("div",t.id);return e.className="notectl-math notectl-math--display",e.setAttribute("data-void","true"),e.setAttribute("data-selectable","true"),K(e,V(t.attrs)),W(e,t.attrs),e},toHTML:t=>Z(V(t.attrs)),toMarkdown:t=>`$$\n${String(t.attrs?.latex??"")}\n$$`,parseHTML:[{tag:"math",getAttrs:t=>Q(t,!0)}],sanitize:{tags:[...it],attrs:[...at]}}),this.overlay=new De(t,this.locale,this.fontSizes),t.registerNodeView(Y,(e={onEdit:(t,e)=>this.editDisplay(t,e),onSelect:()=>t.announce(this.locale.selected)},t=>{let n=t.id,i=!1;const a=v("div",t.id);return a.className="notectl-math notectl-math--display",a.setAttribute("data-void","true"),a.setAttribute("data-selectable","true"),K(a,V(t.attrs)),W(a,t.attrs),a.addEventListener("dblclick",t=>{t.preventDefault(),e.onEdit(n,a.getBoundingClientRect())}),{dom:a,contentDOM:null,update:t=>"math_display"===t.type&&(n=t.id,a.setAttribute("data-block-id",t.id),K(a,V(t.attrs)),W(a,t.attrs),!0),selectNode(){a.classList.add("notectl-math--selected"),i||(i=!0,e.onSelect())},deselectNode(){a.classList.remove("notectl-math--selected"),i=!1}}})),!1!==this.config.inputRule)for(const a of[{pattern:Le,handler(t,e){const n=t.selection;if(!l(n)||!r(n))return null;const a=(e[1]??"").trim();if(!a)return null;const o=n.anchor.blockId;if(!ke(t,o))return null;const c=Se(n.anchor.offset,e[0].length);if(!c)return null;const p=t.doc.children.findIndex(t=>t.id===o);if(-1===p)return null;const{presentation:d}=xe(a,{display:!0}),m=j({presentation:d,latex:a,display:!0}),h=t.transaction("input").deleteTextAt(o,c.from,c.to);return function(t,e,n){const a=i(u(Y),[],void 0,ot(n)),r=i(u("paragraph"));t.insertNode([],e,a).insertNode([],e+1,r).setSelection(s(a.id,[]))}(h,p+1,{mathml:m,latex:a,alt:"",fontSize:""}),h.build()}},{pattern:we,handler(t,e){const i=t.selection;if(!l(i)||!r(i))return null;const a=(e[1]??"").trim();if(!a)return null;const o=i.anchor.blockId;if(!ke(t,o))return null;const s=Se(i.anchor.offset,e[0].length);if(!s)return null;const{presentation:p}=xe(a,{display:!1}),u=j({presentation:p,latex:a,display:!1}),m=n(d(J),{mathml:u,latex:a,alt:"",fontSize:""});return t.transaction("input").deleteTextAt(o,s.from,s.to).insertInlineNode(o,s.from,m).setSelection(c(o,s.from+1)).build()}}])t.registerInputRule(a);t.registerMarkdownSyntax({id:"formula",matchInline(t,e){if("$"!==t[e]||"$"===t[e+1])return null;const n=function(t,e){for(let n=e;n<t.length;n++){const e=t[n]??"";if("\n"===e)return-1;if("$"===e)return n}return-1}(t,e+1);if(-1===n)return null;const i=t.slice(e+1,n).trim();return""===i?null:{type:J,attrs:{..._e(i,!1)},length:n-e+1}},matchBlock(t,e){const n=t[e]??"",i=n.match(ze);if(i?.[1]?.trim())return{type:Y,attrs:{..._e(i[1].trim(),!0)},linesConsumed:1};if("$$"!==n.trim())return null;const a=[];let r=e+1;for(;r<t.length&&"$$"!==(t[r]??"").trim();)a.push(t[r]??""),r++;if(r>=t.length)return null;const o=a.join("\n").trim();return{type:Y,attrs:{..._e(o,!0)},linesConsumed:r-e+1}}}),t.registerPasteInterceptor((t,e,n)=>{if(!function(t){if(!t)return!1;const e=Fe(t);if(!e.querySelector("math"))return!1;const n=e.cloneNode(!0);for(const i of Array.from(n.querySelectorAll('math, [aria-hidden="true"]')))i.remove();return""===(n.textContent??"").trim()}(e))return null;const i=function(t){if(!t)return[];const e=Fe(t);for(const n of Array.from(e.querySelectorAll('[aria-hidden="true"]')))n.remove();return Array.from(e.querySelectorAll("math"))}(e).map(qe).filter(t=>null!==t);return 0===i.length?null:i.every(t=>{return e=t.mathml,!/<math\b[^>]*\bdisplay=["']block["']/i.test(e);var e})?lt(n,i):st(n,i)},{name:"formula",priority:40}),this.registerCommands(t),this.registerKeymap(t),function(t,e,n){t.registerToolbarItem({id:"formula",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round"><path d="M18 5 H6 L12 12 L6 19 H18"/></svg>',label:e.insertInline,tooltip:e.insertInlineTooltip,command:"insertInlineFormula",popupType:"custom",renderPopup:(t,i,a)=>{Pe(t,{context:i,locale:e,mode:"insert",fontSizes:n,onClose:a,onCommit:t=>{pt(i,e,t),a(),i.getContainer().focus()}})}})}(t,this.locale,this.fontSizes),this.installClickToEdit(t)}destroy(){this.clickHandler&&this.context&&this.context.getContainer().removeEventListener("click",this.clickHandler),this.clickHandler=null,this.overlay?.close(!1),this.overlay=null,this.context=null}registerCommands(n){n.registerCommand("insertInlineFormula",()=>{const i=function(n){const i=n.selection;if(!l(i)||!r(i))return null;const o=i.anchor.blockId,s=n.getBlock(o);if(!s)return null;const c=i.anchor.offset;for(const{child:r,from:l,to:p}of t(e(s)))if(a(r)&&"math_inline"===r.inlineType&&(p===c||l===c)){const t=V(r.attrs);return{kind:"inline",blockId:o,offset:l,latex:t.latex,alt:t.alt,fontSize:t.fontSize,rect:null}}return null}(n.getState());return i?(this.overlay?.openEdit(i),!0):(this.overlay?.openInsert(!1),!0)}),n.registerCommand("insertDisplayFormula",()=>{const t=rt(n.getState());return t?(this.editDisplay(t,null),!0):(this.overlay?.openInsert(!0),!0)})}registerKeymap(t){const e={},n=this.resolvedKeymap.insertInline,i=this.resolvedKeymap.insertDisplay;n&&(e[n]=()=>t.executeCommand("insertInlineFormula")),i&&(e[i]=()=>t.executeCommand("insertDisplayFormula")),e.Enter=()=>{const e=rt(t.getState());return!!e&&(this.editDisplay(e,null),!0)},t.registerKeymap(e,{priority:"context"})}installClickToEdit(n){const i=n.getContainer(),r=r=>{if(n.isReadOnly())return;const o=r.target?.closest(".notectl-math--inline");if(!o)return;const l=function(n,i,r){const o=x(n,i,0);if(!o)return null;const l=function(n,i,r){const o=n.getBlock(i);if(!o)return null;for(const{child:l,from:s}of t(e(o)))if(s===r&&a(l)&&"math_inline"===l.inlineType)return V(l.attrs);return null}(r,o.blockId,o.offset);return l?{kind:"inline",blockId:o.blockId,offset:o.offset,latex:l.latex,alt:l.alt,fontSize:l.fontSize,rect:i.getBoundingClientRect()}:null}(i,o,n.getState());l&&(r.preventDefault(),this.overlay?.openEdit(l))};this.clickHandler=r,i.addEventListener("click",r)}editDisplay(t,e){if(!this.overlay||!this.context)return;const n=function(t,e,n){const i=t.getBlock(e);if(!i||"math_display"!==i.type)return null;const a=V(i.attrs);return{kind:"display",path:t.getNodePath(e)??[e],latex:a.latex,alt:a.alt,fontSize:a.fontSize,rect:n}}(this.context.getState(),t,e);n&&this.overlay.openEdit(n)}};export{at as a,j as c,xe as i,Ce as n,it as o,Ae as r,tt as s,Re as t};
2
- //# sourceMappingURL=FormulaPlugin-DVpLaKi5.mjs.map
@@ -1,2 +0,0 @@
1
- import{k as t}from"./Document-ssR6hBzG.mjs";import{u as e}from"./Selection-DC6AOGgF.mjs";import{i as r}from"./NavigationQueries-CaKfccu7.mjs";import{c as o,o as s}from"./PluginHelpers-B3gk3VB3.mjs";import{t as n}from"./Platform-ByobkiCc.mjs";import{n as i,r as c}from"./SelectionTransactions-mQ1NfMEg.mjs";function a(o,s,a){const l=o.selection;if(!e(l))return null;const u=o.getBlockOrder(),f=u.indexOf(l.blockId);if(f<0)return null;const p=function(t,e,r){if(!r)return t;if("left"!==t&&"right"!==t)return t;const o=r.querySelector(`[data-block-id="${e}"]`);return o instanceof HTMLElement?"rtl"!==n(o)?t:"left"===t?"right":"left":t}(s,l.blockId,a);if("before"===l.side&&("right"===p||"down"===p)||"after"===l.side&&("left"===p||"up"===p))return c(o,l.blockId);const d="before"===l.side?f-1:f+1;if(d<0||d>=u.length)return null;const m=u[d];if(!m)return null;if(r(o,m))return c(o,m);const h=o.getBlock(m);if(!h)return null;const g="left"===p||"up"===p?t(h):0;return i(o,m,g)}var l={gapCursorActive:"Gap cursor active. Type to insert new paragraph."},u=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-CR6UdFL9.mjs"),"./locales/de.ts":()=>import("./de-CHcv_Vmf.mjs"),"./locales/es.ts":()=>import("./es-BIXm2Coj.mjs"),"./locales/fr.ts":()=>import("./fr-Bg937iAy.mjs"),"./locales/hi.ts":()=>import("./hi-B5cl8TWK.mjs"),"./locales/pt.ts":()=>import("./pt-UPF7DBlz.mjs"),"./locales/ru.ts":()=>import("./ru-CkG_bpfo.mjs"),"./locales/zh.ts":()=>import("./zh-CWIzJcXi.mjs")});async function f(t){return o(u,t,l)}var p=class{id="gap-cursor";name="Gap Cursor";priority=5;context=null;activeCursorBlockId=null;activeCursorSide=null;locale=l;async init(t){this.locale=await s(t,void 0,l,f),this.context=t,t.registerStyleSheet('.notectl-gap-cursor--before,.notectl-gap-cursor--after{position:relative}.notectl-gap-cursor--before:before{content:"";top:0;pointer-events:none;z-index:1;background:currentColor;width:100%;height:1px;animation:1.1s step-end infinite notectl-gap-blink;display:block;position:absolute;inset-inline-start:0;transform:translateY(-50%)}.notectl-gap-cursor--after:after{content:"";bottom:0;pointer-events:none;z-index:1;background:currentColor;width:100%;height:1px;animation:1.1s step-end infinite notectl-gap-blink;display:block;position:absolute;inset-inline-start:0;transform:translateY(50%)}@media (prefers-reduced-motion:reduce){.notectl-gap-cursor--before:before,.notectl-gap-cursor--after:after{animation:none}}@keyframes notectl-gap-blink{50%{opacity:0}}');const r={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down"},o={};for(const[s,n]of Object.entries(r))o[s]=()=>{const r=t.getState();if(!e(r.selection))return!1;const o=t.getContainer(),s=a(r,n,o);return!!s&&(t.dispatch(s),!0)};t.registerKeymap(o,{priority:"navigation"})}onReady(){this.context&&this.syncCursorClass(this.context.getState())}onStateChange(t,r,o){this.context&&(this.syncCursorClass(r),!e(t.selection)&&e(r.selection)&&this.context.announce(this.locale.gapCursorActive))}destroy(){this.clearCursorClass(),this.context=null}syncCursorClass(t){if(this.clearCursorClass(),!e(t.selection)||!this.context)return;const r="before"===t.selection.side?"notectl-gap-cursor--before":"notectl-gap-cursor--after",o=this.context.getContainer().querySelector(`[data-block-id="${t.selection.blockId}"]`);o instanceof HTMLElement&&(o.classList.add(r),this.activeCursorBlockId=t.selection.blockId,this.activeCursorSide=t.selection.side)}clearCursorClass(){if(!this.context||!this.activeCursorBlockId||!this.activeCursorSide)return;const t=this.context.getContainer().querySelector(`[data-block-id="${this.activeCursorBlockId}"]`);t instanceof HTMLElement&&t.classList.remove("notectl-gap-cursor--before","notectl-gap-cursor--after"),this.activeCursorBlockId=null,this.activeCursorSide=null}};export{a as n,p as t};
2
- //# sourceMappingURL=GapCursorPlugin-QDGwnaRR.mjs.map
@@ -1,2 +0,0 @@
1
- import e from"dompurify";function t(...e){return e.length>0?{SANITIZE_DOM:!1,FORBID_ATTR:[...e]}:{SANITIZE_DOM:!1}}function o(t,o,n){const i=e(window),r=n?.getElementSanitizeValidators?.();return r&&r.size>0&&i.addHook("uponSanitizeElement",e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;const t=e,o=r.get(t.localName.toLowerCase());if(o)for(const n of o){let e=!1;try{e=n(t)}catch{}if(!e)return void t.parentNode?.removeChild(t)}}),i.sanitize(t,o)}export{o as n,t};
2
- //# sourceMappingURL=HTMLSanitization-Ce9dVT1q.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HTMLSanitization-Ce9dVT1q.mjs","names":["createDOMPurify","preserveHTMLIdSanitizeConfig","additionalForbiddenAttrs","length","SANITIZE_DOM","FORBID_ATTR","sanitizeHTML","html","config","registry","sanitizer","window","validators","getElementSanitizeValidators","size","addHook","node","nodeType","Node","ELEMENT_NODE","element","elementValidators","get","localName","toLowerCase","validate","valid","parentNode","removeChild","sanitize"],"sources":["../../src/serialization/HTMLSanitization.ts"],"sourcesContent":["import createDOMPurify, { type Config, type DOMPurify } from 'dompurify';\nimport type { ElementSanitizeValidator } from '../model/SanitizeConfig.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\n\n/** DOMPurify options required to preserve semantic HTML IDs. */\nexport interface HTMLIdSanitizeConfig {\n\treadonly SANITIZE_DOM: false;\n\treadonly FORBID_ATTR?: string[];\n}\n\n/**\n * Builds the shared DOMPurify policy for HTML carrying document-local targets.\n *\n * DOMPurify's `SANITIZE_DOM` option removes otherwise valid IDs such as `target`\n * when their value matches a property on `document` or a form. Those removals\n * break the fragment-link contract. Callers may add attributes that a broad\n * sanitizer pass must always reject; schema-driven allowlists remain authoritative.\n */\nexport function preserveHTMLIdSanitizeConfig(\n\t...additionalForbiddenAttrs: readonly string[]\n): HTMLIdSanitizeConfig {\n\treturn additionalForbiddenAttrs.length > 0\n\t\t? { SANITIZE_DOM: false, FORBID_ATTR: [...additionalForbiddenAttrs] }\n\t\t: { SANITIZE_DOM: false };\n}\n\n/**\n * Sanitizes HTML in an isolated DOMPurify instance.\n *\n * DOMPurify hooks are mutable instance state. Reusing its module singleton\n * would let one editor widen another editor's policy—or remove a hook owned by\n * unrelated application code. A fresh instance makes the invocation the\n * ownership boundary, while schema validators carry the calling editor's exact\n * plugin policy into that invocation.\n */\nexport function sanitizeHTML(html: string, config: Config, registry?: SchemaRegistry): string {\n\tconst sanitizer: DOMPurify = createDOMPurify(window);\n\tconst validators: ReadonlyMap<string, readonly ElementSanitizeValidator[]> | undefined =\n\t\tregistry?.getElementSanitizeValidators?.();\n\n\tif (validators && validators.size > 0) {\n\t\tsanitizer.addHook('uponSanitizeElement', (node: Node) => {\n\t\t\tif (node.nodeType !== Node.ELEMENT_NODE) return;\n\t\t\tconst element = node as Element;\n\t\t\tconst elementValidators = validators.get(element.localName.toLowerCase());\n\t\t\tif (!elementValidators) return;\n\n\t\t\tfor (const validate of elementValidators) {\n\t\t\t\tlet valid = false;\n\t\t\t\ttry {\n\t\t\t\t\tvalid = validate(element);\n\t\t\t\t} catch {\n\t\t\t\t\t// Plugin-provided security validators fail closed.\n\t\t\t\t}\n\t\t\t\tif (!valid) {\n\t\t\t\t\telement.parentNode?.removeChild(element);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\treturn sanitizer.sanitize(html, config);\n}\n"],"mappings":"O,kBAkBA,SAAgBC,KACZC,GAEH,OAAOA,EAAyBC,OAAS,EACtC,CAAEC,cAAc,EAAOC,YAAa,IAAIH,IACxC,CAAEE,cAAc,EACpB,CAWA,SAAgBE,EAAaC,EAAcC,EAAgBC,GAC1D,MAAMC,EAAuBV,EAAgBW,QACvCC,EACLH,GAAUI,iCAwBX,OAtBID,GAAcA,EAAWE,KAAO,GACnCJ,EAAUK,QAAQ,sBAAwBC,IACzC,GAAIA,EAAKC,WAAaC,KAAKC,aAAc,OACzC,MAAMC,EAAUJ,EACVK,EAAoBT,EAAWU,IAAIF,EAAQG,UAAUC,eAC3D,GAAKH,EAEL,IAAK,MAAMI,KAAYJ,EAAmB,CACzC,IAAIK,GAAQ,EACZ,IACCA,EAAQD,EAASL,EAClB,CAAA,MAEA,CACA,IAAKM,EAEJ,YADAN,EAAQO,YAAYC,YAAYR,EAGlC,IAIKV,EAAUmB,SAAStB,EAAMC,EACjC,Q"}
@@ -1,2 +0,0 @@
1
- import{E as e,P as t,V as o,j as n,k as i}from"./Document-ssR6hBzG.mjs";import{c as r,f as a,n as s}from"./Selection-DC6AOGgF.mjs";import{a as c}from"./TypeBrands-Ch9856Gb.mjs";import{c as l,o as g}from"./PluginHelpers-B3gk3VB3.mjs";import{s as p}from"./StyleRuntime-C0RSqKzG.mjs";import{n as d}from"./DomUtils-Bf7JLFlx.mjs";function h(e,t,o,n){const i=document.createElement("button");i.type="button",i.className="notectl-heading-picker__item",i.setAttribute("role","option"),i.setAttribute("aria-selected",String(t)),t&&i.classList.add("notectl-heading-picker__item--active");const r=document.createElement("span");r.className="notectl-heading-picker__check",r.textContent=t?"✓":"",i.appendChild(r);const a=document.createElement("span");return a.className="notectl-heading-picker__label",a.textContent=e,n&&p(a,{fontSize:n.fontSize,fontWeight:n.fontWeight}),i.appendChild(a),i.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation()}),i.addEventListener("click",o),i}function u(e,t){return e[`heading${t}`]}function f(e,t){const o=e.getState();if(!a(o.selection))return!1;const n=o.getBlock(o.selection.anchor.blockId);return!!n&&(n.type===t?k(e,c("paragraph")):k(e,c(t)))}function m(e,t){const o=e.getState(),n=o.selection;if(!a(n))return!1;const i=o.getBlock(n.anchor.blockId);return!!i&&("heading"===i.type&&i.attrs?.level===t?k(e,c("paragraph")):k(e,c("heading"),{level:t}))}function k(e,n,r){const s=e.getState(),c=s.selection;if(!a(c))return!1;const l=s.getBlock(c.anchor.blockId);if(!l)return!1;const g=s.transaction("command"),p=e.getSchemaRegistry().getNodeSpec(n);p?.excludeMarks&&p.excludeMarks.length>0&&(function(e,n,r){if(0===i(n))return;const a=new Set(r),s=t(n);let c=0;for(const t of s)if(o(t)){if(t.text.length>0)for(const o of t.marks)a.has(o.type)&&e.removeMark(n.id,c,c+t.text.length,o);c+=t.text.length}else c+=1}(g,l,p.excludeMarks),function(e,t,o){if(!t.storedMarks)return;const n=new Set(o),i=t.storedMarks.filter(e=>!n.has(e.type));i.length!==t.storedMarks.length&&e.setStoredMarks(i.length>0?i:null,t.storedMarks)}(g,s,p.excludeMarks));const d=g.setBlockType(c.anchor.blockId,n,r).setSelection(c).build();return e.dispatch(d),!0}var b=/* @__PURE__ */new Set(["heading","title","subtitle"]);var y={paragraph:"Paragraph",title:"Title",subtitle:"Subtitle",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",blockTypeLabel:"Block Type",blockTypesAria:"Block types"},v=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-0g2bmXTn.mjs"),"./locales/de.ts":()=>import("./de-Bwxlcuee.mjs"),"./locales/es.ts":()=>import("./es-C7uVqFYr.mjs"),"./locales/fr.ts":()=>import("./fr-D5ulA3Z6.mjs"),"./locales/hi.ts":()=>import("./hi-CrmakMVj.mjs"),"./locales/pt.ts":()=>import("./pt-_qxIe7zX.mjs"),"./locales/ru.ts":()=>import("./ru-Cs8KCNyq.mjs"),"./locales/zh.ts":()=>import("./zh-BQ73oqxc.mjs")});async function x(e){return l(v,e,y)}var S={levels:[1,2,3,4,5,6]},T={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"},B=class{id="heading";name="Heading";priority=30;config;locale;constructor(e){this.config={...S,...e}}async init(t){this.locale=await g(t,this.config.locale,y,x),t.registerStyleSheet(".notectl-toolbar-btn--heading{min-width:100px;max-width:160px}.notectl-heading-picker{min-width:200px;max-height:320px;overflow-y:auto}.notectl-heading-picker__list{padding:4px 0}.notectl-heading-picker__item{cursor:pointer;width:100%;color:var(--notectl-fg);text-align:start;white-space:nowrap;background:0 0;border:none;align-items:center;gap:8px;padding:7px 12px;font-family:inherit;font-size:14px;transition:background .1s;display:flex}@media (hover:hover){.notectl-heading-picker__item:hover{background:var(--notectl-hover-bg)}}.notectl-heading-picker__item--active{background:var(--notectl-active-bg);color:var(--notectl-accent-fg)}@media (hover:hover){.notectl-heading-picker__item--active:hover{background:var(--notectl-active-bg)}}.notectl-heading-picker__check{width:16px;color:var(--notectl-accent-fg);flex-shrink:0;justify-content:center;align-items:center;font-size:13px;font-weight:600;display:inline-flex}.notectl-heading-picker__label{flex:1}"),this.registerNodeSpecs(t),function(e,t){e.registerCommand("setTitle",()=>f(e,"title")),e.registerCommand("setSubtitle",()=>f(e,"subtitle"));for(const o of t.levels)e.registerCommand(`setHeading${o}`,()=>m(e,o));e.registerCommand("toggleHeading",()=>m(e,1)),e.registerCommand("setParagraph",()=>k(e,c("paragraph")))}(t,this.config),function(t,o){const l={Enter:()=>function(t){return function(e,t){const o=e.getState();if(!a(o.selection))return!1;const n=o.selection;if(!r(n))return!1;const i=o.getBlock(n.anchor.blockId);return!(!i||!b.has(i.type))&&t({state:o,block:i,blockId:n.anchor.blockId,offset:n.anchor.offset})}(t,o=>{if(""===n(o.block)){const e=o.state.transaction("input").setBlockType(o.blockId,c("paragraph")).setSelection(o.state.selection).build();return t.dispatch(e),!0}const r=i(o.block);if(o.offset>=r){const n=e(),i=o.state.transaction("input").splitBlock(o.blockId,o.offset,n).setBlockType(n,c("paragraph")).setSelection(s(n,0)).build();return t.dispatch(i),!0}return!1})}(t)};for(const e of o.levels)e<=6&&(l[`Mod-Shift-${e}`]=()=>t.executeCommand(`setHeading${e}`));t.registerKeymap(l)}(t,this.config),!1!==this.config.inputRule&&function(e,t){for(const o of t.levels){const t="#".repeat(o),n=new RegExp(`^${t} $`);e.registerInputRule({pattern:n,handler(e,t,n,i){const l=e.selection;if(!a(l))return null;if(!r(l))return null;const g=e.getBlock(l.anchor.blockId);return g&&"paragraph"===g.type?e.transaction("input").deleteTextAt(l.anchor.blockId,n,n+o+1).setBlockType(l.anchor.blockId,c("heading"),{level:o}).setSelection(s(l.anchor.blockId,0)).build():null}})}}(t,this.config),function(e,t,o){e.registerBlockTypePickerEntry({id:"paragraph",label:o.paragraph,command:"setParagraph",priority:10,isActive:e=>!!a(e.selection)&&"paragraph"===e.getBlock(e.selection.anchor.blockId)?.type}),e.registerBlockTypePickerEntry({id:"title",label:o.title,command:"setTitle",priority:20,style:{fontSize:"1.6em",fontWeight:"700"},isActive:e=>!!a(e.selection)&&"title"===e.getBlock(e.selection.anchor.blockId)?.type}),e.registerBlockTypePickerEntry({id:"subtitle",label:o.subtitle,command:"setSubtitle",priority:30,style:{fontSize:"1.3em",fontWeight:"500"},isActive:e=>!!a(e.selection)&&"subtitle"===e.getBlock(e.selection.anchor.blockId)?.type});for(const n of t.levels)e.registerBlockTypePickerEntry({id:`heading-${n}`,label:u(o,n),command:`setHeading${n}`,priority:100+n,style:{fontSize:1.4-.1*n+"em",fontWeight:"600"},isActive:e=>{if(!a(e.selection))return!1;const t=e.getBlock(e.selection.anchor.blockId);return"heading"===t?.type&&t.attrs?.level===n}})}(t,this.config,this.locale),function(e,t){e.registerToolbarItem({id:"heading",group:"block",label:t.blockTypeLabel,tooltip:t.blockTypeLabel,command:"setParagraph",popupType:"combobox",getLabel:o=>function(e,t,o){if(!a(e.selection))return o.paragraph;const n=t.getBlockTypePickerRegistry().getBlockTypePickerEntries();for(const i of n)if(i.isActive(e))return i.label;return o.paragraph}(o,e,t),renderPopup:(e,o,n)=>{!function(e,t,o,n){e.classList.add("notectl-heading-picker");const i=t.getState();if(!a(i.selection))return;const r=t.getContainer(),s=document.createElement("div");s.className="notectl-heading-picker__list",s.setAttribute("role","listbox"),s.setAttribute("aria-label",o.blockTypesAria);const c=t.getBlockTypePickerRegistry().getBlockTypePickerEntries();for(const a of c){const e=a.isActive(i);s.appendChild(h(a.label,e,()=>{t.executeCommand(a.command),n({restoreFocusTo:r})},a.style))}e.appendChild(s)}(e,o,t,n)},isActive:t=>e.getBlockTypePickerRegistry().getBlockTypePickerEntries().some(e=>"paragraph"!==e.id&&e.isActive(t))})}(t,this.locale)}registerNodeSpecs(e){e.registerNodeSpec({type:"title",group:"block",content:{allow:["text"]},excludeMarks:["fontSize"],toDOM(e){const t=d("h1",e.id);return t.classList.add("notectl-title"),t},toHTML:(e,t)=>`<h1 class="notectl-title">${t||"<br>"}</h1>`,parseHTML:[{tag:"h1",priority:60,getAttrs:e=>!!e.classList.contains("notectl-title")&&{}}],sanitize:{tags:["h1"],attrs:["class"]}}),e.registerNodeSpec({type:"subtitle",group:"block",content:{allow:["text"]},excludeMarks:["fontSize"],toDOM(e){const t=d("h2",e.id);return t.classList.add("notectl-subtitle"),t},toHTML:(e,t)=>`<h2 class="notectl-subtitle">${t||"<br>"}</h2>`,parseHTML:[{tag:"h2",priority:60,getAttrs:e=>!!e.classList.contains("notectl-subtitle")&&{}}],sanitize:{tags:["h2"],attrs:["class"]}}),e.registerNodeSpec({type:"heading",group:"block",content:{allow:["text"]},excludeMarks:["fontSize"],attrs:{level:{default:1}},toDOM(e){const t=e.attrs?.level??1;return d(T[t]??"h1",e.id)},toHTML(e,t){const o=e.attrs?.level??1,n=T[o]??"h1";return`<${n}>${t||"<br>"}</${n}>`},parseHTML:[{tag:"h1",getAttrs:()=>({level:1})},{tag:"h2",getAttrs:()=>({level:2})},{tag:"h3",getAttrs:()=>({level:3})},{tag:"h4",getAttrs:()=>({level:4})},{tag:"h5",getAttrs:()=>({level:5})},{tag:"h6",getAttrs:()=>({level:6})}],sanitize:{tags:["h1","h2","h3","h4","h5","h6"]}})}};export{y as n,x as r,B as t};
2
- //# sourceMappingURL=HeadingPlugin-B7EfynaH.mjs.map
@@ -1,2 +0,0 @@
1
- import{c as e,o as s}from"./PluginHelpers-B3gk3VB3.mjs";import{n as t,o,s as i,t as r}from"./ColorValidation-ZBKZ_gTr.mjs";import{n as a,t as l}from"./InlineStyleMarkSpec-BhfGgfH9.mjs";import{t as f}from"./StyleClassNames-BsAx7k5T.mjs";import{t as c}from"./color-picker-D6HrTsDM.mjs";import{a as h,i as g,t as m}from"./ColorPickerPopup-B6340f3p.mjs";var n={label:"Highlight",tooltip:"Highlight Color",resetLabel:"None",ariaLabelPrefix:"Highlight color"},p=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BAfInw85.mjs"),"./locales/de.ts":()=>import("./de-C9ZhDqPi.mjs"),"./locales/es.ts":()=>import("./es-BMm9kqjC.mjs"),"./locales/fr.ts":()=>import("./fr-F2ZrfVaF.mjs"),"./locales/hi.ts":()=>import("./hi-uACJUw53.mjs"),"./locales/pt.ts":()=>import("./pt-zMHcNGPk.mjs"),"./locales/ru.ts":()=>import("./ru-k7o3Qks3.mjs"),"./locales/zh.ts":()=>import("./zh-DlVfQn4z.mjs")});async function d(s){return e(p,s,n)}var b=["#fff176","#aed581","#4dd0e1","#64b5f6","#ce93d8","#f48fb1","#ffab91","#ff8a65","#e6ee9c","#80cbc4","#fff9c4","#dcedc8","#e0f7fa","#e3f2fd","#f3e5f5","#fce4ec","#fff3e0","#fbe9e7","#f9fbe7","#e0f2f1","#fff59d","#c5e1a5","#80deea","#90caf9","#e1bee7","#f8bbd0","#ffcc80","#ffab91","#e6ee9c","#a5d6a7","#ffee58","#9ccc65","#26c6da","#42a5f5","#ab47bc","#ec407a","#ffa726","#ff7043","#d4e157","#66bb6a","#ffffff","#fafafa","#f5f5f5","#eeeeee","#e0e0e0","#bdbdbd","#e8eaf6","#efebe9","#eceff1","#fafafa"],u={type:"highlight",rank:4,valueAttr:"color",domStyleProperty:"backgroundColor",cssProperty:"background-color",validate:t,validateOnParse:!0},y=class{id="highlight";name="Highlight";priority=24;config;colors;locale;constructor(e){this.config={...e},this.colors=i(e?.colors,b,"HighlightPlugin")}async init(e){this.locale=await s(e,this.config.locale,n,d),e.registerStyleSheet(c),this.registerMarkSpec(e),this.registerStyleClasses(e),this.registerCommands(e),this.registerToolbarItem(e)}registerMarkSpec(e){const s=o(this.colors,this.config.styleClasses);e.registerMarkSpec(l({...u,knownValues:s}))}registerStyleClasses(e){f(e,"HighlightPlugin",this.config.styleClasses,e=>a(u.cssProperty,r(e)))}registerCommands(e){e.registerCommand("removeHighlight",()=>h(e,e.getState(),"highlight"))}registerToolbarItem(e){const s=['<svg xmlns="http://www.w3.org/2000/svg"',' viewBox="0 0 24 24">','<path d="M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z"/>','<rect x="3" y="17" width="18" height="6"',' rx="0.5" fill="#fff176"/>',"</svg>"].join("");e.registerToolbarItem({id:"highlight",group:"format",icon:s,label:this.locale.label,tooltip:this.locale.tooltip,command:"removeHighlight",popupType:"custom",renderPopup:(e,s,t)=>{m(e,s,{markType:"highlight",colors:this.colors,columns:10,resetLabel:this.locale.resetLabel,resetCommand:"removeHighlight",ariaLabelPrefix:this.locale.ariaLabelPrefix,onClose:t})},isActive:e=>g(e,"highlight")})}};export{n,d as r,y as t};
2
- //# sourceMappingURL=HighlightPlugin-LdO0INtJ.mjs.map
@@ -1,2 +0,0 @@
1
- import{p as t}from"./Document-ssR6hBzG.mjs";import{c as e,f as o,n as r}from"./Selection-DC6AOGgF.mjs";import{a as i}from"./TypeBrands-Ch9856Gb.mjs";import{a as s}from"./BlockInsertion-CXfXqUZl.mjs";import{c as l,i as n,o as a}from"./PluginHelpers-B3gk3VB3.mjs";import{n as c}from"./DomUtils-Bf7JLFlx.mjs";import{t as m}from"./ShortcutFormatting-TwiufqeV.mjs";var p={label:"Horizontal Rule",tooltip:t=>`Horizontal Rule (${t})`},u=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-CrOb0jL2.mjs"),"./locales/de.ts":()=>import("./de-C7uehgMu.mjs"),"./locales/es.ts":()=>import("./es-xuahrvJN.mjs"),"./locales/fr.ts":()=>import("./fr-B9pBLaVx.mjs"),"./locales/hi.ts":()=>import("./hi-DWX6k5ZD.mjs"),"./locales/pt.ts":()=>import("./pt-DFKJVh7k.mjs"),"./locales/ru.ts":()=>import("./ru-q8kz-237.mjs"),"./locales/zh.ts":()=>import("./zh-BGYJXxVl.mjs")});async function h(t){return l(u,t,p)}var d={},g=class{id="horizontal-rule";name="Horizontal Rule";priority=40;config;locale;constructor(t){this.config={...d,...t}}async init(t){this.locale=await a(t,this.config.locale,p,h),this.registerNodeSpec(t),this.registerCommands(t),this.registerKeymap(t),!1!==this.config.inputRule&&this.registerInputRule(t),this.registerToolbarItem(t)}registerNodeSpec(t){t.registerNodeSpec({type:"horizontal_rule",group:"block",isVoid:!0,toDOM:t=>c("hr",t.id),toHTML:()=>"<hr>",parseHTML:[{tag:"hr"}],sanitize:{tags:["hr"]}})}registerCommands(t){t.registerCommand("insertHorizontalRule",()=>this.insertHorizontalRule(t))}registerKeymap(t){t.registerKeymap({"Mod-Shift-H":()=>t.executeCommand("insertHorizontalRule")})}registerInputRule(s){s.registerInputRule({pattern:/^-{3,} $/,handler(s,l,n,a){const c=s.selection;if(!o(c))return null;if(!e(c))return null;const m=s.getBlock(c.anchor.blockId);if(!m||"paragraph"!==m.type)return null;const p=function(t){const e=t.selection;return o(e)?t.doc.children.findIndex(t=>t.id===e.anchor.blockId):-1}(s);if(-1===p)return null;const u=t(i("paragraph"));return s.transaction("input").deleteTextAt(c.anchor.blockId,0,a).setBlockType(c.anchor.blockId,i("horizontal_rule")).insertNode([],p+1,u).setSelection(r(u.id,0)).build()}})}registerToolbarItem(t){t.registerToolbarItem({id:"horizontal-rule",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11h16v2H4z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(m("Mod-Shift-H")),command:"insertHorizontalRule",isActive:()=>!1})}insertHorizontalRule(e){const o=e.getState(),l=n(o);if(!l)return!1;const a=o.transaction("command"),c=s(o,a,l,t(i("horizontal_rule")));return!!c&&(a.setSelection(r(c.id,0)),e.dispatch(a.build()),!0)}};export{p as n,h as r,g as t};
2
- //# sourceMappingURL=HorizontalRulePlugin-YywXVZYr.mjs.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./HTMLUtils-DTpsjZyK.mjs";import{D as t,R as i,p as n}from"./Document-ssR6hBzG.mjs";import{d as r,i as o,u as a}from"./Selection-DC6AOGgF.mjs";import{a as s}from"./TypeBrands-Ch9856Gb.mjs";import{a as l,i as c}from"./BlockInsertion-CXfXqUZl.mjs";import{t as d}from"./NodeSelectionCommands-CAqIHW_6.mjs";import{n as g}from"./TypedKeys-CA4bfw9O.mjs";import{c as m,o as p}from"./PluginHelpers-B3gk3VB3.mjs";import{n as u}from"./SelectionReplacement-vC1xhFS0.mjs";import{c as h,n as f,s as b}from"./StyleRuntime-C0RSqKzG.mjs";import{t as v}from"./Platform-ByobkiCc.mjs";import{n as x}from"./DomUtils-Bf7JLFlx.mjs";import{t as _}from"./ShortcutFormatting-TwiufqeV.mjs";function w(e,t){const i=e.getState(),n=i.selection;if(a(n))return!1;const o=r(n)?n.nodeId:n.anchor.blockId;return y(e,i,i.transaction("command"),o,t)}function z(e,t){const i=e.getState();if(a(i.selection))return!1;const n=i.transaction("paste"),r=u(i,n);return y(e,r.state,n,r.blockId,t)}function y(e,r,a,d,g){const m={src:g.src,alt:g.alt??"",align:g.align??"center",...void 0!==g.width?{width:g.width}:{},...void 0!==g.height?{height:g.height}:{}},p=c(r,d);return!!(p?function(e,r,a,l){const c=e.getNodePath(a);if(!c)return!1;const d=n(s("image"),[],void 0,l),g=e.getBlock(a);if(!g)return!1;const m=t(g);for(let t=m.length-1;t>=0;t--){const e=g.children.findIndex(e=>i(e)&&e.id===m[t]?.id);-1!==e&&r.removeNode(c,e)}return r.insertNode(c,0,d),r.setSelection(o(d.id,[...c,d.id])),!0}(r,a,p,m):function(e,t,i,r){const a=n(s("image"),[],void 0,r);return!!l(e,t,i,a)&&(t.setSelection(o(a.id,[])),!0)}(r,a,d,m))&&(e.dispatch(a.build()),!0)}function S(e,t,i){const n=e.getState(),o=n.selection;if(!r(o))return!1;const a=n.getBlock(o.nodeId);if(!a||"image"!==a.type)return!1;const s=a.attrs?.width,l=a.attrs?.height;if(void 0===s||void 0===l)return!1;const c=l>0?s/l:1,d=Math.max(50,Math.min(i,s+t)),g=Math.round(d/c);return(d!==s||g!==l)&&function(e,t){const i=e.getState(),n=i.selection;if(!r(n))return!1;const o=i.getBlock(n.nodeId);if(!o||"image"!==o.type)return!1;const a=i.getNodePath(n.nodeId);if(!a)return!1;const s={...o.attrs??{},...t},l=i.transaction("command").setNodeAttr(a,s).build();return e.dispatch(l),!0}(e,{width:d,height:g})}var I={insertImage:"Insert Image",insertImageTooltip:"Insert Image",uploadFromComputer:"Upload from computer",uploadAria:"Upload image from computer",separator:"or",urlPlaceholder:"https://...",urlAria:"Image URL",insertButton:"Insert",insertAria:"Insert image",imageAria:(e,t,i)=>{const n=[e||"Image"];return void 0!==t&&void 0!==i&&n.push(`${t} by ${i} pixels`),n.join(", ")},resetToNaturalSize:"Image reset to natural size.",uploadFailed:"Upload failed.",uploading:"Uploading...",resizeHandleLabel:e=>`Resize ${e}`,imageSelected:"Image selected.",altTextPrefix:"Alt text: ",imageSizeAnnounce:(e,t)=>`Size: ${e} by ${t} pixels.`,resizeHint:(e,t)=>`${e} / ${t} to resize.`,imageResized:(e,t)=>`Image resized to ${e} by ${t} pixels.`,keyboardResizeHint:(e,t)=>`${e} / ${t} to resize`},k=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-4b8e2YSc.mjs"),"./locales/de.ts":()=>import("./de-i95F9SDy.mjs"),"./locales/es.ts":()=>import("./es-DehVGwQ8.mjs"),"./locales/fr.ts":()=>import("./fr-DEZ_oxzS.mjs"),"./locales/hi.ts":()=>import("./hi-J8ErB5nB.mjs"),"./locales/pt.ts":()=>import("./pt-BlFAJZo7.mjs"),"./locales/ru.ts":()=>import("./ru-D53d-_UB.mjs"),"./locales/zh.ts":()=>import("./zh-DdzgYD7k.mjs")});async function A(e){return m(k,e,I)}var L={start:"notectl-image--start",center:"notectl-image--center",end:"notectl-image--end"},C={nw:"nwse-resize",ne:"nesw-resize",sw:"nesw-resize",se:"nwse-resize"},N={nw:-1,ne:1,sw:-1,se:1},j={nw:"nesw-resize",ne:"nwse-resize",sw:"nwse-resize",se:"nesw-resize"},$=null;function E(){$&&($.remove(),$=null)}function M(e,t,i,n=I){return(r,o,a)=>{const s=document.createElement("figure");s.className="notectl-image",s.setAttribute("data-block-id",r.id),s.setAttribute("data-void","true"),s.setAttribute("data-selectable","true");const l=document.createElement("div");l.className="notectl-image__container";const c=document.createElement("img");c.className="notectl-image__img",c.draggable=!1;const d=document.createElement("div");d.className="notectl-image__overlay",l.appendChild(c),l.appendChild(d),s.appendChild(l);let g=r.id,m=null;function p(e){const i=e.attrs?.src??"",r=e.attrs?.alt??"",o=e.attrs?.width,a=e.attrs?.height,l=e.attrs?.align??"center";c.src!==i&&(c.src=i),c.alt=r,h(c,"width",void 0!==o?`${o}px`:""),h(c,"height",void 0!==a?`${a}px`:"");for(const t of Object.values(L))s.classList.remove(t);const g=L[l];g&&s.classList.add(g);const m=t.get(e.id)??"idle",p="uploading"===m;d.classList.toggle("notectl-image__overlay--uploading",p),d.classList.toggle("notectl-image__overlay--error","error"===m),d.textContent=p?n.uploading:"error"===m?n.uploadFailed:"",p?s.setAttribute("aria-busy","true"):s.removeAttribute("aria-busy"),function(e){const t=e.attrs?.alt??"",i=e.attrs?.width,r=e.attrs?.height;s.setAttribute("aria-label",n.imageAria(t,i,r))}(e)}p(r);let u=!1;function x(t,i,n,r){let l=0,d=0,g=1,m=N[i];const p=t=>{const i=t.clientX-l,n=(o=d+i*m,Math.max(50,Math.min(e.maxWidth,o)));var o;const a=Math.round(n/g);b(c,{width:`${n}px`,height:`${a}px`}),r.textContent=`${Math.round(n)} × ${a}`},u=e=>{document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",u),s.classList.remove("notectl-image--resizing"),r.classList.remove("notectl-image__size-indicator--visible"),E();const t=Math.round(c.getBoundingClientRect().width);!function(e,t,i){const n=o(),r=n.getBlock(e);if(!r)return;const s=r.attrs?.width,l=r.attrs?.height;if(s===t&&l===i)return;const c=n.getNodePath(e);if(!c)return;const d={...r.attrs??{},width:t,height:i};a(n.transaction("command").setNodeAttr(c,d).build())}(n,t,Math.round(t/g)),e.target?.releasePointerCapture?.(e.pointerId)};t.addEventListener("pointerdown",e=>{e.preventDefault(),e.stopPropagation();const t="rtl"===v(s);m=function(e,t){const i=N[e];return t?-i:i}(i,t),l=e.clientX,d=c.getBoundingClientRect().width;const n=c.getBoundingClientRect().height;g=n>0?d/n:1,s.classList.add("notectl-image--resizing"),r.textContent=`${Math.round(d)} × ${Math.round(n)}`,r.classList.add("notectl-image__size-indicator--visible"),function(e,t){E(),$=document.createElement("style");const i=t?f(t):void 0;i&&$.setAttribute("nonce",i),$.textContent=`*{cursor:${e}!important;user-select:none!important}`,document.head.appendChild($)}(t?j[i]:C[i],s),e.target.setPointerCapture(e.pointerId),document.addEventListener("pointermove",p),document.addEventListener("pointerup",u)})}function w(){E(),m&&(m.remove(),m=null)}return c.addEventListener("load",()=>{if(u)return;const t=o(),i=t.getBlock(g);if(!i||"image"!==i.type)return;const n=void 0!==i.attrs?.width,r=void 0!==i.attrs?.height;if(n&&r)return void(u=!0);const s=c.naturalWidth,l=c.naturalHeight;if(0===s||0===l)return;const d=Math.min(s,e.maxWidth),m=s>0?l/s:1,p=Math.round(d*m),h=t.getNodePath(g);if(!h)return;const f={...i.attrs??{},width:d,height:p};a(t.transaction("command").setNodeAttr(h,f).build()),u=!0}),{dom:s,contentDOM:null,update:e=>"image"===e.type&&(g=e.id,s.setAttribute("data-block-id",e.id),p(e),!0),selectNode(){s.classList.add("notectl-image--selected"),function(t){if(!e.resizable||m)return;m=document.createElement("div"),m.className="notectl-image__resize-overlay",m.setAttribute("data-notectl-no-print","");const r=document.createElement("div");r.className="notectl-image__size-indicator",m.appendChild(r);for(const e of["nw","ne","sw","se"]){const i=document.createElement("div");i.className=`notectl-image__resize-handle notectl-image__resize-handle--${e}`,i.setAttribute("aria-hidden","true"),x(i,e,t,r),m.appendChild(i)}if(i){const e=function(e,t){const i=e.shrinkWidth??null,n=e.growWidth??null;return i&&n?t.keyboardResizeHint(_(i),_(n)):""}(i,n);if(e){const t=document.createElement("div");t.className="notectl-image__keyboard-hint",t.setAttribute("aria-hidden","true"),t.textContent=e,m.appendChild(t)}}l.appendChild(m)}(g)},deselectNode(){s.classList.remove("notectl-image--selected"),w()},destroy(){w()}}}}var R=new g("image:upload"),T={growWidth:"Mod-Shift-ArrowRight",shrinkWidth:"Mod-Shift-ArrowLeft",growWidthLarge:"Mod-Shift-Alt-ArrowRight",shrinkWidthLarge:"Mod-Shift-Alt-ArrowLeft",resetSize:"Mod-Shift-0"},B={maxWidth:800,maxFileSize:10485760,acceptedTypes:["image/png","image/jpeg","image/gif","image/webp","image/svg+xml"],resizable:!0,resizeStep:10,resizeStepLarge:50},U=class{id="image";name="Image";priority=45;config;resolvedKeymap;uploadStates=/* @__PURE__ */new Map;blobUrls=/* @__PURE__ */new Set;context=null;locale;constructor(e){this.config={...B,...e},this.resolvedKeymap={...T,...e?.keymap}}async init(e){this.locale=await p(e,this.config.locale,I,A),e.registerStyleSheet(".notectl-image{-webkit-user-select:none;-moz-user-select:none;user-select:none;margin:8px 0;line-height:0}.notectl-image--center{text-align:center}.notectl-image--start{text-align:start}.notectl-image--end{text-align:end}.notectl-image__container{line-height:0;display:inline-block;position:relative}.notectl-image__img{border-radius:4px;max-width:100%;display:block}.notectl-image--selected .notectl-image__container{outline:2px solid var(--notectl-primary);outline-offset:2px;border-radius:6px}.notectl-image__align-toolbar{background:var(--notectl-surface-overlay);border:1px solid var(--notectl-border);box-shadow:0 2px 8px var(--notectl-shadow);z-index:10;border-radius:6px;gap:2px;padding:2px;display:flex;position:absolute;top:-36px;left:50%;transform:translate(-50%)}.notectl-image__align-btn{cursor:pointer;width:28px;height:28px;color:var(--notectl-fg);background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;display:flex}.notectl-image__align-btn:hover{background:var(--notectl-hover-bg)}.notectl-image__align-btn--active{background:var(--notectl-active-bg);color:var(--notectl-accent-fg)}.notectl-image__align-btn svg{fill:currentColor;width:16px;height:16px}.notectl-image__overlay{color:var(--notectl-fg-muted);background:#fffc;border-radius:4px;justify-content:center;align-items:center;font-size:13px;display:none;position:absolute;inset:0}.notectl-image__overlay--uploading{display:flex}.notectl-image__overlay--error{background:var(--notectl-danger-muted);color:var(--notectl-danger);display:flex}.notectl-image__resize-overlay{pointer-events:none;position:absolute;inset:0}.notectl-image__resize-handle{background:var(--notectl-surface-raised);border:2px solid var(--notectl-primary);pointer-events:all;z-index:2;border-radius:50%;width:10px;height:10px;transition:transform .1s,background .1s;position:absolute}.notectl-image__resize-handle:hover{background:var(--notectl-primary);transform:scale(1.3)}.notectl-image--resizing .notectl-image__resize-handle{background:var(--notectl-primary)}.notectl-image__resize-handle--nw{top:-5px;cursor:nwse-resize;inset-inline-start:-5px}.notectl-image__resize-handle--ne{top:-5px;cursor:nesw-resize;inset-inline-end:-5px}.notectl-image__resize-handle--sw{bottom:-5px;cursor:nesw-resize;inset-inline-start:-5px}.notectl-image__resize-handle--se{bottom:-5px;cursor:nwse-resize;inset-inline-end:-5px}[dir=rtl] .notectl-image__resize-handle--nw{cursor:nesw-resize}[dir=rtl] .notectl-image__resize-handle--ne,[dir=rtl] .notectl-image__resize-handle--sw{cursor:nwse-resize}[dir=rtl] .notectl-image__resize-handle--se{cursor:nesw-resize}.notectl-image__size-indicator{background:var(--notectl-tooltip-bg);color:var(--notectl-tooltip-fg);white-space:nowrap;pointer-events:none;opacity:0;z-index:3;border-radius:4px;padding:2px 8px;font-size:11px;font-weight:500;transition:opacity .15s;position:absolute;bottom:-28px;left:50%;transform:translate(-50%)}.notectl-image__size-indicator--visible{opacity:1}.notectl-image__keyboard-hint{color:var(--notectl-fg-muted);white-space:nowrap;pointer-events:none;z-index:3;padding:2px 8px;font-size:11px;display:none;position:absolute;bottom:-28px;left:50%;transform:translate(-50%)}.notectl-image--selected .notectl-image__keyboard-hint{display:block}.notectl-image--resizing .notectl-image__keyboard-hint{display:none}.notectl-image--resizing .notectl-image__img{opacity:.85}"),e.registerStyleSheet(".notectl-image-popup{min-width:240px;padding:8px}.notectl-image-popup__file-input{opacity:0;width:0;height:0;position:absolute;overflow:hidden}.notectl-image-popup__upload-btn{cursor:pointer;text-align:center;box-sizing:border-box;border:1px solid var(--notectl-border);background:var(--notectl-surface-raised);width:100%;color:var(--notectl-fg);border-radius:4px;padding:8px 12px;display:block}.notectl-image-popup__separator{color:var(--notectl-fg-muted);align-items:center;margin:8px 0;font-size:12px;display:flex}.notectl-image-popup__separator-line{background:var(--notectl-border);flex:1;height:1px}.notectl-image-popup__separator-text{padding:0 8px}.notectl-image-popup__url-input{box-sizing:border-box;border:1px solid var(--notectl-border);background:var(--notectl-surface-overlay);width:100%;color:var(--notectl-fg);border-radius:4px;padding:6px 8px}.notectl-image-popup__insert-btn{cursor:pointer;border:1px solid var(--notectl-border);background:var(--notectl-surface-raised);width:100%;color:var(--notectl-fg);border-radius:4px;margin-top:4px;padding:8px 12px}"),this.context=e,this.registerNodeSpec(e),this.registerInlineImageNodeSpec(e),this.registerNodeView(e),function(e){e.registerCommand("insertImage",()=>w(e,{src:""})),e.registerCommand("removeImage",()=>function(e){const t=e.getState(),i=t.selection;if(!r(i))return!1;const n=t.getBlock(i.nodeId);if(!n||"image"!==n.type)return!1;const a=t.getNodePath(i.nodeId);if(!a||0===a.length)return!1;const s=d(t,o(i.nodeId,a));return!!s&&(e.dispatch(s),!0)}(e))}(e),this.registerResizeCommands(e),this.registerResizeKeymaps(e),this.registerFileHandler(e),this.registerToolbarItem(e)}destroy(){for(const e of this.blobUrls)URL.revokeObjectURL(e);this.blobUrls.clear(),this.uploadStates.clear(),this.context=null}onStateChange(e,t,i){if(!this.context)return;for(const o of this.uploadStates.keys())t.getBlock(o)||this.uploadStates.delete(o);const n=this.isImageSelected(e),r=this.isImageSelected(t);!n&&r&&this.announceImageSelection(t)}registerNodeSpec(t){const i=this.locale;t.registerNodeSpec({type:"image",group:"block",isVoid:!0,selectable:!0,attrs:{src:{default:""},alt:{default:""},title:{default:""},align:{default:"center"}},toDOM(e){const t=x("figure",e.id);t.className="notectl-image",t.setAttribute("data-void","true"),t.setAttribute("data-selectable","true");const n=document.createElement("div");n.className="notectl-image__container";const r=e.attrs?.alt??"",o=e.attrs?.width,a=e.attrs?.height,s=document.createElement("img");s.className="notectl-image__img",s.src=e.attrs?.src??"",s.alt=r;const l=e.attrs?.title??"";l&&(s.title=l),s.draggable=!1,void 0!==o&&h(s,"width",`${o}px`),void 0!==a&&h(s,"height",`${a}px`);const c={start:"notectl-image--start",center:"notectl-image--center",end:"notectl-image--end"}[e.attrs?.align??"center"];return c&&t.classList.add(c),t.setAttribute("aria-label",i.imageAria(r,o,a)),n.appendChild(s),t.appendChild(n),t},toHTML(t){const i=e(t.attrs?.src??""),n=e(t.attrs?.alt??""),r=t.attrs?.width,o=t.attrs?.height,a=(void 0!==r?` width="${r}"`:"")+(void 0!==o?` height="${o}"`:""),s=t.attrs?.title??"";return`<figure><img src="${i}" alt="${n}"${s?` title="${e(s)}"`:""}${a}></figure>`},parseHTML:[{tag:"figure",getAttrs(e){const t=e.querySelector("img");if(!t)return!1;const i={src:t.getAttribute("src")??"",alt:t.getAttribute("alt")??"",align:"center"},n=t.getAttribute("width"),r=t.getAttribute("height");n&&(i.width=Number.parseInt(n,10)),r&&(i.height=Number.parseInt(r,10));const o=t.getAttribute("title");o&&(i.title=o);const a=e.style?.textAlign??"";return"start"===a||"end"===a||"center"===a?i.align=a:"left"===a?i.align="start":"right"===a?i.align="end":e.classList.contains("notectl-align-start")||e.classList.contains("notectl-align-left")||e.classList.contains("notectl-image--start")||e.classList.contains("notectl-image--left")?i.align="start":e.classList.contains("notectl-align-end")||e.classList.contains("notectl-align-right")||e.classList.contains("notectl-image--end")||e.classList.contains("notectl-image--right")?i.align="end":e.classList.contains("notectl-align-center")&&(i.align="center"),i}},{tag:"img",getAttrs(e){const t={src:e.getAttribute("src")??"",alt:e.getAttribute("alt")??"",align:"center"},i=e.getAttribute("width"),n=e.getAttribute("height");i&&(t.width=Number.parseInt(i,10)),n&&(t.height=Number.parseInt(n,10));const r=e.getAttribute("title");return r&&(t.title=r),t}}],sanitize:{tags:["figure","img"],attrs:["src","alt","title","width","height","class","style"]}})}registerInlineImageNodeSpec(t){t.registerInlineNodeSpec({type:"image_inline",group:"inline",attrs:{src:{default:""},alt:{default:""},title:{default:""}},toDOM(e){const t=document.createElement("img");t.className="notectl-image-inline",t.setAttribute("contenteditable","false"),t.src=String(e.attrs.src??""),t.alt=String(e.attrs.alt??"");const i=String(e.attrs.title??"");return i&&(t.title=i),t.draggable=!1,t},toHTMLString(t){const i=e(String(t.attrs.src??"")),n=e(String(t.attrs.alt??"")),r=String(t.attrs.title??"");return`<img src="${i}" alt="${n}"${r?` title="${e(r)}"`:""}>`},parseHTML:[{tag:"img",getAttrs:e=>{const t={src:e.getAttribute("src")??"",alt:e.getAttribute("alt")??""},i=e.getAttribute("title");return i&&(t.title=i),t}}],sanitize:{tags:["img"],attrs:["src","alt","title"]}})}registerNodeView(e){e.registerNodeView("image",M(this.config,this.uploadStates,this.resolvedKeymap,this.locale))}registerResizeCommands(e){const t=this.config.resizeStep??10,i=this.config.resizeStepLarge??50,n=this.config.maxWidth;e.registerCommand("resizeImageGrow",()=>{const i=S(e,t,n);return i&&this.announceCurrentSize(e),i}),e.registerCommand("resizeImageShrink",()=>{const i=S(e,-t,n);return i&&this.announceCurrentSize(e),i}),e.registerCommand("resizeImageGrowLarge",()=>{const t=S(e,i,n);return t&&this.announceCurrentSize(e),t}),e.registerCommand("resizeImageShrinkLarge",()=>{const t=S(e,-i,n);return t&&this.announceCurrentSize(e),t}),e.registerCommand("resetImageSize",()=>{const t=function(e){const t=e.getState(),i=t.selection;if(!r(i))return!1;const n=t.getBlock(i.nodeId);if(!n||"image"!==n.type)return!1;const o=t.getNodePath(i.nodeId);if(!o)return!1;const a={...n.attrs??{}},s=Object.fromEntries(Object.entries(a).filter(([e])=>"width"!==e&&"height"!==e)),l=t.transaction("command").setNodeAttr(o,s).build();return e.dispatch(l),!0}(e);return t&&e.announce(this.locale.resetToNaturalSize),t})}registerResizeKeymaps(e){const t={};for(const[i,n]of Object.entries({growWidth:"resizeImageGrow",shrinkWidth:"resizeImageShrink",growWidthLarge:"resizeImageGrowLarge",shrinkWidthLarge:"resizeImageShrinkLarge",resetSize:"resetImageSize"})){const r=this.resolvedKeymap[i]??null;r&&(t[r]=()=>e.executeCommand(n))}Object.keys(t).length>0&&e.registerKeymap(t)}registerFileHandler(e){e.registerFileHandler("image/*",async(t,i,n)=>!!this.isAcceptedType(t.type)&&(this.handleFileInsert(e,t,"paste"===n?z:w),!0))}handleFileInsert(e,t,i){if(t.size>this.config.maxFileSize)return;const n=URL.createObjectURL(t);if(this.blobUrls.add(n),!i(e,{src:n}))return URL.revokeObjectURL(n),void this.blobUrls.delete(n);const o=e.getState().selection;if(!r(o))return;const a=o.nodeId;this.uploadStates.set(a,"uploading"),e.getService(R)?this.uploadFile(e,t,a,n):this.uploadStates.set(a,"complete")}async uploadFile(e,t,i,n){const r=e.getService(R);if(r)try{const o=await r.upload(t);this.uploadStates.set(i,"complete");const a=e.getState(),s=a.getBlock(i);if(!s)return;const l=a.getNodePath(i);if(!l)return;const c={...s.attrs??{},src:o.url,...void 0!==o.width?{width:o.width}:{},...void 0!==o.height?{height:o.height}:{}},d=a.transaction("command").setNodeAttr(l,c).build();e.dispatch(d),URL.revokeObjectURL(n),this.blobUrls.delete(n)}catch{this.uploadStates.set(i,"error"),e.announce(this.locale.uploadFailed)}}registerToolbarItem(e){e.registerToolbarItem({id:"image",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>',label:this.locale.insertImage,tooltip:this.locale.insertImageTooltip,command:"insertImage",popupType:"custom",renderPopup:(e,t,i)=>{!function(e,t,i){e.classList.add("notectl-image-popup"),function(e,t,i){const n=document.createElement("input");n.type="file",n.accept=i.acceptedTypes.join(","),n.className="notectl-image-popup__file-input";const r=document.createElement("button");r.type="button",r.textContent=i.locale.uploadFromComputer,r.setAttribute("aria-label",i.locale.uploadAria),r.className="notectl-image-popup__upload-btn",r.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation()}),r.addEventListener("click",()=>{n.click()}),n.addEventListener("change",()=>{const e=n.files?.[0];e&&(i.onFileInsert(t,e),i.onClose(),t.getContainer().focus())}),e.appendChild(n),e.appendChild(r)}(e,t,i),function(e,t){const i=document.createElement("div");i.className="notectl-image-popup__separator";const n=document.createElement("span");n.className="notectl-image-popup__separator-line";const r=document.createElement("span");r.textContent=t.separator,r.className="notectl-image-popup__separator-text";const o=document.createElement("span");o.className="notectl-image-popup__separator-line",i.appendChild(n),i.appendChild(r),i.appendChild(o),e.appendChild(i)}(e,i.locale),function(e,t,i){const n=document.createElement("input");n.type="url",n.placeholder=i.locale.urlPlaceholder,n.setAttribute("aria-label",i.locale.urlAria),n.className="notectl-image-popup__url-input";const r=document.createElement("button");r.type="button",r.textContent=i.locale.insertButton,r.setAttribute("aria-label",i.locale.insertAria),r.className="notectl-image-popup__insert-btn";const o=()=>{const e=n.value.trim();e&&(w(t,{src:e}),i.onClose(),t.getContainer().focus())};r.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation()}),r.addEventListener("click",()=>{o()}),n.addEventListener("keydown",e=>{"Enter"===e.key&&(e.preventDefault(),o())}),e.appendChild(n),e.appendChild(r),requestAnimationFrame(()=>n.focus())}(e,t,i)}(e,t,{acceptedTypes:this.config.acceptedTypes,locale:this.locale,onFileInsert:(e,t)=>this.handleFileInsert(e,t,w),onClose:i})}})}isAcceptedType(e){return this.config.acceptedTypes.some(t=>t===e||t.endsWith("/*")&&e.startsWith(t.slice(0,-1)))}isImageSelected(e){const t=e.selection;return!!r(t)&&"image"===e.getBlock(t.nodeId)?.type}announceImageSelection(e){if(!this.context)return;const t=e.selection;if(!r(t))return;const i=e.getBlock(t.nodeId);if(!i||"image"!==i.type)return;const n=i.attrs?.alt??"",o=i.attrs?.width,a=i.attrs?.height,s=[this.locale.imageSelected];n&&s.push(`${this.locale.altTextPrefix}${n}.`),void 0!==o&&void 0!==a&&s.push(this.locale.imageSizeAnnounce(o,a));const l=this.resolvedKeymap.shrinkWidth??null,c=this.resolvedKeymap.growWidth??null;l&&c&&s.push(this.locale.resizeHint(_(l),_(c))),this.context.announce(s.join(" "))}announceCurrentSize(e){const t=e.getState(),i=t.selection;if(!r(i))return;const n=t.getBlock(i.nodeId);if(!n||"image"!==n.type)return;const o=n.attrs?.width,a=n.attrs?.height;void 0!==o&&void 0!==a&&e.announce(this.locale.imageResized(o,a))}};export{A as a,I as i,T as n,R as r,U as t};
2
- //# sourceMappingURL=ImagePlugin-BAhZuVdE.mjs.map
@@ -1,2 +0,0 @@
1
- import{O as t}from"./Document-ssR6hBzG.mjs";import{c as e,f as o,n as r}from"./Selection-DC6AOGgF.mjs";import{i as s}from"./TypeBrands-Ch9856Gb.mjs";import{c as i,o as n}from"./PluginHelpers-B3gk3VB3.mjs";import{t as l}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as c}from"./SimpleMark-D6vz3Nfd.mjs";var a={label:"Inline Code",tooltip:t=>`Inline Code (${t})`},d=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-CMXjVzFx.mjs"),"./locales/de.ts":()=>import("./de-e6J6nvAD.mjs"),"./locales/es.ts":()=>import("./es-fTW0TkYV.mjs"),"./locales/fr.ts":()=>import("./fr-CQs0-pNX.mjs"),"./locales/hi.ts":()=>import("./hi-C2jEsf8v.mjs"),"./locales/pt.ts":()=>import("./pt-BDam9cDu.mjs"),"./locales/ru.ts":()=>import("./ru-QcTo2yoL.mjs"),"./locales/zh.ts":()=>import("./zh-DWN1Jqn3.mjs")});async function m(t){return i(d,t,a)}var p={toolbar:!0,keymap:"Mod-E",inputRule:!0},f=/* @__PURE__ */new Set(["bold","italic","underline","strikethrough","highlight","font","fontSize","superscript","subscript"]),u=class{id="inline-code";name="Inline Code";priority=22;config;locale;constructor(t){this.config={...p,...t}}async init(t){this.locale=await n(t,this.config.locale,a,m),t.registerStyleSheet(".notectl-content code{background-color:var(--notectl-code-bg);color:var(--notectl-code-color);word-break:break-word;border-radius:4px;padding:.15em .35em;font-family:ui-monospace,SF Mono,Cascadia Code,Fira Code,monospace;font-size:.9em}@media (forced-colors:active){.notectl-content code{border:1px solid linktext}}"),this.registerMark(t),!1!==this.config.inputRule&&this.registerInputRule(t),this.registerExclusivityMiddleware(t)}registerMark(t){c(t,{markSpec:{type:"code",rank:3,toDOM:()=>document.createElement("code"),toHTMLString:(t,e)=>`<code>${e}</code>`,parseHTML:[{tag:"code",getAttrs:t=>"PRE"!==t.parentElement?.tagName&&{}},{tag:"span",getAttrs:t=>{const e=t.style.fontFamily.replace(/['"]/g,"").trim();return!!/^monospace$/i.test(e)&&{}}}],sanitize:{tags:["code"]}},command:"toggleInlineCode",keyBinding:null!==this.config.keymap?this.config.keymap??"Mod-E":null,toolbar:!1!==this.config.toolbar?{id:"inline_code",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(l(this.config.keymap??"Mod-E"))}:void 0})}registerInputRule(t){t.registerInputRule({pattern:/(?:^|[^`])(`([^`\uFFFC]+)`)$/,handler(t,i,n,l){const c=t.selection;if(!o(c))return null;if(!e(c))return null;const a=t.getBlock(c.anchor.blockId);if(!a||"code_block"===a.type)return null;const d=i[2],m=i[1];if(!d||!m)return null;const p=l-m.length;return t.transaction("input").deleteTextAt(c.anchor.blockId,p,l).insertText(c.anchor.blockId,p,d,[{type:s("code")}]).setSelection(r(c.anchor.blockId,p+d.length)).build()}})}registerExclusivityMiddleware(e){e.registerMiddleware((e,o,r)=>{let i=!1;const n=[];for(const c of e.steps){if("addMark"!==c.type){n.push(c);continue}const e=c.mark.type;if("code"===e){const e=o.getBlock(c.blockId);if(e){const o=t(e,c.from,c.to),r=/* @__PURE__ */new Set;for(const t of o)if("text"===t.kind)for(const e of t.marks)f.has(e.type)&&r.add(e.type);for(const t of r)i=!0,n.push({type:"removeMark",blockId:c.blockId,from:c.from,to:c.to,mark:{type:s(t)},...c.path?{path:c.path}:{}})}n.push(c);continue}if(f.has(e)){const e=o.getBlock(c.blockId);if(e&&t(e,c.from,c.to).some(t=>"text"===t.kind&&t.marks.some(t=>"code"===t.type))){i=!0;continue}}n.push(c)}let l=e.storedMarksAfter;if(l){const t=l.some(t=>"code"===t.type),e=l.some(t=>f.has(t.type));t&&e&&(l=l.filter(t=>!f.has(t.type)),i=!0)}r(i?{...e,steps:n,storedMarksAfter:l}:e)},{name:"inline-code:mark-exclusivity",priority:50})}};export{a as n,m as r,u as t};
2
- //# sourceMappingURL=InlineCodePlugin-Bu9-rE4B.mjs.map