@oliasoft-open-source/react-ui-library 4.3.0 → 4.3.1

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 (399) hide show
  1. package/dist/404.html +1 -1
  2. package/dist/assets/{index-2b7aaa8d.css → index-1SRgv0eL.css} +33 -33
  3. package/dist/assets/{index-326366e3.js → index-pNLRgTGq.js} +315 -341
  4. package/dist/global.css +67 -64
  5. package/dist/index.html +1 -1
  6. package/dist/index.js +40 -37
  7. package/dist/index.js.map +1 -1
  8. package/dist/storybook/assets/Color-6VNJS4EI-74NMK_ph.js +1 -0
  9. package/dist/storybook/assets/DocsRenderer-NNNQARDV-3vsXFSwl.js +1 -0
  10. package/dist/storybook/assets/WithTooltip-4HIR6TLV-SoNAVatX.js +1 -0
  11. package/dist/storybook/assets/{accordion-168fa7c5.js → accordion-6_27SROY.js} +1 -1
  12. package/dist/storybook/assets/accordion.stories-1Yd6WIbt.js +170 -0
  13. package/dist/storybook/assets/{actions-2d4e1c8e.js → actions-ESle7xCw.js} +1 -1
  14. package/dist/storybook/assets/{actions.stories-81a7cb7a.js → actions.stories-e6y9BT7N.js} +1 -1
  15. package/dist/storybook/assets/afe.stories-FJFe0iiG.js +88 -0
  16. package/dist/storybook/assets/{badge-20e7ee0b.js → badge-23Ty_zBt.js} +1 -1
  17. package/dist/storybook/assets/{badge.stories-5ce7957f.js → badge.stories-C0MXS15j.js} +1 -1
  18. package/dist/storybook/assets/{blowout.stories-ee7f932b.js → blowout.stories-KO5_m0Xn.js} +1 -1
  19. package/dist/storybook/assets/{breadcrumb.stories-e4334a75.js → breadcrumb.stories-V7ozYBO-.js} +1 -1
  20. package/dist/storybook/assets/{button-74c97e4a.js → button-7V8oA22w.js} +1 -1
  21. package/dist/storybook/assets/button-aRSI9lcJ.css +1 -0
  22. package/dist/storybook/assets/{button-group-fa895d0c.js → button-group-q8QKkLVU.js} +1 -1
  23. package/dist/storybook/assets/{button-group.stories-22f072b7.js → button-group.stories-tLZpLTfD.js} +1 -1
  24. package/dist/storybook/assets/{button.stories-9b954335.js → button.stories-3R6aC9Rs.js} +1 -1
  25. package/dist/storybook/assets/buttons-and-links-sDEyZ90k.js +14 -0
  26. package/dist/storybook/assets/{card-3847c251.js → card-0r8RRVk-.js} +1 -1
  27. package/dist/storybook/assets/{card.stories-537a1772.js → card.stories-HzHJW6ek.js} +1 -1
  28. package/dist/storybook/assets/casing-loads.stories-GDGZ_fYs.js +209 -0
  29. package/dist/storybook/assets/{cell.stories-524a7418.js → cell.stories-S4scZ-t1.js} +2 -2
  30. package/dist/storybook/assets/{check-box-e21258d5.js → check-box-s9CvqRSD.js} +1 -1
  31. package/dist/storybook/assets/{check-box.stories-5f7d06e0.js → check-box.stories-nOztaYcw.js} +1 -1
  32. package/dist/storybook/assets/chunk-HLWAVYOI-bxc7QupL.js +7 -0
  33. package/dist/storybook/assets/color-q4ze05A-.js +25 -0
  34. package/dist/storybook/assets/{column.stories-ae7588c5.js → column.stories-6OLsjlcP.js} +1 -1
  35. package/dist/storybook/assets/{config-f7e17b17.js → config-b-_d5fwn.js} +1 -1
  36. package/dist/storybook/assets/{dialog-cd58dd09.js → dialog-WKHRZcjc.js} +1 -1
  37. package/dist/storybook/assets/dialog-gTGZ42G6.css +1 -0
  38. package/dist/storybook/assets/disabled-context-urNQThQz.js +1 -0
  39. package/dist/storybook/assets/{divider-182aa58c.js → divider-RwW2f_N0.js} +1 -1
  40. package/dist/storybook/assets/{divider.stories-60c6cd1d.js → divider.stories-FO3XrgMC.js} +1 -1
  41. package/dist/storybook/assets/{drawer-7f450988.js → drawer-WuErQ5Z8.js} +1 -1
  42. package/dist/storybook/assets/{drawer.stories-948b5e8b.js → drawer.stories-lRem_fZs.js} +2 -2
  43. package/dist/storybook/assets/{empty.stories-e0e3ac78.js → empty.stories-lva3DbfI.js} +1 -1
  44. package/dist/storybook/assets/extends-dGVwEr9R.js +1 -0
  45. package/dist/storybook/assets/{field-a094cd72.js → field-eknsj_Ll.js} +1 -1
  46. package/dist/storybook/assets/{field.stories-f1318053.js → field.stories-RmhJ16HT.js} +1 -1
  47. package/dist/storybook/assets/{file-input.stories-d855942a.js → file-input.stories-JMkh7Ovh.js} +1 -1
  48. package/dist/storybook/assets/{flex-1d14d86c.js → flex-KzhjL9yc.js} +1 -1
  49. package/dist/storybook/assets/{flex.stories-09e9c602.js → flex.stories-Ty-qNXaD.js} +1 -1
  50. package/dist/storybook/assets/footer.stories-LKj4DmGv.js +3 -0
  51. package/dist/storybook/assets/{form-row-19dd7f6e.js → form-row-bwoDTUga.js} +1 -1
  52. package/dist/storybook/assets/form.stories-0Xg8lA47.js +49 -0
  53. package/dist/storybook/assets/formation.stories-EZGmfE0B.js +74 -0
  54. package/dist/storybook/assets/{formatter-SWP5E3XI-a0191e1f.js → formatter-SWP5E3XI-pvgDL1On.js} +55 -55
  55. package/dist/storybook/assets/{grid-3b729f81.js → grid-u1mZpaML.js} +1 -1
  56. package/dist/storybook/assets/{grid.stories-bf68df4a.js → grid.stories-hPfW-CxX.js} +1 -1
  57. package/dist/storybook/assets/{heading-d29eb744.js → heading-Bk0bpNfe.js} +1 -1
  58. package/dist/storybook/assets/{heading.stories-9689bddc.js → heading.stories-IEBN66V-.js} +1 -1
  59. package/dist/storybook/assets/{help-icon-d4189b1b.js → help-icon--rUDxLUD.js} +1 -1
  60. package/dist/storybook/assets/{help-icon.stories-15d1620d.js → help-icon.stories-vifwJgNA.js} +1 -1
  61. package/dist/storybook/assets/icon-custom-PyWFQsS3.js +1 -0
  62. package/dist/storybook/assets/icon-y1a2N5SZ.js +8 -0
  63. package/dist/storybook/assets/{icon.stories-8dae69e1.js → icon.stories-D_XEmSGG.js} +1 -1
  64. package/dist/storybook/assets/iframe-Ne5PDyYi.js +7 -0
  65. package/dist/storybook/assets/immer.esm-bD7SSJ7T.js +1 -0
  66. package/dist/storybook/assets/{index-c89a1915.js → index-4QtD-hFu.js} +1 -1
  67. package/dist/storybook/assets/index-4YXVTraW.js +1 -0
  68. package/dist/storybook/assets/{index-57d7693e.js → index-IQMsp8Ab.js} +1 -1
  69. package/dist/storybook/assets/{index-58f3d19c.js → index-OQM9o5C5.js} +30 -24
  70. package/dist/storybook/assets/{index-a80ed1cf.js → index-VW3EWkuE.js} +1 -1
  71. package/dist/storybook/assets/{index-54f0d271.js → index-cCpkwrS5.js} +1 -1
  72. package/dist/storybook/assets/{index-cf68f115.js → index-gM75B7fB.js} +1 -1
  73. package/dist/storybook/assets/index-miLrID2P.js +23 -0
  74. package/dist/storybook/assets/{index-c7f280f6.js → index-ugi_ZH6T.js} +1 -1
  75. package/dist/storybook/assets/index.es-JXn3JM7k.js +86 -0
  76. package/dist/storybook/assets/inheritsLoose-Y9jOMJLd.js +1 -0
  77. package/dist/storybook/assets/{input-group-20c3add3.js → input-group-R8LoqKRn.js} +1 -1
  78. package/dist/storybook/assets/{input-group-addon-f8f6683a.js → input-group-addon-BHVsW9mL.js} +1 -1
  79. package/dist/storybook/assets/{input-group.stories-a2a3400e.js → input-group.stories-o6aJnQk-.js} +2 -2
  80. package/dist/storybook/assets/{input-d68625a5.js → input-u1He-wWs.js} +1 -1
  81. package/dist/storybook/assets/{input-validation-566bbbb7.js → input-validation-8JO3a7mr.js} +2 -2
  82. package/dist/storybook/assets/{input.stories-164d93ab.js → input.stories-rLdDRxtU.js} +1 -1
  83. package/dist/storybook/assets/{inputs-230d0995.js → inputs-KI8iubZP.js} +2 -2
  84. package/dist/storybook/assets/{isPlainObject-1cdd40eb.js → isPlainObject-4RuU_w9g.js} +1 -1
  85. package/dist/storybook/assets/{jsx-runtime-f961835c.js → jsx-runtime-FsUICBgo.js} +1 -1
  86. package/dist/storybook/assets/{label-13d490a3.js → label-0_Qf6I8t.js} +1 -1
  87. package/dist/storybook/assets/{label.stories-427ba162.js → label.stories-aXdU5_Ql.js} +1 -1
  88. package/dist/storybook/assets/layout-forms-d_qIWKd4.js +16 -0
  89. package/dist/storybook/assets/{layout-general-af624016.js → layout-general-ZZbIRlpS.js} +2 -2
  90. package/dist/storybook/assets/list-4R9tCaeF.js +8 -0
  91. package/dist/storybook/assets/{list-heading-5a293d8b.js → list-heading-BTMHiuhI.js} +1 -1
  92. package/dist/storybook/assets/{list-heading-58edcddc.css → list-heading-Pgb8O1zv.css} +1 -1
  93. package/dist/storybook/assets/{list.stories-data-94f7c623.js → list.stories-data-JaZdq4F4.js} +1 -1
  94. package/dist/storybook/assets/{list.stories-4850aa29.js → list.stories-hekyberH.js} +4 -4
  95. package/dist/storybook/assets/{loader-87ec8334.js → loader-TGOJBZQG.js} +1 -1
  96. package/dist/storybook/assets/{loader.stories-6107832a.js → loader.stories-0OwmnNML.js} +1 -1
  97. package/dist/storybook/assets/{lodash-75c70a11.js → lodash-Bmg8FrMx.js} +2 -2
  98. package/dist/storybook/assets/logo-nHW4TqZt.js +1 -0
  99. package/dist/storybook/assets/{menu.stories-927adf3d.js → menu.stories-SmTLDEcl.js} +1 -1
  100. package/dist/storybook/assets/{menu.stories-data-28e27478.js → menu.stories-data-c8X93fYM.js} +1 -1
  101. package/dist/storybook/assets/{message-7e627e60.js → message--yMWfUQv.js} +1 -1
  102. package/dist/storybook/assets/{message.stories-f41a0c22.js → message.stories-NeUh9ew0.js} +1 -1
  103. package/dist/storybook/assets/{modal.stories-0e068cc1.js → modal.stories-0tVFnKsk.js} +2 -2
  104. package/dist/storybook/assets/{number-input-7d49b0b3.js → number-input-SvjJIGsW.js} +1 -1
  105. package/dist/storybook/assets/{number-input.stories-02528124.js → number-input.stories-Y4KCEwyl.js} +2 -2
  106. package/dist/storybook/assets/{option-dropdown.stories-5030bdb8.js → option-dropdown.stories-BZFwP6Yb.js} +1 -1
  107. package/dist/storybook/assets/{padding-and-spacing-37bd345b.js → padding-and-spacing-GE0SFR50.js} +2 -2
  108. package/dist/storybook/assets/{page-6d07f774.js → page-9-f6BzS0.js} +1 -1
  109. package/dist/storybook/assets/{page.stories-7cb68fed.js → page.stories--UKnMSnH.js} +1 -1
  110. package/dist/storybook/assets/{pagination-8aade846.js → pagination-xSK12Mw6.js} +1 -1
  111. package/dist/storybook/assets/pagination.stories-QCBvGl43.js +59 -0
  112. package/dist/storybook/assets/{pop-confirm.stories-81b30901.js → pop-confirm.stories-1rgIFpIA.js} +1 -1
  113. package/dist/storybook/assets/{popover-06e375a5.js → popover-Y3FpGdUS.js} +1 -1
  114. package/dist/storybook/assets/popover.stories-VEw9p8NV.js +1 -0
  115. package/dist/storybook/assets/{portal-03fe4689.js → portal-zPiHHKoC.js} +1 -1
  116. package/dist/storybook/assets/{portal.stories-b31c3fa6.js → portal.stories-UGkzdgVk.js} +1 -1
  117. package/dist/storybook/assets/preview-ABcGy_UQ.js +326 -0
  118. package/dist/storybook/assets/preview-On8eUdCB.js +7 -0
  119. package/dist/storybook/assets/{preview-d47a2f40.css → preview-QdB_aBj_.css} +1 -1
  120. package/dist/storybook/assets/progress-bar-M7WIcFG5.css +1 -0
  121. package/dist/storybook/assets/{progress-bar-40b8dbf0.js → progress-bar-NRjN2baY.js} +1 -1
  122. package/dist/storybook/assets/{progress-bar.stories-bcf87835.js → progress-bar.stories-5x1LDEkb.js} +1 -1
  123. package/dist/storybook/assets/projects.stories-1Ks1DnAG.js +47 -0
  124. package/dist/storybook/assets/{radio-button-135a9615.js → radio-button-jHcwHUA4.js} +1 -1
  125. package/dist/storybook/assets/{radio-button.stories-0e8377ea.js → radio-button.stories-LkCJsp5P.js} +1 -1
  126. package/dist/storybook/assets/{react-16-147b12fd.js → react-16-hgR7FrAp.js} +1 -1
  127. package/dist/storybook/assets/{redux-10ee6be7.js → redux-F5dueAP3.js} +1 -1
  128. package/dist/storybook/assets/{reservoirs.stories-8e7035a5.js → reservoirs.stories-IQ4Alo9P.js} +2 -2
  129. package/dist/storybook/assets/rich-text-input-zzFhJRmL.css +1 -0
  130. package/dist/storybook/assets/{rich-text-input.stories-661f34f1.js → rich-text-input.stories-GdgPkhki.js} +26 -26
  131. package/dist/storybook/assets/{row-2299f0e7.js → row-vFUhHoz5.js} +1 -1
  132. package/dist/storybook/assets/{row.stories-d5b6b4a6.js → row.stories-w8GHs2MZ.js} +2 -2
  133. package/dist/storybook/assets/select-5jrVNbFb.js +1 -0
  134. package/dist/storybook/assets/{select.input-88b6ebab.js → select.input-zP5tW20f.js} +1 -1
  135. package/dist/storybook/assets/{select.stories-60f055e6.js → select.stories-CHb_zXq1.js} +2 -2
  136. package/dist/storybook/assets/{side-bar-88e8cf41.js → side-bar-Fjr2t9MT.js} +1 -1
  137. package/dist/storybook/assets/{side-bar.stories-2c06f8a6.js → side-bar.stories-ze7SsfEv.js} +1 -1
  138. package/dist/storybook/assets/{site.stories-8b3718ce.js → site.stories-tEgKZ4mq.js} +2 -2
  139. package/dist/storybook/assets/slider-nl2rJ9LF.js +7 -0
  140. package/dist/storybook/assets/{slider.stories-79ab0e97.js → slider.stories--aZa8kf-.js} +2 -2
  141. package/dist/storybook/assets/{spacer-54db0620.js → spacer-Yji9g2AW.js} +1 -1
  142. package/dist/storybook/assets/{spacer.stories-38071af8.js → spacer.stories-T6GlFAJH.js} +1 -1
  143. package/dist/storybook/assets/{spinner-a81ebe38.js → spinner-R8Il4aRe.js} +1 -1
  144. package/dist/storybook/assets/{spinner.stories-07039a8c.js → spinner.stories-w5R_Yjfw.js} +1 -1
  145. package/dist/storybook/assets/styled-components.browser.esm-qIipjd6c.js +4 -0
  146. package/dist/storybook/assets/syntaxhighlighter-NMPM6SWI-RxUnwOsq.js +1 -0
  147. package/dist/storybook/assets/{table-da6f6045.js → table-GUPoXZvd.js} +1 -1
  148. package/dist/storybook/assets/{table.stories-67a3023a.js → table.stories-WO94AjqR.js} +2 -2
  149. package/dist/storybook/assets/{table.stories-data-8a836b92.js → table.stories-data-_RfPv9jG.js} +1 -1
  150. package/dist/storybook/assets/{tabs-be40d085.css → tabs-51rNj7QN.css} +1 -1
  151. package/dist/storybook/assets/{tabs-cf5ccede.js → tabs-fcLbHC1n.js} +1 -1
  152. package/dist/storybook/assets/{tabs.stories-5b0ca9e1.js → tabs.stories-KtJc5Yci.js} +1 -1
  153. package/dist/storybook/assets/{text-ad1f5f1d.js → text-6KQ6ntOV.js} +1 -1
  154. package/dist/storybook/assets/{text-link.stories-c1227c6f.js → text-link.stories-kjfUeFtk.js} +1 -1
  155. package/dist/storybook/assets/{text.stories-8ab6da1c.js → text.stories-4JGfMLkI.js} +1 -1
  156. package/dist/storybook/assets/{textarea-d48efea2.js → textarea-Kk8R9MgX.js} +1 -1
  157. package/dist/storybook/assets/{textarea.stories-89c8afd7.js → textarea.stories-2paZI6_B.js} +1 -1
  158. package/dist/storybook/assets/{title.stories-5b4a226c.js → title.stories-t_2VHVut.js} +2 -2
  159. package/dist/storybook/assets/{toaster-541ce85b.js → toaster-_gH13Vo0.js} +1 -1
  160. package/dist/storybook/assets/{toaster.stories-5e4d95b1.js → toaster.stories-gOvrfYS0.js} +1 -1
  161. package/dist/storybook/assets/{toggle-01690c44.js → toggle-BPI2y-lU.js} +1 -1
  162. package/dist/storybook/assets/{toggle-35349f40.css → toggle-Mg-49VUp.css} +1 -1
  163. package/dist/storybook/assets/{toggle.stories-bc686ae1.js → toggle.stories-9D_QmqBC.js} +1 -1
  164. package/dist/storybook/assets/{tooltip-23e84186.js → tooltip-HEHiU__l.js} +6 -6
  165. package/dist/storybook/assets/{tooltip.stories-e8ba5fff.js → tooltip.stories-tiOgoWHH.js} +1 -1
  166. package/dist/storybook/assets/tooltip.test-case.stories-fQh9tpot.js +3 -0
  167. package/dist/storybook/assets/{top-bar-a84b9365.js → top-bar-C1c_2fzK.js} +1 -1
  168. package/dist/storybook/assets/{top-bar-55ed86a3.css → top-bar-cBtxm6yr.css} +1 -1
  169. package/dist/storybook/assets/{top-bar.stories-e93330f0.js → top-bar.stories-__ExKqyI.js} +1 -1
  170. package/dist/storybook/assets/{top-bar.testcase.stories-3a824a14.js → top-bar.testcase.stories-IBxNcBB7.js} +1 -1
  171. package/dist/storybook/assets/tree.stories-BAujNdxx.js +128 -0
  172. package/dist/storybook/assets/types-5uVBABF4.js +1 -0
  173. package/dist/storybook/assets/{unit-input.stories-65984064.js → unit-input.stories-W6qu5wAu.js} +1 -1
  174. package/dist/storybook/iframe.html +1 -3
  175. package/dist/storybook/project.json +1 -1
  176. package/package.json +1 -1
  177. package/dist/storybook/assets/Color-6VNJS4EI-811ca6f0.js +0 -1
  178. package/dist/storybook/assets/DocsRenderer-NNNQARDV-13015b39.js +0 -1
  179. package/dist/storybook/assets/WithTooltip-4HIR6TLV-fe3aa2ab.js +0 -1
  180. package/dist/storybook/assets/accordion.stories-0f8af16e.js +0 -170
  181. package/dist/storybook/assets/afe.stories-41970a5c.js +0 -88
  182. package/dist/storybook/assets/button-7c35ef6e.css +0 -1
  183. package/dist/storybook/assets/buttons-and-links-236ef744.js +0 -14
  184. package/dist/storybook/assets/casing-loads.stories-d3994990.js +0 -209
  185. package/dist/storybook/assets/chunk-HLWAVYOI-f143d329.js +0 -1
  186. package/dist/storybook/assets/color-915dd9da.js +0 -25
  187. package/dist/storybook/assets/dialog-8e840c50.css +0 -1
  188. package/dist/storybook/assets/disabled-context-d654f6ff.js +0 -1
  189. package/dist/storybook/assets/footer.stories-57f07ea2.js +0 -3
  190. package/dist/storybook/assets/form.stories-d6c8da7e.js +0 -49
  191. package/dist/storybook/assets/formation.stories-5eeaa826.js +0 -74
  192. package/dist/storybook/assets/icon-custom-822ce507.js +0 -1
  193. package/dist/storybook/assets/icon-custom-e24cd2fb.svg +0 -1
  194. package/dist/storybook/assets/icon-e9cbb4d7.js +0 -8
  195. package/dist/storybook/assets/iframe-e6f0bd3c.js +0 -1
  196. package/dist/storybook/assets/immer.esm-5c06d4d0.js +0 -1
  197. package/dist/storybook/assets/index-3d476d02.js +0 -23
  198. package/dist/storybook/assets/index-46b5be7e.js +0 -1
  199. package/dist/storybook/assets/index-5cdc9468.js +0 -1
  200. package/dist/storybook/assets/index.es-85cc7dfc.js +0 -86
  201. package/dist/storybook/assets/inheritsLoose-d4851ab8.js +0 -1
  202. package/dist/storybook/assets/layout-forms-36d75e93.js +0 -16
  203. package/dist/storybook/assets/list-31b815b8.js +0 -8
  204. package/dist/storybook/assets/logo-0bd264c0.svg +0 -13
  205. package/dist/storybook/assets/logo-8068ccfc.js +0 -1
  206. package/dist/storybook/assets/pagination.stories-423b4938.js +0 -59
  207. package/dist/storybook/assets/popover.stories-f651a81c.js +0 -1
  208. package/dist/storybook/assets/preview-564d3c1d.js +0 -1
  209. package/dist/storybook/assets/preview-b5fa6b4e.js +0 -326
  210. package/dist/storybook/assets/progress-bar-ab07ff52.css +0 -1
  211. package/dist/storybook/assets/projects.stories-222ad869.js +0 -47
  212. package/dist/storybook/assets/rich-text-input.stories-023a1c99.css +0 -1
  213. package/dist/storybook/assets/select-205cd538.js +0 -1
  214. package/dist/storybook/assets/slider-160e2152.js +0 -7
  215. package/dist/storybook/assets/styled-components.browser.esm-416d73e5.js +0 -4
  216. package/dist/storybook/assets/syntaxhighlighter-NMPM6SWI-9f2334eb.js +0 -1
  217. package/dist/storybook/assets/tooltip.test-case.stories-9817078b.js +0 -3
  218. package/dist/storybook/assets/tree.stories-3422a0bc.js +0 -128
  219. package/dist/storybook/assets/types-332ceaf3.js +0 -1
  220. /package/dist/assets/{bg-rock-164a1bdb.jpg → bg-rock-_5KQNLMu.jpg} +0 -0
  221. /package/dist/assets/{noto-sans-cyrillic-400-italic-e1366c30.woff → noto-sans-cyrillic-400-italic-Ymp0F5o5.woff} +0 -0
  222. /package/dist/assets/{noto-sans-cyrillic-400-italic-f452db2a.woff2 → noto-sans-cyrillic-400-italic-gAWrYslY.woff2} +0 -0
  223. /package/dist/assets/{noto-sans-cyrillic-400-normal-aabb2e68.woff2 → noto-sans-cyrillic-400-normal-cu0AGlsj.woff2} +0 -0
  224. /package/dist/assets/{noto-sans-cyrillic-400-normal-85078bfb.woff → noto-sans-cyrillic-400-normal-dzUcezrt.woff} +0 -0
  225. /package/dist/assets/{noto-sans-cyrillic-700-italic-640c1f3c.woff2 → noto-sans-cyrillic-700-italic-iKfB6UII.woff2} +0 -0
  226. /package/dist/assets/{noto-sans-cyrillic-700-italic-5e3a3f90.woff → noto-sans-cyrillic-700-italic-p7v4iMEP.woff} +0 -0
  227. /package/dist/assets/{noto-sans-cyrillic-700-normal-94f49d79.woff2 → noto-sans-cyrillic-700-normal-4XLZOxR1.woff2} +0 -0
  228. /package/dist/assets/{noto-sans-cyrillic-700-normal-6debf38d.woff → noto-sans-cyrillic-700-normal-EConVeZq.woff} +0 -0
  229. /package/dist/assets/{noto-sans-cyrillic-ext-400-italic-d41caa22.woff → noto-sans-cyrillic-ext-400-italic-6vMuaXY_.woff} +0 -0
  230. /package/dist/assets/{noto-sans-cyrillic-ext-400-italic-4a066f39.woff2 → noto-sans-cyrillic-ext-400-italic-NMurGD2-.woff2} +0 -0
  231. /package/dist/assets/{noto-sans-cyrillic-ext-400-normal-0b48f539.woff2 → noto-sans-cyrillic-ext-400-normal-Ka8sbUdX.woff2} +0 -0
  232. /package/dist/assets/{noto-sans-cyrillic-ext-400-normal-9e486f9d.woff → noto-sans-cyrillic-ext-400-normal-UZumYlXk.woff} +0 -0
  233. /package/dist/assets/{noto-sans-cyrillic-ext-700-italic-c926d08f.woff2 → noto-sans-cyrillic-ext-700-italic-TemUMIUm.woff2} +0 -0
  234. /package/dist/assets/{noto-sans-cyrillic-ext-700-italic-34dc50df.woff → noto-sans-cyrillic-ext-700-italic-XeedtfIh.woff} +0 -0
  235. /package/dist/assets/{noto-sans-cyrillic-ext-700-normal-dac487d5.woff → noto-sans-cyrillic-ext-700-normal-JWA05R08.woff} +0 -0
  236. /package/dist/assets/{noto-sans-cyrillic-ext-700-normal-8967b221.woff2 → noto-sans-cyrillic-ext-700-normal-mvzlDUqm.woff2} +0 -0
  237. /package/dist/assets/{noto-sans-devanagari-400-italic-cf2ab1aa.woff2 → noto-sans-devanagari-400-italic-W1ULa3QX.woff2} +0 -0
  238. /package/dist/assets/{noto-sans-devanagari-400-italic-c23c3bcb.woff → noto-sans-devanagari-400-italic-ryS4Wyn_.woff} +0 -0
  239. /package/dist/assets/{noto-sans-devanagari-400-normal-4dbee9f9.woff → noto-sans-devanagari-400-normal-5Z5MFUWL.woff} +0 -0
  240. /package/dist/assets/{noto-sans-devanagari-400-normal-ad99c6e6.woff2 → noto-sans-devanagari-400-normal-aA8Ej3wu.woff2} +0 -0
  241. /package/dist/assets/{noto-sans-devanagari-700-italic-91e684f1.woff2 → noto-sans-devanagari-700-italic-Hj9vUG12.woff2} +0 -0
  242. /package/dist/assets/{noto-sans-devanagari-700-italic-464b905e.woff → noto-sans-devanagari-700-italic-tegojScU.woff} +0 -0
  243. /package/dist/assets/{noto-sans-devanagari-700-normal-0076830d.woff → noto-sans-devanagari-700-normal-hjxHm8Hg.woff} +0 -0
  244. /package/dist/assets/{noto-sans-devanagari-700-normal-cb6a5f18.woff2 → noto-sans-devanagari-700-normal-rMx9UCWL.woff2} +0 -0
  245. /package/dist/assets/{noto-sans-greek-400-italic-7371763a.woff → noto-sans-greek-400-italic-Ccn1nLaK.woff} +0 -0
  246. /package/dist/assets/{noto-sans-greek-400-italic-4150066f.woff2 → noto-sans-greek-400-italic-K6B_XX1d.woff2} +0 -0
  247. /package/dist/assets/{noto-sans-greek-400-normal-87c15bdb.woff2 → noto-sans-greek-400-normal-7Z88ZoHx.woff2} +0 -0
  248. /package/dist/assets/{noto-sans-greek-400-normal-39bdd4b2.woff → noto-sans-greek-400-normal-FtKUG_XS.woff} +0 -0
  249. /package/dist/assets/{noto-sans-greek-700-italic-b7feb202.woff2 → noto-sans-greek-700-italic-VvJUlzW8.woff2} +0 -0
  250. /package/dist/assets/{noto-sans-greek-700-italic-f4cc4f0b.woff → noto-sans-greek-700-italic-_a2-1AqK.woff} +0 -0
  251. /package/dist/assets/{noto-sans-greek-700-normal-741a8ce4.woff2 → noto-sans-greek-700-normal-Y3yJO9QD.woff2} +0 -0
  252. /package/dist/assets/{noto-sans-greek-700-normal-2ab560ee.woff → noto-sans-greek-700-normal-fEPkAmaD.woff} +0 -0
  253. /package/dist/assets/{noto-sans-greek-ext-400-italic-b4229535.woff2 → noto-sans-greek-ext-400-italic-8eyTdRqD.woff2} +0 -0
  254. /package/dist/assets/{noto-sans-greek-ext-400-italic-521abdae.woff → noto-sans-greek-ext-400-italic-fKeg0vDT.woff} +0 -0
  255. /package/dist/assets/{noto-sans-greek-ext-400-normal-a321d2bc.woff → noto-sans-greek-ext-400-normal-G9H8iAFb.woff} +0 -0
  256. /package/dist/assets/{noto-sans-greek-ext-400-normal-5e0d248b.woff2 → noto-sans-greek-ext-400-normal-fPdjAVF_.woff2} +0 -0
  257. /package/dist/assets/{noto-sans-greek-ext-700-italic-656e9e8a.woff2 → noto-sans-greek-ext-700-italic-QL62JlGO.woff2} +0 -0
  258. /package/dist/assets/{noto-sans-greek-ext-700-italic-4f4d843e.woff → noto-sans-greek-ext-700-italic-egO-jnPj.woff} +0 -0
  259. /package/dist/assets/{noto-sans-greek-ext-700-normal-9e1e15e5.woff2 → noto-sans-greek-ext-700-normal-4NID8Qno.woff2} +0 -0
  260. /package/dist/assets/{noto-sans-greek-ext-700-normal-fe405e93.woff → noto-sans-greek-ext-700-normal-yYj7rc6j.woff} +0 -0
  261. /package/dist/assets/{noto-sans-latin-400-italic-76feca1e.woff2 → noto-sans-latin-400-italic-gecpe6rx.woff2} +0 -0
  262. /package/dist/assets/{noto-sans-latin-400-italic-36bfecf9.woff → noto-sans-latin-400-italic-v4bbZFh4.woff} +0 -0
  263. /package/dist/assets/{noto-sans-latin-400-normal-a6fd04ca.woff → noto-sans-latin-400-normal-QERTWpJt.woff} +0 -0
  264. /package/dist/assets/{noto-sans-latin-400-normal-ae90c002.woff2 → noto-sans-latin-400-normal-yHN0rgdr.woff2} +0 -0
  265. /package/dist/assets/{noto-sans-latin-700-italic-0114b623.woff2 → noto-sans-latin-700-italic-GJ3Ax4kD.woff2} +0 -0
  266. /package/dist/assets/{noto-sans-latin-700-italic-090e554c.woff → noto-sans-latin-700-italic-vbaZducS.woff} +0 -0
  267. /package/dist/assets/{noto-sans-latin-700-normal-58083c3b.woff2 → noto-sans-latin-700-normal-eDtt_793.woff2} +0 -0
  268. /package/dist/assets/{noto-sans-latin-700-normal-3e647021.woff → noto-sans-latin-700-normal-nGP8vUh_.woff} +0 -0
  269. /package/dist/assets/{noto-sans-latin-ext-400-italic-000f0939.woff2 → noto-sans-latin-ext-400-italic-M1J8EBU0.woff2} +0 -0
  270. /package/dist/assets/{noto-sans-latin-ext-400-italic-209f50d8.woff → noto-sans-latin-ext-400-italic-tvQsZR49.woff} +0 -0
  271. /package/dist/assets/{noto-sans-latin-ext-400-normal-05741022.woff → noto-sans-latin-ext-400-normal-G5t8FL3N.woff} +0 -0
  272. /package/dist/assets/{noto-sans-latin-ext-400-normal-0471a144.woff2 → noto-sans-latin-ext-400-normal-_CJguOPi.woff2} +0 -0
  273. /package/dist/assets/{noto-sans-latin-ext-700-italic-2ce43666.woff2 → noto-sans-latin-ext-700-italic-4wdnYi2a.woff2} +0 -0
  274. /package/dist/assets/{noto-sans-latin-ext-700-italic-d6cafb04.woff → noto-sans-latin-ext-700-italic-R0nqzzZ2.woff} +0 -0
  275. /package/dist/assets/{noto-sans-latin-ext-700-normal-22b9ec3f.woff → noto-sans-latin-ext-700-normal-QrKStY9M.woff} +0 -0
  276. /package/dist/assets/{noto-sans-latin-ext-700-normal-2686da46.woff2 → noto-sans-latin-ext-700-normal-mHRou4Zp.woff2} +0 -0
  277. /package/dist/assets/{noto-sans-vietnamese-400-italic-771fc68a.woff2 → noto-sans-vietnamese-400-italic-9cXyU5tK.woff2} +0 -0
  278. /package/dist/assets/{noto-sans-vietnamese-400-italic-4b406d13.woff → noto-sans-vietnamese-400-italic-kwbZkVvw.woff} +0 -0
  279. /package/dist/assets/{noto-sans-vietnamese-400-normal-6e416387.woff → noto-sans-vietnamese-400-normal-M1jMyKFg.woff} +0 -0
  280. /package/dist/assets/{noto-sans-vietnamese-400-normal-7fa5e6cb.woff2 → noto-sans-vietnamese-400-normal-rIgVlLlB.woff2} +0 -0
  281. /package/dist/assets/{noto-sans-vietnamese-700-italic-74a23856.woff → noto-sans-vietnamese-700-italic-7ICH5ljX.woff} +0 -0
  282. /package/dist/assets/{noto-sans-vietnamese-700-italic-6ab2edd3.woff2 → noto-sans-vietnamese-700-italic-NXnNycAU.woff2} +0 -0
  283. /package/dist/assets/{noto-sans-vietnamese-700-normal-0f8a5c93.woff2 → noto-sans-vietnamese-700-normal-7zy22TKC.woff2} +0 -0
  284. /package/dist/assets/{noto-sans-vietnamese-700-normal-a84e25c4.woff → noto-sans-vietnamese-700-normal-Xm5MNRbm.woff} +0 -0
  285. /package/dist/storybook/assets/{accordion-e6b28b2f.css → accordion-4RINpLG4.css} +0 -0
  286. /package/dist/storybook/assets/{accordion.stories-e92bccf3.css → accordion-tw1O4Ru6.css} +0 -0
  287. /package/dist/storybook/assets/{actions-77ea67be.css → actions-W12osUP0.css} +0 -0
  288. /package/dist/storybook/assets/{assertThisInitialized-081f9914.js → assertThisInitialized-4q6YPdh3.js} +0 -0
  289. /package/dist/storybook/assets/{badge-2476bcf1.css → badge-YmqKjusH.css} +0 -0
  290. /package/dist/storybook/assets/{bg-rock-164a1bdb.jpg → bg-rock-_5KQNLMu.jpg} +0 -0
  291. /package/dist/storybook/assets/{breadcrumb.stories-a644544e.css → breadcrumb-zMfjLuCW.css} +0 -0
  292. /package/dist/storybook/assets/{button-group-ca0fb5b4.css → button-group-NIYwVeLc.css} +0 -0
  293. /package/dist/storybook/assets/{card-13420d4a.css → card-FRQxSCqd.css} +0 -0
  294. /package/dist/storybook/assets/{check-box-960c9b05.css → check-box-lfs3fyP9.css} +0 -0
  295. /package/dist/storybook/assets/{common-types-2c81813f.js → common-types-U65vzrrz.js} +0 -0
  296. /package/dist/storybook/assets/{divider-241be35b.css → divider-MEMf2853.css} +0 -0
  297. /package/dist/storybook/assets/{drawer-e350211a.css → drawer-L_geICAt.css} +0 -0
  298. /package/dist/storybook/assets/{empty.stories-9914c767.css → empty-C9BF8m3k.css} +0 -0
  299. /package/dist/storybook/assets/{field-1e434b15.css → field-jQwmeVEW.css} +0 -0
  300. /package/dist/storybook/assets/{file-input.stories-f40408e6.css → file-input-G_eVIuoe.css} +0 -0
  301. /package/dist/storybook/assets/{form-row-5bcba379.css → form-row-WM-bvlay.css} +0 -0
  302. /package/dist/storybook/assets/{heading-5f132816.css → heading-zGDwg1Yz.css} +0 -0
  303. /package/dist/storybook/assets/{help-icon-7c4fbd39.css → help-icon-3sHkLODS.css} +0 -0
  304. /package/dist/storybook/assets/{icon-e56ff3c6.css → icon-l7R76_J0.css} +0 -0
  305. /package/dist/storybook/assets/{index-f80c8c95.js → index-RfLt4OUa.js} +0 -0
  306. /package/dist/storybook/assets/{input-5552adb5.css → input-Fje0itH2.css} +0 -0
  307. /package/dist/storybook/assets/{input-group-addon-f572ad00.css → input-group-addon-im08H5HG.css} +0 -0
  308. /package/dist/storybook/assets/{input-group-a73e9700.css → input-group-uD4dOWa6.css} +0 -0
  309. /package/dist/storybook/assets/{label-fc529eb8.css → label-ZsCidjJ8.css} +0 -0
  310. /package/dist/storybook/assets/{loader-85a5e78d.css → loader-ePthe3P6.css} +0 -0
  311. /package/dist/storybook/assets/{memoize-one.esm-52518564.js → memoize-one.esm-hqe5SRxC.js} +0 -0
  312. /package/dist/storybook/assets/{message-b56c617e.css → message-J8OVkKuk.css} +0 -0
  313. /package/dist/storybook/assets/{noto-sans-cyrillic-400-italic-e1366c30.woff → noto-sans-cyrillic-400-italic-Ymp0F5o5.woff} +0 -0
  314. /package/dist/storybook/assets/{noto-sans-cyrillic-400-italic-f452db2a.woff2 → noto-sans-cyrillic-400-italic-gAWrYslY.woff2} +0 -0
  315. /package/dist/storybook/assets/{noto-sans-cyrillic-400-normal-aabb2e68.woff2 → noto-sans-cyrillic-400-normal-cu0AGlsj.woff2} +0 -0
  316. /package/dist/storybook/assets/{noto-sans-cyrillic-400-normal-85078bfb.woff → noto-sans-cyrillic-400-normal-dzUcezrt.woff} +0 -0
  317. /package/dist/storybook/assets/{noto-sans-cyrillic-700-italic-640c1f3c.woff2 → noto-sans-cyrillic-700-italic-iKfB6UII.woff2} +0 -0
  318. /package/dist/storybook/assets/{noto-sans-cyrillic-700-italic-5e3a3f90.woff → noto-sans-cyrillic-700-italic-p7v4iMEP.woff} +0 -0
  319. /package/dist/storybook/assets/{noto-sans-cyrillic-700-normal-94f49d79.woff2 → noto-sans-cyrillic-700-normal-4XLZOxR1.woff2} +0 -0
  320. /package/dist/storybook/assets/{noto-sans-cyrillic-700-normal-6debf38d.woff → noto-sans-cyrillic-700-normal-EConVeZq.woff} +0 -0
  321. /package/dist/storybook/assets/{noto-sans-cyrillic-ext-400-italic-d41caa22.woff → noto-sans-cyrillic-ext-400-italic-6vMuaXY_.woff} +0 -0
  322. /package/dist/storybook/assets/{noto-sans-cyrillic-ext-400-italic-4a066f39.woff2 → noto-sans-cyrillic-ext-400-italic-NMurGD2-.woff2} +0 -0
  323. /package/dist/storybook/assets/{noto-sans-cyrillic-ext-400-normal-0b48f539.woff2 → noto-sans-cyrillic-ext-400-normal-Ka8sbUdX.woff2} +0 -0
  324. /package/dist/storybook/assets/{noto-sans-cyrillic-ext-400-normal-9e486f9d.woff → noto-sans-cyrillic-ext-400-normal-UZumYlXk.woff} +0 -0
  325. /package/dist/storybook/assets/{noto-sans-cyrillic-ext-700-italic-c926d08f.woff2 → noto-sans-cyrillic-ext-700-italic-TemUMIUm.woff2} +0 -0
  326. /package/dist/storybook/assets/{noto-sans-cyrillic-ext-700-italic-34dc50df.woff → noto-sans-cyrillic-ext-700-italic-XeedtfIh.woff} +0 -0
  327. /package/dist/storybook/assets/{noto-sans-cyrillic-ext-700-normal-dac487d5.woff → noto-sans-cyrillic-ext-700-normal-JWA05R08.woff} +0 -0
  328. /package/dist/storybook/assets/{noto-sans-cyrillic-ext-700-normal-8967b221.woff2 → noto-sans-cyrillic-ext-700-normal-mvzlDUqm.woff2} +0 -0
  329. /package/dist/storybook/assets/{noto-sans-devanagari-400-italic-cf2ab1aa.woff2 → noto-sans-devanagari-400-italic-W1ULa3QX.woff2} +0 -0
  330. /package/dist/storybook/assets/{noto-sans-devanagari-400-italic-c23c3bcb.woff → noto-sans-devanagari-400-italic-ryS4Wyn_.woff} +0 -0
  331. /package/dist/storybook/assets/{noto-sans-devanagari-400-normal-4dbee9f9.woff → noto-sans-devanagari-400-normal-5Z5MFUWL.woff} +0 -0
  332. /package/dist/storybook/assets/{noto-sans-devanagari-400-normal-ad99c6e6.woff2 → noto-sans-devanagari-400-normal-aA8Ej3wu.woff2} +0 -0
  333. /package/dist/storybook/assets/{noto-sans-devanagari-700-italic-91e684f1.woff2 → noto-sans-devanagari-700-italic-Hj9vUG12.woff2} +0 -0
  334. /package/dist/storybook/assets/{noto-sans-devanagari-700-italic-464b905e.woff → noto-sans-devanagari-700-italic-tegojScU.woff} +0 -0
  335. /package/dist/storybook/assets/{noto-sans-devanagari-700-normal-0076830d.woff → noto-sans-devanagari-700-normal-hjxHm8Hg.woff} +0 -0
  336. /package/dist/storybook/assets/{noto-sans-devanagari-700-normal-cb6a5f18.woff2 → noto-sans-devanagari-700-normal-rMx9UCWL.woff2} +0 -0
  337. /package/dist/storybook/assets/{noto-sans-greek-400-italic-7371763a.woff → noto-sans-greek-400-italic-Ccn1nLaK.woff} +0 -0
  338. /package/dist/storybook/assets/{noto-sans-greek-400-italic-4150066f.woff2 → noto-sans-greek-400-italic-K6B_XX1d.woff2} +0 -0
  339. /package/dist/storybook/assets/{noto-sans-greek-400-normal-87c15bdb.woff2 → noto-sans-greek-400-normal-7Z88ZoHx.woff2} +0 -0
  340. /package/dist/storybook/assets/{noto-sans-greek-400-normal-39bdd4b2.woff → noto-sans-greek-400-normal-FtKUG_XS.woff} +0 -0
  341. /package/dist/storybook/assets/{noto-sans-greek-700-italic-b7feb202.woff2 → noto-sans-greek-700-italic-VvJUlzW8.woff2} +0 -0
  342. /package/dist/storybook/assets/{noto-sans-greek-700-italic-f4cc4f0b.woff → noto-sans-greek-700-italic-_a2-1AqK.woff} +0 -0
  343. /package/dist/storybook/assets/{noto-sans-greek-700-normal-741a8ce4.woff2 → noto-sans-greek-700-normal-Y3yJO9QD.woff2} +0 -0
  344. /package/dist/storybook/assets/{noto-sans-greek-700-normal-2ab560ee.woff → noto-sans-greek-700-normal-fEPkAmaD.woff} +0 -0
  345. /package/dist/storybook/assets/{noto-sans-greek-ext-400-italic-b4229535.woff2 → noto-sans-greek-ext-400-italic-8eyTdRqD.woff2} +0 -0
  346. /package/dist/storybook/assets/{noto-sans-greek-ext-400-italic-521abdae.woff → noto-sans-greek-ext-400-italic-fKeg0vDT.woff} +0 -0
  347. /package/dist/storybook/assets/{noto-sans-greek-ext-400-normal-a321d2bc.woff → noto-sans-greek-ext-400-normal-G9H8iAFb.woff} +0 -0
  348. /package/dist/storybook/assets/{noto-sans-greek-ext-400-normal-5e0d248b.woff2 → noto-sans-greek-ext-400-normal-fPdjAVF_.woff2} +0 -0
  349. /package/dist/storybook/assets/{noto-sans-greek-ext-700-italic-656e9e8a.woff2 → noto-sans-greek-ext-700-italic-QL62JlGO.woff2} +0 -0
  350. /package/dist/storybook/assets/{noto-sans-greek-ext-700-italic-4f4d843e.woff → noto-sans-greek-ext-700-italic-egO-jnPj.woff} +0 -0
  351. /package/dist/storybook/assets/{noto-sans-greek-ext-700-normal-9e1e15e5.woff2 → noto-sans-greek-ext-700-normal-4NID8Qno.woff2} +0 -0
  352. /package/dist/storybook/assets/{noto-sans-greek-ext-700-normal-fe405e93.woff → noto-sans-greek-ext-700-normal-yYj7rc6j.woff} +0 -0
  353. /package/dist/storybook/assets/{noto-sans-latin-400-italic-76feca1e.woff2 → noto-sans-latin-400-italic-gecpe6rx.woff2} +0 -0
  354. /package/dist/storybook/assets/{noto-sans-latin-400-italic-36bfecf9.woff → noto-sans-latin-400-italic-v4bbZFh4.woff} +0 -0
  355. /package/dist/storybook/assets/{noto-sans-latin-400-normal-a6fd04ca.woff → noto-sans-latin-400-normal-QERTWpJt.woff} +0 -0
  356. /package/dist/storybook/assets/{noto-sans-latin-400-normal-ae90c002.woff2 → noto-sans-latin-400-normal-yHN0rgdr.woff2} +0 -0
  357. /package/dist/storybook/assets/{noto-sans-latin-700-italic-0114b623.woff2 → noto-sans-latin-700-italic-GJ3Ax4kD.woff2} +0 -0
  358. /package/dist/storybook/assets/{noto-sans-latin-700-italic-090e554c.woff → noto-sans-latin-700-italic-vbaZducS.woff} +0 -0
  359. /package/dist/storybook/assets/{noto-sans-latin-700-normal-58083c3b.woff2 → noto-sans-latin-700-normal-eDtt_793.woff2} +0 -0
  360. /package/dist/storybook/assets/{noto-sans-latin-700-normal-3e647021.woff → noto-sans-latin-700-normal-nGP8vUh_.woff} +0 -0
  361. /package/dist/storybook/assets/{noto-sans-latin-ext-400-italic-000f0939.woff2 → noto-sans-latin-ext-400-italic-M1J8EBU0.woff2} +0 -0
  362. /package/dist/storybook/assets/{noto-sans-latin-ext-400-italic-209f50d8.woff → noto-sans-latin-ext-400-italic-tvQsZR49.woff} +0 -0
  363. /package/dist/storybook/assets/{noto-sans-latin-ext-400-normal-05741022.woff → noto-sans-latin-ext-400-normal-G5t8FL3N.woff} +0 -0
  364. /package/dist/storybook/assets/{noto-sans-latin-ext-400-normal-0471a144.woff2 → noto-sans-latin-ext-400-normal-_CJguOPi.woff2} +0 -0
  365. /package/dist/storybook/assets/{noto-sans-latin-ext-700-italic-2ce43666.woff2 → noto-sans-latin-ext-700-italic-4wdnYi2a.woff2} +0 -0
  366. /package/dist/storybook/assets/{noto-sans-latin-ext-700-italic-d6cafb04.woff → noto-sans-latin-ext-700-italic-R0nqzzZ2.woff} +0 -0
  367. /package/dist/storybook/assets/{noto-sans-latin-ext-700-normal-22b9ec3f.woff → noto-sans-latin-ext-700-normal-QrKStY9M.woff} +0 -0
  368. /package/dist/storybook/assets/{noto-sans-latin-ext-700-normal-2686da46.woff2 → noto-sans-latin-ext-700-normal-mHRou4Zp.woff2} +0 -0
  369. /package/dist/storybook/assets/{noto-sans-vietnamese-400-italic-771fc68a.woff2 → noto-sans-vietnamese-400-italic-9cXyU5tK.woff2} +0 -0
  370. /package/dist/storybook/assets/{noto-sans-vietnamese-400-italic-4b406d13.woff → noto-sans-vietnamese-400-italic-kwbZkVvw.woff} +0 -0
  371. /package/dist/storybook/assets/{noto-sans-vietnamese-400-normal-6e416387.woff → noto-sans-vietnamese-400-normal-M1jMyKFg.woff} +0 -0
  372. /package/dist/storybook/assets/{noto-sans-vietnamese-400-normal-7fa5e6cb.woff2 → noto-sans-vietnamese-400-normal-rIgVlLlB.woff2} +0 -0
  373. /package/dist/storybook/assets/{noto-sans-vietnamese-700-italic-74a23856.woff → noto-sans-vietnamese-700-italic-7ICH5ljX.woff} +0 -0
  374. /package/dist/storybook/assets/{noto-sans-vietnamese-700-italic-6ab2edd3.woff2 → noto-sans-vietnamese-700-italic-NXnNycAU.woff2} +0 -0
  375. /package/dist/storybook/assets/{noto-sans-vietnamese-700-normal-0f8a5c93.woff2 → noto-sans-vietnamese-700-normal-7zy22TKC.woff2} +0 -0
  376. /package/dist/storybook/assets/{noto-sans-vietnamese-700-normal-a84e25c4.woff → noto-sans-vietnamese-700-normal-Xm5MNRbm.woff} +0 -0
  377. /package/dist/storybook/assets/{objectSpread2-fdee9b6d.js → objectSpread2-93s0nBry.js} +0 -0
  378. /package/dist/storybook/assets/{option-dropdown.stories-ddc96b15.css → option-dropdown-qj2LBRz5.css} +0 -0
  379. /package/dist/storybook/assets/{page.stories-dd8c1b35.css → page-6iak35D6.css} +0 -0
  380. /package/dist/storybook/assets/{page-478952f1.css → page-ZwBY88Xw.css} +0 -0
  381. /package/dist/storybook/assets/{pagination-94a8083b.css → pagination-79rymMEE.css} +0 -0
  382. /package/dist/storybook/assets/{pop-confirm.stories-c9faec6b.css → pop-confirm-1_6P1_NS.css} +0 -0
  383. /package/dist/storybook/assets/{popover-e0bfd3a6.css → popover-knPvPg4S.css} +0 -0
  384. /package/dist/storybook/assets/{preview-bed967c6.js → preview-Fi7DQdoQ.js} +0 -0
  385. /package/dist/storybook/assets/{radio-button-52e2b7a7.css → radio-button-77m09BoF.css} +0 -0
  386. /package/dist/storybook/assets/{row-4bea1664.css → row-_hDFhU-t.css} +0 -0
  387. /package/dist/storybook/assets/{select-da71c477.css → select-codRSLz-.css} +0 -0
  388. /package/dist/storybook/assets/{side-bar-1ccf9b62.css → side-bar-78DAkitE.css} +0 -0
  389. /package/dist/storybook/assets/{slider-53a190ae.css → slider-50XXQQsj.css} +0 -0
  390. /package/dist/storybook/assets/{spinner-5f2e7676.css → spinner-tO8fikLm.css} +0 -0
  391. /package/dist/storybook/assets/{table-41cb8b17.css → table-TQYHcsfB.css} +0 -0
  392. /package/dist/storybook/assets/{text-1e636744.css → text-Njvh0hvI.css} +0 -0
  393. /package/dist/storybook/assets/{textarea-926d9307.css → textarea-2qQbcmFS.css} +0 -0
  394. /package/dist/storybook/assets/{toaster-ec06371b.css → toaster-8C7zmNfJ.css} +0 -0
  395. /package/dist/storybook/assets/{tooltip-80296f1d.css → tooltip-jr3F-ie6.css} +0 -0
  396. /package/dist/storybook/assets/{tree.stories-3406c5f6.css → tree-zmq4MRb6.css} +0 -0
  397. /package/dist/storybook/assets/{tslib.es6-dfef685f.js → tslib.es6-OIsz3r9a.js} +0 -0
  398. /package/dist/storybook/assets/{types-cc224262.js → types-VB5zD18b.js} +0 -0
  399. /package/dist/storybook/assets/{unit-input.stories-c251e2c8.css → unit-input-qBUtqoTb.css} +0 -0
@@ -1,4 +1,4 @@
1
- var mf=Object.defineProperty;var gf=(t,e,n)=>e in t?mf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var tl=(t,e,n)=>(gf(t,typeof e!="symbol"?e+"":e,n),n);import{j as ae}from"./jsx-runtime-f961835c.js";import{g as bs,R as Me,r as $}from"./index-f80c8c95.js";import{D as yf}from"./disabled-context-d654f6ff.js";import{C as xf}from"./common-types-2c81813f.js";import{B as xu}from"./button-74c97e4a.js";import{r as bf}from"./index-3d476d02.js";import{S as kf}from"./select-205cd538.js";import"./index-a80ed1cf.js";import"./spinner-a81ebe38.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./tooltip-23e84186.js";import"./types-332ceaf3.js";import"./lodash-75c70a11.js";import"./assertThisInitialized-081f9914.js";import"./memoize-one.esm-52518564.js";import"./types-cc224262.js";import"./text-ad1f5f1d.js";import"./actions-2d4e1c8e.js";import"./badge-20e7ee0b.js";import"./select.input-88b6ebab.js";var Eo={exports:{}};(function(t,e){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,s=Error.captureStackTrace;s===void 0&&(s=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var h=u.stack;return r(this,"stack",{configurable:!0,value:h,writable:!0}),h},set:function(h){r(c,"stack",{configurable:!0,value:h,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),s(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var o=function(){function l(u,d){return r(u,"name",{configurable:!0,value:d})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},o!==void 0&&(o(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var d={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(d.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,d),l}e=t.exports=a,e.BaseError=i})(Eo,Eo.exports);var bu=Eo.exports,nl="ProseMirror-selectednode",la="",Wt="\0",rl="__state_override__",Sf={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},j=Sf,At=Symbol.for("__remirror__"),xe=(t=>(t.PlainExtension="RemirrorPlainExtension",t.NodeExtension="RemirrorNodeExtension",t.MarkExtension="RemirrorMarkExtension",t.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",t.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",t.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",t.Manager="RemirrorManager",t.Preset="RemirrorPreset",t.PresetConstructor="RemirrorPresetConstructor",t))(xe||{}),X=(t=>(t[t.Critical=1e6]="Critical",t[t.Highest=1e5]="Highest",t[t.High=1e4]="High",t[t.Medium=1e3]="Medium",t[t.Default=100]="Default",t[t.Low=10]="Low",t[t.Lowest=0]="Lowest",t))(X||{}),Pe=(t=>(t[t.None=0]="None",t[t.Create=1]="Create",t[t.EditorView=2]="EditorView",t[t.Runtime=3]="Runtime",t[t.Destroy=4]="Destroy",t))(Pe||{}),w=(t=>(t.Undo="_|undo|_",t.Redo="_|redo|_",t.Bold="_|bold|_",t.Italic="_|italic|_",t.Underline="_|underline|_",t.Strike="_|strike|_",t.Code="_|code|_",t.Paragraph="_|paragraph|_",t.H1="_|h1|_",t.H2="_|h2|_",t.H3="_|h3|_",t.H4="_|h4|_",t.H5="_|h5|_",t.H6="_|h6|_",t.TaskList="_|task|_",t.BulletList="_|bullet|_",t.OrderedList="_|number|_",t.Quote="_|quote|_",t.Divider="_|divider|_",t.Codeblock="_|codeblock|_",t.ClearFormatting="_|clear|_",t.Superscript="_|sup|_",t.Subscript="_|sub|_",t.LeftAlignment="_|left-align|_",t.CenterAlignment="_|center-align|_",t.RightAlignment="_|right-align|_",t.JustifyAlignment="_|justify-align|_",t.InsertLink="_|link|_",t.Find="_|find|_",t.FindBackwards="_|find-backwards|_",t.FindReplace="_|find-replace|_",t.AddFootnote="_|footnote|_",t.AddComment="_|comment|_",t.ContextMenu="_|context-menu|_",t.IncreaseFontSize="_|inc-font-size|_",t.DecreaseFontSize="_|dec-font-size|_",t.IncreaseIndent="_|indent|_",t.DecreaseIndent="_|dedent|_",t.Shortcuts="_|shortcuts|_",t.Copy="_|copy|_",t.Cut="_|cut|_",t.Paste="_|paste|_",t.PastePlain="_|paste-plain|_",t.SelectAll="_|select-all|_",t.Format="_|format|_",t))(w||{}),b=(t=>(t.PROD="RMR0000",t.UNKNOWN="RMR0001",t.INVALID_COMMAND_ARGUMENTS="RMR0002",t.CUSTOM="RMR0003",t.CORE_HELPERS="RMR0004",t.MUTATION="RMR0005",t.INTERNAL="RMR0006",t.MISSING_REQUIRED_EXTENSION="RMR0007",t.MANAGER_PHASE_ERROR="RMR0008",t.INVALID_GET_EXTENSION="RMR0010",t.INVALID_MANAGER_ARGUMENTS="RMR0011",t.SCHEMA="RMR0012",t.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",t.INVALID_MANAGER_EXTENSION="RMR0014",t.DUPLICATE_COMMAND_NAMES="RMR0016",t.DUPLICATE_HELPER_NAMES="RMR0017",t.NON_CHAINABLE_COMMAND="RMR0018",t.INVALID_EXTENSION="RMR0019",t.INVALID_CONTENT="RMR0021",t.INVALID_NAME="RMR0050",t.EXTENSION="RMR0100",t.EXTENSION_SPEC="RMR0101",t.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",t.INVALID_SET_EXTENSION_OPTIONS="RMR0103",t.REACT_PROVIDER_CONTEXT="RMR0200",t.REACT_GET_ROOT_PROPS="RMR0201",t.REACT_EDITOR_VIEW="RMR0202",t.REACT_CONTROLLED="RMR0203",t.REACT_NODE_VIEW="RMR0204",t.REACT_GET_CONTEXT="RMR0205",t.REACT_COMPONENTS="RMR0206",t.REACT_HOOKS="RMR0207",t.I18N_CONTEXT="RMR0300",t))(b||{}),vf=function(e){return wf(e)&&!Ef(e)};function wf(t){return!!t&&typeof t=="object"}function Ef(t){var e=Object.prototype.toString.call(t);return e==="[object RegExp]"||e==="[object Date]"||Of(t)}var Cf=typeof Symbol=="function"&&Symbol.for,Tf=Cf?Symbol.for("react.element"):60103;function Of(t){return t.$$typeof===Tf}function Mf(t){return Array.isArray(t)?[]:{}}function Qr(t,e){return e.clone!==!1&&e.isMergeableObject(t)?er(Mf(t),t,e):t}function _f(t,e,n){return t.concat(e).map(function(r){return Qr(r,n)})}function Nf(t,e){if(!e.customMerge)return er;var n=e.customMerge(t);return typeof n=="function"?n:er}function Af(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]}function sl(t){return Object.keys(t).concat(Af(t))}function ku(t,e){try{return e in t}catch{return!1}}function Rf(t,e){return ku(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))}function If(t,e,n){var r={};return n.isMergeableObject(t)&&sl(t).forEach(function(s){r[s]=Qr(t[s],n)}),sl(e).forEach(function(s){Rf(t,s)||(ku(t,s)&&n.isMergeableObject(e[s])?r[s]=Nf(s,n)(t[s],e[s],n):r[s]=Qr(e[s],n))}),r}function er(t,e,n){n=n||{},n.arrayMerge=n.arrayMerge||_f,n.isMergeableObject=n.isMergeableObject||vf,n.cloneUnlessOtherwiseSpecified=Qr;var r=Array.isArray(e),s=Array.isArray(t),i=r===s;return i?r?n.arrayMerge(t,e,n):If(t,e,n):Qr(e,n)}er.all=function(e,n){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(r,s){return er(r,s,n)},{})};var Df=er,Pf=Df;const Lf=bs(Pf);/*!
1
+ var mf=Object.defineProperty;var gf=(t,e,n)=>e in t?mf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var tl=(t,e,n)=>(gf(t,typeof e!="symbol"?e+"":e,n),n);import{j as ae}from"./jsx-runtime-FsUICBgo.js";import{g as bs,R as Me,r as $}from"./index-RfLt4OUa.js";import{D as yf}from"./disabled-context-urNQThQz.js";import{C as xf}from"./common-types-U65vzrrz.js";import{B as xu}from"./button-7V8oA22w.js";import{r as bf}from"./index-miLrID2P.js";import{S as kf}from"./select-5jrVNbFb.js";import"./index-VW3EWkuE.js";import"./spinner-R8Il4aRe.js";import"./icon-y1a2N5SZ.js";import"./inheritsLoose-Y9jOMJLd.js";import"./tslib.es6-OIsz3r9a.js";import"./index-4QtD-hFu.js";import"./tooltip-HEHiU__l.js";import"./types-5uVBABF4.js";import"./lodash-Bmg8FrMx.js";import"./extends-dGVwEr9R.js";import"./assertThisInitialized-4q6YPdh3.js";import"./memoize-one.esm-hqe5SRxC.js";import"./types-VB5zD18b.js";import"./text-6KQ6ntOV.js";import"./actions-ESle7xCw.js";import"./badge-23Ty_zBt.js";import"./select.input-zP5tW20f.js";var Eo={exports:{}};(function(t,e){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,s=Error.captureStackTrace;s===void 0&&(s=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var h=u.stack;return r(this,"stack",{configurable:!0,value:h,writable:!0}),h},set:function(h){r(c,"stack",{configurable:!0,value:h,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),s(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var o=function(){function l(u,d){return r(u,"name",{configurable:!0,value:d})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},o!==void 0&&(o(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var d={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(d.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,d),l}e=t.exports=a,e.BaseError=i})(Eo,Eo.exports);var bu=Eo.exports,nl="ProseMirror-selectednode",la="",Wt="\0",rl="__state_override__",Sf={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},j=Sf,At=Symbol.for("__remirror__"),xe=(t=>(t.PlainExtension="RemirrorPlainExtension",t.NodeExtension="RemirrorNodeExtension",t.MarkExtension="RemirrorMarkExtension",t.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",t.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",t.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",t.Manager="RemirrorManager",t.Preset="RemirrorPreset",t.PresetConstructor="RemirrorPresetConstructor",t))(xe||{}),X=(t=>(t[t.Critical=1e6]="Critical",t[t.Highest=1e5]="Highest",t[t.High=1e4]="High",t[t.Medium=1e3]="Medium",t[t.Default=100]="Default",t[t.Low=10]="Low",t[t.Lowest=0]="Lowest",t))(X||{}),Pe=(t=>(t[t.None=0]="None",t[t.Create=1]="Create",t[t.EditorView=2]="EditorView",t[t.Runtime=3]="Runtime",t[t.Destroy=4]="Destroy",t))(Pe||{}),w=(t=>(t.Undo="_|undo|_",t.Redo="_|redo|_",t.Bold="_|bold|_",t.Italic="_|italic|_",t.Underline="_|underline|_",t.Strike="_|strike|_",t.Code="_|code|_",t.Paragraph="_|paragraph|_",t.H1="_|h1|_",t.H2="_|h2|_",t.H3="_|h3|_",t.H4="_|h4|_",t.H5="_|h5|_",t.H6="_|h6|_",t.TaskList="_|task|_",t.BulletList="_|bullet|_",t.OrderedList="_|number|_",t.Quote="_|quote|_",t.Divider="_|divider|_",t.Codeblock="_|codeblock|_",t.ClearFormatting="_|clear|_",t.Superscript="_|sup|_",t.Subscript="_|sub|_",t.LeftAlignment="_|left-align|_",t.CenterAlignment="_|center-align|_",t.RightAlignment="_|right-align|_",t.JustifyAlignment="_|justify-align|_",t.InsertLink="_|link|_",t.Find="_|find|_",t.FindBackwards="_|find-backwards|_",t.FindReplace="_|find-replace|_",t.AddFootnote="_|footnote|_",t.AddComment="_|comment|_",t.ContextMenu="_|context-menu|_",t.IncreaseFontSize="_|inc-font-size|_",t.DecreaseFontSize="_|dec-font-size|_",t.IncreaseIndent="_|indent|_",t.DecreaseIndent="_|dedent|_",t.Shortcuts="_|shortcuts|_",t.Copy="_|copy|_",t.Cut="_|cut|_",t.Paste="_|paste|_",t.PastePlain="_|paste-plain|_",t.SelectAll="_|select-all|_",t.Format="_|format|_",t))(w||{}),b=(t=>(t.PROD="RMR0000",t.UNKNOWN="RMR0001",t.INVALID_COMMAND_ARGUMENTS="RMR0002",t.CUSTOM="RMR0003",t.CORE_HELPERS="RMR0004",t.MUTATION="RMR0005",t.INTERNAL="RMR0006",t.MISSING_REQUIRED_EXTENSION="RMR0007",t.MANAGER_PHASE_ERROR="RMR0008",t.INVALID_GET_EXTENSION="RMR0010",t.INVALID_MANAGER_ARGUMENTS="RMR0011",t.SCHEMA="RMR0012",t.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",t.INVALID_MANAGER_EXTENSION="RMR0014",t.DUPLICATE_COMMAND_NAMES="RMR0016",t.DUPLICATE_HELPER_NAMES="RMR0017",t.NON_CHAINABLE_COMMAND="RMR0018",t.INVALID_EXTENSION="RMR0019",t.INVALID_CONTENT="RMR0021",t.INVALID_NAME="RMR0050",t.EXTENSION="RMR0100",t.EXTENSION_SPEC="RMR0101",t.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",t.INVALID_SET_EXTENSION_OPTIONS="RMR0103",t.REACT_PROVIDER_CONTEXT="RMR0200",t.REACT_GET_ROOT_PROPS="RMR0201",t.REACT_EDITOR_VIEW="RMR0202",t.REACT_CONTROLLED="RMR0203",t.REACT_NODE_VIEW="RMR0204",t.REACT_GET_CONTEXT="RMR0205",t.REACT_COMPONENTS="RMR0206",t.REACT_HOOKS="RMR0207",t.I18N_CONTEXT="RMR0300",t))(b||{}),vf=function(e){return wf(e)&&!Ef(e)};function wf(t){return!!t&&typeof t=="object"}function Ef(t){var e=Object.prototype.toString.call(t);return e==="[object RegExp]"||e==="[object Date]"||Of(t)}var Cf=typeof Symbol=="function"&&Symbol.for,Tf=Cf?Symbol.for("react.element"):60103;function Of(t){return t.$$typeof===Tf}function Mf(t){return Array.isArray(t)?[]:{}}function Qr(t,e){return e.clone!==!1&&e.isMergeableObject(t)?er(Mf(t),t,e):t}function _f(t,e,n){return t.concat(e).map(function(r){return Qr(r,n)})}function Nf(t,e){if(!e.customMerge)return er;var n=e.customMerge(t);return typeof n=="function"?n:er}function Af(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]}function sl(t){return Object.keys(t).concat(Af(t))}function ku(t,e){try{return e in t}catch{return!1}}function Rf(t,e){return ku(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))}function If(t,e,n){var r={};return n.isMergeableObject(t)&&sl(t).forEach(function(s){r[s]=Qr(t[s],n)}),sl(e).forEach(function(s){Rf(t,s)||(ku(t,s)&&n.isMergeableObject(e[s])?r[s]=Nf(s,n)(t[s],e[s],n):r[s]=Qr(e[s],n))}),r}function er(t,e,n){n=n||{},n.arrayMerge=n.arrayMerge||_f,n.isMergeableObject=n.isMergeableObject||vf,n.cloneUnlessOtherwiseSpecified=Qr;var r=Array.isArray(e),s=Array.isArray(t),i=r===s;return i?r?n.arrayMerge(t,e,n):If(t,e,n):Qr(e,n)}er.all=function(e,n){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(r,s){return er(r,s,n)},{})};var Df=er,Pf=Df;const Lf=bs(Pf);/*!
2
2
  * isobject <https://github.com/jonschlinkert/isobject>
3
3
  *
4
4
  * Copyright (c) 2014-2017, Jon Schlinkert.
@@ -30,27 +30,27 @@ var mf=Object.defineProperty;var gf=(t,e,n)=>e in t?mf(t,e,{enumerable:!0,config
30
30
  `:"";return`${r}${s}For more information visit ${Ru}#${t.toLowerCase()}`}var Iu=class extends bu.BaseError{constructor({code:t,message:e,disableLogging:n=!1}={}){const r=dp(t)?t:b.CUSTOM;super(hp(r,e)),this.errorCode=r,this.url=`${Ru}#${r.toLowerCase()}`,n||console.error(this.message)}static create(t={}){return new Iu(t)}};function R(t,e){if(!t)throw Iu.create(e)}function fp(t){if(typeof t!="object"||t===null)return t;const e=Symbol.toStringTag in t&&t[Symbol.toStringTag]==="Module"?t.default??t:t;return e&&typeof t=="object"&&"__esModule"in e&&e.__esModule&&e.default!==void 0?e.default:e}function xn(t,e={}){return t}function ke(t){this.content=t}ke.prototype={constructor:ke,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new ke(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ke(n)},addToStart:function(t,e){return new ke([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ke(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new ke(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=ke.from(t),t.size?new ke(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ke.from(t),t.size?new ke(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ke.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};ke.from=function(t){if(t instanceof ke)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ke(e)};function Du(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=Du(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function Pu(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Pu(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class x{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(a,l)=>{a.isText?(i+=a.text.slice(Math.max(e,l)-l,n-l),o=!r):a.isLeaf?(s?i+=typeof s=="function"?s(a):s:a.type.spec.leafText&&(i+=a.type.spec.leafText(a)),o=!r):!o&&a.isBlock&&(i+=r,o=!0)},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new x(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=l}return new x(r,s)}cutByIndex(e,n){return e==n?x.empty:e==0&&n==this.content.length?this:new x(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new x(s,i)}addToStart(e){return new x([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new x(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return Du(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Pu(this,e,n,r)}findIndex(e,n=-1){if(e==0)return _s(0,e);if(e==this.size)return _s(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,s=0;;r++){let i=this.child(r),o=s+i.nodeSize;if(o>=e)return o==e||n>0?_s(r+1,o):_s(r,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return x.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new x(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return x.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new x(n||e,r)}static from(e){if(!e)return x.empty;if(e instanceof x)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new x([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}x.empty=new x([],0);const Yi={index:0,offset:0};function _s(t,e){return Yi.index=t,Yi.offset=e,Yi}function ri(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ri(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ri(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class U{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ri(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return U.none;if(e instanceof U)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}}U.none=[];class si extends Error{}class S{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Bu(this.content,e+this.openStart,n);return r&&new S(r,this.openStart,this.openEnd)}removeBetween(e,n){return new S(Lu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return S.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new S(x.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new S(e,r,s)}}S.empty=new S(x.empty,0,0);function Lu(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(s==e||i.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Lu(i.content,e-s-1,n-s-1)))}function Bu(t,e,n,r){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Bu(o.content,e-i-1,n);return a&&t.replaceChild(s,o.copy(a))}function pp(t,e,n){if(n.openStart>t.depth)throw new si("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new si("Inconsistent open depths");return zu(t,e,n,0)}function zu(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=zu(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return wn(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=mp(n,t);return wn(i,Fu(t,o,a,e,r))}else return wn(i,ii(t,e,r))}function $u(t,e){if(!e.type.compatibleContent(t.type))throw new si("Cannot join "+e.type.name+" onto "+t.type.name)}function To(t,e,n){let r=t.node(n);return $u(r,e.node(n)),r}function vn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Gr(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(vn(t.nodeAfter,r),i++));for(let a=i;a<o;a++)vn(s.child(a),r);e&&e.depth==n&&e.textOffset&&vn(e.nodeBefore,r)}function wn(t,e){return t.type.checkContent(e),t.copy(e)}function Fu(t,e,n,r,s){let i=t.depth>s&&To(t,e,s+1),o=r.depth>s&&To(n,r,s+1),a=[];return Gr(null,t,s,a),i&&o&&e.index(s)==n.index(s)?($u(i,o),vn(wn(i,Fu(t,e,n,r,s+1)),a)):(i&&vn(wn(i,ii(t,e,s+1)),a),Gr(e,n,s,a),o&&vn(wn(o,ii(n,r,s+1)),a)),Gr(r,null,s,a),new x(a)}function ii(t,e,n){let r=[];if(Gr(null,t,n,r),t.depth>n){let s=To(t,e,n+1);vn(wn(s,ii(t,e,n+1)),r)}return Gr(e,null,n,r),new x(r)}function mp(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(x.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class nr{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return U.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Tn(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new nr(n,r,i)}static resolveCached(e,n){for(let s=0;s<Zi.length;s++){let i=Zi[s];if(i.pos==n&&i.doc==e)return i}let r=Zi[Qi]=nr.resolve(e,n);return Qi=(Qi+1)%gp,r}}let Zi=[],Qi=0,gp=12;class Tn{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const yp=Object.create(null);let Gt=class Oo{constructor(e,n,r,s=U.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||x.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&ri(this.attrs,n||e.defaultAttrs||yp)&&U.sameSet(this.marks,r||U.none)}copy(e=null){return e==this.content?this:new Oo(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Oo(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return S.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new S(c,s.depth-o,i.depth-o)}replace(e,n,r){return pp(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return nr.resolveCached(this,e)}resolveNoCache(e){return nr.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Vu(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=x.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=U.none;for(let n=0;n<this.marks.length;n++)e=this.marks[n].addToSet(e);if(!U.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=x.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,s,r)}};Gt.prototype.text=void 0;class oi extends Gt{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Vu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new oi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new oi(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Vu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class On{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new xp(e,n);if(r.next==null)return On.empty;let s=Hu(r);r.next&&r.err("Unexpected trailing text");let i=Cp(Ep(s));return Tp(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return x.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let h=i(d,a.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
31
31
  `)}}On.empty=new On(!0);class xp{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Hu(t){let e=[];do e.push(bp(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function bp(t){let e=[];do e.push(kp(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function kp(t){let e=wp(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Sp(t,e);else break;return e}function ul(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Sp(t,e){let n=ul(t),r=n;return t.eat(",")&&(t.next!="}"?r=ul(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function vp(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.groups.indexOf(e)>-1&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function wp(t){if(t.eat("(")){let e=Hu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=vp(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Ep(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=i(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();s(i(o.expr,l),u),l=u}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),s(i(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Uu(t,e){return e-t}function dl(t,e){let n=[];return r(e),n.sort(Uu);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&n.indexOf(l)==-1&&r(l)}}}function Cp(t){let e=Object.create(null);return n(dl(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<s.length;u++)s[u][0]==a&&(c=s[u][1]);dl(t,l).forEach(u=>{c||s.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new On(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(Uu);i.next.push({type:s[o][0],next:e[a.join(",")]||n(a)})}return i}}function Tp(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ju(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Wu(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function Ku(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new Op(t[n]);return e}let Mo=class qu{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ku(r.attrs),this.defaultAttrs=ju(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==On.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Wu(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Gt(this,this.computeAttrs(e),x.from(n),U.setFrom(r))}createChecked(e=null,n,r){return n=x.from(n),this.checkContent(n),new Gt(this,this.computeAttrs(e),n,U.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=x.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(x.empty,!0);return i?new Gt(this,e,n.append(i),U.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:U.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new qu(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Op{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Ss{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=Ku(s.attrs),this.excluded=null;let i=ju(this.attrs);this.instance=i?new U(this,i):null}create(e=null){return!e&&this.instance?this.instance:new U(this,Wu(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Ss(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}}class Mp{constructor(e){this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=ke.from(e.nodes),n.marks=ke.from(e.marks||{}),this.nodes=Mo.compile(this.spec.nodes,this),this.marks=Ss.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;i.contentMatch=r[o]||(r[o]=On.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=a=="_"?null:a?hl(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:hl(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Mo){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new oi(r,r.defaultAttrs,e,U.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Gt.fromJSON(this,e)}markFromJSON(e){return U.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function hl(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}let da=class _o{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let s=e.nodes[r.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new pl(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new pl(this,n,!0);return r.addAll(e,n.from,n.to),S.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Ap(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=ml(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=ml(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _o(e,_o.schemaRules(e)))}};const Ju={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},_p={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Gu={ol:!0,ul:!0},ai=1,li=2,Xr=4;function fl(t,e,n){return e!=null?(e?ai:0)|(e==="full"?li:0):t&&t.whitespace=="pre"?ai|li:n&~Xr}class Ns{constructor(e,n,r,s,i,o,a){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=s,this.solid=i,this.options=a,this.content=[],this.activeMarks=U.none,this.stashMarks=[],this.match=o||(a&Xr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(x.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ai)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=x.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(x.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;n<r.length;n++){let s=r[n];(this.type?this.type.allowsMarkType(s.type):Ip(s.type,e))&&!s.isInSet(this.activeMarks)&&(this.activeMarks=s.addToSet(this.activeMarks),this.pendingMarks=s.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ju.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class pl{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let s=n.topNode,i,o=fl(null,n.preserveWhitespace,0)|(r?Xr:0);s?i=new Ns(s.type,s.attrs,U.none,U.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new Ns(null,null,U.none,U.none,!0,null,o):i=new Ns(e.schema.topNodeType,null,U.none,U.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,n){let r=e.getAttribute("style");if(!r)return n();let s=this.readStyles(Rp(r));if(!s)return;let[i,o]=s,a=this.top;for(let l=0;l<o.length;l++)this.removePendingMark(o[l],a);for(let l=0;l<i.length;l++)this.addPendingMark(i[l]);n();for(let l=0;l<i.length;l++)this.removePendingMark(i[l],a);for(let l=0;l<o.length;l++)this.addPendingMark(o[l])}addTextNode(e){let n=e.nodeValue,r=this.top;if(r.options&li||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&ai)r.options&li?n=n.replace(/\r\n?/g,`
32
32
  `):n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let s=r.content[r.content.length-1],i=e.previousSibling;(!s||i&&i.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n)),this.findInText(e)}else this.findInside(e)}addElement(e,n){let r=e.nodeName.toLowerCase(),s;Gu.hasOwnProperty(r)&&this.parser.normalizeLists&&Np(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));if(i?i.ignore:_p.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let o,a=this.top,l=this.needsBlock;if(Ju.hasOwnProperty(r))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),o=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}i&&i.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),o&&this.sync(a),this.needsBlock=l}else this.withStyleRules(e,()=>{this.addElementByRule(e,i,i.consuming===!1?s:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
33
- `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=U.none,r=U.none;for(let s=0;s<e.length;s+=2)for(let i=void 0;;){let o=this.parser.matchStyle(e[s],e[s+1],this,i);if(!o)break;if(o.ignore)return null;if(o.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(a=>{o.clearMark(a)&&(r=a.addToSet(r))}):n=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(n),o.consuming===!1)i=o;else break}return[n,r]}addElementByRule(e,n,r){let s,i,o;n.node?(i=this.parser.schema.nodes[n.node],i.isLeaf?this.insertNode(i.create(n.attrs))||this.leafFallback(e):s=this.enter(i,n.attrs||null,n.preserveWhitespace)):(o=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(o));let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l)}s&&this.sync(a)&&this.open--,o&&this.removePendingMark(o,a)}addAll(e,n,r){let s=n||0;for(let i=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];i!=o;i=i.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(i);this.findAtPoint(e,s)}findPlace(e){let n,r;for(let s=this.open;s>=0;s--){let i=this.nodes[s],o=i.findWrapping(e);if(o&&(!n||n.length>o.length)&&(n=o,r=i,!o.length)||i.solid)break}if(!n)return!1;this.sync(r);for(let s=0;s<n.length;s++)this.enterInner(n[s],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(e)){this.closeExtra();let n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));let r=n.activeMarks;for(let s=0;s<e.marks.length;s++)(!n.type||n.type.allowsMarkType(e.marks[s].type))&&(r=e.marks[s].addToSet(r));return n.content.push(e.mark(r)),!0}return!1}enter(e,n,r){let s=this.findPlace(e.create(n));return s&&this.enterInner(e,n,!0,r),s}enterInner(e,n=null,r=!1,s){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let o=fl(e,s,i.options);i.options&Xr&&i.content.length==0&&(o|=Xr),this.nodes.push(new Ns(e,n,i.activeMarks,i.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=Dp(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let s=this.nodes[r];if(s.pendingMarks.lastIndexOf(e)>-1)s.pendingMarks=e.removeFromSet(s.pendingMarks);else{s.activeMarks=e.removeFromSet(s.activeMarks);let o=s.popFromStashMark(e);o&&s.type&&s.type.allowsMarkType(o.type)&&(s.activeMarks=o.addToSet(s.activeMarks))}if(s==n)break}}}function Np(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Gu.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Ap(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Rp(t){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,r=[];for(;n=e.exec(t);)r.push(n[1],n[2].trim());return r}function ml(t){let e={};for(let n in t)e[n]=t[n];return e}function Ip(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}function Dp(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class qe{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=eo(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=qe.renderSpec(eo(n),this.nodes[e.type.name](e));if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&qe.renderSpec(eo(r),s(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let s=n[0],i=s.indexOf(" ");i>0&&(r=s.slice(0,i),s=s.slice(i+1));let o,a=r?e.createElementNS(r,s):e.createElement(s),l=n[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let u in l)if(l[u]!=null){let d=u.indexOf(" ");d>0?a.setAttributeNS(u.slice(0,d),u.slice(d+1),l[u]):a.setAttribute(u,l[u])}}for(let u=c;u<n.length;u++){let d=n[u];if(d===0){if(u<n.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:f}=qe.renderSpec(e,d,r);if(a.appendChild(h),f){if(o)throw new RangeError("Multiple content holes");o=f}}}return{dom:a,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new qe(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=gl(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return gl(e.marks)}}function gl(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function eo(t){return t.document||window.document}const Xu=65535,Yu=Math.pow(2,16);function Pp(t,e){return t+e*Yu}function yl(t){return t&Xu}function Lp(t){return(t-(t&Xu))/Yu}const Zu=1,Qu=2,Ls=4,ed=8;class No{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ed)>0}get deletedBefore(){return(this.delInfo&(Zu|Ls))>0}get deletedAfter(){return(this.delInfo&(Qu|Ls))>0}get deletedAcross(){return(this.delInfo&Ls)>0}}class We{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&We.empty)return We.empty}recover(e){let n=0,r=yl(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+Lp(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+o],d=l+c;if(e<=d){let h=c?e==l?-1:e==d?1:n:n,f=l+s+(h<0?0:u);if(r)return f;let p=e==(n<0?l:d)?null:Pp(a/3,e-l),m=e==l?Qu:e==d?Zu:Ls;return(n<0?e!=l:e!=d)&&(m|=ed),new No(f,m,p)}s+=u-c}return r?e+s:new No(e+s,0,null)}touches(e,n){let r=0,s=yl(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new We(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?We.empty:new We(e<0?[0,-e,0]:[0,0,e])}}We.empty=new We([]);class Gn{constructor(e=[],n,r=0,s=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=s}slice(e=0,n=this.maps.length){return new Gn(this.maps,this.mirror,e,n)}copy(){return new Gn(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let s=e.getMirror(n);this.appendMap(e.maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e.maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Gn;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this.maps[i],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this.maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new No(e,s,null)}}const to=Object.create(null);class me{getMap(){return We.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=to[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in to)throw new RangeError("Duplicate use of step JSON ID "+e);return to[e]=n,n.prototype.jsonID=e,n}}class le{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new le(e,null)}static fail(e){return new le(null,e)}static fromReplace(e,n,r,s){try{return le.ok(e.replace(n,r,s))}catch(i){if(i instanceof si)return le.fail(i.message);throw i}}}function ha(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(ha(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return x.fromArray(r)}class Kt extends me{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new S(ha(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return le.fromReplace(e,this.from,this.to,i)}invert(){return new pt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Kt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Kt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Kt(n.from,n.to,e.markFromJSON(n.mark))}}me.jsonID("addMark",Kt);class pt extends me{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new S(ha(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return le.fromReplace(e,this.from,this.to,r)}invert(){return new Kt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new pt(n.pos,r.pos,this.mark)}merge(e){return e instanceof pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new pt(n.from,n.to,e.markFromJSON(n.mark))}}me.jsonID("removeMark",pt);class qt extends me{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return le.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return le.fromReplace(e,this.pos,this.pos+1,new S(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new qt(this.pos,n.marks[s]);return new qt(this.pos,this.mark)}}return new rr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new qt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new qt(n.pos,e.markFromJSON(n.mark))}}me.jsonID("addNodeMark",qt);class rr extends me{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return le.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return le.fromReplace(e,this.pos,this.pos+1,new S(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new qt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new rr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new rr(n.pos,e.markFromJSON(n.mark))}}me.jsonID("removeNodeMark",rr);class Ee extends me{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Ao(e,this.from,this.to)?le.fail("Structure replace would overwrite content"):le.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new We([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ee(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ee(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Ee)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?S.empty:new S(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ee(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?S.empty:new S(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ee(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ee(n.from,n.to,S.fromJSON(e,n.slice),!!n.structure)}}me.jsonID("replace",Ee);class fe extends me{constructor(e,n,r,s,i,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Ao(e,this.from,this.gapFrom)||Ao(e,this.gapTo,this.to)))return le.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return le.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?le.fromReplace(e,this.from,this.to,r):le.fail("Content does not fit in gap")}getMap(){return new We([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new fe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=e.map(this.gapFrom,-1),i=e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new fe(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new fe(n.from,n.to,n.gapFrom,n.gapTo,S.fromJSON(e,n.slice),n.insert,!!n.structure)}}me.jsonID("replaceAround",fe);function Ao(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Bp(t,e,n,r){let s=[],i=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:s.push(o=new pt(h,f,d[m])));a&&a.to==h?a.to=f:i.push(a=new Kt(h,f,r))}}),s.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function zp(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof Ss){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],h;for(let f=0;f<s.length;f++){let p=s[f];p.step==i-1&&d.eq(s[f].style)&&(h=p)}h?(h.to=c,h.step=i):s.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>t.step(new pt(o.from,o.to,o.style)))}function $p(t,e,n,r=n.contentMatch){let s=t.doc.nodeAt(e),i=[],o=e+1;for(let a=0;a<s.childCount;a++){let l=s.child(a),c=o+l.nodeSize,u=r.matchType(l.type);if(!u)i.push(new Ee(o,c,S.empty));else{r=u;for(let d=0;d<l.marks.length;d++)n.allowsMarkType(l.marks[d].type)||t.step(new pt(o,c,l.marks[d]));if(l.isText&&!n.spec.code){let d,h=/\r?\n|\r/g,f;for(;d=h.exec(l.text);)f||(f=new S(x.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),i.push(new Ee(o+d.index,o+d.index+d[0].length,f))}}o=c}if(!r.validEnd){let a=r.fillBefore(x.empty,!0);t.replace(o,o,new S(a,0,0))}for(let a=i.length-1;a>=0;a--)t.step(i[a])}function Fp(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function fr(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let s=t.$from.node(r),i=t.$from.index(r),o=t.$to.indexAfter(r);if(r<t.depth&&s.canReplace(i,o,n))return r;if(r==0||s.type.spec.isolating||!Fp(s,i,o))break}return null}function Vp(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,u=x.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=x.from(r.node(p).copy(u)),d++):l--;let h=x.empty,f=0;for(let p=i,m=!1;p>n;p--)m||s.after(p+1)<s.end(p)?(m=!0,h=x.from(s.node(p).copy(h)),f++):c++;t.step(new fe(l,c,o,a,new S(u.append(h),d,f),u.size-d,!0))}function fa(t,e,n=null,r=t){let s=Hp(t,e),i=s&&Up(r,e);return i?s.map(xl).concat({type:e,attrs:n}).concat(i.map(xl)):null}function xl(t){return{type:t,attrs:null}}function Hp(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function Up(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function jp(t,e,n){let r=x.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=x.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new fe(s,i,s,i,new S(r,0,0),n.length,!0))}function Wp(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,s)&&Kp(t.doc,t.mapping.slice(i).map(a),r)){t.clearIncompatible(t.mapping.slice(i).map(a,1),r);let l=t.mapping.slice(i),c=l.map(a,1),u=l.map(a+o.nodeSize,1);return t.step(new fe(c,u,c+1,u-1,new S(x.from(r.create(s,null,o.marks)),0,0),1,!0)),!1}})}function Kp(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function qp(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new fe(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new S(x.from(o),0,0),1,!0))}function Xn(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>i;c--,u--){let d=s.node(c),h=s.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[u+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(f))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function Jp(t,e,n=1,r){let s=t.doc.resolve(e),i=x.empty,o=x.empty;for(let a=s.depth,l=s.depth-n,c=n-1;a>l;a--,c--){i=x.from(s.node(a).copy(i));let u=r&&r[c];o=x.from(u?u.type.create(u.attrs,o):s.node(a).copy(o))}t.step(new Ee(e,e,new S(i.append(o),n,n),!0))}function vs(t,e){let n=t.resolve(e),r=n.index();return Gp(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Gp(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function Xp(t,e,n){let r=new Ee(e-n,e+n,S.empty,!0);t.step(r)}function Yp(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function Zp(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(l,l,s);else{let d=c.contentMatchAt(l).findWrapping(s.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function pa(t,e,n=e,r=S.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return td(s,i,r)?new Ee(e,n,r):new Qp(s,i,r).fit()}function td(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Qp{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=x.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=x.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new S(i,o,a);return e>-1?new fe(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ee(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=no(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(x.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=no(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new S(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=no(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new S(Sr(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new S(Sr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[n];if(s){for(let m=0;m<s.childCount;m++)u.push(s.child(m));d=d.matchFragment(s)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(d=g,u.push(nd(m.mark(h.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=vr(this.placed,n,x.from(u)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?S.empty:new S(Sr(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new S(Sr(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!ro(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=ro(e,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=ro(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=vr(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=vr(this.placed,this.depth,x.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(x.empty,!0);n.childCount&&(this.placed=vr(this.placed,this.frontier.length,n))}}function Sr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Sr(t.firstChild.content,e-1,n)))}function vr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(vr(t.lastChild.content,e-1,n)))}function no(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function nd(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,nd(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(x.empty,!0)))),t.copy(r)}function ro(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!em(n,i.content,o)?a:null}function em(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function tm(t){return t.spec.defining||t.spec.definingForContent}function nm(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(td(s,i,r))return t.step(new Ee(e,n,r));let o=sd(s,t.doc.resolve(n));o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,f=s.pos-1;h>0;h--,f--){let p=s.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=u-1;h>=0;h--){let f=c[h],p=tm(f.type);if(p&&!f.sameMarkup(s.node(Math.abs(a)-1)))u=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+u+1)%(r.openStart+1),p=c[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let E=s.node(g-1),L=s.index(g-1);if(E.canReplaceWith(L,L,p.type,p.marks))return t.replace(s.before(g),y?i.after(g):n,new S(rd(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=o[h];f<0||(e=s.before(f),n=i.after(f))}}function rd(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(rd(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(x.empty,!0))}return t}function rm(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=Yp(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new S(x.from(r),0,0))}function sm(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),i=sd(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o)return t.delete(r.before(o),n);t.delete(e,n)}function sd(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Yn extends me{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return le.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return le.fromReplace(e,this.pos,this.pos+1,new S(x.from(s),0,n.isLeaf?0:1))}getMap(){return We.empty}invert(e){return new Yn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yn(n.pos,n.attr,n.value)}}me.jsonID("attr",Yn);class ts extends me{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return le.ok(r)}getMap(){return We.empty}invert(e){return new ts(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ts(n.attr,n.value)}}me.jsonID("docAttr",ts);let sr=class extends Error{};sr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};sr.prototype=Object.create(Error.prototype);sr.prototype.constructor=sr;sr.prototype.name="TransformError";class im{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Gn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new sr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=S.empty){let s=pa(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new S(x.from(r),0,0))}delete(e,n){return this.replace(e,n,S.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return nm(this,e,n,r),this}replaceRangeWith(e,n,r){return rm(this,e,n,r),this}deleteRange(e,n){return sm(this,e,n),this}lift(e,n){return Vp(this,e,n),this}join(e,n=1){return Xp(this,e,n),this}wrap(e,n){return jp(this,e,n),this}setBlockType(e,n=e,r,s=null){return Wp(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return qp(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Yn(e,n,r)),this}setDocAttribute(e,n){return this.step(new ts(e,n)),this}addNodeMark(e,n){return this.step(new qt(e,n)),this}removeNodeMark(e,n){if(!(n instanceof U)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new rr(e,n)),this}split(e,n=1,r){return Jp(this,e,n,r),this}addMark(e,n,r){return Bp(this,e,n,r),this}removeMark(e,n,r){return zp(this,e,n,r),this}clearIncompatible(e,n,r){return $p(this,e,n,r),this}}const so=Object.create(null);class V{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new om(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=S.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?S.empty:n),a==0&&Sl(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Sl(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new P(e):Fn(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?Fn(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Fn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Be(e.node(0))}static atStart(e){return Fn(e,e,0,0,1)||new Be(e)}static atEnd(e){return Fn(e,e,e.content.size,e.childCount,-1)||new Be(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=so[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in so)throw new RangeError("Duplicate use of selection JSON ID "+e);return so[e]=n,n.prototype.jsonID=e,n}getBookmark(){return P.between(this.$anchor,this.$head).getBookmark()}}V.prototype.visible=!0;class om{constructor(e,n){this.$from=e,this.$to=n}}let bl=!1;function kl(t){!bl&&!t.parent.inlineContent&&(bl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class P extends V{constructor(e,n=e){kl(e),kl(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return V.near(r);let s=e.resolve(n.map(this.anchor));return new P(s.parent.inlineContent?s:r,r)}replace(e,n=S.empty){if(super.replace(e,n),n==S.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof P&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ri(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new P(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=V.findFrom(n,r,!0)||V.findFrom(n,-r,!0);if(i)n=i.$head;else return V.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(V.findFrom(e,-r,!0)||V.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new P(e,n)}}V.jsonID("text",P);class Ri{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ri(e.map(this.anchor),e.map(this.head))}resolve(e){return P.between(e.resolve(this.anchor),e.resolve(this.head))}}class I extends V{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?V.near(i):new I(i)}content(){return new S(x.from(this.node),0,0)}eq(e){return e instanceof I&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ma(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new I(e.resolve(n.anchor))}static create(e,n){return new I(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}I.prototype.visible=!1;V.jsonID("node",I);class ma{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ri(r,r):new ma(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&I.isSelectable(r)?new I(n):V.near(n)}}class Be extends V{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=S.empty){if(n==S.empty){e.delete(0,e.doc.content.size);let r=V.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Be(e)}map(e){return new Be(e)}eq(e){return e instanceof Be}getBookmark(){return am}}V.jsonID("all",Be);const am={map(){return this},resolve(t){return new Be(t)}};function Fn(t,e,n,r,s,i=!1){if(e.inlineContent)return P.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&I.isSelectable(a))return I.create(t,n-(s<0?a.nodeSize:0))}else{let l=Fn(t,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function Sl(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof Ee||s instanceof fe))return;let i=t.mapping.maps[r],o;i.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(V.near(t.doc.resolve(o),n))}const vl=1,As=2,wl=4;class lm extends im{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|vl)&~As,this.storedMarks=null,this}get selectionSet(){return(this.updated&vl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=As,this}ensureMarks(e){return U.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&As)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~As,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||U.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),this.selection.empty||this.setSelection(V.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wl,this}get scrolledIntoView(){return(this.updated&wl)>0}}function El(t,e){return!e||!t?t:t.bind(e)}class wr{constructor(e,n,r){this.name=e,this.init=El(n.init,r),this.apply=El(n.apply,r)}}const cm=[new wr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new wr("selection",{init(t,e){return t.selection||V.atStart(e.doc)},apply(t){return t.selection}}),new wr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new wr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class io{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=cm.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new wr(r.key,r.spec.state,r))})}}class bn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new bn(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new lm(this)}static create(e){let n=new io(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new bn(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new io(this.schema,e.plugins),r=n.fields,s=new bn(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new io(e.schema,e.plugins),i=new bn(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=Gt.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=V.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=c.fromJSON.call(l,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function id(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=id(s,e,{})),n[r]=s}return n}class un{constructor(e){this.spec=e,this.props={},e.props&&id(e.props,this,this.props),this.key=e.key?e.key.key:od("plugin")}getState(e){return e[this.key]}}const oo=Object.create(null);function od(t){return t in oo?t+"$"+ ++oo[t]:(oo[t]=0,t+"$")}class pr{constructor(e="key"){this.key=od(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}function um(){return typeof document<"u"?document:null}var ad=um;function ld(t,e){if(typeof t!="string")return[t];var n=[t];typeof e=="string"||Array.isArray(e)?e={brackets:e}:e||(e={});var r=e.brackets?Array.isArray(e.brackets)?e.brackets:[e.brackets]:["{}","[]","()"],s=e.escape||"___",i=!!e.flat;r.forEach(function(l){var c=new RegExp(["\\",l[0],"[^\\",l[0],"\\",l[1],"]*\\",l[1]].join("")),u=[];function d(h,f,p){var m=n.push(h.slice(l[0].length,-l[1].length))-1;return u.push(m),s+m+s}n.forEach(function(h,f){for(var p,m=0;h!=p;)if(p=h,h=h.replace(c,d),m++>1e4)throw Error("References have circular dependency. Please, check them.");n[f]=h}),u=u.reverse(),n=n.map(function(h){return u.forEach(function(f){h=h.replace(new RegExp("(\\"+s+f+"\\"+s+")","g"),l[0]+"$1"+l[1])}),h})});var o=new RegExp("\\"+s+"([0-9]+)\\"+s);function a(l,c,u){for(var d=[],h,f=0;h=o.exec(l);){if(f++>1e4)throw Error("Circular references in parenthesis");d.push(l.slice(0,h.index)),d.push(a(c[h[1]],c)),l=l.slice(h.index+h[0].length)}return d.push(l),d}return i?n:a(n[0],n)}function cd(t,e){if(e&&e.flat){var n=e&&e.escape||"___",r=t[0],s;if(!r)return"";for(var i=new RegExp("\\"+n+"([0-9]+)\\"+n),o=0;r!=s;){if(o++>1e4)throw Error("Circular references in "+t);s=r,r=r.replace(i,a)}return r}return t.reduce(function l(c,u){return Array.isArray(u)&&(u=u.reduce(l,"")),c+u},"");function a(l,c){if(t[c]==null)throw Error("Reference "+c+"is undefined");return t[c]}}function ud(t,e){return Array.isArray(t)?cd(t,e):ld(t,e)}ud.parse=ld;ud.stringify=cd;const dm={id:"extension.command.copy.label",message:"Copy",comment:"Label for copy command."},hm={id:"extension.command.copy.description",message:"Copy the selected text",comment:"Description for copy command."},fm={id:"extension.command.cut.label",message:"Cut",comment:"Label for cut command."},pm={id:"extension.command.cut.description",message:"Cut the selected text",comment:"Description for cut command."},mm={id:"extension.command.paste.label",message:"Paste",comment:"Label for paste command."},gm={id:"extension.command.paste.description",message:"Paste content into the editor",comment:"Description for paste command."},ym={id:"extension.command.select-all.label",message:"Select all",comment:"Label for select all command."},xm={id:"extension.command.select-all.description",message:"Select all content within the editor",comment:"Description for select all command."};var nn=Object.freeze({__proto__:null,COPY_DESCRIPTION:hm,COPY_LABEL:dm,CUT_DESCRIPTION:pm,CUT_LABEL:fm,PASTE_DESCRIPTION:gm,PASTE_LABEL:mm,SELECT_ALL_DESCRIPTION:xm,SELECT_ALL_LABEL:ym});const bm={id:"extension.command.toggle-bold.label",message:"Bold",comment:"Label for bold formatting command."},km={id:"extension.command.toggle-bold.description",message:"Add bold formatting to the selected text",comment:"Description for bold formatting command."};var Cl=Object.freeze({__proto__:null,DESCRIPTION:km,LABEL:bm});const Sm={id:"extension.command.toggle-code.label",message:"Code",comment:"Label for the inline code formatting."},vm={id:"extension.command.toggle-code.description",message:"Add inline code formatting to the selected text",comment:"Description for the inline code formatting command."};var wm=Object.freeze({__proto__:null,DESCRIPTION:vm,LABEL:Sm});const Em={id:"extension.command.undo.label",message:"Undo",comment:"Label for undo."},Cm={id:"extension.command.undo.description",message:"Undo the most recent action",comment:"Description for undo."},Tm={id:"extension.command.redo.label",message:"Redo",comment:"Label for redo."},Om={id:"extension.command.redo.description",message:"Redo the most recent action",comment:"Description for redo."};var ci=Object.freeze({__proto__:null,REDO_DESCRIPTION:Om,REDO_LABEL:Tm,UNDO_DESCRIPTION:Cm,UNDO_LABEL:Em});const Mm={id:"extension.command.toggle-italic.label",message:"Italic",comment:"Label for italic formatting command."},_m={id:"extension.command.toggle-italic.description",message:"Italicize the selected text",comment:"Description for italic formatting command."};var Tl=Object.freeze({__proto__:null,DESCRIPTION:_m,LABEL:Mm});const Nm={id:"extension.command.toggle-ordered-list.label",message:"Ordered list",comment:"Label for inserting an ordered list into the editor."},Am={id:"extension.command.toggle-bullet-list.description",message:"Bulleted list",comment:"Description for inserting a bullet list into the editor."},Rm={id:"extension.command.toggle-task-list.description",message:"Tasked list",comment:"Description for inserting a task list into the editor."};var ga=Object.freeze({__proto__:null,BULLET_LIST_LABEL:Am,ORDERED_LIST_LABEL:Nm,TASK_LIST_LABEL:Rm});const Im={id:"extension.command.insert-paragraph.label",message:"Insert Paragraph",comment:"Label for inserting a paragraph."},Dm={id:"extension.command.insert-paragraph.description",message:"Insert a new paragraph",comment:"Description for inserting a paragraph."},Pm={id:"extension.command.convert-paragraph.label",message:"Convert Paragraph",comment:"Label for converting the current node into a paragraph."},Lm={id:"extension.command.convert-paragraph.description",message:"Convert current block into a paragraph block.",comment:"Description for converting a paragraph."};var ui=Object.freeze({__proto__:null,CONVERT_DESCRIPTION:Lm,CONVERT_LABEL:Pm,INSERT_DESCRIPTION:Dm,INSERT_LABEL:Im});class ws{constructor(e,n){this.match=e,this.match=e,this.handler=typeof n=="string"?Bm(n):n}}function Bm(t){return function(e,n,r,s){let i=t;if(n[1]){let o=n[0].lastIndexOf(n[1]);i+=n[0].slice(o+n[1].length),r+=o;let a=r-s;a>0&&(i=n[0].slice(o-a,o)+i,r=s)}return e.tr.insertText(i,r,s)}}const zm=500;function $m({rules:t}){let e=new un({state:{init(){return null},apply(n,r){let s=n.getMeta(this);return s||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,s,i){return Ol(n,r,s,i,t,e)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&Ol(n,r.pos,r.pos,"",t,e)})}}},isInputRules:!0});return e}function Ol(t,e,n,r,s,i){if(t.composing)return!1;let o=t.state,a=o.doc.resolve(e);if(a.parent.type.spec.code)return!1;let l=a.parent.textBetween(Math.max(0,a.parentOffset-zm),a.parentOffset,null,"")+r;for(let c=0;c<s.length;c++){let u=s[c].match.exec(l),d=u&&s[c].handler(o,u,e-(u[0].length-r.length),n);if(d)return t.dispatch(d.setMeta(i,{transform:d,from:e,to:n,text:r})),!0}return!1}const Fm=(t,e)=>{let n=t.plugins;for(let r=0;r<n.length;r++){let s=n[r],i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){let o=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l--)o.step(a.steps[l].invert(a.docs[l]));if(i.text){let l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else o.delete(i.from,i.to);e(o)}return!0}}return!1};function ya(t,e,n=null,r){return new ws(t,(s,i,o,a)=>{let l=n instanceof Function?n(i):n,c=s.tr.delete(o,a),u=c.doc.resolve(o),d=u.blockRange(),h=d&&fa(d,e,l);if(!h)return null;c.wrap(d,h);let f=c.doc.resolve(o-1).nodeBefore;return f&&f.type==e&&vs(c.doc,o-1)&&(!r||r(i,f))&&c.join(o-1),c})}const _e=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ns=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ml=null;const Ct=function(t,e,n){let r=Ml||(Ml=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Mn=function(t,e,n,r){return n&&(_l(t,e,n,r,-1)||_l(t,e,n,r,1))},Vm=/^(img|br|input|textarea|hr)$/i;function _l(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:ft(t))){let i=t.parentNode;if(!i||i.nodeType!=1||xa(t)||Vm.test(t.nodeName)||t.contentEditable=="false")return!1;e=_e(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.contentEditable=="false")return!1;e=s<0?ft(t):0}else return!1}}function ft(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Hm(t,e,n){for(let r=e==0,s=e==ft(t);r||s;){if(t==n)return!0;let i=_e(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==ft(t)}}function xa(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ii=function(t){return t.focusNode&&Mn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function yn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Um(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function jm(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const yt=typeof navigator<"u"?navigator:null,Nl=typeof document<"u"?document:null,dn=yt&&yt.userAgent||"",Ro=/Edge\/(\d+)/.exec(dn),dd=/MSIE \d/.exec(dn),Io=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dn),ze=!!(dd||Io||Ro),Xt=dd?document.documentMode:Io?+Io[1]:Ro?+Ro[1]:0,at=!ze&&/gecko\/(\d+)/i.test(dn);at&&+(/Firefox\/(\d+)/.exec(dn)||[0,0])[1];const Do=!ze&&/Chrome\/(\d+)/.exec(dn),Ce=!!Do,Wm=Do?+Do[1]:0,Ne=!ze&&!!yt&&/Apple Computer/.test(yt.vendor),ir=Ne&&(/Mobile\/\w+/.test(dn)||!!yt&&yt.maxTouchPoints>2),Ke=ir||(yt?/Mac/.test(yt.platform):!1),Km=yt?/Win/.test(yt.platform):!1,nt=/Android \d/.test(dn),Es=!!Nl&&"webkitFontSmoothing"in Nl.documentElement.style,qm=Es?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Jm(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function kt(t,e){return typeof t=="number"?t:t[e]}function Gm(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Al(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;o=ns(o)){if(o.nodeType!=1)continue;let a=o,l=a==i.body,c=l?Jm(i):Gm(a),u=0,d=0;if(e.top<c.top+kt(r,"top")?d=-(c.top-e.top+kt(s,"top")):e.bottom>c.bottom-kt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+kt(s,"top")-c.top:e.bottom-c.bottom+kt(s,"bottom")),e.left<c.left+kt(r,"left")?u=-(c.left-e.left+kt(s,"left")):e.right>c.right-kt(r,"right")&&(u=e.right-c.right+kt(s,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,f=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let p=a.scrollLeft-h,m=a.scrollTop-f;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Xm(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(i,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:hd(t.dom)}}function hd(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ns(r));return e}function Ym({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;fd(n,r==0?0:r-e)}function fd(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Ln=null;function Zm(t){if(t.setActive)return t.setActive();if(Ln)return t.focus(Ln);let e=hd(t);t.focus(Ln==null?{get preventScroll(){return Ln={preventScroll:!0},!0}}:void 0),Ln||(Ln=!1,fd(e,0))}function pd(t,e){let n,r=2e8,s,i=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Ct(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,s=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&l&&(n=l,s=c,r=0),n&&n.nodeType==3?Qm(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:pd(n,s)}function Qm(t,e){let n=t.nodeValue.length,r=document.createRange();for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let i=Bt(r,1);if(i.top!=i.bottom&&ba(e,i))return{node:t,offset:s+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function ba(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function eg(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function tg(t,e,n){let{node:r,offset:s}=pd(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function ng(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent&&!o||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&!o&&(o=!0,l.left>r.left||l.top>r.top?s=a.posBefore:(l.right<r.left||l.bottom<r.top)&&(s=a.posAfter)),!a.contentDOM&&s<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}i=a.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function md(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(ba(e,c))return md(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function rg(t,e){let n=t.dom.ownerDocument,r,s=0,i=jm(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!ba(e,c)||(o=md(t.dom,e,c),!o))return null}if(Ne)for(let c=o;r&&c;c=ns(c))c.draggable&&(r=void 0);if(o=eg(o,e),r){if(at&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&s++}let c;Es&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=ng(t,r,s,e))}a==null&&(a=tg(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Rl(t){return t.top<t.bottom||t.left<t.right}function Bt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Rl(r))return r}return Array.prototype.find.call(n,Rl)||t.getBoundingClientRect()}const sg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function gd(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Es||at;if(r.nodeType==3)if(o&&(sg.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let l=Bt(Ct(r,s,s),n);if(at&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Bt(Ct(r,s-1,s-1),-1);if(c.top==l.top){let u=Bt(Ct(r,s,s+1),-1);if(u.top!=l.top)return br(u,u.left<c.left)}}return l}else{let l=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(l--,u=1):n<0?l--:c++,br(Bt(Ct(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==ft(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return ao(l.getBoundingClientRect(),!1)}if(i==null&&s<ft(r)){let l=r.childNodes[s];if(l.nodeType==1)return ao(l.getBoundingClientRect(),!0)}return ao(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==ft(r))){let l=r.childNodes[s-1],c=l.nodeType==3?Ct(l,ft(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return br(Bt(c,1),!1)}if(i==null&&s<ft(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Ct(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return br(Bt(c,-1),!0)}return br(Bt(r.nodeType==3?Ct(r):r,-n),n>=0)}function br(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function ao(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function yd(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function ig(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return yd(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=gd(t,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Ct(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const og=/[\u0590-\u08ac]/;function ag(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return!og.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:yd(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g})}let Il=null,Dl=null,Pl=!1;function lg(t,e,n){return Il==e&&Dl==n?Pl:(Il=e,Dl=n,Pl=n=="up"||n=="down"?ig(t,e,n):ag(t,e,n))}const Je=0,Ll=1,kn=2,xt=3;class Cs{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Je,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>_e(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)s=s.children[0];return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e||o instanceof bd){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof xd&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?_e(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?_e(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=_e(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=_e(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let h=0,f=0;h<this.children.length;h++){let p=this.children[h],m=f+p.size;if(i>f&&o<m)return p.setSelection(e-f-p.border,n-f-p.border,r,s);f=m}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.getSelection(),u=!1;if((at||Ne)&&e==n){let{node:h,offset:f}=a;if(h.nodeType==3){if(u=!!(f&&h.nodeValue[f-1]==`
34
- `),u&&f==h.nodeValue.length)for(let p=h,m;p;p=p.parentNode){if(m=p.nextSibling){m.nodeName=="BR"&&(a=l={node:m.parentNode,offset:_e(m)+1});break}let g=p.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let p=h.childNodes[f-1];u=p&&(p.nodeName=="BR"||p.contentEditable=="false")}}if(at&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(s=!0)}if(!(s||u&&Ne)&&Mn(a.node,a.offset,c.anchorNode,c.anchorOffset)&&Mn(l.node,l.offset,c.focusNode,c.focusOffset))return;let d=!1;if((c.extend||e==n)&&!u){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),d=!0}catch{}}if(!d){if(e>n){let f=a;a=l,l=f}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+i.border,l=o-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?kn:Ll,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=xt:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?kn:xt}r=o}this.dirty=kn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?kn:Ll;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class xd extends Cs{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Je&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class cg extends Cs{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class _n extends Cs{constructor(e,n,r,s){super(e,[],r,s),this.mark=n}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=qe.renderSpec(document,n.type.spec.toDOM(n,r))),new _n(e,n,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&xt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Je){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Je}}slice(e,n,r){let s=_n.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Bo(i,n,o,r)),e>0&&(i=Bo(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}}class Yt extends Cs{constructor(e,n,r,s,i,o,a,l,c){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,n,r,s,i,o){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=qe.renderSpec(document,n.type.spec.toDOM(n)));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=vd(u,r,n),c?l=new ug(e,n,r,s,u,d||null,h,c,i,o+1):n.isText?new Di(e,n,r,s,u,h,i):new Yt(e,n,r,s,u,d||null,h,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>x.empty)}return e}matchesNode(e,n,r){return this.dirty==Je&&e.eq(this.node)&&Lo(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new hg(this,o&&o.node,e);mg(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?U.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,s)},(c,u,d,h)=>{l.syncToMarks(c.marks,r,e);let f;l.findNodeMatch(c,u,d,h)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(f=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,h,s)||l.addNode(c,u,d,e,s),s+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==kn)&&(o&&this.protectLocalComposition(e,o),kd(this.contentDOM,this.children,e),ir&&gg(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof P)||r<n||s>n+this.node.content.size)return null;let i=e.domSelectionRange(),o=yg(i.focusNode,i.focusOffset);if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let a=o.nodeValue,l=xg(this.node.content,a,r-n,s-n);return l<0?null:{node:o,pos:l,text:a}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new cg(this,i,n,s);e.input.compositionNodes.push(o),this.children=Bo(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==xt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Je}updateOuterDeco(e){if(Lo(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Sd(this.dom,this.nodeDOM,Po(this.outerDeco,this.node,n),Po(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Bl(t,e,n,r,s){vd(r,e,t);let i=new Yt(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class Di extends Yt{constructor(e,n,r,s,i,o,a){super(e,n,r,s,i,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==xt||this.dirty!=Je&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Je||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Je,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new Di(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=xt)}get domAtom(){return!1}}class bd extends Cs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Je&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class ug extends Yt{constructor(e,n,r,s,i,o,a,l,c,u){super(e,n,r,s,i,o,a,c,u),this.spec=l}update(e,n,r,s){if(this.dirty==xt)return!1;if(this.spec.update){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function kd(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=zl(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(a,r);if(o instanceof _n){let l=r?r.previousSibling:t.lastChild;kd(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=zl(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const Yr=function(t){t&&(this.nodeName=t)};Yr.prototype=Object.create(null);const Sn=[new Yr];function Po(t,e,n){if(t.length==0)return Sn;let r=n?Sn[0]:new Yr,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new Yr(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&s.length==1&&s.push(r=new Yr(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return s}function Sd(t,e,n,r){if(n==Sn&&r==Sn)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=Sn[0]),s=l}dg(s,a||Sn[0],o)}return s}function dg(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function vd(t,e,n){return Sd(t,t,Sn,Po(e,n,t.nodeType!=1))}function Lo(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function zl(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class hg{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=fg(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let s=0,i=this.stack.length>>1,o=Math.min(i,e.length);for(;s<o&&(s==i-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<i;)this.destroyRest(),this.top.dirty=Je,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=_n.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==xt&&o.dom==o.contentDOM&&(o.dirty=kn),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Yt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=xt&&Lo(n,l.outerDeco));if(!h&&l.update(e,n,r,s))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,n,r,s,o)))return this.top.children[this.index]=d,d.contentDOM&&(d.dirty=kn,d.updateChildren(s,o+1),d.dirty=Je),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content))return null;let a=Yt.create(this.top,n,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,s,i){let o=Yt.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new xd(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof _n;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Di)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ne||Ce)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new bd(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function fg(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof _n)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function pg(t,e){return t.type.side-e.type.side}function mg(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let g=s[o++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(pg);for(let g=0;g<d.length;g++)n(d[g],c,!!l)}else n(u,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<t.childCount)f=c,h=t.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=i&&a.splice(g--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let p=i+h.nodeSize;if(h.isText){let g=p;o<s.length&&s[o].from<g&&(g=s[o].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<p&&(l=h.cut(g-i),h=h.cut(0,g-i),p=g,f=-1)}let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(i,h),f),i=p}}function gg(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function yg(t,e){for(;;){if(t.nodeType==3)return t;if(t.nodeType==1&&e>0){if(t.childNodes.length>e&&t.childNodes[e].nodeType==3)return t.childNodes[e];t=t.childNodes[e-1],e=ft(t)}else if(t.nodeType==1&&e<t.childNodes.length)t=t.childNodes[e],e=0;else return null}}function xg(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<t.childCount;){let c=t.child(s++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Bo(t,e,n,r,s){let i=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function ka(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Ii(n)){for(l=a;s&&!s.node;)s=s.parent;let u=s.node;if(s&&u.isAtom&&I.isSelectable(u)&&s.parent&&!(u.isInline&&Hm(n.focusNode,n.focusOffset,s.dom))){let d=s.posBefore;c=new I(o==d?a:r.resolve(d))}}else{let u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null;l=r.resolve(u)}if(!c){let u=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=Sa(t,l,a,u)}return c}function wd(t){return t.editable?t.hasFocus():Cd(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Nt(t,e=!1){let n=t.state.selection;if(Ed(t,n),!!wd(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ce){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Mn(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)kg(t);else{let{anchor:r,head:s}=n,i,o;$l&&!(n instanceof P)&&(n.$from.parent.inlineContent||(i=Fl(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Fl(t,n.to))),t.docView.setSelection(r,s,t.root,e),$l&&(i&&Vl(i),o&&Vl(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&bg(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const $l=Ne||Ce&&Wm<63;function Fl(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Ne&&s&&s.contentEditable=="false")return lo(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return lo(s);if(i)return lo(i)}}function lo(t){return t.contentEditable="true",Ne&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Vl(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function bg(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!wd(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function kg(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,s=r.nodeName=="IMG";s?n.setEnd(r.parentNode,_e(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!s&&!t.state.selection.visible&&ze&&Xt<=11&&(r.disabled=!0,r.disabled=!1)}function Ed(t,e){if(e instanceof I){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Hl(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Hl(t)}function Hl(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Sa(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||P.between(e,n,r)}function Ul(t){return t.editable&&!t.hasFocus()?!1:Cd(t)}function Cd(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Sg(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Mn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function zo(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&V.findFrom(i,e)}function Ht(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function jl(t,e,n){let r=t.state.selection;if(r instanceof P)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Ht(t,new P(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=zo(t.state,e);return s&&s instanceof I?Ht(t,s):!1}else if(!(Ke&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?I.isSelectable(i)?Ht(t,new I(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Es?Ht(t,new P(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof I&&r.node.isInline)return Ht(t,new P(e>0?r.$to:r.$from));{let s=zo(t.state,e);return s?Ht(t,s):!1}}}function di(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Zr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Bn(t,e){return e<0?vg(t):wg(t)}function vg(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(at&&n.nodeType==1&&r<di(n)&&Zr(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Zr(a,-1))s=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Td(n))break;{let a=n.previousSibling;for(;a&&Zr(a,-1);)s=n.parentNode,i=_e(a),a=a.previousSibling;if(a)n=a,r=di(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?$o(t,n,r):s&&$o(t,s,i)}function wg(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=di(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Zr(a,1))i=n,o=++r;else break}else{if(Td(n))break;{let a=n.nextSibling;for(;a&&Zr(a,1);)i=a.parentNode,o=_e(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=di(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&$o(t,i,o)}function Td(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Eg(t,e){for(;t&&e==t.childNodes.length&&!xa(t);)e=_e(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Cg(t,e){for(;t&&!e&&!xa(t);)e=_e(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function $o(t,e,n){if(e.nodeType!=3){let i,o;(o=Eg(e,n))?(e=o,n=0):(i=Cg(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(Ii(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&Nt(t)},50)}function Wl(t,e){let n=t.state.doc.resolve(e);if(!(Ce||Km)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Kl(t,e,n){let r=t.state.selection;if(r instanceof P&&!r.empty||n.indexOf("s")>-1||Ke&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=zo(t.state,e);if(o&&o instanceof I)return Ht(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Be?V.near(o,e):V.findFrom(o,e);return a?Ht(t,a):!1}return!1}function ql(t,e){if(!(t.state.selection instanceof P))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Jl(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Tg(t){if(!Ne||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Jl(t,r,"true"),setTimeout(()=>Jl(t,r,"false"),20)}return!1}function Og(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Mg(t,e){let n=e.keyCode,r=Og(e);if(n==8||Ke&&n==72&&r=="c")return ql(t,-1)||Bn(t,-1);if(n==46&&!e.shiftKey||Ke&&n==68&&r=="c")return ql(t,1)||Bn(t,1);if(n==13||n==27)return!0;if(n==37||Ke&&n==66&&r=="c"){let s=n==37?Wl(t,t.state.selection.from)=="ltr"?-1:1:-1;return jl(t,s,r)||Bn(t,s)}else if(n==39||Ke&&n==70&&r=="c"){let s=n==39?Wl(t,t.state.selection.from)=="ltr"?1:-1:1;return jl(t,s,r)||Bn(t,s)}else{if(n==38||Ke&&n==80&&r=="c")return Kl(t,-1,r)||Bn(t,-1);if(n==40||Ke&&n==78&&r=="c")return Tg(t)||Kl(t,1,r)||Bn(t,1);if(r==(Ke?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Od(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||qe.fromSchema(t.state.schema),a=Id(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Rd[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let p=a.createElement(u[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
33
+ `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=U.none,r=U.none;for(let s=0;s<e.length;s+=2)for(let i=void 0;;){let o=this.parser.matchStyle(e[s],e[s+1],this,i);if(!o)break;if(o.ignore)return null;if(o.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(a=>{o.clearMark(a)&&(r=a.addToSet(r))}):n=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(n),o.consuming===!1)i=o;else break}return[n,r]}addElementByRule(e,n,r){let s,i,o;n.node?(i=this.parser.schema.nodes[n.node],i.isLeaf?this.insertNode(i.create(n.attrs))||this.leafFallback(e):s=this.enter(i,n.attrs||null,n.preserveWhitespace)):(o=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(o));let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l)}s&&this.sync(a)&&this.open--,o&&this.removePendingMark(o,a)}addAll(e,n,r){let s=n||0;for(let i=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];i!=o;i=i.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(i);this.findAtPoint(e,s)}findPlace(e){let n,r;for(let s=this.open;s>=0;s--){let i=this.nodes[s],o=i.findWrapping(e);if(o&&(!n||n.length>o.length)&&(n=o,r=i,!o.length)||i.solid)break}if(!n)return!1;this.sync(r);for(let s=0;s<n.length;s++)this.enterInner(n[s],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(e)){this.closeExtra();let n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));let r=n.activeMarks;for(let s=0;s<e.marks.length;s++)(!n.type||n.type.allowsMarkType(e.marks[s].type))&&(r=e.marks[s].addToSet(r));return n.content.push(e.mark(r)),!0}return!1}enter(e,n,r){let s=this.findPlace(e.create(n));return s&&this.enterInner(e,n,!0,r),s}enterInner(e,n=null,r=!1,s){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let o=fl(e,s,i.options);i.options&Xr&&i.content.length==0&&(o|=Xr),this.nodes.push(new Ns(e,n,i.activeMarks,i.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=Dp(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let s=this.nodes[r];if(s.pendingMarks.lastIndexOf(e)>-1)s.pendingMarks=e.removeFromSet(s.pendingMarks);else{s.activeMarks=e.removeFromSet(s.activeMarks);let o=s.popFromStashMark(e);o&&s.type&&s.type.allowsMarkType(o.type)&&(s.activeMarks=o.addToSet(s.activeMarks))}if(s==n)break}}}function Np(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Gu.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Ap(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Rp(t){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,r=[];for(;n=e.exec(t);)r.push(n[1],n[2].trim());return r}function ml(t){let e={};for(let n in t)e[n]=t[n];return e}function Ip(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}function Dp(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class qe{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=eo(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=qe.renderSpec(eo(n),this.nodes[e.type.name](e));if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&qe.renderSpec(eo(r),s(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let s=n[0],i=s.indexOf(" ");i>0&&(r=s.slice(0,i),s=s.slice(i+1));let o,a=r?e.createElementNS(r,s):e.createElement(s),l=n[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let u in l)if(l[u]!=null){let d=u.indexOf(" ");d>0?a.setAttributeNS(u.slice(0,d),u.slice(d+1),l[u]):a.setAttribute(u,l[u])}}for(let u=c;u<n.length;u++){let d=n[u];if(d===0){if(u<n.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:f}=qe.renderSpec(e,d,r);if(a.appendChild(h),f){if(o)throw new RangeError("Multiple content holes");o=f}}}return{dom:a,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new qe(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=gl(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return gl(e.marks)}}function gl(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function eo(t){return t.document||window.document}const Xu=65535,Yu=Math.pow(2,16);function Pp(t,e){return t+e*Yu}function yl(t){return t&Xu}function Lp(t){return(t-(t&Xu))/Yu}const Zu=1,Qu=2,Ls=4,ed=8;class No{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ed)>0}get deletedBefore(){return(this.delInfo&(Zu|Ls))>0}get deletedAfter(){return(this.delInfo&(Qu|Ls))>0}get deletedAcross(){return(this.delInfo&Ls)>0}}class We{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&We.empty)return We.empty}recover(e){let n=0,r=yl(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+Lp(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+o],d=l+c;if(e<=d){let h=c?e==l?-1:e==d?1:n:n,f=l+s+(h<0?0:u);if(r)return f;let p=e==(n<0?l:d)?null:Pp(a/3,e-l),m=e==l?Qu:e==d?Zu:Ls;return(n<0?e!=l:e!=d)&&(m|=ed),new No(f,m,p)}s+=u-c}return r?e+s:new No(e+s,0,null)}touches(e,n){let r=0,s=yl(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new We(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?We.empty:new We(e<0?[0,-e,0]:[0,0,e])}}We.empty=new We([]);class Gn{constructor(e=[],n,r=0,s=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=s}slice(e=0,n=this.maps.length){return new Gn(this.maps,this.mirror,e,n)}copy(){return new Gn(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let s=e.getMirror(n);this.appendMap(e.maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e.maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Gn;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this.maps[i],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this.maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new No(e,s,null)}}const to=Object.create(null);class me{getMap(){return We.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=to[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in to)throw new RangeError("Duplicate use of step JSON ID "+e);return to[e]=n,n.prototype.jsonID=e,n}}class le{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new le(e,null)}static fail(e){return new le(null,e)}static fromReplace(e,n,r,s){try{return le.ok(e.replace(n,r,s))}catch(i){if(i instanceof si)return le.fail(i.message);throw i}}}function ha(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(ha(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return x.fromArray(r)}class Kt extends me{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new S(ha(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return le.fromReplace(e,this.from,this.to,i)}invert(){return new pt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Kt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Kt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Kt(n.from,n.to,e.markFromJSON(n.mark))}}me.jsonID("addMark",Kt);class pt extends me{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new S(ha(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return le.fromReplace(e,this.from,this.to,r)}invert(){return new Kt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new pt(n.pos,r.pos,this.mark)}merge(e){return e instanceof pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new pt(n.from,n.to,e.markFromJSON(n.mark))}}me.jsonID("removeMark",pt);class qt extends me{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return le.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return le.fromReplace(e,this.pos,this.pos+1,new S(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new qt(this.pos,n.marks[s]);return new qt(this.pos,this.mark)}}return new rr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new qt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new qt(n.pos,e.markFromJSON(n.mark))}}me.jsonID("addNodeMark",qt);class rr extends me{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return le.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return le.fromReplace(e,this.pos,this.pos+1,new S(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new qt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new rr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new rr(n.pos,e.markFromJSON(n.mark))}}me.jsonID("removeNodeMark",rr);class Ee extends me{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Ao(e,this.from,this.to)?le.fail("Structure replace would overwrite content"):le.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new We([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ee(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ee(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Ee)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?S.empty:new S(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ee(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?S.empty:new S(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ee(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ee(n.from,n.to,S.fromJSON(e,n.slice),!!n.structure)}}me.jsonID("replace",Ee);class fe extends me{constructor(e,n,r,s,i,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Ao(e,this.from,this.gapFrom)||Ao(e,this.gapTo,this.to)))return le.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return le.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?le.fromReplace(e,this.from,this.to,r):le.fail("Content does not fit in gap")}getMap(){return new We([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new fe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=e.map(this.gapFrom,-1),i=e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new fe(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new fe(n.from,n.to,n.gapFrom,n.gapTo,S.fromJSON(e,n.slice),n.insert,!!n.structure)}}me.jsonID("replaceAround",fe);function Ao(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Bp(t,e,n,r){let s=[],i=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:s.push(o=new pt(h,f,d[m])));a&&a.to==h?a.to=f:i.push(a=new Kt(h,f,r))}}),s.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function zp(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof Ss){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],h;for(let f=0;f<s.length;f++){let p=s[f];p.step==i-1&&d.eq(s[f].style)&&(h=p)}h?(h.to=c,h.step=i):s.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>t.step(new pt(o.from,o.to,o.style)))}function $p(t,e,n,r=n.contentMatch){let s=t.doc.nodeAt(e),i=[],o=e+1;for(let a=0;a<s.childCount;a++){let l=s.child(a),c=o+l.nodeSize,u=r.matchType(l.type);if(!u)i.push(new Ee(o,c,S.empty));else{r=u;for(let d=0;d<l.marks.length;d++)n.allowsMarkType(l.marks[d].type)||t.step(new pt(o,c,l.marks[d]));if(l.isText&&!n.spec.code){let d,h=/\r?\n|\r/g,f;for(;d=h.exec(l.text);)f||(f=new S(x.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),i.push(new Ee(o+d.index,o+d.index+d[0].length,f))}}o=c}if(!r.validEnd){let a=r.fillBefore(x.empty,!0);t.replace(o,o,new S(a,0,0))}for(let a=i.length-1;a>=0;a--)t.step(i[a])}function Fp(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function fr(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let s=t.$from.node(r),i=t.$from.index(r),o=t.$to.indexAfter(r);if(r<t.depth&&s.canReplace(i,o,n))return r;if(r==0||s.type.spec.isolating||!Fp(s,i,o))break}return null}function Vp(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,u=x.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=x.from(r.node(p).copy(u)),d++):l--;let h=x.empty,f=0;for(let p=i,m=!1;p>n;p--)m||s.after(p+1)<s.end(p)?(m=!0,h=x.from(s.node(p).copy(h)),f++):c++;t.step(new fe(l,c,o,a,new S(u.append(h),d,f),u.size-d,!0))}function fa(t,e,n=null,r=t){let s=Hp(t,e),i=s&&Up(r,e);return i?s.map(xl).concat({type:e,attrs:n}).concat(i.map(xl)):null}function xl(t){return{type:t,attrs:null}}function Hp(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function Up(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function jp(t,e,n){let r=x.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=x.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new fe(s,i,s,i,new S(r,0,0),n.length,!0))}function Wp(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,s)&&Kp(t.doc,t.mapping.slice(i).map(a),r)){t.clearIncompatible(t.mapping.slice(i).map(a,1),r);let l=t.mapping.slice(i),c=l.map(a,1),u=l.map(a+o.nodeSize,1);return t.step(new fe(c,u,c+1,u-1,new S(x.from(r.create(s,null,o.marks)),0,0),1,!0)),!1}})}function Kp(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function qp(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new fe(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new S(x.from(o),0,0),1,!0))}function Xn(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>i;c--,u--){let d=s.node(c),h=s.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[u+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(f))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function Jp(t,e,n=1,r){let s=t.doc.resolve(e),i=x.empty,o=x.empty;for(let a=s.depth,l=s.depth-n,c=n-1;a>l;a--,c--){i=x.from(s.node(a).copy(i));let u=r&&r[c];o=x.from(u?u.type.create(u.attrs,o):s.node(a).copy(o))}t.step(new Ee(e,e,new S(i.append(o),n,n),!0))}function vs(t,e){let n=t.resolve(e),r=n.index();return Gp(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Gp(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function Xp(t,e,n){let r=new Ee(e-n,e+n,S.empty,!0);t.step(r)}function Yp(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function Zp(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(l,l,s);else{let d=c.contentMatchAt(l).findWrapping(s.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function pa(t,e,n=e,r=S.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return td(s,i,r)?new Ee(e,n,r):new Qp(s,i,r).fit()}function td(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Qp{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=x.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=x.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new S(i,o,a);return e>-1?new fe(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ee(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=no(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(x.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=no(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new S(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=no(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new S(Sr(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new S(Sr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[n];if(s){for(let m=0;m<s.childCount;m++)u.push(s.child(m));d=d.matchFragment(s)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(d=g,u.push(nd(m.mark(h.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=vr(this.placed,n,x.from(u)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?S.empty:new S(Sr(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new S(Sr(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!ro(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=ro(e,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=ro(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=vr(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=vr(this.placed,this.depth,x.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(x.empty,!0);n.childCount&&(this.placed=vr(this.placed,this.frontier.length,n))}}function Sr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Sr(t.firstChild.content,e-1,n)))}function vr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(vr(t.lastChild.content,e-1,n)))}function no(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function nd(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,nd(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(x.empty,!0)))),t.copy(r)}function ro(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!em(n,i.content,o)?a:null}function em(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function tm(t){return t.spec.defining||t.spec.definingForContent}function nm(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(td(s,i,r))return t.step(new Ee(e,n,r));let o=sd(s,t.doc.resolve(n));o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,f=s.pos-1;h>0;h--,f--){let p=s.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=u-1;h>=0;h--){let f=c[h],p=tm(f.type);if(p&&!f.sameMarkup(s.node(Math.abs(a)-1)))u=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+u+1)%(r.openStart+1),p=c[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let E=s.node(g-1),L=s.index(g-1);if(E.canReplaceWith(L,L,p.type,p.marks))return t.replace(s.before(g),y?i.after(g):n,new S(rd(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=o[h];f<0||(e=s.before(f),n=i.after(f))}}function rd(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(rd(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(x.empty,!0))}return t}function rm(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=Yp(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new S(x.from(r),0,0))}function sm(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),i=sd(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o)return t.delete(r.before(o),n);t.delete(e,n)}function sd(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Yn extends me{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return le.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return le.fromReplace(e,this.pos,this.pos+1,new S(x.from(s),0,n.isLeaf?0:1))}getMap(){return We.empty}invert(e){return new Yn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yn(n.pos,n.attr,n.value)}}me.jsonID("attr",Yn);class ts extends me{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return le.ok(r)}getMap(){return We.empty}invert(e){return new ts(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ts(n.attr,n.value)}}me.jsonID("docAttr",ts);let sr=class extends Error{};sr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};sr.prototype=Object.create(Error.prototype);sr.prototype.constructor=sr;sr.prototype.name="TransformError";class im{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Gn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new sr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=S.empty){let s=pa(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new S(x.from(r),0,0))}delete(e,n){return this.replace(e,n,S.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return nm(this,e,n,r),this}replaceRangeWith(e,n,r){return rm(this,e,n,r),this}deleteRange(e,n){return sm(this,e,n),this}lift(e,n){return Vp(this,e,n),this}join(e,n=1){return Xp(this,e,n),this}wrap(e,n){return jp(this,e,n),this}setBlockType(e,n=e,r,s=null){return Wp(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return qp(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Yn(e,n,r)),this}setDocAttribute(e,n){return this.step(new ts(e,n)),this}addNodeMark(e,n){return this.step(new qt(e,n)),this}removeNodeMark(e,n){if(!(n instanceof U)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new rr(e,n)),this}split(e,n=1,r){return Jp(this,e,n,r),this}addMark(e,n,r){return Bp(this,e,n,r),this}removeMark(e,n,r){return zp(this,e,n,r),this}clearIncompatible(e,n,r){return $p(this,e,n,r),this}}const so=Object.create(null);class V{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new om(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=S.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?S.empty:n),a==0&&Sl(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Sl(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new P(e):Fn(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?Fn(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Fn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Be(e.node(0))}static atStart(e){return Fn(e,e,0,0,1)||new Be(e)}static atEnd(e){return Fn(e,e,e.content.size,e.childCount,-1)||new Be(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=so[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in so)throw new RangeError("Duplicate use of selection JSON ID "+e);return so[e]=n,n.prototype.jsonID=e,n}getBookmark(){return P.between(this.$anchor,this.$head).getBookmark()}}V.prototype.visible=!0;class om{constructor(e,n){this.$from=e,this.$to=n}}let bl=!1;function kl(t){!bl&&!t.parent.inlineContent&&(bl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class P extends V{constructor(e,n=e){kl(e),kl(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return V.near(r);let s=e.resolve(n.map(this.anchor));return new P(s.parent.inlineContent?s:r,r)}replace(e,n=S.empty){if(super.replace(e,n),n==S.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof P&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ri(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new P(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=V.findFrom(n,r,!0)||V.findFrom(n,-r,!0);if(i)n=i.$head;else return V.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(V.findFrom(e,-r,!0)||V.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new P(e,n)}}V.jsonID("text",P);class Ri{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ri(e.map(this.anchor),e.map(this.head))}resolve(e){return P.between(e.resolve(this.anchor),e.resolve(this.head))}}class I extends V{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?V.near(i):new I(i)}content(){return new S(x.from(this.node),0,0)}eq(e){return e instanceof I&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ma(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new I(e.resolve(n.anchor))}static create(e,n){return new I(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}I.prototype.visible=!1;V.jsonID("node",I);class ma{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ri(r,r):new ma(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&I.isSelectable(r)?new I(n):V.near(n)}}class Be extends V{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=S.empty){if(n==S.empty){e.delete(0,e.doc.content.size);let r=V.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Be(e)}map(e){return new Be(e)}eq(e){return e instanceof Be}getBookmark(){return am}}V.jsonID("all",Be);const am={map(){return this},resolve(t){return new Be(t)}};function Fn(t,e,n,r,s,i=!1){if(e.inlineContent)return P.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&I.isSelectable(a))return I.create(t,n-(s<0?a.nodeSize:0))}else{let l=Fn(t,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function Sl(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof Ee||s instanceof fe))return;let i=t.mapping.maps[r],o;i.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(V.near(t.doc.resolve(o),n))}const vl=1,As=2,wl=4;class lm extends im{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|vl)&~As,this.storedMarks=null,this}get selectionSet(){return(this.updated&vl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=As,this}ensureMarks(e){return U.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&As)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~As,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||U.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),this.selection.empty||this.setSelection(V.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wl,this}get scrolledIntoView(){return(this.updated&wl)>0}}function El(t,e){return!e||!t?t:t.bind(e)}class wr{constructor(e,n,r){this.name=e,this.init=El(n.init,r),this.apply=El(n.apply,r)}}const cm=[new wr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new wr("selection",{init(t,e){return t.selection||V.atStart(e.doc)},apply(t){return t.selection}}),new wr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new wr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class io{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=cm.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new wr(r.key,r.spec.state,r))})}}class bn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new bn(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new lm(this)}static create(e){let n=new io(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new bn(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new io(this.schema,e.plugins),r=n.fields,s=new bn(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new io(e.schema,e.plugins),i=new bn(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=Gt.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=V.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=c.fromJSON.call(l,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function id(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=id(s,e,{})),n[r]=s}return n}class un{constructor(e){this.spec=e,this.props={},e.props&&id(e.props,this,this.props),this.key=e.key?e.key.key:od("plugin")}getState(e){return e[this.key]}}const oo=Object.create(null);function od(t){return t in oo?t+"$"+ ++oo[t]:(oo[t]=0,t+"$")}class pr{constructor(e="key"){this.key=od(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}function ad(){return typeof document<"u"?document:null}function ld(t,e){if(typeof t!="string")return[t];var n=[t];typeof e=="string"||Array.isArray(e)?e={brackets:e}:e||(e={});var r=e.brackets?Array.isArray(e.brackets)?e.brackets:[e.brackets]:["{}","[]","()"],s=e.escape||"___",i=!!e.flat;r.forEach(function(l){var c=new RegExp(["\\",l[0],"[^\\",l[0],"\\",l[1],"]*\\",l[1]].join("")),u=[];function d(h,f,p){var m=n.push(h.slice(l[0].length,-l[1].length))-1;return u.push(m),s+m+s}n.forEach(function(h,f){for(var p,m=0;h!=p;)if(p=h,h=h.replace(c,d),m++>1e4)throw Error("References have circular dependency. Please, check them.");n[f]=h}),u=u.reverse(),n=n.map(function(h){return u.forEach(function(f){h=h.replace(new RegExp("(\\"+s+f+"\\"+s+")","g"),l[0]+"$1"+l[1])}),h})});var o=new RegExp("\\"+s+"([0-9]+)\\"+s);function a(l,c,u){for(var d=[],h,f=0;h=o.exec(l);){if(f++>1e4)throw Error("Circular references in parenthesis");d.push(l.slice(0,h.index)),d.push(a(c[h[1]],c)),l=l.slice(h.index+h[0].length)}return d.push(l),d}return i?n:a(n[0],n)}function cd(t,e){if(e&&e.flat){var n=e&&e.escape||"___",r=t[0],s;if(!r)return"";for(var i=new RegExp("\\"+n+"([0-9]+)\\"+n),o=0;r!=s;){if(o++>1e4)throw Error("Circular references in "+t);s=r,r=r.replace(i,a)}return r}return t.reduce(function l(c,u){return Array.isArray(u)&&(u=u.reduce(l,"")),c+u},"");function a(l,c){if(t[c]==null)throw Error("Reference "+c+"is undefined");return t[c]}}function ud(t,e){return Array.isArray(t)?cd(t,e):ld(t,e)}ud.parse=ld;ud.stringify=cd;const um={id:"extension.command.copy.label",message:"Copy",comment:"Label for copy command."},dm={id:"extension.command.copy.description",message:"Copy the selected text",comment:"Description for copy command."},hm={id:"extension.command.cut.label",message:"Cut",comment:"Label for cut command."},fm={id:"extension.command.cut.description",message:"Cut the selected text",comment:"Description for cut command."},pm={id:"extension.command.paste.label",message:"Paste",comment:"Label for paste command."},mm={id:"extension.command.paste.description",message:"Paste content into the editor",comment:"Description for paste command."},gm={id:"extension.command.select-all.label",message:"Select all",comment:"Label for select all command."},ym={id:"extension.command.select-all.description",message:"Select all content within the editor",comment:"Description for select all command."};var nn=Object.freeze({__proto__:null,COPY_DESCRIPTION:dm,COPY_LABEL:um,CUT_DESCRIPTION:fm,CUT_LABEL:hm,PASTE_DESCRIPTION:mm,PASTE_LABEL:pm,SELECT_ALL_DESCRIPTION:ym,SELECT_ALL_LABEL:gm});const xm={id:"extension.command.toggle-bold.label",message:"Bold",comment:"Label for bold formatting command."},bm={id:"extension.command.toggle-bold.description",message:"Add bold formatting to the selected text",comment:"Description for bold formatting command."};var Cl=Object.freeze({__proto__:null,DESCRIPTION:bm,LABEL:xm});const km={id:"extension.command.toggle-code.label",message:"Code",comment:"Label for the inline code formatting."},Sm={id:"extension.command.toggle-code.description",message:"Add inline code formatting to the selected text",comment:"Description for the inline code formatting command."};var vm=Object.freeze({__proto__:null,DESCRIPTION:Sm,LABEL:km});const wm={id:"extension.command.undo.label",message:"Undo",comment:"Label for undo."},Em={id:"extension.command.undo.description",message:"Undo the most recent action",comment:"Description for undo."},Cm={id:"extension.command.redo.label",message:"Redo",comment:"Label for redo."},Tm={id:"extension.command.redo.description",message:"Redo the most recent action",comment:"Description for redo."};var ci=Object.freeze({__proto__:null,REDO_DESCRIPTION:Tm,REDO_LABEL:Cm,UNDO_DESCRIPTION:Em,UNDO_LABEL:wm});const Om={id:"extension.command.toggle-italic.label",message:"Italic",comment:"Label for italic formatting command."},Mm={id:"extension.command.toggle-italic.description",message:"Italicize the selected text",comment:"Description for italic formatting command."};var Tl=Object.freeze({__proto__:null,DESCRIPTION:Mm,LABEL:Om});const _m={id:"extension.command.toggle-ordered-list.label",message:"Ordered list",comment:"Label for inserting an ordered list into the editor."},Nm={id:"extension.command.toggle-bullet-list.description",message:"Bulleted list",comment:"Description for inserting a bullet list into the editor."},Am={id:"extension.command.toggle-task-list.description",message:"Tasked list",comment:"Description for inserting a task list into the editor."};var ga=Object.freeze({__proto__:null,BULLET_LIST_LABEL:Nm,ORDERED_LIST_LABEL:_m,TASK_LIST_LABEL:Am});const Rm={id:"extension.command.insert-paragraph.label",message:"Insert Paragraph",comment:"Label for inserting a paragraph."},Im={id:"extension.command.insert-paragraph.description",message:"Insert a new paragraph",comment:"Description for inserting a paragraph."},Dm={id:"extension.command.convert-paragraph.label",message:"Convert Paragraph",comment:"Label for converting the current node into a paragraph."},Pm={id:"extension.command.convert-paragraph.description",message:"Convert current block into a paragraph block.",comment:"Description for converting a paragraph."};var ui=Object.freeze({__proto__:null,CONVERT_DESCRIPTION:Pm,CONVERT_LABEL:Dm,INSERT_DESCRIPTION:Im,INSERT_LABEL:Rm});class ws{constructor(e,n){this.match=e,this.match=e,this.handler=typeof n=="string"?Lm(n):n}}function Lm(t){return function(e,n,r,s){let i=t;if(n[1]){let o=n[0].lastIndexOf(n[1]);i+=n[0].slice(o+n[1].length),r+=o;let a=r-s;a>0&&(i=n[0].slice(o-a,o)+i,r=s)}return e.tr.insertText(i,r,s)}}const Bm=500;function zm({rules:t}){let e=new un({state:{init(){return null},apply(n,r){let s=n.getMeta(this);return s||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,s,i){return Ol(n,r,s,i,t,e)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&Ol(n,r.pos,r.pos,"",t,e)})}}},isInputRules:!0});return e}function Ol(t,e,n,r,s,i){if(t.composing)return!1;let o=t.state,a=o.doc.resolve(e);if(a.parent.type.spec.code)return!1;let l=a.parent.textBetween(Math.max(0,a.parentOffset-Bm),a.parentOffset,null,"")+r;for(let c=0;c<s.length;c++){let u=s[c].match.exec(l),d=u&&s[c].handler(o,u,e-(u[0].length-r.length),n);if(d)return t.dispatch(d.setMeta(i,{transform:d,from:e,to:n,text:r})),!0}return!1}const $m=(t,e)=>{let n=t.plugins;for(let r=0;r<n.length;r++){let s=n[r],i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){let o=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l--)o.step(a.steps[l].invert(a.docs[l]));if(i.text){let l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else o.delete(i.from,i.to);e(o)}return!0}}return!1};function ya(t,e,n=null,r){return new ws(t,(s,i,o,a)=>{let l=n instanceof Function?n(i):n,c=s.tr.delete(o,a),u=c.doc.resolve(o),d=u.blockRange(),h=d&&fa(d,e,l);if(!h)return null;c.wrap(d,h);let f=c.doc.resolve(o-1).nodeBefore;return f&&f.type==e&&vs(c.doc,o-1)&&(!r||r(i,f))&&c.join(o-1),c})}const _e=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ns=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ml=null;const Ct=function(t,e,n){let r=Ml||(Ml=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Mn=function(t,e,n,r){return n&&(_l(t,e,n,r,-1)||_l(t,e,n,r,1))},Fm=/^(img|br|input|textarea|hr)$/i;function _l(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:ft(t))){let i=t.parentNode;if(!i||i.nodeType!=1||xa(t)||Fm.test(t.nodeName)||t.contentEditable=="false")return!1;e=_e(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.contentEditable=="false")return!1;e=s<0?ft(t):0}else return!1}}function ft(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Vm(t,e,n){for(let r=e==0,s=e==ft(t);r||s;){if(t==n)return!0;let i=_e(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==ft(t)}}function xa(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ii=function(t){return t.focusNode&&Mn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function yn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Hm(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Um(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const yt=typeof navigator<"u"?navigator:null,Nl=typeof document<"u"?document:null,dn=yt&&yt.userAgent||"",Ro=/Edge\/(\d+)/.exec(dn),dd=/MSIE \d/.exec(dn),Io=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dn),ze=!!(dd||Io||Ro),Xt=dd?document.documentMode:Io?+Io[1]:Ro?+Ro[1]:0,at=!ze&&/gecko\/(\d+)/i.test(dn);at&&+(/Firefox\/(\d+)/.exec(dn)||[0,0])[1];const Do=!ze&&/Chrome\/(\d+)/.exec(dn),Ce=!!Do,jm=Do?+Do[1]:0,Ne=!ze&&!!yt&&/Apple Computer/.test(yt.vendor),ir=Ne&&(/Mobile\/\w+/.test(dn)||!!yt&&yt.maxTouchPoints>2),Ke=ir||(yt?/Mac/.test(yt.platform):!1),Wm=yt?/Win/.test(yt.platform):!1,nt=/Android \d/.test(dn),Es=!!Nl&&"webkitFontSmoothing"in Nl.documentElement.style,Km=Es?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function qm(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function kt(t,e){return typeof t=="number"?t:t[e]}function Jm(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Al(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;o=ns(o)){if(o.nodeType!=1)continue;let a=o,l=a==i.body,c=l?qm(i):Jm(a),u=0,d=0;if(e.top<c.top+kt(r,"top")?d=-(c.top-e.top+kt(s,"top")):e.bottom>c.bottom-kt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+kt(s,"top")-c.top:e.bottom-c.bottom+kt(s,"bottom")),e.left<c.left+kt(r,"left")?u=-(c.left-e.left+kt(s,"left")):e.right>c.right-kt(r,"right")&&(u=e.right-c.right+kt(s,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,f=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let p=a.scrollLeft-h,m=a.scrollTop-f;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Gm(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(i,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:hd(t.dom)}}function hd(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ns(r));return e}function Xm({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;fd(n,r==0?0:r-e)}function fd(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Ln=null;function Ym(t){if(t.setActive)return t.setActive();if(Ln)return t.focus(Ln);let e=hd(t);t.focus(Ln==null?{get preventScroll(){return Ln={preventScroll:!0},!0}}:void 0),Ln||(Ln=!1,fd(e,0))}function pd(t,e){let n,r=2e8,s,i=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Ct(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,s=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&l&&(n=l,s=c,r=0),n&&n.nodeType==3?Zm(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:pd(n,s)}function Zm(t,e){let n=t.nodeValue.length,r=document.createRange();for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let i=Bt(r,1);if(i.top!=i.bottom&&ba(e,i))return{node:t,offset:s+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function ba(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Qm(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function eg(t,e,n){let{node:r,offset:s}=pd(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function tg(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent&&!o||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&!o&&(o=!0,l.left>r.left||l.top>r.top?s=a.posBefore:(l.right<r.left||l.bottom<r.top)&&(s=a.posAfter)),!a.contentDOM&&s<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}i=a.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function md(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(ba(e,c))return md(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function ng(t,e){let n=t.dom.ownerDocument,r,s=0,i=Um(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!ba(e,c)||(o=md(t.dom,e,c),!o))return null}if(Ne)for(let c=o;r&&c;c=ns(c))c.draggable&&(r=void 0);if(o=Qm(o,e),r){if(at&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&s++}let c;Es&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=tg(t,r,s,e))}a==null&&(a=eg(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Rl(t){return t.top<t.bottom||t.left<t.right}function Bt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Rl(r))return r}return Array.prototype.find.call(n,Rl)||t.getBoundingClientRect()}const rg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function gd(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Es||at;if(r.nodeType==3)if(o&&(rg.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let l=Bt(Ct(r,s,s),n);if(at&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Bt(Ct(r,s-1,s-1),-1);if(c.top==l.top){let u=Bt(Ct(r,s,s+1),-1);if(u.top!=l.top)return br(u,u.left<c.left)}}return l}else{let l=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(l--,u=1):n<0?l--:c++,br(Bt(Ct(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==ft(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return ao(l.getBoundingClientRect(),!1)}if(i==null&&s<ft(r)){let l=r.childNodes[s];if(l.nodeType==1)return ao(l.getBoundingClientRect(),!0)}return ao(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==ft(r))){let l=r.childNodes[s-1],c=l.nodeType==3?Ct(l,ft(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return br(Bt(c,1),!1)}if(i==null&&s<ft(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Ct(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return br(Bt(c,-1),!0)}return br(Bt(r.nodeType==3?Ct(r):r,-n),n>=0)}function br(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function ao(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function yd(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function sg(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return yd(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=gd(t,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Ct(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const ig=/[\u0590-\u08ac]/;function og(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return!ig.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:yd(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g})}let Il=null,Dl=null,Pl=!1;function ag(t,e,n){return Il==e&&Dl==n?Pl:(Il=e,Dl=n,Pl=n=="up"||n=="down"?sg(t,e,n):og(t,e,n))}const Je=0,Ll=1,kn=2,xt=3;class Cs{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Je,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>_e(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)s=s.children[0];return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e||o instanceof bd){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof xd&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?_e(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?_e(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=_e(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=_e(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let h=0,f=0;h<this.children.length;h++){let p=this.children[h],m=f+p.size;if(i>f&&o<m)return p.setSelection(e-f-p.border,n-f-p.border,r,s);f=m}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.getSelection(),u=!1;if((at||Ne)&&e==n){let{node:h,offset:f}=a;if(h.nodeType==3){if(u=!!(f&&h.nodeValue[f-1]==`
34
+ `),u&&f==h.nodeValue.length)for(let p=h,m;p;p=p.parentNode){if(m=p.nextSibling){m.nodeName=="BR"&&(a=l={node:m.parentNode,offset:_e(m)+1});break}let g=p.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let p=h.childNodes[f-1];u=p&&(p.nodeName=="BR"||p.contentEditable=="false")}}if(at&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(s=!0)}if(!(s||u&&Ne)&&Mn(a.node,a.offset,c.anchorNode,c.anchorOffset)&&Mn(l.node,l.offset,c.focusNode,c.focusOffset))return;let d=!1;if((c.extend||e==n)&&!u){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),d=!0}catch{}}if(!d){if(e>n){let f=a;a=l,l=f}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+i.border,l=o-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?kn:Ll,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=xt:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?kn:xt}r=o}this.dirty=kn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?kn:Ll;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class xd extends Cs{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Je&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class lg extends Cs{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class _n extends Cs{constructor(e,n,r,s){super(e,[],r,s),this.mark=n}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=qe.renderSpec(document,n.type.spec.toDOM(n,r))),new _n(e,n,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&xt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Je){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Je}}slice(e,n,r){let s=_n.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Bo(i,n,o,r)),e>0&&(i=Bo(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}}class Yt extends Cs{constructor(e,n,r,s,i,o,a,l,c){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,n,r,s,i,o){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=qe.renderSpec(document,n.type.spec.toDOM(n)));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=vd(u,r,n),c?l=new cg(e,n,r,s,u,d||null,h,c,i,o+1):n.isText?new Di(e,n,r,s,u,h,i):new Yt(e,n,r,s,u,d||null,h,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>x.empty)}return e}matchesNode(e,n,r){return this.dirty==Je&&e.eq(this.node)&&Lo(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new dg(this,o&&o.node,e);pg(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?U.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,s)},(c,u,d,h)=>{l.syncToMarks(c.marks,r,e);let f;l.findNodeMatch(c,u,d,h)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(f=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,h,s)||l.addNode(c,u,d,e,s),s+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==kn)&&(o&&this.protectLocalComposition(e,o),kd(this.contentDOM,this.children,e),ir&&mg(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof P)||r<n||s>n+this.node.content.size)return null;let i=e.domSelectionRange(),o=gg(i.focusNode,i.focusOffset);if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let a=o.nodeValue,l=yg(this.node.content,a,r-n,s-n);return l<0?null:{node:o,pos:l,text:a}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new lg(this,i,n,s);e.input.compositionNodes.push(o),this.children=Bo(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==xt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Je}updateOuterDeco(e){if(Lo(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Sd(this.dom,this.nodeDOM,Po(this.outerDeco,this.node,n),Po(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Bl(t,e,n,r,s){vd(r,e,t);let i=new Yt(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class Di extends Yt{constructor(e,n,r,s,i,o,a){super(e,n,r,s,i,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==xt||this.dirty!=Je&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Je||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Je,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new Di(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=xt)}get domAtom(){return!1}}class bd extends Cs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Je&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class cg extends Yt{constructor(e,n,r,s,i,o,a,l,c,u){super(e,n,r,s,i,o,a,c,u),this.spec=l}update(e,n,r,s){if(this.dirty==xt)return!1;if(this.spec.update){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function kd(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=zl(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(a,r);if(o instanceof _n){let l=r?r.previousSibling:t.lastChild;kd(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=zl(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const Yr=function(t){t&&(this.nodeName=t)};Yr.prototype=Object.create(null);const Sn=[new Yr];function Po(t,e,n){if(t.length==0)return Sn;let r=n?Sn[0]:new Yr,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new Yr(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&s.length==1&&s.push(r=new Yr(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return s}function Sd(t,e,n,r){if(n==Sn&&r==Sn)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=Sn[0]),s=l}ug(s,a||Sn[0],o)}return s}function ug(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function vd(t,e,n){return Sd(t,t,Sn,Po(e,n,t.nodeType!=1))}function Lo(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function zl(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class dg{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=hg(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let s=0,i=this.stack.length>>1,o=Math.min(i,e.length);for(;s<o&&(s==i-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<i;)this.destroyRest(),this.top.dirty=Je,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=_n.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==xt&&o.dom==o.contentDOM&&(o.dirty=kn),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Yt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=xt&&Lo(n,l.outerDeco));if(!h&&l.update(e,n,r,s))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,n,r,s,o)))return this.top.children[this.index]=d,d.contentDOM&&(d.dirty=kn,d.updateChildren(s,o+1),d.dirty=Je),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content))return null;let a=Yt.create(this.top,n,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,s,i){let o=Yt.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new xd(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof _n;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Di)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ne||Ce)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new bd(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function hg(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof _n)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function fg(t,e){return t.type.side-e.type.side}function pg(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let g=s[o++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(fg);for(let g=0;g<d.length;g++)n(d[g],c,!!l)}else n(u,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<t.childCount)f=c,h=t.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=i&&a.splice(g--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let p=i+h.nodeSize;if(h.isText){let g=p;o<s.length&&s[o].from<g&&(g=s[o].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<p&&(l=h.cut(g-i),h=h.cut(0,g-i),p=g,f=-1)}let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(i,h),f),i=p}}function mg(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function gg(t,e){for(;;){if(t.nodeType==3)return t;if(t.nodeType==1&&e>0){if(t.childNodes.length>e&&t.childNodes[e].nodeType==3)return t.childNodes[e];t=t.childNodes[e-1],e=ft(t)}else if(t.nodeType==1&&e<t.childNodes.length)t=t.childNodes[e],e=0;else return null}}function yg(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<t.childCount;){let c=t.child(s++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Bo(t,e,n,r,s){let i=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function ka(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Ii(n)){for(l=a;s&&!s.node;)s=s.parent;let u=s.node;if(s&&u.isAtom&&I.isSelectable(u)&&s.parent&&!(u.isInline&&Vm(n.focusNode,n.focusOffset,s.dom))){let d=s.posBefore;c=new I(o==d?a:r.resolve(d))}}else{let u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null;l=r.resolve(u)}if(!c){let u=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=Sa(t,l,a,u)}return c}function wd(t){return t.editable?t.hasFocus():Cd(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Nt(t,e=!1){let n=t.state.selection;if(Ed(t,n),!!wd(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ce){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Mn(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)bg(t);else{let{anchor:r,head:s}=n,i,o;$l&&!(n instanceof P)&&(n.$from.parent.inlineContent||(i=Fl(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Fl(t,n.to))),t.docView.setSelection(r,s,t.root,e),$l&&(i&&Vl(i),o&&Vl(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&xg(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const $l=Ne||Ce&&jm<63;function Fl(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Ne&&s&&s.contentEditable=="false")return lo(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return lo(s);if(i)return lo(i)}}function lo(t){return t.contentEditable="true",Ne&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Vl(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function xg(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!wd(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function bg(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,s=r.nodeName=="IMG";s?n.setEnd(r.parentNode,_e(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!s&&!t.state.selection.visible&&ze&&Xt<=11&&(r.disabled=!0,r.disabled=!1)}function Ed(t,e){if(e instanceof I){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Hl(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Hl(t)}function Hl(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Sa(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||P.between(e,n,r)}function Ul(t){return t.editable&&!t.hasFocus()?!1:Cd(t)}function Cd(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function kg(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Mn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function zo(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&V.findFrom(i,e)}function Ht(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function jl(t,e,n){let r=t.state.selection;if(r instanceof P)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Ht(t,new P(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=zo(t.state,e);return s&&s instanceof I?Ht(t,s):!1}else if(!(Ke&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?I.isSelectable(i)?Ht(t,new I(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Es?Ht(t,new P(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof I&&r.node.isInline)return Ht(t,new P(e>0?r.$to:r.$from));{let s=zo(t.state,e);return s?Ht(t,s):!1}}}function di(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Zr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Bn(t,e){return e<0?Sg(t):vg(t)}function Sg(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(at&&n.nodeType==1&&r<di(n)&&Zr(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Zr(a,-1))s=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Td(n))break;{let a=n.previousSibling;for(;a&&Zr(a,-1);)s=n.parentNode,i=_e(a),a=a.previousSibling;if(a)n=a,r=di(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?$o(t,n,r):s&&$o(t,s,i)}function vg(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=di(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Zr(a,1))i=n,o=++r;else break}else{if(Td(n))break;{let a=n.nextSibling;for(;a&&Zr(a,1);)i=a.parentNode,o=_e(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=di(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&$o(t,i,o)}function Td(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function wg(t,e){for(;t&&e==t.childNodes.length&&!xa(t);)e=_e(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Eg(t,e){for(;t&&!e&&!xa(t);)e=_e(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function $o(t,e,n){if(e.nodeType!=3){let i,o;(o=wg(e,n))?(e=o,n=0):(i=Eg(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(Ii(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&Nt(t)},50)}function Wl(t,e){let n=t.state.doc.resolve(e);if(!(Ce||Wm)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Kl(t,e,n){let r=t.state.selection;if(r instanceof P&&!r.empty||n.indexOf("s")>-1||Ke&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=zo(t.state,e);if(o&&o instanceof I)return Ht(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Be?V.near(o,e):V.findFrom(o,e);return a?Ht(t,a):!1}return!1}function ql(t,e){if(!(t.state.selection instanceof P))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Jl(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Cg(t){if(!Ne||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Jl(t,r,"true"),setTimeout(()=>Jl(t,r,"false"),20)}return!1}function Tg(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Og(t,e){let n=e.keyCode,r=Tg(e);if(n==8||Ke&&n==72&&r=="c")return ql(t,-1)||Bn(t,-1);if(n==46&&!e.shiftKey||Ke&&n==68&&r=="c")return ql(t,1)||Bn(t,1);if(n==13||n==27)return!0;if(n==37||Ke&&n==66&&r=="c"){let s=n==37?Wl(t,t.state.selection.from)=="ltr"?-1:1:-1;return jl(t,s,r)||Bn(t,s)}else if(n==39||Ke&&n==70&&r=="c"){let s=n==39?Wl(t,t.state.selection.from)=="ltr"?1:-1:1;return jl(t,s,r)||Bn(t,s)}else{if(n==38||Ke&&n==80&&r=="c")return Kl(t,-1,r)||Bn(t,-1);if(n==40||Ke&&n==78&&r=="c")return Cg(t)||Kl(t,1,r)||Bn(t,1);if(r==(Ke?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Od(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||qe.fromSchema(t.state.schema),a=Id(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Rd[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let p=a.createElement(u[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
35
35
 
36
36
  `);return{dom:l,text:h}}function Md(t,e,n,r,s){let i=s.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,i||r,t)}),i)return e?new S(x.from(t.state.schema.text(e.replace(/\r\n?/g,`
37
- `))),0,0):S.empty;let d=t.someProp("clipboardTextParser",h=>h(e,s,r,t));if(d)a=d;else{let h=s.marks(),{schema:f}=t.state,p=qe.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Ag(n),Es&&Rg(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||da.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!_g.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Ig(Gl(a,+u[1],+u[2]),u[4]);else if(a=S.maxOpen(Ng(a.content,s),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Gl(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const _g=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ng(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&Nd(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Ad(o[o.length-1],i.length));let u=_d(a,l);o.push(u),s=s.matchType(u.type),i=l}}),o)return x.from(o)}return t}function _d(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,x.from(t));return t}function Nd(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=Nd(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(x.from(_d(n,t,s+1))))}}function Ad(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ad(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(x.empty,!0);return t.copy(n.append(r))}function Fo(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(i=0),s<r-1&&(a=Fo(a,e,n,r,s+1,i)),s>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(x.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function Gl(t,e,n){return e<t.openStart&&(t=new S(Fo(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new S(Fo(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Rd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Xl=null;function Id(){return Xl||(Xl=document.implementation.createHTMLDocument("title"))}function Ag(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Id().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&Rd[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=t,s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function Rg(t){let e=t.querySelectorAll(Ce?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Ig(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;s=x.from(l.create(r[a+1],s)),i++,o++}return new S(s,i,o)}const Ae={},Re={},Dg={touchstart:!0,touchmove:!0};class Pg{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Lg(t){for(let e in Ae){let n=Ae[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{zg(t,r)&&!va(t,r)&&(t.editable||!(r.type in Re))&&n(t,r)},Dg[e]?{passive:!0}:void 0)}Ne&&t.dom.addEventListener("input",()=>null),Vo(t)}function Jt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Bg(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Vo(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>va(t,r))})}function va(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function zg(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function $g(t,e){!va(t,e)&&Ae[e.type]&&(t.editable||!(e.type in Re))&&Ae[e.type](t,e)}Re.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Pd(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(nt&&Ce&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ir&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,yn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Mg(t,n)?n.preventDefault():Jt(t,"key")};Re.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Re.keypress=(t,e)=>{let n=e;if(Pd(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ke&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof P)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode);!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,s))&&t.dispatch(t.state.tr.insertText(s).scrollIntoView()),n.preventDefault()}};function Pi(t){return{left:t.clientX,top:t.clientY}}function Fg(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function wa(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Zn(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function Vg(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&I.isSelectable(r)?(Zn(t,new I(n),"pointer"),!0):!1}function Hg(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof I&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(I.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Zn(t,I.create(t.state.doc,s),"pointer"),!0):!1}function Ug(t,e,n,r,s){return wa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?Hg(t,n):Vg(t,n))}function jg(t,e,n,r){return wa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function Wg(t,e,n,r){return wa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||Kg(t,n,r)}function Kg(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Zn(t,P.create(r,0,r.content.size),"pointer"),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)Zn(t,P.create(r,a+1,a+1+o.content.size),"pointer");else if(I.isSelectable(o))Zn(t,I.create(r,a),"pointer");else continue;return!0}}function Ea(t){return hi(t)}const Dd=Ke?"metaKey":"ctrlKey";Ae.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ea(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&Fg(n,t.input.lastClick)&&!n[Dd]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i};let o=t.posAtCoords(Pi(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new qg(t,o,n,!!r)):(i=="doubleClick"?jg:Wg)(t,o.pos,o.inside,n)?n.preventDefault():Jt(t,"pointer"))};class qg{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Dd],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,o=u.depth?u.before():0}const a=s?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof I&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&at&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Jt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Nt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Pi(e))),this.updateAllowDefault(e),this.allowDefault||!n?Jt(this.view,"pointer"):Ug(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ne&&this.mightDrag&&!this.mightDrag.node.isAtom||Ce&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Zn(this.view,V.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):Jt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Jt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ae.touchstart=t=>{t.input.lastTouch=Date.now(),Ea(t),Jt(t,"pointer")};Ae.touchmove=t=>{t.input.lastTouch=Date.now(),Jt(t,"pointer")};Ae.contextmenu=t=>Ea(t);function Pd(t,e){return t.composing?!0:Ne&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Jg=nt?5e3:-1;Re.compositionstart=Re.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),hi(t,!0),t.markCursor=null;else if(hi(t),at&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){t.domSelection().collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}Ld(t,Jg)};Re.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Ld(t,20))};function Ld(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>hi(t),e))}function Bd(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Gg());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Gg(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function hi(t,e=!1){if(!(nt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Bd(t),e||t.docView&&t.docView.dirty){let n=ka(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function Xg(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const rs=ze&&Xt<15||ir&&qm<604;Ae.copy=Re.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=rs?null:n.clipboardData,o=r.content(),{dom:a,text:l}=Od(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):Xg(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Yg(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Zg(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ss(t,r.value,null,s,e):ss(t,r.textContent,r.innerHTML,s,e)},50)}function ss(t,e,n,r,s){let i=Md(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,i||S.empty)))return!0;if(!i)return!1;let o=Yg(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function zd(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Re.paste=(t,e)=>{let n=e;if(t.composing&&!nt)return;let r=rs?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ss(t,zd(r),r.getData("text/html"),s,n)?n.preventDefault():Zg(t,n)};class Qg{constructor(e,n){this.slice=e,this.move=n}}const $d=Ke?"altKey":"ctrlKey";Ae.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(Pi(n));if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof I?s.to-1:s.to))){if(r&&r.mightDrag)t.dispatch(t.state.tr.setSelection(I.create(t.state.doc,r.mightDrag.pos)));else if(n.target&&n.target.nodeType==1){let c=t.docView.nearestDesc(n.target,!0);c&&c.node.type.spec.draggable&&c!=t.docView&&t.dispatch(t.state.tr.setSelection(I.create(t.state.doc,c.posBefore)))}}let o=t.state.selection.content(),{dom:a,text:l}=Od(t,o);n.dataTransfer.clearData(),n.dataTransfer.setData(rs?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",rs||n.dataTransfer.setData("text/plain",l),t.dragging=new Qg(o,!n[$d])};Ae.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Re.dragover=Re.dragenter=(t,e)=>e.preventDefault();Re.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let s=t.posAtCoords(Pi(n));if(!s)return;let i=t.state.doc.resolve(s.pos),o=r&&r.slice;o?t.someProp("transformPasted",p=>{o=p(o,t)}):o=Md(t,zd(n.dataTransfer),rs?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[$d]);if(t.someProp("handleDrop",p=>p(t,n,o||S.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?Zp(t.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let c=t.state.tr;a&&c.deleteSelection();let u=c.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(h))return;let f=c.doc.resolve(u);if(d&&I.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new I(f));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,E)=>p=E),c.setSelection(Sa(t,f,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Ae.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Nt(t)},20))};Ae.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ae.beforeinput=(t,e)=>{if(Ce&&nt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,yn(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Re)Ae[t]=Re[t];function is(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class fi{constructor(e,n){this.toDOM=e,this.spec=n||En,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new Q(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof fi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&is(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Zt{constructor(e,n){this.attrs=e,this.spec=n||En}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Q(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Zt&&is(this.attrs,e.attrs)&&is(this.spec,e.spec)}static is(e){return e.type instanceof Zt}destroy(){}}class Ca{constructor(e,n){this.attrs=e,this.spec=n||En}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Q(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof Ca&&is(this.attrs,e.attrs)&&is(this.spec,e.spec)}destroy(){}}class Q{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Q(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Q(e,e,new fi(n,r))}static inline(e,n,r,s){return new Q(e,n,new Zt(r,s))}static node(e,n,r,s){return new Q(e,n,new Ca(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Zt}get widget(){return this.type instanceof fi}}const Vn=[],En={};class W{constructor(e,n){this.local=e.length?e:Vn,this.children=n.length?n:Vn}static create(e,n){return n.length?pi(n,e,0,En):ve}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==ve||e.maps.length==0?this:this.mapInner(e,n,0,0,r||En)}mapInner(e,n,r,s,i){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,s);l&&l.type.valid(n,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?ey(this.children,o||[],e,n,r,s,i):o?new W(o.sort(Cn),Vn):ve}add(e,n){return n.length?this==ve?W.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=Vd(n,a,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,u,c+1):s.splice(i,0,l,l+a.nodeSize,pi(u,a,c+1,En)),i+=3}});let o=Fd(i?Hd(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new W(o.length?this.local.concat(o).sort(Cn):this.local,s||this.children)}remove(e){return e.length==0||this==ve?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=ve?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new W(s,r):ve}forChild(e,n){if(this==ve)return this;if(n.isLeaf)return W.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,o=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>i&&l.type instanceof Zt){let c=Math.max(i,l.from)-i,u=Math.min(o,l.to)-i;c<u&&(s||(s=[])).push(l.copy(c,u))}}if(s){let a=new W(s.sort(Cn),Vn);return r?new jt([a,r]):a}return r||ve}eq(e){if(this==e)return!0;if(!(e instanceof W)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Ta(this.localsInner(e))}localsInner(e){if(this==ve)return Vn;if(e.inlineContent||!this.local.some(Zt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Zt||n.push(this.local[r]);return n}}W.empty=new W([],[]);W.removeOverlap=Ta;const ve=W.empty;class jt{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,En));return jt.from(r)}forChild(e,n){if(n.isLeaf)return W.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=ve&&(i instanceof jt?r=r.concat(i.members):r.push(i))}return jt.from(r)}eq(e){if(!(e instanceof jt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?Ta(r?n:n.sort(Cn)):Vn}static from(e){switch(e.length){case 0:return ve;case 1:return e[0];default:return new jt(e.every(n=>n instanceof W)?e:e.reduce((n,r)=>n.concat(r instanceof W?r:r.members),[]))}}}function ey(t,e,n,r,s,i,o){let a=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let y=0;y<a.length;y+=3){let E=a[y+1];if(E<0||h>E+u-d)continue;let L=a[y]+u-d;f>=L?a[y+1]=h<=L?-2:-1:p>=s&&g&&(a[y]+=g,a[y+1]+=g)}d+=g}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-s;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+i,-1),f=h-s,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==f){let y=a[c+2].mapInner(n,g,u+1,t[c]+i+1,o);y!=ve?(a[c]=d,a[c+1]=f,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=ty(a,t,e,n,s,i,o),u=pi(c,r,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new W(e.sort(Cn),a)}function Fd(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new Q(s.from+e,s.to+e,s.type))}return n}function ty(t,e,n,r,s,i,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,s,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function Vd(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function Hd(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function pi(t,e,n,r){let s=[],i=!1;e.forEach((a,l)=>{let c=Vd(t,a,l+n);if(c){i=!0;let u=pi(c,a,n+l+1,r);u!=ve&&s.push(l,l+a.nodeSize,u)}});let o=Fd(i?Hd(t):t,-n).sort(Cn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new W(o,s):ve}function Cn(t,e){return t.from-e.from||t.to-e.to}function Ta(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),Yl(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Yl(e,s,r.copy(i.from,r.to)));break}}}return e}function Yl(t,e,n){for(;e<t.length&&Cn(n,t[e])>0;)e++;t.splice(e,0,n)}function co(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ve&&e.push(r)}),t.cursorWrapper&&e.push(W.create(t.state.doc,[t.cursorWrapper.deco])),jt.from(e)}const ny={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ry=ze&&Xt<=11;class sy{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class iy{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new sy,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);ze&&Xt<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),ry&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,ny)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ul(this.view)){if(this.suppressingSelectionUpdates)return Nt(this.view);if(ze&&Xt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Mn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=ns(i))n.add(i);for(let i=e.anchorNode;i;i=ns(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ul(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(at&&l.length>1){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let d=u[0],h=u[1];d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ii(r)&&(c=ka(e))&&c.eq(V.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Nt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),oy(e)),this.handleDOMChange(i,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Nt(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++)n.push(e.addedNodes[u]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(ze&&Xt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let o=s&&s.parentNode==e.target?_e(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?_e(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let Zl=new WeakMap,Ql=!1;function oy(t){if(!Zl.has(t)&&(Zl.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=at,Ql)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ql=!0}}function ay(t){let e;function n(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}t.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,!0);let r=e.startContainer,s=e.startOffset,i=e.endContainer,o=e.endOffset,a=t.domAtPos(t.state.selection.anchor);return Mn(a.node,a.offset,i,o)&&([r,s,i,o]=[i,o,r,s]),{anchorNode:r,anchorOffset:s,focusNode:i,focusOffset:o}}function ly(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Ii(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ce&&t.input.lastKeyCode===8)for(let g=i;g>s;g--){let y=r.childNodes[g-1],E=y.pmViewDesc;if(y.nodeName=="BR"&&!E){i=g;break}if(!E||E.size)break}let d=t.state.doc,h=t.someProp("domParser")||da.fromSchema(t.state.schema),f=d.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:cy,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:a}}function cy(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ne&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ne&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const uy=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function dy(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let B=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,ut=ka(t,B);if(ut&&!t.state.selection.eq(ut)){if(Ce&&nt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Xi=>Xi(t,yn(13,"Enter"))))return;let Dt=t.state.tr.setSelection(ut);B=="pointer"?Dt.setMeta("pointer",!0):B=="key"&&Dt.scrollIntoView(),i&&Dt.setMeta("composition",i),t.dispatch(Dt)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=ly(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=py(d.content,c.doc.content,c.from,h,f);if((ir&&t.input.lastIOSEnter>Date.now()-225||nt)&&s.some(B=>B.nodeType==1&&!uy.test(B.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",B=>B(t,yn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof P&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let B=ec(t,t.state.doc,c.sel);if(B&&!B.eq(t.state.selection)){let ut=t.state.tr.setSelection(B);i&&ut.setMeta("composition",i),t.dispatch(ut)}}return}if(Ce&&t.cursorWrapper&&c.sel&&c.sel.anchor==t.cursorWrapper.deco.from&&c.sel.head==c.sel.anchor){let B=p.endB-p.start;c.sel={anchor:c.sel.anchor+B,head:c.sel.anchor+B}}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof P&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ze&&Xt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),E=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,L;if((ir&&t.input.lastIOSEnter>Date.now()-225&&(!E||s.some(B=>B.nodeName=="DIV"||B.nodeName=="P"))||!E&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(L=V.findFrom(c.doc.resolve(m.pos+1),1,!0))&&L.head==g.pos)&&t.someProp("handleKeyDown",B=>B(t,yn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&fy(u,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",B=>B(t,yn(8,"Backspace")))){nt&&Ce&&t.domObserver.suppressSelectionUpdates();return}Ce&&nt&&p.endB==p.start&&(t.input.lastAndroidDelete=Date.now()),nt&&!E&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(B){return B(t,yn(13,"Enter"))})},20));let q=p.start,J=p.endA,F,oe,Fe;if(E){if(m.pos==g.pos)ze&&Xt<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Nt(t),20)),F=t.state.tr.delete(q,J),oe=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&(Fe=hy(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))F=t.state.tr,Fe.type=="add"?F.addMark(q,J,Fe.mark):F.removeMark(q,J,Fe.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let B=m.parent.textBetween(m.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",ut=>ut(t,q,J,B)))return;F=t.state.tr.insertText(B,q,J)}}if(F||(F=t.state.tr.replace(q,J,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let B=ec(t,F.doc,c.sel);B&&!(Ce&&nt&&t.composing&&B.empty&&(p.start!=p.endB||t.input.lastAndroidDelete<Date.now()-100)&&(B.head==q||B.head==F.mapping.map(J)-1)||ze&&B.empty&&B.head==q)&&F.setSelection(B)}oe&&F.ensureMarks(oe),i&&F.setMeta("composition",i),t.dispatch(F.scrollIntoView())}function ec(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Sa(t,e.resolve(n.anchor),e.resolve(n.head))}function hy(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,l;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(x.from(c).eq(t))return{mark:a,type:o}}function fy(t,e,n,r,s){if(!r.parent.isTextblock||n-e<=s.pos-r.pos||uo(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(uo(i,!0,!0));return!o.parent.isTextblock||o.pos>n||uo(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function uo(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function py(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let l=Math.max(0,i-Math.min(o,a));r-=o+l-i}if(o<i&&t.size<e.size){let l=r<=i&&r>=o?i-r:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,o=i+(o-a),a=i}return{start:i,endA:o,endB:a}}class my{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Pg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ic),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=rc(this),nc(this),this.nodeViews=sc(this),this.docView=Bl(this.state.doc,tc(this),co(this),this.dom,this),this.domObserver=new iy(this,(r,s,i,o)=>dy(this,r,s,i,o)),this.domObserver.start(),Lg(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Vo(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ic),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){let r=this.state,s=!1,i=!1;e.storedMarks&&this.composing&&(Bd(this),i=!0),this.state=e;let o=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(o||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=sc(this);yy(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(o||n.handleDOMEvents!=this._props.handleDOMEvents)&&Vo(this),this.editable=rc(this),nc(this);let a=co(this),l=tc(this),c=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,l,a);(u||!e.selection.eq(r.selection))&&(i=!0);let d=c=="preserve"&&i&&this.dom.style.overflowAnchor==null&&Xm(this);if(i){this.domObserver.stop();let h=u&&(ze||Ce)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&gy(r.selection,e.selection);if(u){let f=Ce?this.trackWrites=this.domSelectionRange().focusNode:null;(s||!this.docView.update(e.doc,l,a,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Bl(e.doc,l,a,this.dom,this)),f&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Sg(this))?Nt(this,h):(Ed(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&Ym(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof I){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Al(this,n.getBoundingClientRect(),e)}else Al(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){if(ze){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Zm(this.dom),Nt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return rg(this,e)}coordsAtPos(e,n=1){return gd(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return lg(this,n||this.state,e)}pasteHTML(e,n){return ss(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ss(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(Bg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],co(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return $g(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Ne&&this.root.nodeType===11&&Um(this.dom.ownerDocument)==this.dom?ay(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function tc(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Q.node(0,t.state.doc.content.size,e)]}function nc(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Q.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function rc(t){return!t.someProp("editable",e=>e(t.state)===!1)}function gy(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function sc(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function yy(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function ic(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var xy=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const by=bs(xy);var Ud=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},z=(t,e,n)=>(Ud(t,e,"read from private field"),n?n.call(t):e.get(t)),St=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Z=(t,e,n,r)=>(Ud(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function ky(t){return!!(t.prev&&t.next&&t.prev.text.full!==t.next.text.full)}function Sy(t){return!!(t.prev&&t.next&&t.prev.range.cursor!==t.next.range.cursor)}function vy(t){return!!(!t.prev&&t.next)}function wy(t){return!!(t.prev&&!t.next)}function Ey(t){return!!(t.prev&&t.next&&t.prev.range.from!==t.next.range.from)}function Cy(t){return t==="invalid-exit-split"}var Ty=["jump-backward-exit","jump-forward-exit"],Oy=["jump-backward-change","jump-forward-change"];function My(t){var e,n;return gt(Ty,(e=t.exit)==null?void 0:e.exitReason)||gt(Oy,(n=t.change)==null?void 0:n.changeReason)}function oc(t){return!!(t&&t.query.full.length>=t.suggester.matchOffset)}function ac(t){return De(t)&&t instanceof P}function Le(t){const{match:e,changeReason:n,exitReason:r}=t;return{...e,changeReason:n,exitReason:r}}function _y(t,e){const{invalidPrefixCharacters:n,validPrefixCharacters:r}=e;return n?!new RegExp(Uo(n)).test(t):new RegExp(Uo(r)).test(t)}function Ny(t){const{text:e,regexp:n,$pos:r,suggester:s}=t,i=r.start();let o;return ua(e,n).forEach(a=>{const l=a.input.slice(Math.max(0,a.index-1),a.index);if(_y(l,s)){const c=a.index+i,u=a[0],d=a[1];if(!D(u)||!D(d))return;const h=c+u.length,f=Math.min(h,r.pos),p=f-c;c<r.pos&&h>=r.pos&&(o={range:{from:c,to:h,cursor:f},match:a,query:{partial:u.slice(d.length,p),full:u.slice(d.length)},text:{partial:u.slice(0,p),full:u},textAfter:r.doc.textBetween(h,r.end(),Wt,Wt),textBefore:r.doc.textBetween(i,c,Wt,Wt),suggester:s})}}),o}function jd(t){const{$pos:e,suggester:n}=t,{char:r,name:s,startOfLine:i,supportedCharacters:o,matchOffset:a,multiline:l,caseInsensitive:c,unicode:u}=n,d=$y({char:r,matchOffset:a,startOfLine:i,supportedCharacters:o,multiline:l,caseInsensitive:c,unicode:u}),h=e.doc.textBetween(e.before(),e.end(),Wt,Wt);return Ny({suggester:n,text:h,regexp:d,$pos:e,char:r,name:s})}function Wd(t){const{state:e,match:n}=t;try{return jd({$pos:e.doc.resolve(n.range.cursor),suggester:n.suggester})}catch{return}}function Kd(t){const{prev:e,next:n,state:r}=t;return!n&&e.range.from>=r.doc.nodeSize?{exit:Le({match:e,exitReason:"delete"})}:!n||!e.query.partial?{exit:Le({match:e,exitReason:"invalid-exit-split"})}:e.range.to===n.range.cursor?{exit:Le({match:n,exitReason:"exit-end"})}:e.query.partial?{exit:Le({match:n,exitReason:"exit-split"})}:{}}function Ay(t){const{prev:e,next:n,state:r}=t,s=M(),i=Wd({state:r,match:e}),{exit:o}=i&&i.query.full!==e.query.full?Kd({prev:e,next:i,state:r}):s;return e.range.from<n.range.from?{exit:o??Le({match:e,exitReason:"jump-forward-exit"}),change:Le({match:n,changeReason:"jump-forward-change"})}:{exit:o??Le({match:e,exitReason:"jump-backward-exit"}),change:Le({match:n,changeReason:"jump-backward-change"})}}function Ry(t){const{match:e,state:n,$pos:r}=t,{selection:s}=n,i=Wd({match:e,state:n});return!i||i.text.full!==e.text.full?Kd({prev:e,next:i,state:n}):!s.empty&&(s.from<=e.range.from||s.to>=e.range.to)?{exit:Le({match:e,exitReason:"selection-outside"})}:r.pos>e.range.to?{exit:Le({match:e,exitReason:"move-end"})}:r.pos<=e.range.from?{exit:Le({match:e,exitReason:"move-start"})}:{}}function Iy(t){const{prev:e,next:n,state:r,$pos:s}=t,i=M();if(!e&&!n)return i;const o={prev:e,next:n};return Ey(o)?Ay({prev:o.prev,next:o.next,state:r}):vy(o)?{change:Le({match:o.next,changeReason:"start"})}:wy(o)?Ry({$pos:s,match:o.prev,state:r}):ky(o)?{change:Le({match:o.next,changeReason:"change-character"})}:Sy(o)?{change:Le({match:o.next,changeReason:r.selection.empty?"move":"selection-inside"})}:i}function lc(t,e){for(let n=t.depth;n>0;n--){const r=t.node(n);if(e.includes(r.type.name))return!0}return!1}function Ho(t,e){const{$from:n,$to:r}=t;return qd(t,e)?!0:Nu(n.pos,r.pos).some(s=>Dy(n.doc.resolve(s),e))}function qd(t,e){const{$from:n,$to:r}=t,s=new Set((n.marksAcross(r)??[]).map(i=>i.type.name));return e.some(i=>s.has(i))}function Dy(t,e){const n=new Set(t.marks().map(r=>r.type.name));return e.some(r=>n.has(r))}function Py(t,e){const{$cursor:n}=e,{validMarks:r,validNodes:s,invalidMarks:i,invalidNodes:o}=t;return!r&&!s&&tn(i)&&tn(o)?!0:!(r&&!qd(e,r)||s&&!lc(n,s)||!r&&Ho(e,i)||!s&&lc(n,o))}function cc(t){const{suggesters:e,$pos:n,selectionEmpty:r}=t;for(const s of e)if(!(s.emptySelectionsOnly&&!r))try{const i=jd({suggester:s,$pos:n});if(!i)continue;const o={$from:n.doc.resolve(i.range.from),$to:n.doc.resolve(i.range.to),$cursor:n};if(Py(s,o)&&s.isValidPosition(o,i))return i}catch{}}function Uo(t){return Qf(t)?t.source:t}function Ly(t){return t?"^":""}function By(t,e){return`(?:${Uo(t)}){${e},}`}function zy(t){return D(t)?new RegExp(by(t)):t}function $y(t){const{char:e,matchOffset:n,startOfLine:r,supportedCharacters:s,captureChar:i=!0,caseInsensitive:o=!1,multiline:a=!1,unicode:l=!1}=t,c=`g${a?"m":""}${o?"i":""}${l?"u":""}`;let u=zy(e).source;return i&&(u=`(${u})`),new RegExp(`${Ly(r)}${u}${By(s,n)}`,c)}var Fy={appendTransaction:!1,priority:50,ignoredTag:"span",matchOffset:0,disableDecorations:!1,startOfLine:!1,suggestClassName:"suggest",suggestTag:"span",supportedCharacters:/\w+/,validPrefixCharacters:/^[\s\0]?$/,invalidPrefixCharacters:null,ignoredClassName:null,invalidMarks:[],invalidNodes:[],validMarks:null,validNodes:null,isValidPosition:()=>!0,checkNextValidSelection:null,emptySelectionsOnly:!1,caseInsensitive:!1,multiline:!1,unicode:!1,captureChar:!0},Jd="__ignore_prosemirror_suggest_update__",Bs,Er,ge,zt,Hn,dt,de,$t,Un,Gd=class{constructor(t){St(this,Bs,!1),St(this,Er,!1),St(this,ge,void 0),St(this,zt,void 0),St(this,Hn,void 0),St(this,dt,M()),St(this,de,W.empty),St(this,$t,!1),St(this,Un,!1),this.setMarkRemoved=()=>{Z(this,$t,!0)},this.findNextTextSelection=n=>{const r=n.$from.doc,s=Math.min(r.nodeSize-2,n.to+1),i=r.resolve(s),o=V.findFrom(i,1,!0);if(ac(o))return o},this.ignoreNextExit=()=>{Z(this,Er,!0)},this.addIgnored=({from:n,name:r,specific:s=!1})=>{const i=z(this,ge).find(u=>u.name===r);if(!i)throw new Error(`No suggester exists for the name provided: ${r}`);const o=D(i.char)?i.char.length:1,a=n+o,l=i.ignoredClassName?{class:i.ignoredClassName}:{},c=Q.inline(n,a,{nodeName:i.ignoredTag,...l},{name:r,specific:s,char:i.char});Z(this,de,z(this,de).add(this.view.state.doc,[c]))},this.removeIgnored=({from:n,name:r})=>{const s=z(this,ge).find(a=>a.name===r);if(!s)throw new Error(`No suggester exists for the name provided: ${r}`);const i=D(s.char)?s.char.length:1,o=z(this,de).find(n,n+i)[0];!o||o.spec.name!==r||Z(this,de,z(this,de).remove([o]))},this.clearIgnored=n=>{if(!n){Z(this,de,W.empty);return}const s=z(this,de).find().filter(({spec:i})=>i.name===n);Z(this,de,z(this,de).remove(s))},this.findMatchAtPosition=(n,r)=>{const s=r?z(this,ge).filter(i=>i.name===r):z(this,ge);return cc({suggesters:s,$pos:n,docChanged:!1,selectionEmpty:!0})},this.setLastChangeFromAppend=()=>{Z(this,Un,!0)};const e=uc();Z(this,ge,t.map(e)),Z(this,ge,tr(z(this,ge),(n,r)=>r.priority-n.priority))}static create(t){return new Gd(t)}get decorationSet(){return z(this,de)}get removed(){return z(this,$t)}get match(){return z(this,zt)?z(this,zt):z(this,Hn)&&z(this,dt).exit?z(this,Hn):void 0}init(t){return this.view=t,this}createProps(t){const{name:e,char:n}=t.suggester;return{view:this.view,addIgnored:this.addIgnored,clearIgnored:this.clearIgnored,ignoreNextExit:this.ignoreNextExit,setMarkRemoved:this.setMarkRemoved,name:e,char:n,...t}}shouldRunExit(){return z(this,Er)?(Z(this,Er,!1),!1):!0}updateWithNextSelection(t){var e,n,r;const s=this.findNextTextSelection(t.selection);if(s)for(const i of z(this,ge)){const o=(e=z(this,dt).change)==null?void 0:e.suggester.name,a=(n=z(this,dt).exit)==null?void 0:n.suggester.name;(r=i.checkNextValidSelection)==null||r.call(i,s.$from,t,{change:o,exit:a})}}changeHandler(t,e){const{change:n,exit:r}=z(this,dt),s=this.match;if(!n&&!r||!oc(s))return;const i=e===(r==null?void 0:r.suggester.appendTransaction)&&this.shouldRunExit(),o=e===(n==null?void 0:n.suggester.appendTransaction);if(!(!i&&!o)){if(n&&r&&My({change:n,exit:r})){const a=this.createProps(r),l=this.createProps(n),c=r.range.from<n.range.from;i&&r.suggester.onChange(a,t),o&&n.suggester.onChange(l,t),i&&Z(this,$t,!1);return}n&&o&&n.suggester.onChange(this.createProps(n),t),r&&i&&(r.suggester.onChange(this.createProps(r),t),Z(this,$t,!1),Cy(r.exitReason)&&Z(this,dt,M()))}}mapIgnoredDecorations(t){const e=z(this,de).map(t.mapping,t.doc),r=e.find().filter(({from:s,to:i,spec:o})=>{const a=D(o.char)?o.char.length:1;return i-s!==a});Z(this,de,e.remove(r))}shouldIgnoreMatch({range:t,suggester:{name:e}}){return z(this,de).find().some(({spec:s,from:i})=>i!==t.from?!1:s.specific?s.name===e:!0)}resetState(){Z(this,dt,M()),Z(this,zt,void 0),Z(this,$t,!1),Z(this,Un,!1)}updateReasons(t){const{$pos:e,state:n}=t,r=z(this,Bs),s=z(this,ge),i=n.selection.empty,o=ac(n.selection)?cc({suggesters:s,$pos:e,docChanged:r,selectionEmpty:i}):void 0;Z(this,zt,o&&this.shouldIgnoreMatch(o)?void 0:o),Z(this,dt,Iy({next:z(this,zt),prev:z(this,Hn),state:n,$pos:e}))}addSuggester(t){const e=z(this,ge).find(r=>r.name===t.name),n=uc();if(e)Z(this,ge,z(this,ge).map(r=>r===e?n(t):r));else{const r=[...z(this,ge),n(t)];Z(this,ge,tr(r,(s,i)=>i.priority-s.priority))}return()=>this.removeSuggester(t.name)}removeSuggester(t){const e=D(t)?t:t.name;Z(this,ge,z(this,ge).filter(n=>n.name!==e)),this.clearIgnored(e)}toJSON(){return this.match}apply(t){const{exit:e,change:n}=z(this,dt);if(z(this,Un)&&(Z(this,Un,!1),!(e!=null&&e.suggester.appendTransaction)&&!(n!=null&&n.suggester.appendTransaction)))return this;const{tr:r,state:s}=t,i=r.docChanged||r.selectionSet;return r.getMeta(Jd)||!i&&!z(this,$t)?this:(Z(this,Bs,r.docChanged),this.mapIgnoredDecorations(r),e&&this.resetState(),Z(this,Hn,z(this,zt)),this.updateReasons({$pos:r.selection.$from,state:s}),this)}createDecorations(t){const e=this.match;if(!oc(e))return z(this,de);const{disableDecorations:n}=e.suggester;if(ee(n)?n(t,e):n)return z(this,de);const{range:s,suggester:i}=e,{name:o,suggestTag:a,suggestClassName:l}=i,{from:c,to:u}=s;return this.shouldIgnoreMatch(e)?z(this,de):z(this,de).add(t.doc,[Q.inline(c,u,{nodeName:a,class:o?`${l} suggest-${o}`:l},{name:o})])}},Vy=Gd;Bs=new WeakMap;Er=new WeakMap;ge=new WeakMap;zt=new WeakMap;Hn=new WeakMap;dt=new WeakMap;de=new WeakMap;$t=new WeakMap;Un=new WeakMap;function uc(){const t=new Set;return e=>{if(t.has(e.name))throw new Error(`A suggester already exists with the name '${e.name}'. The name provided must be unique.`);const n={...Fy,...e};return t.add(e.name),n}}var Xd=new pr("suggest");function Oa(t){return Xd.getState(t)}function dc(t,e){return Oa(t).addSuggester(e)}function hc(t){t.setMeta(Jd,!0)}function Hy(t,e){return Oa(t).removeSuggester(e)}function Uy(...t){const e=Vy.create(t);return new un({key:Xd,view:n=>(e.init(n),{update:r=>e.changeHandler(r.state.tr,!1)}),state:{init:()=>e,apply:(n,r,s,i)=>e.apply({tr:n,state:i})},appendTransaction:(n,r,s)=>{const i=s.tr;return e.updateWithNextSelection(i),e.changeHandler(i,!0),i.docChanged||i.steps.length>0||i.selectionSet||i.storedMarksSet?(e.setLastChangeFromAppend(),i):null},props:{decorations:n=>e.createDecorations(n)}})}function Ma(t,e){const n=Object.getPrototypeOf(e);let r=t.selection,s=t.doc,i=t.storedMarks;const o=M();for(const[a,l]of Object.entries(e))o[a]={value:l};return Object.create(n,{...o,storedMarks:{get(){return i}},selection:{get(){return r}},doc:{get(){return s}},tr:{get(){return r=t.selection,s=t.doc,i=t.storedMarks,t}}})}function zs(t){return({state:e,dispatch:n,view:r,tr:s})=>t(Ma(s,e),n,r)}function fc(t){return e=>{var n;return R(e.dispatch===void 0||e.dispatch===((n=e.view)==null?void 0:n.dispatch),{code:b.NON_CHAINABLE_COMMAND}),t(e)}}var rt={get isBrowser(){return!!(typeof window<"u"&&typeof window.document<"u"&&window.navigator&&window.navigator.userAgent)},get isJSDOM(){return rt.isBrowser&&window.navigator.userAgent.includes("jsdom")},get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null},get isIos(){return rt.isBrowser&&/iPod|iPhone|iPad/.test(navigator.platform)},get isMac(){return rt.isBrowser&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)},get isApple(){return rt.isNode?process.platform==="darwin":rt.isBrowser?/Mac|iPod|iPhone|iPad/.test(window.navigator.platform):!1},get isDevelopment(){return!1},get isTest(){return!1},get isProduction(){return!0}};function Pt(t,e){var n;const r=h0(t);return((n=r==null?void 0:r.getComputedStyle(t))==null?void 0:n.getPropertyValue(e))??""}function mi(t){return De(t)&&Ge(t.nodeType)&&D(t.nodeName)}function Ie(t){return mi(t)&&t.nodeType===1}function jy(t){return mi(t)&&t.nodeType===3}function _a(t){const{types:e,node:n}=t;if(!n)return!1;const r=s=>s===n.type||s===n.type.name;return pe(e)?e.some(r):r(e)}function Li(t){const{predicate:e,selection:n}=t,r=Qd(n)?n.selection.$from:Aa(n)?n.$from:n;for(let s=r.depth;s>0;s--){const i=r.node(s),o=s>0?r.before(s):0,a=r.start(s),l=o+i.nodeSize;if(e(i,o))return{pos:o,depth:s,node:i,start:a,end:l}}}function Wy(t){const{depth:e}=t,n=e>0?t.before(e):0,r=t.node(e),s=t.start(e),i=n+r.nodeSize;return{pos:n,start:s,node:r,end:i,depth:e}}function as(t){const{types:e,selection:n}=t;return Li({predicate:r=>_a({types:e,node:r}),selection:n})}function Ky(t){const{types:e,selection:n}=t;if(!(!zi(n)||!_a({types:e,node:n.node})))return{pos:n.$from.pos,depth:n.$from.depth,start:n.$from.start(),end:n.$from.pos+n.node.nodeSize,node:n.node}}function Yd(t){return Aa(t)?t.empty:t.selection.empty}function qy(t){return t.docChanged||t.selectionSet}function Jy(t){return!!ls(t)}function ls(t){const{state:e,type:n,attrs:r}=t,{selection:s,doc:i}=e,o=D(n)?i.type.schema.nodes[n]:n;R(o,{code:b.SCHEMA,message:`No node exists for ${n}`});const a=Ky({selection:s,types:n})??Li({predicate:l=>l.type===o,selection:s});return!r||ei(r)||!a||a.node.hasMarkup(o,{...a.node.attrs,...r})?a:void 0}function gi(...t){return e=>{if(!ll(t))return!1;const[n,...r]=t;let s=!1;const i=(...l)=>()=>{if(!ll(l))return!1;s=!0;const[,...c]=l;return gi(...l)({...e,next:i(...c)})},o=i(...r),a=n({...e,next:o});return s||a?a:o()}}function Gy(t,e){const n=new Map,r=M();for(const s of t)for(const[i,o]of he(s)){const l=[...n.get(i)??[],o],c=gi(...l);n.set(i,l),r[i]=e(c)}return r}function Xy(t){return Gy(t,e=>(n,r,s)=>e({state:n,dispatch:r,view:s,tr:n.tr,next:()=>!1}))}function Na(t,e){const n=t.attrs??{};return Object.entries(e).every(([r,s])=>n[r]===s)}function mr(t){return De(t)}function gr(t,e){return pe(e)?gt(e,t[At]):e===t[At]}function Yy(t){return De(t)&&t instanceof Mo}function Zy(t,e){return D(t)?re(e.nodes,t):t}function Zd(t){return De(t)&&t instanceof Ss}function Qy(t,e){return D(t)?re(e.marks,t):t}function Bi(t){return De(t)&&t instanceof Gt}function e0(t){return De(t)&&t instanceof x}function t0(t){return De(t)&&t instanceof U}function Qd(t){return De(t)&&t instanceof bn}function yr(t){return De(t)&&t instanceof P}function Aa(t){return De(t)&&t instanceof V}function n0(t){return De(t)&&t instanceof nr}function pc(t){const{trState:e,from:n,to:r,type:s,attrs:i={}}=t,{doc:o}=e,a=Qy(s,o.type.schema);if(Object.keys(i).length===0)return o.rangeHasMark(n,r,a);let l=!1;return r>n&&o.nodesBetween(n,r,c=>l?!1:(l=(c.marks??[]).some(d=>d.type!==a?!1:Na(d,i)),!l)),l}function zi(t){return De(t)&&t instanceof I}function eh(t){const{trState:e,type:n,attrs:r={},from:s,to:i}=t,{selection:o,doc:a,storedMarks:l}=e,c=D(n)?a.type.schema.marks[n]:n;if(R(c,{code:b.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}),s&&i)try{return Math.max(s,i)<a.nodeSize&&pc({...t,from:s,to:i})}catch{return!1}return o.empty?(l??o.$from.marks()).some(d=>d.type!==n?!1:Na(d,r??{})):pc({...t,from:o.from,to:o.to})}function Ra(t,e={}){const n=r0(t.type.schema);if(!n)return!1;const{ignoreAttributes:r,ignoreDocAttributes:s}=e;return r?th(n,t):s?n.content.eq(t.content):n.eq(t)}function th(t,e){if(t===e)return!0;const n=t.type===e.type&&U.sameSet(t.marks,e.marks);function r(){if(t.content===e.content)return!0;if(t.content.size!==e.content.size)return!1;const s=[],i=[];t.content.forEach(o=>s.push(o)),e.content.forEach(o=>i.push(o));for(const[o,a]of s.entries()){const l=i[o];if(!l||!th(a,l))return!1}return!0}return n&&r()}function r0(t){var e;return((e=t.nodes.doc)==null?void 0:e.createAndFill())??void 0}function $i(t){for(const e of Object.values(t.nodes))if(e.name!=="doc"&&(e.isBlock||e.isTextblock))return e;R(!1,{code:b.SCHEMA,message:"No default block node found for the provided schema."})}function s0(t){return t.type===$i(t.type.schema)}function Ia(t){return!!t&&t.type.isBlock&&!t.textContent&&!t.childCount}function In(t,e,n){const r=t.parent.childAfter(t.parentOffset);if(!r.node)return;const s=D(e)?e:e.name,i=r.node.marks.find(({type:d})=>d.name===s);let o=t.index(),a=t.start()+r.offset,l=o+1,c=a+r.node.nodeSize;if(!i)return n&&c<n.pos?In(t.doc.resolve(c+1),e,n):void 0;for(;o>0&&i.isInSet(t.parent.child(o-1).marks);)o-=1,a-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&i.isInSet(t.parent.child(l).marks);)c+=t.parent.child(l).nodeSize,l+=1;const u=t.doc.textBetween(a,c,la,`
37
+ `))),0,0):S.empty;let d=t.someProp("clipboardTextParser",h=>h(e,s,r,t));if(d)a=d;else{let h=s.marks(),{schema:f}=t.state,p=qe.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Ng(n),Es&&Ag(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||da.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Mg.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Rg(Gl(a,+u[1],+u[2]),u[4]);else if(a=S.maxOpen(_g(a.content,s),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Gl(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const Mg=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function _g(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&Nd(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Ad(o[o.length-1],i.length));let u=_d(a,l);o.push(u),s=s.matchType(u.type),i=l}}),o)return x.from(o)}return t}function _d(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,x.from(t));return t}function Nd(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=Nd(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(x.from(_d(n,t,s+1))))}}function Ad(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ad(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(x.empty,!0);return t.copy(n.append(r))}function Fo(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(i=0),s<r-1&&(a=Fo(a,e,n,r,s+1,i)),s>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(x.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function Gl(t,e,n){return e<t.openStart&&(t=new S(Fo(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new S(Fo(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Rd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Xl=null;function Id(){return Xl||(Xl=document.implementation.createHTMLDocument("title"))}function Ng(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Id().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&Rd[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=t,s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function Ag(t){let e=t.querySelectorAll(Ce?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Rg(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;s=x.from(l.create(r[a+1],s)),i++,o++}return new S(s,i,o)}const Ae={},Re={},Ig={touchstart:!0,touchmove:!0};class Dg{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Pg(t){for(let e in Ae){let n=Ae[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Bg(t,r)&&!va(t,r)&&(t.editable||!(r.type in Re))&&n(t,r)},Ig[e]?{passive:!0}:void 0)}Ne&&t.dom.addEventListener("input",()=>null),Vo(t)}function Jt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Lg(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Vo(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>va(t,r))})}function va(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Bg(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function zg(t,e){!va(t,e)&&Ae[e.type]&&(t.editable||!(e.type in Re))&&Ae[e.type](t,e)}Re.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Pd(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(nt&&Ce&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ir&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,yn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Og(t,n)?n.preventDefault():Jt(t,"key")};Re.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Re.keypress=(t,e)=>{let n=e;if(Pd(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ke&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof P)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode);!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,s))&&t.dispatch(t.state.tr.insertText(s).scrollIntoView()),n.preventDefault()}};function Pi(t){return{left:t.clientX,top:t.clientY}}function $g(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function wa(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Zn(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function Fg(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&I.isSelectable(r)?(Zn(t,new I(n),"pointer"),!0):!1}function Vg(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof I&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(I.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Zn(t,I.create(t.state.doc,s),"pointer"),!0):!1}function Hg(t,e,n,r,s){return wa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?Vg(t,n):Fg(t,n))}function Ug(t,e,n,r){return wa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function jg(t,e,n,r){return wa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||Wg(t,n,r)}function Wg(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Zn(t,P.create(r,0,r.content.size),"pointer"),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)Zn(t,P.create(r,a+1,a+1+o.content.size),"pointer");else if(I.isSelectable(o))Zn(t,I.create(r,a),"pointer");else continue;return!0}}function Ea(t){return hi(t)}const Dd=Ke?"metaKey":"ctrlKey";Ae.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ea(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&$g(n,t.input.lastClick)&&!n[Dd]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i};let o=t.posAtCoords(Pi(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Kg(t,o,n,!!r)):(i=="doubleClick"?Ug:jg)(t,o.pos,o.inside,n)?n.preventDefault():Jt(t,"pointer"))};class Kg{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Dd],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,o=u.depth?u.before():0}const a=s?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof I&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&at&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Jt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Nt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Pi(e))),this.updateAllowDefault(e),this.allowDefault||!n?Jt(this.view,"pointer"):Hg(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ne&&this.mightDrag&&!this.mightDrag.node.isAtom||Ce&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Zn(this.view,V.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):Jt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Jt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ae.touchstart=t=>{t.input.lastTouch=Date.now(),Ea(t),Jt(t,"pointer")};Ae.touchmove=t=>{t.input.lastTouch=Date.now(),Jt(t,"pointer")};Ae.contextmenu=t=>Ea(t);function Pd(t,e){return t.composing?!0:Ne&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const qg=nt?5e3:-1;Re.compositionstart=Re.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),hi(t,!0),t.markCursor=null;else if(hi(t),at&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){t.domSelection().collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}Ld(t,qg)};Re.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Ld(t,20))};function Ld(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>hi(t),e))}function Bd(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Jg());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Jg(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function hi(t,e=!1){if(!(nt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Bd(t),e||t.docView&&t.docView.dirty){let n=ka(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function Gg(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const rs=ze&&Xt<15||ir&&Km<604;Ae.copy=Re.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=rs?null:n.clipboardData,o=r.content(),{dom:a,text:l}=Od(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):Gg(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Xg(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Yg(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ss(t,r.value,null,s,e):ss(t,r.textContent,r.innerHTML,s,e)},50)}function ss(t,e,n,r,s){let i=Md(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,i||S.empty)))return!0;if(!i)return!1;let o=Xg(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function zd(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Re.paste=(t,e)=>{let n=e;if(t.composing&&!nt)return;let r=rs?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ss(t,zd(r),r.getData("text/html"),s,n)?n.preventDefault():Yg(t,n)};class Zg{constructor(e,n){this.slice=e,this.move=n}}const $d=Ke?"altKey":"ctrlKey";Ae.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(Pi(n));if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof I?s.to-1:s.to))){if(r&&r.mightDrag)t.dispatch(t.state.tr.setSelection(I.create(t.state.doc,r.mightDrag.pos)));else if(n.target&&n.target.nodeType==1){let c=t.docView.nearestDesc(n.target,!0);c&&c.node.type.spec.draggable&&c!=t.docView&&t.dispatch(t.state.tr.setSelection(I.create(t.state.doc,c.posBefore)))}}let o=t.state.selection.content(),{dom:a,text:l}=Od(t,o);n.dataTransfer.clearData(),n.dataTransfer.setData(rs?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",rs||n.dataTransfer.setData("text/plain",l),t.dragging=new Zg(o,!n[$d])};Ae.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Re.dragover=Re.dragenter=(t,e)=>e.preventDefault();Re.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let s=t.posAtCoords(Pi(n));if(!s)return;let i=t.state.doc.resolve(s.pos),o=r&&r.slice;o?t.someProp("transformPasted",p=>{o=p(o,t)}):o=Md(t,zd(n.dataTransfer),rs?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[$d]);if(t.someProp("handleDrop",p=>p(t,n,o||S.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?Zp(t.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let c=t.state.tr;a&&c.deleteSelection();let u=c.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(h))return;let f=c.doc.resolve(u);if(d&&I.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new I(f));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,E)=>p=E),c.setSelection(Sa(t,f,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Ae.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Nt(t)},20))};Ae.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ae.beforeinput=(t,e)=>{if(Ce&&nt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,yn(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Re)Ae[t]=Re[t];function is(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class fi{constructor(e,n){this.toDOM=e,this.spec=n||En,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new Q(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof fi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&is(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Zt{constructor(e,n){this.attrs=e,this.spec=n||En}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Q(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Zt&&is(this.attrs,e.attrs)&&is(this.spec,e.spec)}static is(e){return e.type instanceof Zt}destroy(){}}class Ca{constructor(e,n){this.attrs=e,this.spec=n||En}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Q(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof Ca&&is(this.attrs,e.attrs)&&is(this.spec,e.spec)}destroy(){}}class Q{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Q(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Q(e,e,new fi(n,r))}static inline(e,n,r,s){return new Q(e,n,new Zt(r,s))}static node(e,n,r,s){return new Q(e,n,new Ca(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Zt}get widget(){return this.type instanceof fi}}const Vn=[],En={};class W{constructor(e,n){this.local=e.length?e:Vn,this.children=n.length?n:Vn}static create(e,n){return n.length?pi(n,e,0,En):ve}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==ve||e.maps.length==0?this:this.mapInner(e,n,0,0,r||En)}mapInner(e,n,r,s,i){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,s);l&&l.type.valid(n,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?Qg(this.children,o||[],e,n,r,s,i):o?new W(o.sort(Cn),Vn):ve}add(e,n){return n.length?this==ve?W.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=Vd(n,a,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,u,c+1):s.splice(i,0,l,l+a.nodeSize,pi(u,a,c+1,En)),i+=3}});let o=Fd(i?Hd(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new W(o.length?this.local.concat(o).sort(Cn):this.local,s||this.children)}remove(e){return e.length==0||this==ve?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=ve?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new W(s,r):ve}forChild(e,n){if(this==ve)return this;if(n.isLeaf)return W.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,o=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>i&&l.type instanceof Zt){let c=Math.max(i,l.from)-i,u=Math.min(o,l.to)-i;c<u&&(s||(s=[])).push(l.copy(c,u))}}if(s){let a=new W(s.sort(Cn),Vn);return r?new jt([a,r]):a}return r||ve}eq(e){if(this==e)return!0;if(!(e instanceof W)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Ta(this.localsInner(e))}localsInner(e){if(this==ve)return Vn;if(e.inlineContent||!this.local.some(Zt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Zt||n.push(this.local[r]);return n}}W.empty=new W([],[]);W.removeOverlap=Ta;const ve=W.empty;class jt{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,En));return jt.from(r)}forChild(e,n){if(n.isLeaf)return W.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=ve&&(i instanceof jt?r=r.concat(i.members):r.push(i))}return jt.from(r)}eq(e){if(!(e instanceof jt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?Ta(r?n:n.sort(Cn)):Vn}static from(e){switch(e.length){case 0:return ve;case 1:return e[0];default:return new jt(e.every(n=>n instanceof W)?e:e.reduce((n,r)=>n.concat(r instanceof W?r:r.members),[]))}}}function Qg(t,e,n,r,s,i,o){let a=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let y=0;y<a.length;y+=3){let E=a[y+1];if(E<0||h>E+u-d)continue;let L=a[y]+u-d;f>=L?a[y+1]=h<=L?-2:-1:p>=s&&g&&(a[y]+=g,a[y+1]+=g)}d+=g}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-s;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+i,-1),f=h-s,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==f){let y=a[c+2].mapInner(n,g,u+1,t[c]+i+1,o);y!=ve?(a[c]=d,a[c+1]=f,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=ey(a,t,e,n,s,i,o),u=pi(c,r,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new W(e.sort(Cn),a)}function Fd(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new Q(s.from+e,s.to+e,s.type))}return n}function ey(t,e,n,r,s,i,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,s,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function Vd(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function Hd(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function pi(t,e,n,r){let s=[],i=!1;e.forEach((a,l)=>{let c=Vd(t,a,l+n);if(c){i=!0;let u=pi(c,a,n+l+1,r);u!=ve&&s.push(l,l+a.nodeSize,u)}});let o=Fd(i?Hd(t):t,-n).sort(Cn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new W(o,s):ve}function Cn(t,e){return t.from-e.from||t.to-e.to}function Ta(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),Yl(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Yl(e,s,r.copy(i.from,r.to)));break}}}return e}function Yl(t,e,n){for(;e<t.length&&Cn(n,t[e])>0;)e++;t.splice(e,0,n)}function co(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ve&&e.push(r)}),t.cursorWrapper&&e.push(W.create(t.state.doc,[t.cursorWrapper.deco])),jt.from(e)}const ty={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ny=ze&&Xt<=11;class ry{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class sy{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ry,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);ze&&Xt<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),ny&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,ty)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ul(this.view)){if(this.suppressingSelectionUpdates)return Nt(this.view);if(ze&&Xt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Mn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=ns(i))n.add(i);for(let i=e.anchorNode;i;i=ns(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ul(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(at&&l.length>1){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let d=u[0],h=u[1];d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ii(r)&&(c=ka(e))&&c.eq(V.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Nt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),iy(e)),this.handleDOMChange(i,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Nt(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++)n.push(e.addedNodes[u]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(ze&&Xt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let o=s&&s.parentNode==e.target?_e(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?_e(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let Zl=new WeakMap,Ql=!1;function iy(t){if(!Zl.has(t)&&(Zl.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=at,Ql)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ql=!0}}function oy(t){let e;function n(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}t.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,!0);let r=e.startContainer,s=e.startOffset,i=e.endContainer,o=e.endOffset,a=t.domAtPos(t.state.selection.anchor);return Mn(a.node,a.offset,i,o)&&([r,s,i,o]=[i,o,r,s]),{anchorNode:r,anchorOffset:s,focusNode:i,focusOffset:o}}function ay(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Ii(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ce&&t.input.lastKeyCode===8)for(let g=i;g>s;g--){let y=r.childNodes[g-1],E=y.pmViewDesc;if(y.nodeName=="BR"&&!E){i=g;break}if(!E||E.size)break}let d=t.state.doc,h=t.someProp("domParser")||da.fromSchema(t.state.schema),f=d.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:ly,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:a}}function ly(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ne&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ne&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const cy=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function uy(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let B=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,ut=ka(t,B);if(ut&&!t.state.selection.eq(ut)){if(Ce&&nt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Xi=>Xi(t,yn(13,"Enter"))))return;let Dt=t.state.tr.setSelection(ut);B=="pointer"?Dt.setMeta("pointer",!0):B=="key"&&Dt.scrollIntoView(),i&&Dt.setMeta("composition",i),t.dispatch(Dt)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=ay(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=fy(d.content,c.doc.content,c.from,h,f);if((ir&&t.input.lastIOSEnter>Date.now()-225||nt)&&s.some(B=>B.nodeType==1&&!cy.test(B.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",B=>B(t,yn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof P&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let B=ec(t,t.state.doc,c.sel);if(B&&!B.eq(t.state.selection)){let ut=t.state.tr.setSelection(B);i&&ut.setMeta("composition",i),t.dispatch(ut)}}return}if(Ce&&t.cursorWrapper&&c.sel&&c.sel.anchor==t.cursorWrapper.deco.from&&c.sel.head==c.sel.anchor){let B=p.endB-p.start;c.sel={anchor:c.sel.anchor+B,head:c.sel.anchor+B}}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof P&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ze&&Xt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),E=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,L;if((ir&&t.input.lastIOSEnter>Date.now()-225&&(!E||s.some(B=>B.nodeName=="DIV"||B.nodeName=="P"))||!E&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(L=V.findFrom(c.doc.resolve(m.pos+1),1,!0))&&L.head==g.pos)&&t.someProp("handleKeyDown",B=>B(t,yn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&hy(u,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",B=>B(t,yn(8,"Backspace")))){nt&&Ce&&t.domObserver.suppressSelectionUpdates();return}Ce&&nt&&p.endB==p.start&&(t.input.lastAndroidDelete=Date.now()),nt&&!E&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(B){return B(t,yn(13,"Enter"))})},20));let q=p.start,J=p.endA,F,oe,Fe;if(E){if(m.pos==g.pos)ze&&Xt<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Nt(t),20)),F=t.state.tr.delete(q,J),oe=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&(Fe=dy(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))F=t.state.tr,Fe.type=="add"?F.addMark(q,J,Fe.mark):F.removeMark(q,J,Fe.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let B=m.parent.textBetween(m.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",ut=>ut(t,q,J,B)))return;F=t.state.tr.insertText(B,q,J)}}if(F||(F=t.state.tr.replace(q,J,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let B=ec(t,F.doc,c.sel);B&&!(Ce&&nt&&t.composing&&B.empty&&(p.start!=p.endB||t.input.lastAndroidDelete<Date.now()-100)&&(B.head==q||B.head==F.mapping.map(J)-1)||ze&&B.empty&&B.head==q)&&F.setSelection(B)}oe&&F.ensureMarks(oe),i&&F.setMeta("composition",i),t.dispatch(F.scrollIntoView())}function ec(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Sa(t,e.resolve(n.anchor),e.resolve(n.head))}function dy(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,l;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(x.from(c).eq(t))return{mark:a,type:o}}function hy(t,e,n,r,s){if(!r.parent.isTextblock||n-e<=s.pos-r.pos||uo(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(uo(i,!0,!0));return!o.parent.isTextblock||o.pos>n||uo(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function uo(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function fy(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let l=Math.max(0,i-Math.min(o,a));r-=o+l-i}if(o<i&&t.size<e.size){let l=r<=i&&r>=o?i-r:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,o=i+(o-a),a=i}return{start:i,endA:o,endB:a}}class py{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Dg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ic),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=rc(this),nc(this),this.nodeViews=sc(this),this.docView=Bl(this.state.doc,tc(this),co(this),this.dom,this),this.domObserver=new sy(this,(r,s,i,o)=>uy(this,r,s,i,o)),this.domObserver.start(),Pg(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Vo(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ic),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){let r=this.state,s=!1,i=!1;e.storedMarks&&this.composing&&(Bd(this),i=!0),this.state=e;let o=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(o||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=sc(this);gy(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(o||n.handleDOMEvents!=this._props.handleDOMEvents)&&Vo(this),this.editable=rc(this),nc(this);let a=co(this),l=tc(this),c=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,l,a);(u||!e.selection.eq(r.selection))&&(i=!0);let d=c=="preserve"&&i&&this.dom.style.overflowAnchor==null&&Gm(this);if(i){this.domObserver.stop();let h=u&&(ze||Ce)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&my(r.selection,e.selection);if(u){let f=Ce?this.trackWrites=this.domSelectionRange().focusNode:null;(s||!this.docView.update(e.doc,l,a,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Bl(e.doc,l,a,this.dom,this)),f&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&kg(this))?Nt(this,h):(Ed(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&Xm(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof I){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Al(this,n.getBoundingClientRect(),e)}else Al(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){if(ze){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Ym(this.dom),Nt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ng(this,e)}coordsAtPos(e,n=1){return gd(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return ag(this,n||this.state,e)}pasteHTML(e,n){return ss(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ss(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(Lg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],co(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return zg(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Ne&&this.root.nodeType===11&&Hm(this.dom.ownerDocument)==this.dom?oy(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function tc(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Q.node(0,t.state.doc.content.size,e)]}function nc(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Q.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function rc(t){return!t.someProp("editable",e=>e(t.state)===!1)}function my(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function sc(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function gy(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function ic(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var yy=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const xy=bs(yy);var Ud=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},z=(t,e,n)=>(Ud(t,e,"read from private field"),n?n.call(t):e.get(t)),St=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Z=(t,e,n,r)=>(Ud(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function by(t){return!!(t.prev&&t.next&&t.prev.text.full!==t.next.text.full)}function ky(t){return!!(t.prev&&t.next&&t.prev.range.cursor!==t.next.range.cursor)}function Sy(t){return!!(!t.prev&&t.next)}function vy(t){return!!(t.prev&&!t.next)}function wy(t){return!!(t.prev&&t.next&&t.prev.range.from!==t.next.range.from)}function Ey(t){return t==="invalid-exit-split"}var Cy=["jump-backward-exit","jump-forward-exit"],Ty=["jump-backward-change","jump-forward-change"];function Oy(t){var e,n;return gt(Cy,(e=t.exit)==null?void 0:e.exitReason)||gt(Ty,(n=t.change)==null?void 0:n.changeReason)}function oc(t){return!!(t&&t.query.full.length>=t.suggester.matchOffset)}function ac(t){return De(t)&&t instanceof P}function Le(t){const{match:e,changeReason:n,exitReason:r}=t;return{...e,changeReason:n,exitReason:r}}function My(t,e){const{invalidPrefixCharacters:n,validPrefixCharacters:r}=e;return n?!new RegExp(Uo(n)).test(t):new RegExp(Uo(r)).test(t)}function _y(t){const{text:e,regexp:n,$pos:r,suggester:s}=t,i=r.start();let o;return ua(e,n).forEach(a=>{const l=a.input.slice(Math.max(0,a.index-1),a.index);if(My(l,s)){const c=a.index+i,u=a[0],d=a[1];if(!D(u)||!D(d))return;const h=c+u.length,f=Math.min(h,r.pos),p=f-c;c<r.pos&&h>=r.pos&&(o={range:{from:c,to:h,cursor:f},match:a,query:{partial:u.slice(d.length,p),full:u.slice(d.length)},text:{partial:u.slice(0,p),full:u},textAfter:r.doc.textBetween(h,r.end(),Wt,Wt),textBefore:r.doc.textBetween(i,c,Wt,Wt),suggester:s})}}),o}function jd(t){const{$pos:e,suggester:n}=t,{char:r,name:s,startOfLine:i,supportedCharacters:o,matchOffset:a,multiline:l,caseInsensitive:c,unicode:u}=n,d=zy({char:r,matchOffset:a,startOfLine:i,supportedCharacters:o,multiline:l,caseInsensitive:c,unicode:u}),h=e.doc.textBetween(e.before(),e.end(),Wt,Wt);return _y({suggester:n,text:h,regexp:d,$pos:e,char:r,name:s})}function Wd(t){const{state:e,match:n}=t;try{return jd({$pos:e.doc.resolve(n.range.cursor),suggester:n.suggester})}catch{return}}function Kd(t){const{prev:e,next:n,state:r}=t;return!n&&e.range.from>=r.doc.nodeSize?{exit:Le({match:e,exitReason:"delete"})}:!n||!e.query.partial?{exit:Le({match:e,exitReason:"invalid-exit-split"})}:e.range.to===n.range.cursor?{exit:Le({match:n,exitReason:"exit-end"})}:e.query.partial?{exit:Le({match:n,exitReason:"exit-split"})}:{}}function Ny(t){const{prev:e,next:n,state:r}=t,s=M(),i=Wd({state:r,match:e}),{exit:o}=i&&i.query.full!==e.query.full?Kd({prev:e,next:i,state:r}):s;return e.range.from<n.range.from?{exit:o??Le({match:e,exitReason:"jump-forward-exit"}),change:Le({match:n,changeReason:"jump-forward-change"})}:{exit:o??Le({match:e,exitReason:"jump-backward-exit"}),change:Le({match:n,changeReason:"jump-backward-change"})}}function Ay(t){const{match:e,state:n,$pos:r}=t,{selection:s}=n,i=Wd({match:e,state:n});return!i||i.text.full!==e.text.full?Kd({prev:e,next:i,state:n}):!s.empty&&(s.from<=e.range.from||s.to>=e.range.to)?{exit:Le({match:e,exitReason:"selection-outside"})}:r.pos>e.range.to?{exit:Le({match:e,exitReason:"move-end"})}:r.pos<=e.range.from?{exit:Le({match:e,exitReason:"move-start"})}:{}}function Ry(t){const{prev:e,next:n,state:r,$pos:s}=t,i=M();if(!e&&!n)return i;const o={prev:e,next:n};return wy(o)?Ny({prev:o.prev,next:o.next,state:r}):Sy(o)?{change:Le({match:o.next,changeReason:"start"})}:vy(o)?Ay({$pos:s,match:o.prev,state:r}):by(o)?{change:Le({match:o.next,changeReason:"change-character"})}:ky(o)?{change:Le({match:o.next,changeReason:r.selection.empty?"move":"selection-inside"})}:i}function lc(t,e){for(let n=t.depth;n>0;n--){const r=t.node(n);if(e.includes(r.type.name))return!0}return!1}function Ho(t,e){const{$from:n,$to:r}=t;return qd(t,e)?!0:Nu(n.pos,r.pos).some(s=>Iy(n.doc.resolve(s),e))}function qd(t,e){const{$from:n,$to:r}=t,s=new Set((n.marksAcross(r)??[]).map(i=>i.type.name));return e.some(i=>s.has(i))}function Iy(t,e){const n=new Set(t.marks().map(r=>r.type.name));return e.some(r=>n.has(r))}function Dy(t,e){const{$cursor:n}=e,{validMarks:r,validNodes:s,invalidMarks:i,invalidNodes:o}=t;return!r&&!s&&tn(i)&&tn(o)?!0:!(r&&!qd(e,r)||s&&!lc(n,s)||!r&&Ho(e,i)||!s&&lc(n,o))}function cc(t){const{suggesters:e,$pos:n,selectionEmpty:r}=t;for(const s of e)if(!(s.emptySelectionsOnly&&!r))try{const i=jd({suggester:s,$pos:n});if(!i)continue;const o={$from:n.doc.resolve(i.range.from),$to:n.doc.resolve(i.range.to),$cursor:n};if(Dy(s,o)&&s.isValidPosition(o,i))return i}catch{}}function Uo(t){return Qf(t)?t.source:t}function Py(t){return t?"^":""}function Ly(t,e){return`(?:${Uo(t)}){${e},}`}function By(t){return D(t)?new RegExp(xy(t)):t}function zy(t){const{char:e,matchOffset:n,startOfLine:r,supportedCharacters:s,captureChar:i=!0,caseInsensitive:o=!1,multiline:a=!1,unicode:l=!1}=t,c=`g${a?"m":""}${o?"i":""}${l?"u":""}`;let u=By(e).source;return i&&(u=`(${u})`),new RegExp(`${Py(r)}${u}${Ly(s,n)}`,c)}var $y={appendTransaction:!1,priority:50,ignoredTag:"span",matchOffset:0,disableDecorations:!1,startOfLine:!1,suggestClassName:"suggest",suggestTag:"span",supportedCharacters:/\w+/,validPrefixCharacters:/^[\s\0]?$/,invalidPrefixCharacters:null,ignoredClassName:null,invalidMarks:[],invalidNodes:[],validMarks:null,validNodes:null,isValidPosition:()=>!0,checkNextValidSelection:null,emptySelectionsOnly:!1,caseInsensitive:!1,multiline:!1,unicode:!1,captureChar:!0},Jd="__ignore_prosemirror_suggest_update__",Bs,Er,ge,zt,Hn,dt,de,$t,Un,Gd=class{constructor(t){St(this,Bs,!1),St(this,Er,!1),St(this,ge,void 0),St(this,zt,void 0),St(this,Hn,void 0),St(this,dt,M()),St(this,de,W.empty),St(this,$t,!1),St(this,Un,!1),this.setMarkRemoved=()=>{Z(this,$t,!0)},this.findNextTextSelection=n=>{const r=n.$from.doc,s=Math.min(r.nodeSize-2,n.to+1),i=r.resolve(s),o=V.findFrom(i,1,!0);if(ac(o))return o},this.ignoreNextExit=()=>{Z(this,Er,!0)},this.addIgnored=({from:n,name:r,specific:s=!1})=>{const i=z(this,ge).find(u=>u.name===r);if(!i)throw new Error(`No suggester exists for the name provided: ${r}`);const o=D(i.char)?i.char.length:1,a=n+o,l=i.ignoredClassName?{class:i.ignoredClassName}:{},c=Q.inline(n,a,{nodeName:i.ignoredTag,...l},{name:r,specific:s,char:i.char});Z(this,de,z(this,de).add(this.view.state.doc,[c]))},this.removeIgnored=({from:n,name:r})=>{const s=z(this,ge).find(a=>a.name===r);if(!s)throw new Error(`No suggester exists for the name provided: ${r}`);const i=D(s.char)?s.char.length:1,o=z(this,de).find(n,n+i)[0];!o||o.spec.name!==r||Z(this,de,z(this,de).remove([o]))},this.clearIgnored=n=>{if(!n){Z(this,de,W.empty);return}const s=z(this,de).find().filter(({spec:i})=>i.name===n);Z(this,de,z(this,de).remove(s))},this.findMatchAtPosition=(n,r)=>{const s=r?z(this,ge).filter(i=>i.name===r):z(this,ge);return cc({suggesters:s,$pos:n,docChanged:!1,selectionEmpty:!0})},this.setLastChangeFromAppend=()=>{Z(this,Un,!0)};const e=uc();Z(this,ge,t.map(e)),Z(this,ge,tr(z(this,ge),(n,r)=>r.priority-n.priority))}static create(t){return new Gd(t)}get decorationSet(){return z(this,de)}get removed(){return z(this,$t)}get match(){return z(this,zt)?z(this,zt):z(this,Hn)&&z(this,dt).exit?z(this,Hn):void 0}init(t){return this.view=t,this}createProps(t){const{name:e,char:n}=t.suggester;return{view:this.view,addIgnored:this.addIgnored,clearIgnored:this.clearIgnored,ignoreNextExit:this.ignoreNextExit,setMarkRemoved:this.setMarkRemoved,name:e,char:n,...t}}shouldRunExit(){return z(this,Er)?(Z(this,Er,!1),!1):!0}updateWithNextSelection(t){var e,n,r;const s=this.findNextTextSelection(t.selection);if(s)for(const i of z(this,ge)){const o=(e=z(this,dt).change)==null?void 0:e.suggester.name,a=(n=z(this,dt).exit)==null?void 0:n.suggester.name;(r=i.checkNextValidSelection)==null||r.call(i,s.$from,t,{change:o,exit:a})}}changeHandler(t,e){const{change:n,exit:r}=z(this,dt),s=this.match;if(!n&&!r||!oc(s))return;const i=e===(r==null?void 0:r.suggester.appendTransaction)&&this.shouldRunExit(),o=e===(n==null?void 0:n.suggester.appendTransaction);if(!(!i&&!o)){if(n&&r&&Oy({change:n,exit:r})){const a=this.createProps(r),l=this.createProps(n),c=r.range.from<n.range.from;i&&r.suggester.onChange(a,t),o&&n.suggester.onChange(l,t),i&&Z(this,$t,!1);return}n&&o&&n.suggester.onChange(this.createProps(n),t),r&&i&&(r.suggester.onChange(this.createProps(r),t),Z(this,$t,!1),Ey(r.exitReason)&&Z(this,dt,M()))}}mapIgnoredDecorations(t){const e=z(this,de).map(t.mapping,t.doc),r=e.find().filter(({from:s,to:i,spec:o})=>{const a=D(o.char)?o.char.length:1;return i-s!==a});Z(this,de,e.remove(r))}shouldIgnoreMatch({range:t,suggester:{name:e}}){return z(this,de).find().some(({spec:s,from:i})=>i!==t.from?!1:s.specific?s.name===e:!0)}resetState(){Z(this,dt,M()),Z(this,zt,void 0),Z(this,$t,!1),Z(this,Un,!1)}updateReasons(t){const{$pos:e,state:n}=t,r=z(this,Bs),s=z(this,ge),i=n.selection.empty,o=ac(n.selection)?cc({suggesters:s,$pos:e,docChanged:r,selectionEmpty:i}):void 0;Z(this,zt,o&&this.shouldIgnoreMatch(o)?void 0:o),Z(this,dt,Ry({next:z(this,zt),prev:z(this,Hn),state:n,$pos:e}))}addSuggester(t){const e=z(this,ge).find(r=>r.name===t.name),n=uc();if(e)Z(this,ge,z(this,ge).map(r=>r===e?n(t):r));else{const r=[...z(this,ge),n(t)];Z(this,ge,tr(r,(s,i)=>i.priority-s.priority))}return()=>this.removeSuggester(t.name)}removeSuggester(t){const e=D(t)?t:t.name;Z(this,ge,z(this,ge).filter(n=>n.name!==e)),this.clearIgnored(e)}toJSON(){return this.match}apply(t){const{exit:e,change:n}=z(this,dt);if(z(this,Un)&&(Z(this,Un,!1),!(e!=null&&e.suggester.appendTransaction)&&!(n!=null&&n.suggester.appendTransaction)))return this;const{tr:r,state:s}=t,i=r.docChanged||r.selectionSet;return r.getMeta(Jd)||!i&&!z(this,$t)?this:(Z(this,Bs,r.docChanged),this.mapIgnoredDecorations(r),e&&this.resetState(),Z(this,Hn,z(this,zt)),this.updateReasons({$pos:r.selection.$from,state:s}),this)}createDecorations(t){const e=this.match;if(!oc(e))return z(this,de);const{disableDecorations:n}=e.suggester;if(ee(n)?n(t,e):n)return z(this,de);const{range:s,suggester:i}=e,{name:o,suggestTag:a,suggestClassName:l}=i,{from:c,to:u}=s;return this.shouldIgnoreMatch(e)?z(this,de):z(this,de).add(t.doc,[Q.inline(c,u,{nodeName:a,class:o?`${l} suggest-${o}`:l},{name:o})])}},Fy=Gd;Bs=new WeakMap;Er=new WeakMap;ge=new WeakMap;zt=new WeakMap;Hn=new WeakMap;dt=new WeakMap;de=new WeakMap;$t=new WeakMap;Un=new WeakMap;function uc(){const t=new Set;return e=>{if(t.has(e.name))throw new Error(`A suggester already exists with the name '${e.name}'. The name provided must be unique.`);const n={...$y,...e};return t.add(e.name),n}}var Xd=new pr("suggest");function Oa(t){return Xd.getState(t)}function dc(t,e){return Oa(t).addSuggester(e)}function hc(t){t.setMeta(Jd,!0)}function Vy(t,e){return Oa(t).removeSuggester(e)}function Hy(...t){const e=Fy.create(t);return new un({key:Xd,view:n=>(e.init(n),{update:r=>e.changeHandler(r.state.tr,!1)}),state:{init:()=>e,apply:(n,r,s,i)=>e.apply({tr:n,state:i})},appendTransaction:(n,r,s)=>{const i=s.tr;return e.updateWithNextSelection(i),e.changeHandler(i,!0),i.docChanged||i.steps.length>0||i.selectionSet||i.storedMarksSet?(e.setLastChangeFromAppend(),i):null},props:{decorations:n=>e.createDecorations(n)}})}function Ma(t,e){const n=Object.getPrototypeOf(e);let r=t.selection,s=t.doc,i=t.storedMarks;const o=M();for(const[a,l]of Object.entries(e))o[a]={value:l};return Object.create(n,{...o,storedMarks:{get(){return i}},selection:{get(){return r}},doc:{get(){return s}},tr:{get(){return r=t.selection,s=t.doc,i=t.storedMarks,t}}})}function zs(t){return({state:e,dispatch:n,view:r,tr:s})=>t(Ma(s,e),n,r)}function fc(t){return e=>{var n;return R(e.dispatch===void 0||e.dispatch===((n=e.view)==null?void 0:n.dispatch),{code:b.NON_CHAINABLE_COMMAND}),t(e)}}var rt={get isBrowser(){return!!(typeof window<"u"&&typeof window.document<"u"&&window.navigator&&window.navigator.userAgent)},get isJSDOM(){return rt.isBrowser&&window.navigator.userAgent.includes("jsdom")},get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null},get isIos(){return rt.isBrowser&&/iPod|iPhone|iPad/.test(navigator.platform)},get isMac(){return rt.isBrowser&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)},get isApple(){return rt.isNode?process.platform==="darwin":rt.isBrowser?/Mac|iPod|iPhone|iPad/.test(window.navigator.platform):!1},get isDevelopment(){return!1},get isTest(){return!1},get isProduction(){return!0}};function Pt(t,e){var n;const r=d0(t);return((n=r==null?void 0:r.getComputedStyle(t))==null?void 0:n.getPropertyValue(e))??""}function mi(t){return De(t)&&Ge(t.nodeType)&&D(t.nodeName)}function Ie(t){return mi(t)&&t.nodeType===1}function Uy(t){return mi(t)&&t.nodeType===3}function _a(t){const{types:e,node:n}=t;if(!n)return!1;const r=s=>s===n.type||s===n.type.name;return pe(e)?e.some(r):r(e)}function Li(t){const{predicate:e,selection:n}=t,r=Qd(n)?n.selection.$from:Aa(n)?n.$from:n;for(let s=r.depth;s>0;s--){const i=r.node(s),o=s>0?r.before(s):0,a=r.start(s),l=o+i.nodeSize;if(e(i,o))return{pos:o,depth:s,node:i,start:a,end:l}}}function jy(t){const{depth:e}=t,n=e>0?t.before(e):0,r=t.node(e),s=t.start(e),i=n+r.nodeSize;return{pos:n,start:s,node:r,end:i,depth:e}}function as(t){const{types:e,selection:n}=t;return Li({predicate:r=>_a({types:e,node:r}),selection:n})}function Wy(t){const{types:e,selection:n}=t;if(!(!zi(n)||!_a({types:e,node:n.node})))return{pos:n.$from.pos,depth:n.$from.depth,start:n.$from.start(),end:n.$from.pos+n.node.nodeSize,node:n.node}}function Yd(t){return Aa(t)?t.empty:t.selection.empty}function Ky(t){return t.docChanged||t.selectionSet}function qy(t){return!!ls(t)}function ls(t){const{state:e,type:n,attrs:r}=t,{selection:s,doc:i}=e,o=D(n)?i.type.schema.nodes[n]:n;R(o,{code:b.SCHEMA,message:`No node exists for ${n}`});const a=Wy({selection:s,types:n})??Li({predicate:l=>l.type===o,selection:s});return!r||ei(r)||!a||a.node.hasMarkup(o,{...a.node.attrs,...r})?a:void 0}function gi(...t){return e=>{if(!ll(t))return!1;const[n,...r]=t;let s=!1;const i=(...l)=>()=>{if(!ll(l))return!1;s=!0;const[,...c]=l;return gi(...l)({...e,next:i(...c)})},o=i(...r),a=n({...e,next:o});return s||a?a:o()}}function Jy(t,e){const n=new Map,r=M();for(const s of t)for(const[i,o]of he(s)){const l=[...n.get(i)??[],o],c=gi(...l);n.set(i,l),r[i]=e(c)}return r}function Gy(t){return Jy(t,e=>(n,r,s)=>e({state:n,dispatch:r,view:s,tr:n.tr,next:()=>!1}))}function Na(t,e){const n=t.attrs??{};return Object.entries(e).every(([r,s])=>n[r]===s)}function mr(t){return De(t)}function gr(t,e){return pe(e)?gt(e,t[At]):e===t[At]}function Xy(t){return De(t)&&t instanceof Mo}function Yy(t,e){return D(t)?re(e.nodes,t):t}function Zd(t){return De(t)&&t instanceof Ss}function Zy(t,e){return D(t)?re(e.marks,t):t}function Bi(t){return De(t)&&t instanceof Gt}function Qy(t){return De(t)&&t instanceof x}function e0(t){return De(t)&&t instanceof U}function Qd(t){return De(t)&&t instanceof bn}function yr(t){return De(t)&&t instanceof P}function Aa(t){return De(t)&&t instanceof V}function t0(t){return De(t)&&t instanceof nr}function pc(t){const{trState:e,from:n,to:r,type:s,attrs:i={}}=t,{doc:o}=e,a=Zy(s,o.type.schema);if(Object.keys(i).length===0)return o.rangeHasMark(n,r,a);let l=!1;return r>n&&o.nodesBetween(n,r,c=>l?!1:(l=(c.marks??[]).some(d=>d.type!==a?!1:Na(d,i)),!l)),l}function zi(t){return De(t)&&t instanceof I}function eh(t){const{trState:e,type:n,attrs:r={},from:s,to:i}=t,{selection:o,doc:a,storedMarks:l}=e,c=D(n)?a.type.schema.marks[n]:n;if(R(c,{code:b.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}),s&&i)try{return Math.max(s,i)<a.nodeSize&&pc({...t,from:s,to:i})}catch{return!1}return o.empty?(l??o.$from.marks()).some(d=>d.type!==n?!1:Na(d,r??{})):pc({...t,from:o.from,to:o.to})}function Ra(t,e={}){const n=n0(t.type.schema);if(!n)return!1;const{ignoreAttributes:r,ignoreDocAttributes:s}=e;return r?th(n,t):s?n.content.eq(t.content):n.eq(t)}function th(t,e){if(t===e)return!0;const n=t.type===e.type&&U.sameSet(t.marks,e.marks);function r(){if(t.content===e.content)return!0;if(t.content.size!==e.content.size)return!1;const s=[],i=[];t.content.forEach(o=>s.push(o)),e.content.forEach(o=>i.push(o));for(const[o,a]of s.entries()){const l=i[o];if(!l||!th(a,l))return!1}return!0}return n&&r()}function n0(t){var e;return((e=t.nodes.doc)==null?void 0:e.createAndFill())??void 0}function $i(t){for(const e of Object.values(t.nodes))if(e.name!=="doc"&&(e.isBlock||e.isTextblock))return e;R(!1,{code:b.SCHEMA,message:"No default block node found for the provided schema."})}function r0(t){return t.type===$i(t.type.schema)}function Ia(t){return!!t&&t.type.isBlock&&!t.textContent&&!t.childCount}function In(t,e,n){const r=t.parent.childAfter(t.parentOffset);if(!r.node)return;const s=D(e)?e:e.name,i=r.node.marks.find(({type:d})=>d.name===s);let o=t.index(),a=t.start()+r.offset,l=o+1,c=a+r.node.nodeSize;if(!i)return n&&c<n.pos?In(t.doc.resolve(c+1),e,n):void 0;for(;o>0&&i.isInSet(t.parent.child(o-1).marks);)o-=1,a-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&i.isInSet(t.parent.child(l).marks);)c+=t.parent.child(l).nodeSize,l+=1;const u=t.doc.textBetween(a,c,la,`
38
38
 
39
- `);return{from:a,to:c,text:u,mark:i}}function i0(t){var e;return((e=t.content.firstChild)==null?void 0:e.textContent)??""}function o0(t,e){if(!yr(t.selection))return;let{from:n,to:r}=t.selection;const s=(o,a)=>i0(P.between(t.doc.resolve(o),t.doc.resolve(a)).content());for(let o=s(n-1,n);o&&!e.test(o);n--,o=s(n-1,n));for(let o=s(r,r+1);o&&!e.test(o);r++,o=s(r,r+1));if(n===r)return;const i=t.doc.textBetween(n,r,la,`
39
+ `);return{from:a,to:c,text:u,mark:i}}function s0(t){var e;return((e=t.content.firstChild)==null?void 0:e.textContent)??""}function i0(t,e){if(!yr(t.selection))return;let{from:n,to:r}=t.selection;const s=(o,a)=>s0(P.between(t.doc.resolve(o),t.doc.resolve(a)).content());for(let o=s(n-1,n);o&&!e.test(o);n--,o=s(n-1,n));for(let o=s(r,r+1);o&&!e.test(o);r++,o=s(r,r+1));if(n===r)return;const i=t.doc.textBetween(n,r,la,`
40
40
 
41
- `);return{from:n,to:r,text:i}}function a0(t){return o0(t,/\W/)}function mc(t,e=0){const n=pe(t)?t[e]:t;return Tu(D(n),`No match string found for match ${t}`),n??""}function l0(t){return yr(t)?t.$cursor:void 0}function c0(t,e){return Bi(t)?e?t.type===e.nodes.doc:t.type.name==="doc":!1}function u0(t){return De(t)&&Ge(t.anchor)&&Ge(t.head)}function lt(t,e){const n=e.nodeSize-2,r=0;let s;const i=l=>ip({min:r,max:n,value:l});if(Aa(t))return t;if(t==="all")return new Be(e);if(t==="start"?s=r:t==="end"?s=n:n0(t)?s=t.pos:s=t,Ge(s))return s=i(s),P.near(e.resolve(s));if(u0(s)){const l=i(s.anchor),c=i(s.head);return P.between(e.resolve(l),e.resolve(c))}const o=i(s.from),a=i(s.to);return P.between(e.resolve(o),e.resolve(a))}var d0=3;function nh(t){const{content:e,schema:n,document:r,stringHandler:s,onError:i,attempts:o=0}=t,a=i&&o<=d0||o===0;if(R(a,{code:b.INVALID_CONTENT,message:"The invalid content has been called recursively more than ${MAX_ATTEMPTS} times. The content is invalid and the error handler has not been able to recover properly."}),D(e))return R(s,{code:b.INVALID_CONTENT,message:`The string '${e}' was added to the editor, but no \`stringHandler\` was added. Please provide a valid string handler which transforms your content to a \`ProsemirrorNode\` to prevent this error.`}),s({document:r,content:e,schema:n});if(Qd(e))return e.doc;if(Bi(e))return e;try{return n.nodeFromJSON(e)}catch(l){const c=x0({schema:n,error:l,json:e}),u=i==null?void 0:i(c);return R(u,{code:b.INVALID_CONTENT,message:`An error occurred when processing the content. Please provide an \`onError\` handler to process the invalid content: ${JSON.stringify(c.invalidContent,null,2)}`}),nh({...t,content:u,attempts:o+1})}}function Fi(){const t=ad();if(t)return t;throw new Error(`Unable to retrieve the document from the global scope.
41
+ `);return{from:n,to:r,text:i}}function o0(t){return i0(t,/\W/)}function mc(t,e=0){const n=pe(t)?t[e]:t;return Tu(D(n),`No match string found for match ${t}`),n??""}function a0(t){return yr(t)?t.$cursor:void 0}function l0(t,e){return Bi(t)?e?t.type===e.nodes.doc:t.type.name==="doc":!1}function c0(t){return De(t)&&Ge(t.anchor)&&Ge(t.head)}function lt(t,e){const n=e.nodeSize-2,r=0;let s;const i=l=>ip({min:r,max:n,value:l});if(Aa(t))return t;if(t==="all")return new Be(e);if(t==="start"?s=r:t==="end"?s=n:t0(t)?s=t.pos:s=t,Ge(s))return s=i(s),P.near(e.resolve(s));if(c0(s)){const l=i(s.anchor),c=i(s.head);return P.between(e.resolve(l),e.resolve(c))}const o=i(s.from),a=i(s.to);return P.between(e.resolve(o),e.resolve(a))}var u0=3;function nh(t){const{content:e,schema:n,document:r,stringHandler:s,onError:i,attempts:o=0}=t,a=i&&o<=u0||o===0;if(R(a,{code:b.INVALID_CONTENT,message:"The invalid content has been called recursively more than ${MAX_ATTEMPTS} times. The content is invalid and the error handler has not been able to recover properly."}),D(e))return R(s,{code:b.INVALID_CONTENT,message:`The string '${e}' was added to the editor, but no \`stringHandler\` was added. Please provide a valid string handler which transforms your content to a \`ProsemirrorNode\` to prevent this error.`}),s({document:r,content:e,schema:n});if(Qd(e))return e.doc;if(Bi(e))return e;try{return n.nodeFromJSON(e)}catch(l){const c=y0({schema:n,error:l,json:e}),u=i==null?void 0:i(c);return R(u,{code:b.INVALID_CONTENT,message:`An error occurred when processing the content. Please provide an \`onError\` handler to process the invalid content: ${JSON.stringify(c.invalidContent,null,2)}`}),nh({...t,content:u,attempts:o+1})}}function Fi(){const t=ad();if(t)return t;throw new Error(`Unable to retrieve the document from the global scope.
42
42
  It seems that you are running Remirror in a non-browser environment. Remirror need browser APIs to work.
43
43
  If you are using Jest (or other testing frameworks), make sure that you are using the JSDOM environment (https://jestjs.io/docs/29.0/configuration#testenvironment-string).
44
44
  If you are using Next.js (or other server-side rendering frameworks), please use dynamic import with \`ssr: false\` to load the editor component without rendering it on the server (https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr).
45
- If you are using Node.js, you can install JSDOM and Remirror will try to use it automatically, or you can create a fake document and pass it to Remirror`)}function rh(t){var e;return(t==null?void 0:t.defaultView)??(typeof window<"u"?window:void 0)??((e=ad())==null?void 0:e.defaultView)}function h0(t){return rh(t==null?void 0:t.ownerDocument)}function f0(t){const e=rh(t)??Fi().defaultView;if(e)return e;throw new Error("Unable to retrieve the window from the global scope")}function p0(t,e=Fi()){const n=c0(t,t.type.schema)?t.content:x.from(t);return qe.fromSchema(t.type.schema).serializeFragment(n,{document:e})}function m0(t,e){return new(f0(e)).DOMParser().parseFromString(`<body>${t}</body>`,"text/html").body}function g0(t,e=Fi()){const n=e.createElement("div");return n.append(p0(t,e)),n.innerHTML}function jo(t){const{content:e,schema:n,document:r,fragment:s=!1,...i}=t,o=m0(e,r),a=da.fromSchema(n);return s?a.parseSlice(o,{...gc,...i}).content:a.parse(o,{...gc,...i})}var gc={preserveWhitespace:!1},y0={remove(t,e){let n=t;for(const r of e)r.invalidParentNode||(n=ap(r.path,n));return n}};function x0({json:t,schema:e,...n}){const r=new Set(Qs(e.marks)),s=new Set(Qs(e.nodes)),i=sh({json:t,path:[],validNodes:s,validMarks:r});return{json:t,invalidContent:i,transformers:y0,...n}}function sh(t){const{json:e,validMarks:n,validNodes:r,path:s=[]}=t,i={validMarks:n,validNodes:r},o=[],{type:a,marks:l,content:c}=e;let{invalidParentMark:u=!1,invalidParentNode:d=!1}=t;if(l){const h=[];for(const[f,p]of l.entries()){const m=D(p)?p:p.type;n.has(m)||(h.unshift({name:m,path:[...s,"marks",`${f}`],type:"mark",invalidParentMark:u,invalidParentNode:d}),u=!0)}o.push(...h)}if(r.has(a)||(o.push({name:a,type:"node",path:s,invalidParentMark:u,invalidParentNode:d}),d=!0),c){const h=[];for(const[f,p]of c.entries())h.unshift(...sh({...i,json:p,path:[...s,"content",`${f}`],invalidParentMark:u,invalidParentNode:d}));o.unshift(...h)}return o}function b0(t){return!!(yr(t)&&t.$cursor&&t.$cursor.parentOffset>=t.$cursor.parent.content.size)}function Wo(t){return!!(yr(t)&&t.$cursor&&t.$cursor.parentOffset<=0)}function yc(t){const e=V.atStart(t.$anchor.doc);return!!(Wo(t)&&e.anchor===t.anchor)}function k0({tr:t,dispatch:e}){const{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&fr(s);return!Ge(i)||!s?!1:(e==null||e(t.lift(s,i).scrollIntoView()),!0)}function ih(t,e={},n){return function(r){const{tr:s,dispatch:i,state:o}=r,a=D(t)?re(o.schema.nodes,t):t,{from:l,to:c}=lt(n??s.selection,s.doc),u=s.doc.resolve(l),d=s.doc.resolve(c),h=u.blockRange(d),f=h&&fa(h,a,e);return!f||!h?!1:(i==null||i(s.wrap(h,f).scrollIntoView()),!0)}}function S0(t,e={},n){return r=>{const{tr:s,state:i}=r,o=D(t)?re(i.schema.nodes,t):t;return ls({state:s,type:o,attrs:e})?k0(r):ih(t,e,n)(r)}}function Ko(t,e,n,r=!0){return function(s){const{tr:i,dispatch:o,state:a}=s,l=D(t)?re(a.schema.nodes,t):t,{from:c,to:u}=lt(n??i.selection,i.doc);let d=!1,h;return i.doc.nodesBetween(c,u,(f,p)=>{if(d)return!1;if(!f.isTextblock||f.hasMarkup(l,e))return;if(f.type===l){d=!0,h=f.attrs;return}const m=i.doc.resolve(p),g=m.index();d=m.parent.canReplaceWith(g,g+1,l),d&&(h=m.parent.attrs)}),d?(o==null||o(i.setBlockType(c,u,l,{...r?h:{},...e}).scrollIntoView()),!0):!1}}function v0(t){return e=>{const{tr:n,state:r}=e,{type:s,attrs:i,preserveAttrs:o=!0}=t,a=ls({state:n,type:s,attrs:i}),l=t.toggleType??$i(r.schema);if(a)return Ko(l,{...o?a.node.attrs:{},...i})(e);const c=ls({state:n,type:l,attrs:i});return Ko(s,{...o?c==null?void 0:c.node.attrs:{},...i})(e)}}function w0(t=0){const e=navigator.userAgent.match(/Chrom(e|ium)\/(\d+)\./);return e?Number.parseInt(re(e,2),10)>=t:!1}function E0(t,e){let{head:n,empty:r,anchor:s}=t;for(const i of e.steps)n=i.getMap().map(n);r?e.setSelection(P.near(e.doc.resolve(n))):e.setSelection(P.between(e.doc.resolve(s),e.doc.resolve(n)))}function C0(t){const{attrs:e={},appendText:n="",content:r="",keepSelection:s=!1,range:i}=t;return({state:o,tr:a,dispatch:l})=>{var c;const u=o.schema,d=lt(t.selection??i??a.selection,a.doc),h=d.$from.index(),{from:f,to:p,$from:m}=d,g=D(t.type)?u.nodes[t.type]??u.marks[t.type]:t.type;if(R(D(t.type)?g:!0,{code:b.SCHEMA,message:`Schema contains no marks or nodes with name ${g}`}),Yy(g)){if(!m.parent.canReplaceWith(h,h,g))return!1;a.replaceWith(f,p,g.create(e,r?u.text(r):void 0))}else R(r,{message:"`replaceText` cannot be called without content when using a mark type"}),a.replaceWith(f,p,u.text(r,Zd(g)?[g.create(e)]:void 0));return n&&a.insertText(n),s&&E0(o.selection,a),l&&(w0(60)&&((c=document.getSelection())==null||c.empty()),l(a)),!0}}function oh(t,e){const n=t.parent.childAfter(t.parentOffset);if(!n.node)return;const{marks:r,nodeSize:s}=n.node;if(r[0])return r[0].type;const o=t.start()+n.offset+s;return oh(t.doc.resolve(o+1))}function T0(t){return({dispatch:e,tr:n,state:r})=>{const{type:s,expand:i=!0,range:o}=t,a=lt(t.selection??o??n.selection,n.doc);let{from:l,to:c,$from:u,$to:d}=a;const h=D(s)?r.schema.marks[s]:s;h!==null&&R(h,{code:b.SCHEMA,message:`Mark type: ${s} does not exist on the current schema.`});const f=h??oh(u);if(!f)return!1;const p=In(u,f,d);return i&&p&&(l=Math.max(0,Math.min(l,p.from)),c=Math.min(Math.max(c,p.to),n.doc.nodeSize-2)),e==null||e(n.removeMark(l,Ge(c)?c:l,Zd(h)?h:void 0)),!0}}function yi(t){const{regexp:e,type:n,getAttributes:r,ignoreWhitespace:s=!1,beforeDispatch:i,updateCaptured:o,shouldSkip:a,invalidMarks:l}=t;let c;const u=new ws(e,(d,h,f,p)=>{const{tr:m,schema:g}=d;c||(c=D(n)?g.marks[n]:n,R(c,{code:b.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}));let y=h[1],E=h[0];const L=O0({captureGroup:y,fullMatch:E,end:p,start:f,rule:u,state:d,ignoreWhitespace:s,invalidMarks:l,shouldSkip:a,updateCaptured:o});if(!L)return null;({start:f,end:p,captureGroup:y,fullMatch:E}=L);const q=ee(r)?r(h):r;let J=p,F=[];if(y){const oe=E.search(/\S/),Fe=f+E.indexOf(y),B=Fe+y.length;F=m.storedMarks??[],B<p&&m.delete(B,p),Fe>f&&m.delete(f+oe,Fe),J=f+oe+y.length}return m.addMark(f,J,c.create(q)),m.setStoredMarks(F),i==null||i({tr:m,match:h,start:f,end:p}),m});return u}function O0({captureGroup:t,fullMatch:e,end:n,start:r,rule:s,ignoreWhitespace:i,shouldSkip:o,updateCaptured:a,state:l,invalidMarks:c}){var u;if(e==null)return null;const d=(a==null?void 0:a({captureGroup:t,fullMatch:e,start:r,end:n}))??{};t=d.captureGroup??t,e=d.fullMatch??e,r=d.start??r,n=d.end??n;const h=l.doc.resolve(r),f=l.doc.resolve(n);return c&&Ho({$from:h,$to:f},c)||s.invalidMarks&&Ho({$from:h,$to:f},s.invalidMarks)||i&&(t==null?void 0:t.trim())===""||o!=null&&o({state:l,captureGroup:t,fullMatch:e,start:r,end:n,ruleType:"mark"})||(u=s.shouldSkip)!=null&&u.call(s,{state:l,captureGroup:t,fullMatch:e,start:r,end:n,ruleType:"mark"})?null:{captureGroup:t,end:n,fullMatch:e,start:r}}var M0=function(){const e=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];e.forEach(i=>{(i?i.split(" "):[]).forEach(a=>{if(a.startsWith("atm_")){const[,l]=a.split("_");n[l]=a}else r.push(a)})});const s=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&s.push(n[i]);return s.push(...r),s.join(" ")},_0=M0;const ah=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function N0(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const lh=(t,e,n)=>{let r=N0(t,n);if(!r)return!1;let s=ch(r);if(!s){let o=r.blockRange(),a=o&&fr(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(!i.type.spec.isolating&&dh(t,s,e))return!0;if(r.parent.content.size==0&&(or(i,"end")||I.isSelectable(i))){let o=pa(t.doc,r.before(),r.after(),S.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(or(i,"end")?V.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):I.create(a.doc,s.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1};function or(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const A0=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=ch(r)}let o=i&&i.nodeBefore;return!o||!I.isSelectable(o)?!1:(e&&e(t.tr.setSelection(I.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function ch(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function R0(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const I0=(t,e,n)=>{let r=R0(t,n);if(!r)return!1;let s=uh(r);if(!s)return!1;let i=s.nodeAfter;if(dh(t,s,e))return!0;if(r.parent.content.size==0&&(or(i,"start")||I.isSelectable(i))){let o=pa(t.doc,r.before(),r.after(),S.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(or(i,"start")?V.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):I.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},D0=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=uh(r)}let o=i&&i.nodeAfter;return!o||!I.isSelectable(o)?!1:(e&&e(t.tr.setSelection(I.create(t.doc,i.pos)).scrollIntoView()),!0)};function uh(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const P0=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
46
- `).scrollIntoView()),!0)};function Da(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const L0=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=Da(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(V.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},B0=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Be||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=Da(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=t.tr.insert(o,i.createAndFill());a.setSelection(P.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},z0=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Xn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&fr(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function $0(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof I&&e.selection.node.isBlock)return!r.parentOffset||!Xn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(n){let i=s.parentOffset==s.parent.content.size,o=e.tr;(e.selection instanceof P||e.selection instanceof Be)&&o.deleteSelection();let a=r.depth==0?null:Da(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=t&&t(s.parent,i),c=l?[l]:i&&a?[{type:a}]:void 0,u=Xn(o.doc,o.mapping.map(r.pos),1,c);if(!c&&!u&&Xn(o.doc,o.mapping.map(r.pos),1,a?[{type:a}]:void 0)&&(a&&(c=[{type:a}]),u=!0),u&&(o.split(o.mapping.map(r.pos),1,c),!i&&!r.parentOffset&&r.parent.type!=a)){let d=o.mapping.map(r.before()),h=o.doc.resolve(d);a&&r.node(-1).canReplaceWith(h.index(),h.index()+1,a)&&o.setNodeMarkup(o.mapping.map(r.before()),a)}n(o.scrollIntoView())}return!0}}const F0=$0(),V0=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(I.create(t.doc,s))),!0)},H0=(t,e)=>(e&&e(t.tr.setSelection(new Be(t.doc))),!0);function U0(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||vs(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function dh(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i,o;if(r.type.spec.isolating||s.type.spec.isolating)return!1;if(U0(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(i=(o=r.contentMatchAt(r.childCount)).findWrapping(s.type))&&o.matchType(i[0]||s.type).validEnd){if(n){let d=e.pos+s.nodeSize,h=x.empty;for(let m=i.length-1;m>=0;m--)h=x.from(i[m].create(null,h));h=x.from(r.copy(h));let f=t.tr.step(new fe(e.pos-1,d,e.pos,d,new S(h,1,0),i.length,!0)),p=d+2*i.length;vs(f.doc,p)&&f.join(p),n(f.scrollIntoView())}return!0}let l=V.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&fr(c);if(u!=null&&u>=e.depth)return n&&n(t.tr.lift(c,u).scrollIntoView()),!0;if(a&&or(s,"start",!0)&&or(r,"end")){let d=r,h=[];for(;h.push(d),!d.isTextblock;)d=d.lastChild;let f=s,p=1;for(;!f.isTextblock;f=f.firstChild)p++;if(d.canReplace(d.childCount,d.childCount,f.content)){if(n){let m=x.empty;for(let y=h.length-1;y>=0;y--)m=x.from(h[y].copy(m));let g=t.tr.step(new fe(e.pos-h.length,e.pos+s.nodeSize,e.pos+p,e.pos+s.nodeSize-p,new S(m,h.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function hh(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(P.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const j0=hh(-1),W0=hh(1);function K0(t,e,n){for(let r=0;r<e.length;r++){let{$from:s,$to:i}=e[r],o=s.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(s.pos,i.pos,a=>{if(o)return!1;o=a.inlineContent&&a.type.allowsMarkType(n)}),o)return!0}return!1}function q0(t,e=null){return function(n,r){let{empty:s,$cursor:i,ranges:o}=n.selection;if(s&&!i||!K0(n.doc,o,t))return!1;if(r)if(i)t.isInSet(n.storedMarks||i.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{let a=!1,l=n.tr;for(let c=0;!a&&c<o.length;c++){let{$from:u,$to:d}=o[c];a=n.doc.rangeHasMark(u.pos,d.pos,t)}for(let c=0;c<o.length;c++){let{$from:u,$to:d}=o[c];if(a)l.removeMark(u.pos,d.pos,t);else{let h=u.pos,f=d.pos,p=u.nodeAfter,m=d.nodeBefore,g=p&&p.isText?/^\s*/.exec(p.text)[0].length:0,y=m&&m.isText?/\s*$/.exec(m.text)[0].length:0;h+g<f&&(h+=g,f-=y),l.addMark(h,f,t.create(e))}}r(l.scrollIntoView())}return!0}}function Vi(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}let ho=Vi(ah,lh,A0),xc=Vi(ah,I0,D0);const Tt={Enter:Vi(P0,B0,z0,F0),"Mod-Enter":L0,Backspace:ho,"Mod-Backspace":ho,"Shift-Backspace":ho,Delete:xc,"Mod-Delete":xc,"Mod-a":H0},fh={"Ctrl-h":Tt.Backspace,"Alt-Backspace":Tt["Mod-Backspace"],"Ctrl-d":Tt.Delete,"Ctrl-Alt-Backspace":Tt["Mod-Delete"],"Alt-Delete":Tt["Mod-Delete"],"Alt-d":Tt["Mod-Delete"],"Ctrl-a":j0,"Ctrl-e":W0};for(let t in Tt)fh[t]=Tt[t];const J0=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,fo=J0?fh:Tt;var rn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},G0=typeof navigator<"u"&&/Mac/.test(navigator.platform),X0=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Se=0;Se<10;Se++)rn[48+Se]=rn[96+Se]=String(Se);for(var Se=1;Se<=24;Se++)rn[Se+111]="F"+Se;for(var Se=65;Se<=90;Se++)rn[Se]=String.fromCharCode(Se+32),xi[Se]=String.fromCharCode(Se);for(var po in rn)xi.hasOwnProperty(po)||(xi[po]=rn[po]);function Y0(t){var e=G0&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||X0&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xi:rn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Z0=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Q0(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Z0?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function ex(t){let e=Object.create(null);for(let n in t)e[Q0(n)]=t[n];return e}function mo(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function ph(t){let e=ex(t);return function(n,r){let s=Y0(r),i,o=e[mo(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[mo(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||s.charCodeAt(0)>127)&&(i=rn[r.keyCode])&&i!=s){let a=e[mo(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function tx(t){const e=tr(t,(i,o)=>(o.priority??X.Low)-(i.priority??X.Low)),n=[],r=[];for(const i of e)lx(i)?n.push(i):r.push(i);let s;return new un({key:nx,view:i=>(s=i,{}),props:{transformPasted:i=>{var o,a,l;const c=s.state.selection.$from,u=c.node().type.name,d=new Set(c.marks().map(h=>h.type.name));for(const h of n){if((o=h.ignoredNodes)!=null&&o.includes(u)||(a=h.ignoredMarks)!=null&&a.some(E=>d.has(E)))continue;const f=((l=i.content.firstChild)==null?void 0:l.textContent)??"",p=!s.state.selection.empty&&i.content.childCount===1&&f,m=ua(f,h.regexp)[0];if(p&&m&&h.type==="mark"&&h.replaceSelection){const{from:E,to:L}=s.state.selection,q=s.state.doc.slice(E,L),J=q.content.textBetween(0,q.content.size);if(typeof h.replaceSelection!="boolean"?h.replaceSelection(J):h.replaceSelection){const F=[],{getAttributes:oe,markType:Fe}=h,B=ee(oe)?oe(m,!0):oe,ut=Fe.create(B);return q.content.forEach(Dt=>{if(Dt.isText){const Xi=ut.addToSet(Dt.marks);F.push(Dt.mark(Xi))}}),S.maxOpen(x.fromArray(F))}}const{nodes:g,transformed:y}=ox(i.content,h,s.state.schema);y&&(i=h.type==="node"&&h.nodeType.isBlock?new S(x.fromArray(g),0,0):new S(x.fromArray(g),i.openStart,i.openEnd))}return hx(i)},handleDOMEvents:{paste:(i,o)=>{var a,l;const c=o;if(!((l=(a=i.props).editable)!=null&&l.call(a,i.state)))return!1;const{clipboardData:u}=c;if(!u)return!1;const d=[...u.items].map(f=>f.getAsFile()).filter(f=>!!f);if(d.length===0)return!1;const{selection:h}=i.state;for(const{fileHandler:f,regexp:p}of r){const m=p?d.filter(g=>p.test(g.type)):d;if(m.length!==0&&f({event:c,files:m,selection:h,view:i,type:"paste"}))return c.preventDefault(),!0}return!1},drop:(i,o)=>{var a,l,c;const u=o;if(!((l=(a=i.props).editable)!=null&&l.call(a,i.state)))return!1;const{dataTransfer:d,clientX:h,clientY:f}=u;if(!d)return!1;const p=dx(u);if(p.length===0)return!1;const m=((c=i.posAtCoords({left:h,top:f}))==null?void 0:c.pos)??i.state.selection.anchor;for(const{fileHandler:g,regexp:y}of r){const E=y?p.filter(L=>y.test(L.type)):p;if(E.length!==0&&g({event:u,files:E,pos:m,view:i,type:"drop"}))return u.preventDefault(),!0}return!1}}}})}var nx=new pr("pasteRule");function go(t,e){return function n(r){const{fragment:s,rule:i,nodes:o}=r,{regexp:a,ignoreWhitespace:l,ignoredMarks:c,ignoredNodes:u}=i;let d=!1;return s.forEach(h=>{if(u!=null&&u.includes(h.type.name)||cx(h)){o.push(h);return}if(!h.isText){const m=n({fragment:h.content,rule:i,nodes:[]});d||(d=m.transformed);const g=x.fromArray(m.nodes);h.type.validContent(g)?o.push(h.copy(g)):o.push(...m.nodes);return}if(h.marks.some(m=>ux(m)||(c==null?void 0:c.includes(m.type.name)))){o.push(h);return}const f=h.text??"";let p=0;for(const m of ua(f,a)){const g=m[1],y=m[0];if(l&&(g==null?void 0:g.trim())===""||!y)return;const E=m.index,L=E+y.length;E>p&&o.push(h.cut(p,E));let q=h.cut(E,L);if(y&&g){const J=y.search(/\S/),F=E+y.indexOf(g),oe=F+g.length;J&&o.push(h.cut(E,E+J)),q=h.cut(F,oe)}t({nodes:o,rule:i,textNode:q,match:m,schema:e}),d=!0,p=L}f&&p<f.length&&o.push(h.cut(p))}),{nodes:o,transformed:d}}}function rx(t){const{nodes:e,rule:n,textNode:r,match:s,schema:i}=t,{transformMatch:o,getAttributes:a,markType:l}=n,c=ee(a)?a(s,!1):a,u=r.text??"",d=l.create(c),h=o==null?void 0:o(s);if(h==="")return;if(h===!1){e.push(i.text(u,r.marks));return}const f=d.addToSet(r.marks);e.push(i.text(h??u,f))}function sx(t){const{nodes:e,rule:n,textNode:r,match:s,schema:i}=t,{transformMatch:o}=n,a=o==null?void 0:o(s);if(a===""||a===!1)return;const l=a??r.text??"";e.push(i.text(l,r.marks))}function ix(t){const{nodes:e,rule:n,textNode:r,match:s}=t,{getAttributes:i,nodeType:o,getContent:a}=n,l=ee(i)?i(s,!1):i,c=(a?a(s):r)||void 0;e.push(o.createChecked(l,c))}function ox(t,e,n){const r=[];switch(e.type){case"mark":return go(rx,n)({fragment:t,nodes:r,rule:e});case"node":return go(ix,n)({fragment:t,nodes:r,rule:e});default:return go(sx,n)({fragment:t,nodes:r,rule:e})}}var ax=["mark","node","text"];function lx(t){return gt(ax,t.type)}function cx(t){var e;return t.type.spec.code||((e=t.type.spec.group)==null?void 0:e.split(" ").includes("code"))}function ux(t){var e;return t.type.name==="code"||((e=t.type.spec.group)==null?void 0:e.split(" ").includes("code"))}function dx(t){var e,n;const{dataTransfer:r}=t;return r?((e=r.files)==null?void 0:e.length)>0?[...r.files]:(n=r.items)!=null&&n.length?[...r.items].map(s=>s.getAsFile()).filter(s=>!!s):[]:[]}function hx(t){const e=S.maxOpen(t.content);return e.openStart<t.openStart||e.openEnd<t.openEnd?e:t}let Hi=()=>({events:{},emit(t,...e){(this.events[t]||[]).forEach(n=>n(...e))},on(t,e){return(this.events[t]=this.events[t]||[]).push(e),()=>this.events[t]=(this.events[t]||[]).filter(n=>n!==e)}});var fx=Object.defineProperty,px=Object.getOwnPropertyDescriptor,T=(t,e,n,r)=>{for(var s=r>1?void 0:r?px(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&fx(e,n,s),s},mh=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},v=(t,e,n)=>(mh(t,e,"read from private field"),n?n.call(t):e.get(t)),ce=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ye=(t,e,n,r)=>(mh(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function mx(t,e){return t===e}function bc(t){const{previousOptions:e,update:n,equals:r=mx}=t,s=xn({...e,...n}),i=M(),o=Qs(e);for(const l of o){const c=e[l],u=s[l];if(r(c,u)){i[l]={changed:!1};continue}i[l]={changed:!0,previousValue:c,value:u}}const a=l=>{const c=M();for(const u of l){const d=i[u];d!=null&&d.changed&&(c[u]=d.value)}return c};return{changes:xn(i),options:s,pickChanged:a}}var gx={[b.DUPLICATE_HELPER_NAMES]:"helper method",[b.DUPLICATE_COMMAND_NAMES]:"command method"};function gh(t){const{name:e,set:n,code:r}=t,s=gx[r];R(!n.has(e),{code:r,message:`There is a naming conflict for the name: ${e} used in this '${s}'. Please rename or remove from the editor to avoid runtime errors.`}),n.add(e)}function qo(...t){return es(_0(...t).split(" ")).join(" ")}var kc="__IGNORE__",yx="__ALL__",xr=class{constructor(t,...[e]){this["~O"]={},this._mappedHandlers=M(),this.populateMappedHandlers(),this._options=this._initialOptions=sp(t,this.constructor.defaultOptions,e??M(),this.createDefaultHandlerOptions()),this._dynamicKeys=this.getDynamicKeys(),this.init()}get options(){return this._options}get dynamicKeys(){return this._dynamicKeys}get initialOptions(){return this._initialOptions}init(){}getDynamicKeys(){const t=[],{customHandlerKeys:e,handlerKeys:n,staticKeys:r}=this.constructor;for(const s of Qs(this._options))r.includes(s)||n.includes(s)||e.includes(s)||t.push(s);return t}ensureAllKeysAreDynamic(t){}setOptions(t){var e;const n=this.getDynamicOptions();this.ensureAllKeysAreDynamic(t);const{changes:r,options:s,pickChanged:i}=bc({previousOptions:n,update:t});this.updateDynamicOptions(s),(e=this.onSetOptions)==null||e.call(this,{reason:"set",changes:r,options:s,pickChanged:i,initialOptions:this._initialOptions})}resetOptions(){var t;const e=this.getDynamicOptions(),{changes:n,options:r,pickChanged:s}=bc({previousOptions:e,update:this._initialOptions});this.updateDynamicOptions(r),(t=this.onSetOptions)==null||t.call(this,{reason:"reset",options:r,changes:n,pickChanged:s,initialOptions:this._initialOptions})}getDynamicOptions(){return vu(this._options,[...this.constructor.customHandlerKeys,...this.constructor.handlerKeys])}updateDynamicOptions(t){this._options={...this._options,...t}}populateMappedHandlers(){for(const t of this.constructor.handlerKeys)this._mappedHandlers[t]=[]}createDefaultHandlerOptions(){const t=M();for(const e of this.constructor.handlerKeys)t[e]=(...n)=>{var r;const{handlerKeyOptions:s}=this.constructor,i=(r=s[e])==null?void 0:r.reducer;let o=i==null?void 0:i.getDefault(...n);for(const[,a]of this._mappedHandlers[e]){const l=a(...n);if(o=i?i.accumulator(o,l,...n):l,xx(s,o,e))return o}return o};return t}addHandler(t,e,n=X.Default){return this._mappedHandlers[t].push([n,e]),this.sortHandlers(t),()=>this._mappedHandlers[t]=this._mappedHandlers[t].filter(([,r])=>r!==e)}hasHandlers(t){return(this._mappedHandlers[t]??[]).length>0}sortHandlers(t){this._mappedHandlers[t]=tr(this._mappedHandlers[t],([e],[n])=>n-e)}addCustomHandler(t,e){var n;return((n=this.onAddCustomHandler)==null?void 0:n.call(this,{[t]:e}))??_u}};xr.defaultOptions={};xr.staticKeys=[];xr.handlerKeys=[];xr.handlerKeyOptions={};xr.customHandlerKeys=[];function xx(t,e,n){const{[yx]:r}=t,s=t[n];return!r&&!s?!1:!!(s&&s.earlyReturnValue!==kc&&(ee(s.earlyReturnValue)?s.earlyReturnValue(e)===!0:e===s.earlyReturnValue)||r&&r.earlyReturnValue!==kc&&(ee(r.earlyReturnValue)?r.earlyReturnValue(e)===!0:e===r.earlyReturnValue))}var Ui=class extends xr{constructor(...t){super(bx,...t),this["~E"]={},this._extensions=cp(this.createExtensions(),e=>e.constructor),this.extensionMap=new Map;for(const e of this._extensions)this.extensionMap.set(e.constructor,e)}get priority(){return this.priorityOverride??this.options.priority??this.constructor.defaultPriority}get constructorName(){return`${Cu(this.name)}Extension`}get store(){return R(this._store,{code:b.MANAGER_PHASE_ERROR,message:"An error occurred while attempting to access the 'extension.store' when the Manager has not yet set created the lifecycle methods."}),xn(this._store,{requireKeys:!0})}get extensions(){return this._extensions}replaceChildExtension(t,e){this.extensionMap.has(t)&&(this.extensionMap.set(t,e),this._extensions=this.extensions.map(n=>e.constructor===t?e:n))}createExtensions(){return[]}getExtension(t){const e=this.extensionMap.get(t);return R(e,{code:b.INVALID_GET_EXTENSION,message:`'${t.name}' does not exist within the preset: '${this.name}'`}),e}isOfType(t){return this.constructor===t}setStore(t){this._store||(this._store=t)}clone(...t){return new this.constructor(...t)}setPriority(t){this.priorityOverride=t}};Ui.defaultPriority=X.Default;var te=class extends Ui{static get[At](){return xe.PlainExtensionConstructor}get[At](){return xe.PlainExtension}},ji=class extends Ui{static get[At](){return xe.MarkExtensionConstructor}get[At](){return xe.MarkExtension}get type(){return re(this.store.schema.marks,this.name)}constructor(...t){super(...t)}};ji.disableExtraAttributes=!1;var Rt=class extends Ui{static get[At](){return xe.NodeExtensionConstructor}get[At](){return xe.NodeExtension}get type(){return re(this.store.schema.nodes,this.name)}constructor(...t){super(...t)}};Rt.disableExtraAttributes=!1;var bx={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function yh(t){return mr(t)&&gr(t,[xe.PlainExtension,xe.MarkExtension,xe.NodeExtension])}function kx(t){return mr(t)&&gr(t,[xe.PlainExtensionConstructor,xe.MarkExtensionConstructor,xe.NodeExtensionConstructor])}function xh(t){return mr(t)&&gr(t,xe.PlainExtension)}function Ts(t){return mr(t)&&gr(t,xe.NodeExtension)}function Wi(t){return mr(t)&&gr(t,xe.MarkExtension)}function G(t){return e=>{const{defaultOptions:n,customHandlerKeys:r,handlerKeys:s,staticKeys:i,defaultPriority:o,handlerKeyOptions:a,...l}=t,c=e;n&&(c.defaultOptions=n),o&&(c.defaultPriority=o),a&&(c.handlerKeyOptions=a),c.staticKeys=i??[],c.handlerKeys=s??[],c.customHandlerKeys=r??[];for(const[u,d]of Object.entries(l))c[u]||(c[u]=d);return c}}var Sx=class extends te{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=M(),this.updateAttributes=(t=!0)=>{this.transformAttributes(),t&&this.store.commands.forceUpdate("attributes")}}get name(){return"attributes"}onCreate(){this.transformAttributes(),this.store.setExtensionStore("updateAttributes",this.updateAttributes)}transformAttributes(){var t,e,n;if(this.attributeObject=M(),(t=this.store.managerSettings.exclude)!=null&&t.attributes){this.store.setStoreKey("attributes",this.attributeObject);return}this.attributeList=[];for(const r of this.store.extensions){if((e=r.options.exclude)!=null&&e.attributes)continue;const s=(n=r.createAttributes)==null?void 0:n.call(r),i={...s,class:qo(...r.classNames??[],s==null?void 0:s.class)};this.attributeList.unshift(i)}for(const r of this.attributeList)this.attributeObject={...this.attributeObject,...r,class:qo(this.attributeObject.class,r.class)};this.store.setStoreKey("attributes",this.attributeObject)}};function se(t={}){return(e,n,r)=>{(e.decoratedHelpers??(e.decoratedHelpers={}))[n]=t}}function _(t={}){return(e,n,r)=>{(e.decoratedCommands??(e.decoratedCommands={}))[n]=t}}function Ye(t){return(e,n,r)=>{(e.decoratedKeybindings??(e.decoratedKeybindings={}))[n]=t}}var vx=class{constructor(t){this.promiseCreator=t,this.failureHandlers=[],this.successHandlers=[],this.validateHandlers=[],this.generateCommand=()=>e=>{let n=!0;const{view:r,tr:s,dispatch:i}=e;if(!r)return!1;for(const a of this.validateHandlers)if(!a({...e,dispatch:()=>{}})){n=!1;break}return!i||!n?n:(this.promiseCreator(e).then(a=>{this.runHandlers(this.successHandlers,{value:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}).catch(a=>{this.runHandlers(this.failureHandlers,{error:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}),i(s),!0)}}validate(t,e="push"){return this.validateHandlers[e](t),this}success(t,e="push"){return this.successHandlers[e](t),this}failure(t,e="push"){return this.failureHandlers[e](t),this}runHandlers(t,e){var n;for(const r of t)if(!r({...e,dispatch:()=>{}}))break;(n=e.dispatch)==null||n.call(e,e.tr)}};function ar(t){const{type:e,attrs:n,range:r,selection:s}=t;return i=>{const{dispatch:o,tr:a,state:l}=i,c=D(e)?l.schema.marks[e]:e;if(R(c,{code:b.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),r||s){const{from:u,to:d}=lt(s??r??a.selection,a.doc);return eh({trState:a,type:e,...r})?o==null||o(a.removeMark(u,d,c)):o==null||o(a.addMark(u,d,c.create(n))),!0}return zs(q0(c,n))(i)}}function wx(t,e,n){for(const{$from:r,$to:s}of n){let i=r.depth===0?e.type.allowsMarkType(t):!1;if(e.nodesBetween(r.pos,s.pos,o=>{if(i)return!1;i=o.inlineContent&&o.type.allowsMarkType(t)}),i)return!0}return!1}function Ex(t,e,n){return({tr:r,dispatch:s,state:i})=>{const o=lt(n??r.selection,r.doc),a=l0(o),l=D(t)?i.schema.marks[t]:t;if(R(l,{code:b.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),o.empty&&!a||!wx(l,r.doc,o.ranges))return!1;if(!s)return!0;if(a)return r.removeStoredMark(l),e&&r.addStoredMark(l.create(e)),s(r),!0;let c=!1;for(const{$from:u,$to:d}of o.ranges){if(c)break;c=r.doc.rangeHasMark(u.pos,d.pos,l)}for(const{$from:u,$to:d}of o.ranges)c&&r.removeMark(u.pos,d.pos,l),e&&r.addMark(u.pos,d.pos,l.create(e));return s(r),!0}}function Cx(t,e={}){return({tr:n,dispatch:r,state:s})=>{const i=s.schema,o=n.selection,{from:a=o.from,to:l=a??o.to,marks:c={}}=e;if(!r)return!0;n.insertText(t,a,l);const u=re(n.steps,n.steps.length-1).getMap().map(l);for(const[d,h]of he(c))n.addMark(a,u,re(i.marks,d).create(h));return r(n),!0}}var H=class extends te{constructor(){super(...arguments),this.decorated=new Map,this.forceUpdateTransaction=(t,...e)=>{const{forcedUpdates:n}=this.getCommandMeta(t);return this.setCommandMeta(t,{forcedUpdates:es([...n,...e])}),t}}get name(){return"commands"}get transaction(){const t=this.store.getState();this._transaction||(this._transaction=t.tr);const e=this._transaction.before.eq(t.doc),n=!tn(this._transaction.steps);if(!e){const r=t.tr;if(n)for(const s of this._transaction.steps)r.step(s);this._transaction=r}return this._transaction}onCreate(){this.store.setStoreKey("getForcedUpdates",this.getForcedUpdates.bind(this))}onView(t){var e;const{extensions:n,helpers:r}=this.store,s=M(),i=new Set;let o=M();const a=c=>{var u;const d=M(),h=()=>c??this.transaction;let f=[];const p=()=>f;for(const[g,y]of Object.entries(s))(u=o[g])!=null&&u.disableChaining||(d[g]=this.chainedFactory({chain:d,command:y.original,getTr:h,getChain:p}));const m=g=>{R(g===h(),{message:"Chaining currently only supports `CommandFunction` methods which do not use the `state.tr` property. Instead you should use the provided `tr` property."})};return d.run=(g={})=>{const y=f;f=[];for(const E of y)if(!E(m)&&g.exitEarly)return;t.dispatch(h())},d.tr=()=>{const g=f;f=[];for(const y of g)y(m);return h()},d.enabled=()=>{for(const g of f)if(!g())return!1;return!0},d.new=g=>a(g),d};for(const c of n){const u=((e=c.createCommands)==null?void 0:e.call(c))??{},d=c.decoratedCommands??{},h={};o={...o,decoratedCommands:d};for(const[f,p]of Object.entries(d)){const m=D(p.shortcut)&&p.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(p.shortcut,c.options)}:void 0;this.updateDecorated(f,{...p,name:c.name,...m}),u[f]=c[f].bind(c),p.active&&(h[f]=()=>{var g;return((g=p.active)==null?void 0:g.call(p,c.options,this.store))??!1})}ei(u)||this.addCommands({active:h,names:i,commands:s,extensionCommands:u})}const l=a();for(const[c,u]of Object.entries(l))a[c]=u;this.store.setStoreKey("commands",s),this.store.setStoreKey("chain",a),this.store.setExtensionStore("commands",s),this.store.setExtensionStore("chain",a)}onStateUpdate({state:t}){this._transaction=t.tr}createPlugin(){return{}}customDispatch(t){return t}insertText(t,e={}){return D(t)?Cx(t,e):this.store.createPlaceholderCommand({promise:t,placeholder:{type:"inline"},onSuccess:(n,r,s)=>this.insertText(n,{...e,...r})(s)}).generateCommand()}selectText(t,e={}){return({tr:n,dispatch:r})=>{const s=lt(t,n.doc);return n.selection.anchor===s.anchor&&n.selection.head===s.head&&!e.forceUpdate?!1:(r==null||r(n.setSelection(s)),!0)}}selectMark(t){return e=>{const{tr:n}=e,r=In(n.selection.$from,t);return r?this.store.commands.selectText.original({from:r.from,to:r.to})(e):!1}}delete(t){return({tr:e,dispatch:n})=>{const{from:r,to:s}=t??e.selection;return n==null||n(e.delete(r,s)),!0}}emptyUpdate(t){return({tr:e,dispatch:n})=>(n&&(t==null||t(),n(e)),!0)}forceUpdate(...t){return({tr:e,dispatch:n})=>(n==null||n(this.forceUpdateTransaction(e,...t)),!0)}updateNodeAttributes(t,e){return({tr:n,dispatch:r})=>(r==null||r(n.setNodeMarkup(t,void 0,e)),!0)}setContent(t,e){return n=>{const{tr:r,dispatch:s}=n,i=this.store.manager.createState({content:t,selection:e});return i?(s==null||s(r.replaceRangeWith(0,r.doc.nodeSize-2,i.doc)),!0):!1}}resetContent(){return t=>{const{tr:e,dispatch:n}=t,r=this.store.manager.createEmptyDoc();return r?this.setContent(r)(t):(n==null||n(e.delete(0,e.doc.nodeSize)),!0)}}emptySelection(){return({tr:t,dispatch:e})=>t.selection.empty?!1:(e==null||e(t.setSelection(P.near(t.selection.$anchor))),!0)}insertNewLine(){return({dispatch:t,tr:e})=>yr(e.selection)?(t==null||t(e.insertText(`
47
- `)),!0):!1}insertNode(t,e={}){return({dispatch:n,tr:r,state:s})=>{var i;const{attrs:o,range:a,selection:l,replaceEmptyParentBlock:c=!1}=e,{from:u,to:d,$from:h}=lt(l??a??r.selection,r.doc);if(Bi(t)||e0(t)){const y=h.before(h.depth);return n==null||n(c&&u===d&&Ia(h.parent)?r.replaceWith(y,y+h.parent.nodeSize,t):r.replaceWith(u,d,t)),!0}const f=D(t)?s.schema.nodes[t]:t;R(f,{code:b.SCHEMA,message:`The requested node type ${t} does not exist in the schema.`});const p=(i=e.marks)==null?void 0:i.map(y=>{if(y instanceof U)return y;const E=D(y)?s.schema.marks[y]:y;return R(E,{code:b.SCHEMA,message:`The requested mark type ${y} does not exist in the schema.`}),E.create()}),m=f.createAndFill(o,D(e.content)?s.schema.text(e.content):e.content,p);if(!m)return!1;const g=u!==d;return n==null||n(g?r.replaceRangeWith(u,d,m):r.insert(u,m)),!0}}focus(t){return e=>{const{dispatch:n,tr:r}=e,{view:s}=this.store;if(t===!1||s.hasFocus()&&(t===void 0||t===!0))return!1;if(t===void 0||t===!0){const{from:i=0,to:o=i}=r.selection;t={from:i,to:o}}return n&&this.delayedFocus(),this.selectText(t)(e)}}blur(t){return e=>{const{view:n}=this.store;return n.hasFocus()?(requestAnimationFrame(()=>{n.dom.blur()}),t?this.selectText(t)(e):!0):!1}}setBlockNodeType(t,e,n,r=!0){return Ko(t,e,n,r)}toggleWrappingNode(t,e,n){return S0(t,e,n)}toggleBlockNodeItem(t){return v0(t)}wrapInNode(t,e,n){return ih(t,e,n)}applyMark(t,e,n){return Ex(t,e,n)}toggleMark(t){return ar(t)}removeMark(t){return T0(t)}setMeta(t,e){return({tr:n})=>(n.setMeta(t,e),!0)}selectAll(){return this.selectText("all")}copy(){return t=>t.tr.selection.empty?!1:(t.dispatch&&document.execCommand("copy"),!0)}paste(){return this.store.createPlaceholderCommand({promise:async()=>{var t;return(t=navigator.clipboard)!=null&&t.readText?await navigator.clipboard.readText():""},placeholder:{type:"inline"},onSuccess:(t,e,n)=>this.insertNode(jo({content:t,schema:n.state.schema}),{selection:e})(n)}).generateCommand()}cut(){return t=>t.tr.selection.empty?!1:(t.dispatch&&document.execCommand("cut"),!0)}replaceText(t){return C0(t)}getAllCommandOptions(){const t={};for(const[e,n]of this.decorated)ei(n)||(t[e]=n);return t}getCommandOptions(t){return this.decorated.get(t)}getCommandProp(){return{tr:this.transaction,dispatch:this.store.view.dispatch,state:this.store.view.state,view:this.store.view}}updateDecorated(t,e){if(!e){this.decorated.delete(t);return}const n=this.decorated.get(t)??{name:""};this.decorated.set(t,{...n,...e})}handleIosFocus(){rt.isIos&&this.store.view.dom.focus()}delayedFocus(){this.handleIosFocus(),requestAnimationFrame(()=>{this.store.view.focus(),this.store.view.dispatch(this.transaction.scrollIntoView())})}getForcedUpdates(t){return this.getCommandMeta(t).forcedUpdates}getCommandMeta(t){const e=t.getMeta(this.pluginKey)??{};return{...Tx,...e}}setCommandMeta(t,e){const n=this.getCommandMeta(t);t.setMeta(this.pluginKey,{...n,...e})}addCommands(t){const{extensionCommands:e,commands:n,names:r,active:s}=t;for(const[i,o]of he(e))gh({name:i,set:r,code:b.DUPLICATE_COMMAND_NAMES}),R(!Ox.has(i),{code:b.DUPLICATE_COMMAND_NAMES,message:"The command name you chose is forbidden."}),n[i]=this.createUnchainedCommand(o,s[i])}unchainedFactory(t){return(...e)=>{const{shouldDispatch:n=!0,command:r}=t,{view:s}=this.store,{state:i}=s;let o;return n&&(o=s.dispatch),r(...e)({state:i,dispatch:o,view:s,tr:i.tr})}}createUnchainedCommand(t,e){const n=this.unchainedFactory({command:t});return n.enabled=this.unchainedFactory({command:t,shouldDispatch:!1}),n.isEnabled=n.enabled,n.original=t,n.active=e,n}chainedFactory(t){return(...e)=>{const{chain:n,command:r,getTr:s,getChain:i}=t,o=i(),{view:a}=this.store,{state:l}=a;return o.push(c=>r(...e)({state:l,dispatch:c,view:a,tr:s()})),n}}};T([_()],H.prototype,"customDispatch",1);T([_()],H.prototype,"insertText",1);T([_()],H.prototype,"selectText",1);T([_()],H.prototype,"selectMark",1);T([_()],H.prototype,"delete",1);T([_()],H.prototype,"emptyUpdate",1);T([_()],H.prototype,"forceUpdate",1);T([_()],H.prototype,"updateNodeAttributes",1);T([_()],H.prototype,"setContent",1);T([_()],H.prototype,"resetContent",1);T([_()],H.prototype,"emptySelection",1);T([_()],H.prototype,"insertNewLine",1);T([_()],H.prototype,"insertNode",1);T([_()],H.prototype,"focus",1);T([_()],H.prototype,"blur",1);T([_()],H.prototype,"setBlockNodeType",1);T([_()],H.prototype,"toggleWrappingNode",1);T([_()],H.prototype,"toggleBlockNodeItem",1);T([_()],H.prototype,"wrapInNode",1);T([_()],H.prototype,"applyMark",1);T([_()],H.prototype,"toggleMark",1);T([_()],H.prototype,"removeMark",1);T([_()],H.prototype,"setMeta",1);T([_({description:({t})=>t(nn.SELECT_ALL_DESCRIPTION),label:({t})=>t(nn.SELECT_ALL_LABEL),shortcut:w.SelectAll})],H.prototype,"selectAll",1);T([_({description:({t})=>t(nn.COPY_DESCRIPTION),label:({t})=>t(nn.COPY_LABEL),shortcut:w.Copy,icon:"fileCopyLine"})],H.prototype,"copy",1);T([_({description:({t})=>t(nn.PASTE_DESCRIPTION),label:({t})=>t(nn.PASTE_LABEL),shortcut:w.Paste,icon:"clipboardLine"})],H.prototype,"paste",1);T([_({description:({t})=>t(nn.CUT_DESCRIPTION),label:({t})=>t(nn.CUT_LABEL),shortcut:w.Cut,icon:"scissorsFill"})],H.prototype,"cut",1);T([_()],H.prototype,"replaceText",1);T([se()],H.prototype,"getAllCommandOptions",1);T([se()],H.prototype,"getCommandOptions",1);T([se()],H.prototype,"getCommandProp",1);H=T([G({defaultPriority:X.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],H);var Tx={forcedUpdates:[]},Ox=new Set(["run","chain","original","raw","enabled","tr","new"]),ct=class extends te{constructor(){super(...arguments),this.placeholders=W.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=t=>{const e=ni(),{promise:n,placeholder:r,onFailure:s,onSuccess:i}=t;return new vx(n).validate(o=>this.addPlaceholder(e,r)(o)).success(o=>{const{state:a,tr:l,dispatch:c,view:u,value:d}=o,h=this.store.helpers.findPlaceholder(e);if(!h){const f=new Error("The placeholder has been removed");return(s==null?void 0:s({error:f,state:a,tr:l,dispatch:c,view:u}))??!1}return this.removePlaceholder(e)({state:a,tr:l,view:u,dispatch:()=>{}}),i(d,h,{state:a,tr:l,dispatch:c,view:u})}).failure(o=>(this.removePlaceholder(e)({...o,dispatch:()=>{}}),(s==null?void 0:s(o))??!1))}}get name(){return"decorations"}onCreate(){this.store.setExtensionStore("createPlaceholderCommand",this.createPlaceholderCommand)}createPlugin(){return{state:{init:()=>{},apply:t=>{var e,n,r,s,i,o;const{added:a,clearTrackers:l,removed:c,updated:u}=this.getMeta(t);if(l){this.placeholders=W.empty;for(const[,d]of this.placeholderWidgets)(n=(e=d.spec).onDestroy)==null||n.call(e,this.store.view,d.spec.element);this.placeholderWidgets.clear();return}this.placeholders=this.placeholders.map(t.mapping,t.doc,{onRemove:d=>{var h,f;const p=this.placeholderWidgets.get(d.id);p&&((f=(h=p.spec).onDestroy)==null||f.call(h,this.store.view,p.spec.element))}});for(const[,d]of this.placeholderWidgets)(s=(r=d.spec).onUpdate)==null||s.call(r,this.store.view,d.from,d.spec.element,d.spec.data);for(const d of a){if(d.type==="inline"){this.addInlinePlaceholder(d,t);continue}if(d.type==="node"){this.addNodePlaceholder(d,t);continue}if(d.type==="widget"){this.addWidgetPlaceholder(d,t);continue}}for(const{id:d,data:h}of u){const f=this.placeholderWidgets.get(d);if(!f)continue;const p=Q.widget(f.from,f.spec.element,{...f.spec,data:h});this.placeholders=this.placeholders.remove([f]).add(t.doc,[p]),this.placeholderWidgets.set(d,p)}for(const d of c){const h=this.placeholders.find(void 0,void 0,p=>p.id===d&&p.__type===zn),f=this.placeholderWidgets.get(d);f&&((o=(i=f.spec).onDestroy)==null||o.call(i,this.store.view,f.spec.element)),this.placeholders=this.placeholders.remove(h),this.placeholderWidgets.delete(d)}}},props:{decorations:t=>{let e=this.options.decorations(t);e=e.add(t.doc,this.placeholders.find());for(const n of this.store.extensions){if(!n.createDecorations)continue;const r=n.createDecorations(t).find();e=e.add(t.doc,r)}return e},handleDOMEvents:{blur:t=>(this.options.persistentSelectionClass&&t.dispatch(t.state.tr.setMeta(Sc,!1)),!1),focus:t=>(this.options.persistentSelectionClass&&t.dispatch(t.state.tr.setMeta(Sc,!0)),!1)}}}}updateDecorations(){return({tr:t,dispatch:e})=>(e==null||e(t),!0)}addPlaceholder(t,e,n){return({dispatch:r,tr:s})=>this.addPlaceholderTransaction(t,e,s,!r)?(r==null||r(n?s.deleteSelection():s),!0):!1}updatePlaceholder(t,e){return({dispatch:n,tr:r})=>this.updatePlaceholderTransaction({id:t,data:e,tr:r,checkOnly:!n})?(n==null||n(r),!0):!1}removePlaceholder(t){return({dispatch:e,tr:n})=>this.removePlaceholderTransaction({id:t,tr:n,checkOnly:!e})?(e==null||e(n),!0):!1}clearPlaceholders(){return({tr:t,dispatch:e})=>this.clearPlaceholdersTransaction({tr:t,checkOnly:!e})?(e==null||e(t),!0):!1}findPlaceholder(t){return this.findAllPlaceholders().get(t)}findAllPlaceholders(){const t=new Map,e=this.placeholders.find(void 0,void 0,n=>n.__type===zn);for(const n of e)t.set(n.spec.id,{from:n.from,to:n.to});return t}createDecorations(t){var e,n,r;const{persistentSelectionClass:s}=this.options;return!s||(e=this.store.view)!=null&&e.hasFocus()||(r=(n=this.store.helpers).isInteracting)!=null&&r.call(n)?W.empty:_x(t,W.empty,{class:D(s)?s:"selection"})}onApplyState(){}addWidgetPlaceholder(t,e){const{pos:n,createElement:r,onDestroy:s,onUpdate:i,className:o,nodeName:a,id:l,type:c}=t,u=(r==null?void 0:r(this.store.view,n))??document.createElement(a);u.classList.add(o);const d=Q.widget(n,u,{id:l,__type:zn,type:c,element:u,onDestroy:s,onUpdate:i});this.placeholderWidgets.set(l,d),this.placeholders=this.placeholders.add(e.doc,[d])}addInlinePlaceholder(t,e){const{from:n=e.selection.from,to:r=e.selection.to,className:s,nodeName:i,id:o,type:a}=t;let l;if(n===r){const c=document.createElement(i);c.classList.add(s),l=Q.widget(n,c,{id:o,type:a,__type:zn,widget:c})}else l=Q.inline(n,r,{nodeName:i,class:s},{id:o,__type:zn});this.placeholders=this.placeholders.add(e.doc,[l])}addNodePlaceholder(t,e){const{pos:n,className:r,nodeName:s,id:i}=t,o=Ge(n)?e.doc.resolve(n):e.selection.$from,a=Ge(n)?o.nodeAfter?{pos:n,end:o.nodeAfter.nodeSize}:void 0:Wy(o);if(!a)return;const l=Q.node(a.pos,a.end,{nodeName:s,class:r},{id:i,__type:zn});this.placeholders=this.placeholders.add(e.doc,[l])}withRequiredBase(t,e){const{placeholderNodeName:n,placeholderClassName:r}=this.options,{nodeName:s=n,className:i,...o}=e,a=(i?[r,i]:[r]).join(" ");return{nodeName:s,className:a,...o,id:t}}getMeta(t){const e=t.getMeta(this.pluginKey)??{};return{...Mx,...e}}setMeta(t,e){const n=this.getMeta(t);t.setMeta(this.pluginKey,{...n,...e})}addPlaceholderTransaction(t,e,n,r=!1){if(this.findPlaceholder(t))return!1;if(r)return!0;const{added:i}=this.getMeta(n);return this.setMeta(n,{added:[...i,this.withRequiredBase(t,e)]}),!0}updatePlaceholderTransaction(t){const{id:e,tr:n,checkOnly:r=!1,data:s}=t;if(!this.findPlaceholder(e))return!1;if(r)return!0;const{updated:o}=this.getMeta(n);return this.setMeta(n,{updated:es([...o,{id:e,data:s}])}),!0}removePlaceholderTransaction(t){const{id:e,tr:n,checkOnly:r=!1}=t;if(!this.findPlaceholder(e))return!1;if(r)return!0;const{removed:i}=this.getMeta(n);return this.setMeta(n,{removed:es([...i,e])}),!0}clearPlaceholdersTransaction(t){const{tr:e,checkOnly:n=!1}=t;return this.getPluginState()===W.empty?!1:(n||this.setMeta(e,{clearTrackers:!0}),!0)}};T([_()],ct.prototype,"updateDecorations",1);T([_()],ct.prototype,"addPlaceholder",1);T([_()],ct.prototype,"updatePlaceholder",1);T([_()],ct.prototype,"removePlaceholder",1);T([_()],ct.prototype,"clearPlaceholders",1);T([se()],ct.prototype,"findPlaceholder",1);T([se()],ct.prototype,"findAllPlaceholders",1);ct=T([G({defaultOptions:{persistentSelectionClass:void 0,placeholderClassName:"placeholder",placeholderNodeName:"span"},staticKeys:["placeholderClassName","placeholderNodeName"],handlerKeys:["decorations"],handlerKeyOptions:{decorations:{reducer:{accumulator:(t,e,n)=>t.add(n.doc,e.find()),getDefault:()=>W.empty}}},defaultPriority:X.Low})],ct);var Mx={added:[],updated:[],clearTrackers:!1,removed:[]},zn="placeholderDecoration",Sc="persistentSelectionFocus";function _x(t,e,n){const{selection:r,doc:s}=t;if(r.empty)return e;const{from:i,to:o}=r,a=zi(r)?Q.node(i,o,n):Q.inline(i,o,n);return e.add(s,[a])}var Jo=class extends te{get name(){return"docChanged"}onStateUpdate(t){const{firstUpdate:e,transactions:n,tr:r}=t;e||(n??[r]).some(s=>s==null?void 0:s.docChanged)&&this.options.docChanged(t)}};Jo=T([G({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:X.Lowest})],Jo);var Xe=class extends te{get name(){return"helpers"}onCreate(){var t;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",jo);const e=M(),n=M(),r=M(),s=new Set;for(const i of this.store.extensions){Ts(i)&&(n[i.name]=a=>Jy({state:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{var l;return(l=ls({state:this.store.getState(),type:i.type,attrs:a}))==null?void 0:l.node.attrs}),Wi(i)&&(n[i.name]=a=>eh({trState:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{const l=In(this.store.getState().selection.$from,i.type);if(!l||!a)return l==null?void 0:l.mark.attrs;if(Na(l.mark,a))return l.mark.attrs});const o=((t=i.createHelpers)==null?void 0:t.call(i))??{};for(const a of Object.keys(i.decoratedHelpers??{}))o[a]=i[a].bind(i);if(!ei(o))for(const[a,l]of he(o))gh({name:a,set:s,code:b.DUPLICATE_HELPER_NAMES}),e[a]=l}this.store.setStoreKey("attrs",r),this.store.setStoreKey("active",n),this.store.setStoreKey("helpers",e),this.store.setExtensionStore("attrs",r),this.store.setExtensionStore("active",n),this.store.setExtensionStore("helpers",e)}isSelectionEmpty(t=this.store.getState()){return Yd(t)}isViewEditable(t=this.store.getState()){var e,n;return((n=(e=this.store.view.props).editable)==null?void 0:n.call(e,t))??!1}getStateJSON(t=this.store.getState()){return t.toJSON()}getJSON(t=this.store.getState()){return t.doc.toJSON()}getRemirrorJSON(t=this.store.getState()){return this.getJSON(t)}insertHtml(t,e){return n=>{const{state:r}=n,s=jo({content:t,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(s,e)(n)}}getText({lineBreakDivider:t=`
45
+ If you are using Node.js, you can install JSDOM and Remirror will try to use it automatically, or you can create a fake document and pass it to Remirror`)}function rh(t){var e;return(t==null?void 0:t.defaultView)??(typeof window<"u"?window:void 0)??((e=ad())==null?void 0:e.defaultView)}function d0(t){return rh(t==null?void 0:t.ownerDocument)}function h0(t){const e=rh(t)??Fi().defaultView;if(e)return e;throw new Error("Unable to retrieve the window from the global scope")}function f0(t,e=Fi()){const n=l0(t,t.type.schema)?t.content:x.from(t);return qe.fromSchema(t.type.schema).serializeFragment(n,{document:e})}function p0(t,e){return new(h0(e)).DOMParser().parseFromString(`<body>${t}</body>`,"text/html").body}function m0(t,e=Fi()){const n=e.createElement("div");return n.append(f0(t,e)),n.innerHTML}function jo(t){const{content:e,schema:n,document:r,fragment:s=!1,...i}=t,o=p0(e,r),a=da.fromSchema(n);return s?a.parseSlice(o,{...gc,...i}).content:a.parse(o,{...gc,...i})}var gc={preserveWhitespace:!1},g0={remove(t,e){let n=t;for(const r of e)r.invalidParentNode||(n=ap(r.path,n));return n}};function y0({json:t,schema:e,...n}){const r=new Set(Qs(e.marks)),s=new Set(Qs(e.nodes)),i=sh({json:t,path:[],validNodes:s,validMarks:r});return{json:t,invalidContent:i,transformers:g0,...n}}function sh(t){const{json:e,validMarks:n,validNodes:r,path:s=[]}=t,i={validMarks:n,validNodes:r},o=[],{type:a,marks:l,content:c}=e;let{invalidParentMark:u=!1,invalidParentNode:d=!1}=t;if(l){const h=[];for(const[f,p]of l.entries()){const m=D(p)?p:p.type;n.has(m)||(h.unshift({name:m,path:[...s,"marks",`${f}`],type:"mark",invalidParentMark:u,invalidParentNode:d}),u=!0)}o.push(...h)}if(r.has(a)||(o.push({name:a,type:"node",path:s,invalidParentMark:u,invalidParentNode:d}),d=!0),c){const h=[];for(const[f,p]of c.entries())h.unshift(...sh({...i,json:p,path:[...s,"content",`${f}`],invalidParentMark:u,invalidParentNode:d}));o.unshift(...h)}return o}function x0(t){return!!(yr(t)&&t.$cursor&&t.$cursor.parentOffset>=t.$cursor.parent.content.size)}function Wo(t){return!!(yr(t)&&t.$cursor&&t.$cursor.parentOffset<=0)}function yc(t){const e=V.atStart(t.$anchor.doc);return!!(Wo(t)&&e.anchor===t.anchor)}function b0({tr:t,dispatch:e}){const{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&fr(s);return!Ge(i)||!s?!1:(e==null||e(t.lift(s,i).scrollIntoView()),!0)}function ih(t,e={},n){return function(r){const{tr:s,dispatch:i,state:o}=r,a=D(t)?re(o.schema.nodes,t):t,{from:l,to:c}=lt(n??s.selection,s.doc),u=s.doc.resolve(l),d=s.doc.resolve(c),h=u.blockRange(d),f=h&&fa(h,a,e);return!f||!h?!1:(i==null||i(s.wrap(h,f).scrollIntoView()),!0)}}function k0(t,e={},n){return r=>{const{tr:s,state:i}=r,o=D(t)?re(i.schema.nodes,t):t;return ls({state:s,type:o,attrs:e})?b0(r):ih(t,e,n)(r)}}function Ko(t,e,n,r=!0){return function(s){const{tr:i,dispatch:o,state:a}=s,l=D(t)?re(a.schema.nodes,t):t,{from:c,to:u}=lt(n??i.selection,i.doc);let d=!1,h;return i.doc.nodesBetween(c,u,(f,p)=>{if(d)return!1;if(!f.isTextblock||f.hasMarkup(l,e))return;if(f.type===l){d=!0,h=f.attrs;return}const m=i.doc.resolve(p),g=m.index();d=m.parent.canReplaceWith(g,g+1,l),d&&(h=m.parent.attrs)}),d?(o==null||o(i.setBlockType(c,u,l,{...r?h:{},...e}).scrollIntoView()),!0):!1}}function S0(t){return e=>{const{tr:n,state:r}=e,{type:s,attrs:i,preserveAttrs:o=!0}=t,a=ls({state:n,type:s,attrs:i}),l=t.toggleType??$i(r.schema);if(a)return Ko(l,{...o?a.node.attrs:{},...i})(e);const c=ls({state:n,type:l,attrs:i});return Ko(s,{...o?c==null?void 0:c.node.attrs:{},...i})(e)}}function v0(t=0){const e=navigator.userAgent.match(/Chrom(e|ium)\/(\d+)\./);return e?Number.parseInt(re(e,2),10)>=t:!1}function w0(t,e){let{head:n,empty:r,anchor:s}=t;for(const i of e.steps)n=i.getMap().map(n);r?e.setSelection(P.near(e.doc.resolve(n))):e.setSelection(P.between(e.doc.resolve(s),e.doc.resolve(n)))}function E0(t){const{attrs:e={},appendText:n="",content:r="",keepSelection:s=!1,range:i}=t;return({state:o,tr:a,dispatch:l})=>{var c;const u=o.schema,d=lt(t.selection??i??a.selection,a.doc),h=d.$from.index(),{from:f,to:p,$from:m}=d,g=D(t.type)?u.nodes[t.type]??u.marks[t.type]:t.type;if(R(D(t.type)?g:!0,{code:b.SCHEMA,message:`Schema contains no marks or nodes with name ${g}`}),Xy(g)){if(!m.parent.canReplaceWith(h,h,g))return!1;a.replaceWith(f,p,g.create(e,r?u.text(r):void 0))}else R(r,{message:"`replaceText` cannot be called without content when using a mark type"}),a.replaceWith(f,p,u.text(r,Zd(g)?[g.create(e)]:void 0));return n&&a.insertText(n),s&&w0(o.selection,a),l&&(v0(60)&&((c=document.getSelection())==null||c.empty()),l(a)),!0}}function oh(t,e){const n=t.parent.childAfter(t.parentOffset);if(!n.node)return;const{marks:r,nodeSize:s}=n.node;if(r[0])return r[0].type;const o=t.start()+n.offset+s;return oh(t.doc.resolve(o+1))}function C0(t){return({dispatch:e,tr:n,state:r})=>{const{type:s,expand:i=!0,range:o}=t,a=lt(t.selection??o??n.selection,n.doc);let{from:l,to:c,$from:u,$to:d}=a;const h=D(s)?r.schema.marks[s]:s;h!==null&&R(h,{code:b.SCHEMA,message:`Mark type: ${s} does not exist on the current schema.`});const f=h??oh(u);if(!f)return!1;const p=In(u,f,d);return i&&p&&(l=Math.max(0,Math.min(l,p.from)),c=Math.min(Math.max(c,p.to),n.doc.nodeSize-2)),e==null||e(n.removeMark(l,Ge(c)?c:l,Zd(h)?h:void 0)),!0}}function yi(t){const{regexp:e,type:n,getAttributes:r,ignoreWhitespace:s=!1,beforeDispatch:i,updateCaptured:o,shouldSkip:a,invalidMarks:l}=t;let c;const u=new ws(e,(d,h,f,p)=>{const{tr:m,schema:g}=d;c||(c=D(n)?g.marks[n]:n,R(c,{code:b.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}));let y=h[1],E=h[0];const L=T0({captureGroup:y,fullMatch:E,end:p,start:f,rule:u,state:d,ignoreWhitespace:s,invalidMarks:l,shouldSkip:a,updateCaptured:o});if(!L)return null;({start:f,end:p,captureGroup:y,fullMatch:E}=L);const q=ee(r)?r(h):r;let J=p,F=[];if(y){const oe=E.search(/\S/),Fe=f+E.indexOf(y),B=Fe+y.length;F=m.storedMarks??[],B<p&&m.delete(B,p),Fe>f&&m.delete(f+oe,Fe),J=f+oe+y.length}return m.addMark(f,J,c.create(q)),m.setStoredMarks(F),i==null||i({tr:m,match:h,start:f,end:p}),m});return u}function T0({captureGroup:t,fullMatch:e,end:n,start:r,rule:s,ignoreWhitespace:i,shouldSkip:o,updateCaptured:a,state:l,invalidMarks:c}){var u;if(e==null)return null;const d=(a==null?void 0:a({captureGroup:t,fullMatch:e,start:r,end:n}))??{};t=d.captureGroup??t,e=d.fullMatch??e,r=d.start??r,n=d.end??n;const h=l.doc.resolve(r),f=l.doc.resolve(n);return c&&Ho({$from:h,$to:f},c)||s.invalidMarks&&Ho({$from:h,$to:f},s.invalidMarks)||i&&(t==null?void 0:t.trim())===""||o!=null&&o({state:l,captureGroup:t,fullMatch:e,start:r,end:n,ruleType:"mark"})||(u=s.shouldSkip)!=null&&u.call(s,{state:l,captureGroup:t,fullMatch:e,start:r,end:n,ruleType:"mark"})?null:{captureGroup:t,end:n,fullMatch:e,start:r}}var O0=function(){const e=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];e.forEach(i=>{(i?i.split(" "):[]).forEach(a=>{if(a.startsWith("atm_")){const[,l]=a.split("_");n[l]=a}else r.push(a)})});const s=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&s.push(n[i]);return s.push(...r),s.join(" ")},M0=O0;const ah=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function _0(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const lh=(t,e,n)=>{let r=_0(t,n);if(!r)return!1;let s=ch(r);if(!s){let o=r.blockRange(),a=o&&fr(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(!i.type.spec.isolating&&dh(t,s,e))return!0;if(r.parent.content.size==0&&(or(i,"end")||I.isSelectable(i))){let o=pa(t.doc,r.before(),r.after(),S.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(or(i,"end")?V.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):I.create(a.doc,s.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1};function or(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const N0=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=ch(r)}let o=i&&i.nodeBefore;return!o||!I.isSelectable(o)?!1:(e&&e(t.tr.setSelection(I.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function ch(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function A0(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const R0=(t,e,n)=>{let r=A0(t,n);if(!r)return!1;let s=uh(r);if(!s)return!1;let i=s.nodeAfter;if(dh(t,s,e))return!0;if(r.parent.content.size==0&&(or(i,"start")||I.isSelectable(i))){let o=pa(t.doc,r.before(),r.after(),S.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(or(i,"start")?V.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):I.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},I0=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=uh(r)}let o=i&&i.nodeAfter;return!o||!I.isSelectable(o)?!1:(e&&e(t.tr.setSelection(I.create(t.doc,i.pos)).scrollIntoView()),!0)};function uh(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const D0=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
46
+ `).scrollIntoView()),!0)};function Da(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const P0=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=Da(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(V.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},L0=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Be||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=Da(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=t.tr.insert(o,i.createAndFill());a.setSelection(P.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},B0=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Xn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&fr(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function z0(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof I&&e.selection.node.isBlock)return!r.parentOffset||!Xn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(n){let i=s.parentOffset==s.parent.content.size,o=e.tr;(e.selection instanceof P||e.selection instanceof Be)&&o.deleteSelection();let a=r.depth==0?null:Da(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=t&&t(s.parent,i),c=l?[l]:i&&a?[{type:a}]:void 0,u=Xn(o.doc,o.mapping.map(r.pos),1,c);if(!c&&!u&&Xn(o.doc,o.mapping.map(r.pos),1,a?[{type:a}]:void 0)&&(a&&(c=[{type:a}]),u=!0),u&&(o.split(o.mapping.map(r.pos),1,c),!i&&!r.parentOffset&&r.parent.type!=a)){let d=o.mapping.map(r.before()),h=o.doc.resolve(d);a&&r.node(-1).canReplaceWith(h.index(),h.index()+1,a)&&o.setNodeMarkup(o.mapping.map(r.before()),a)}n(o.scrollIntoView())}return!0}}const $0=z0(),F0=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(I.create(t.doc,s))),!0)},V0=(t,e)=>(e&&e(t.tr.setSelection(new Be(t.doc))),!0);function H0(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||vs(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function dh(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i,o;if(r.type.spec.isolating||s.type.spec.isolating)return!1;if(H0(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(i=(o=r.contentMatchAt(r.childCount)).findWrapping(s.type))&&o.matchType(i[0]||s.type).validEnd){if(n){let d=e.pos+s.nodeSize,h=x.empty;for(let m=i.length-1;m>=0;m--)h=x.from(i[m].create(null,h));h=x.from(r.copy(h));let f=t.tr.step(new fe(e.pos-1,d,e.pos,d,new S(h,1,0),i.length,!0)),p=d+2*i.length;vs(f.doc,p)&&f.join(p),n(f.scrollIntoView())}return!0}let l=V.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&fr(c);if(u!=null&&u>=e.depth)return n&&n(t.tr.lift(c,u).scrollIntoView()),!0;if(a&&or(s,"start",!0)&&or(r,"end")){let d=r,h=[];for(;h.push(d),!d.isTextblock;)d=d.lastChild;let f=s,p=1;for(;!f.isTextblock;f=f.firstChild)p++;if(d.canReplace(d.childCount,d.childCount,f.content)){if(n){let m=x.empty;for(let y=h.length-1;y>=0;y--)m=x.from(h[y].copy(m));let g=t.tr.step(new fe(e.pos-h.length,e.pos+s.nodeSize,e.pos+p,e.pos+s.nodeSize-p,new S(m,h.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function hh(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(P.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const U0=hh(-1),j0=hh(1);function W0(t,e,n){for(let r=0;r<e.length;r++){let{$from:s,$to:i}=e[r],o=s.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(s.pos,i.pos,a=>{if(o)return!1;o=a.inlineContent&&a.type.allowsMarkType(n)}),o)return!0}return!1}function K0(t,e=null){return function(n,r){let{empty:s,$cursor:i,ranges:o}=n.selection;if(s&&!i||!W0(n.doc,o,t))return!1;if(r)if(i)t.isInSet(n.storedMarks||i.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{let a=!1,l=n.tr;for(let c=0;!a&&c<o.length;c++){let{$from:u,$to:d}=o[c];a=n.doc.rangeHasMark(u.pos,d.pos,t)}for(let c=0;c<o.length;c++){let{$from:u,$to:d}=o[c];if(a)l.removeMark(u.pos,d.pos,t);else{let h=u.pos,f=d.pos,p=u.nodeAfter,m=d.nodeBefore,g=p&&p.isText?/^\s*/.exec(p.text)[0].length:0,y=m&&m.isText?/\s*$/.exec(m.text)[0].length:0;h+g<f&&(h+=g,f-=y),l.addMark(h,f,t.create(e))}}r(l.scrollIntoView())}return!0}}function Vi(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}let ho=Vi(ah,lh,N0),xc=Vi(ah,R0,I0);const Tt={Enter:Vi(D0,L0,B0,$0),"Mod-Enter":P0,Backspace:ho,"Mod-Backspace":ho,"Shift-Backspace":ho,Delete:xc,"Mod-Delete":xc,"Mod-a":V0},fh={"Ctrl-h":Tt.Backspace,"Alt-Backspace":Tt["Mod-Backspace"],"Ctrl-d":Tt.Delete,"Ctrl-Alt-Backspace":Tt["Mod-Delete"],"Alt-Delete":Tt["Mod-Delete"],"Alt-d":Tt["Mod-Delete"],"Ctrl-a":U0,"Ctrl-e":j0};for(let t in Tt)fh[t]=Tt[t];const q0=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,fo=q0?fh:Tt;var rn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},J0=typeof navigator<"u"&&/Mac/.test(navigator.platform),G0=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Se=0;Se<10;Se++)rn[48+Se]=rn[96+Se]=String(Se);for(var Se=1;Se<=24;Se++)rn[Se+111]="F"+Se;for(var Se=65;Se<=90;Se++)rn[Se]=String.fromCharCode(Se+32),xi[Se]=String.fromCharCode(Se);for(var po in rn)xi.hasOwnProperty(po)||(xi[po]=rn[po]);function X0(t){var e=J0&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||G0&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xi:rn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Y0=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Z0(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Y0?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Q0(t){let e=Object.create(null);for(let n in t)e[Z0(n)]=t[n];return e}function mo(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function ph(t){let e=Q0(t);return function(n,r){let s=X0(r),i,o=e[mo(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[mo(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||s.charCodeAt(0)>127)&&(i=rn[r.keyCode])&&i!=s){let a=e[mo(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function ex(t){const e=tr(t,(i,o)=>(o.priority??X.Low)-(i.priority??X.Low)),n=[],r=[];for(const i of e)ax(i)?n.push(i):r.push(i);let s;return new un({key:tx,view:i=>(s=i,{}),props:{transformPasted:i=>{var o,a,l;const c=s.state.selection.$from,u=c.node().type.name,d=new Set(c.marks().map(h=>h.type.name));for(const h of n){if((o=h.ignoredNodes)!=null&&o.includes(u)||(a=h.ignoredMarks)!=null&&a.some(E=>d.has(E)))continue;const f=((l=i.content.firstChild)==null?void 0:l.textContent)??"",p=!s.state.selection.empty&&i.content.childCount===1&&f,m=ua(f,h.regexp)[0];if(p&&m&&h.type==="mark"&&h.replaceSelection){const{from:E,to:L}=s.state.selection,q=s.state.doc.slice(E,L),J=q.content.textBetween(0,q.content.size);if(typeof h.replaceSelection!="boolean"?h.replaceSelection(J):h.replaceSelection){const F=[],{getAttributes:oe,markType:Fe}=h,B=ee(oe)?oe(m,!0):oe,ut=Fe.create(B);return q.content.forEach(Dt=>{if(Dt.isText){const Xi=ut.addToSet(Dt.marks);F.push(Dt.mark(Xi))}}),S.maxOpen(x.fromArray(F))}}const{nodes:g,transformed:y}=ix(i.content,h,s.state.schema);y&&(i=h.type==="node"&&h.nodeType.isBlock?new S(x.fromArray(g),0,0):new S(x.fromArray(g),i.openStart,i.openEnd))}return dx(i)},handleDOMEvents:{paste:(i,o)=>{var a,l;const c=o;if(!((l=(a=i.props).editable)!=null&&l.call(a,i.state)))return!1;const{clipboardData:u}=c;if(!u)return!1;const d=[...u.items].map(f=>f.getAsFile()).filter(f=>!!f);if(d.length===0)return!1;const{selection:h}=i.state;for(const{fileHandler:f,regexp:p}of r){const m=p?d.filter(g=>p.test(g.type)):d;if(m.length!==0&&f({event:c,files:m,selection:h,view:i,type:"paste"}))return c.preventDefault(),!0}return!1},drop:(i,o)=>{var a,l,c;const u=o;if(!((l=(a=i.props).editable)!=null&&l.call(a,i.state)))return!1;const{dataTransfer:d,clientX:h,clientY:f}=u;if(!d)return!1;const p=ux(u);if(p.length===0)return!1;const m=((c=i.posAtCoords({left:h,top:f}))==null?void 0:c.pos)??i.state.selection.anchor;for(const{fileHandler:g,regexp:y}of r){const E=y?p.filter(L=>y.test(L.type)):p;if(E.length!==0&&g({event:u,files:E,pos:m,view:i,type:"drop"}))return u.preventDefault(),!0}return!1}}}})}var tx=new pr("pasteRule");function go(t,e){return function n(r){const{fragment:s,rule:i,nodes:o}=r,{regexp:a,ignoreWhitespace:l,ignoredMarks:c,ignoredNodes:u}=i;let d=!1;return s.forEach(h=>{if(u!=null&&u.includes(h.type.name)||lx(h)){o.push(h);return}if(!h.isText){const m=n({fragment:h.content,rule:i,nodes:[]});d||(d=m.transformed);const g=x.fromArray(m.nodes);h.type.validContent(g)?o.push(h.copy(g)):o.push(...m.nodes);return}if(h.marks.some(m=>cx(m)||(c==null?void 0:c.includes(m.type.name)))){o.push(h);return}const f=h.text??"";let p=0;for(const m of ua(f,a)){const g=m[1],y=m[0];if(l&&(g==null?void 0:g.trim())===""||!y)return;const E=m.index,L=E+y.length;E>p&&o.push(h.cut(p,E));let q=h.cut(E,L);if(y&&g){const J=y.search(/\S/),F=E+y.indexOf(g),oe=F+g.length;J&&o.push(h.cut(E,E+J)),q=h.cut(F,oe)}t({nodes:o,rule:i,textNode:q,match:m,schema:e}),d=!0,p=L}f&&p<f.length&&o.push(h.cut(p))}),{nodes:o,transformed:d}}}function nx(t){const{nodes:e,rule:n,textNode:r,match:s,schema:i}=t,{transformMatch:o,getAttributes:a,markType:l}=n,c=ee(a)?a(s,!1):a,u=r.text??"",d=l.create(c),h=o==null?void 0:o(s);if(h==="")return;if(h===!1){e.push(i.text(u,r.marks));return}const f=d.addToSet(r.marks);e.push(i.text(h??u,f))}function rx(t){const{nodes:e,rule:n,textNode:r,match:s,schema:i}=t,{transformMatch:o}=n,a=o==null?void 0:o(s);if(a===""||a===!1)return;const l=a??r.text??"";e.push(i.text(l,r.marks))}function sx(t){const{nodes:e,rule:n,textNode:r,match:s}=t,{getAttributes:i,nodeType:o,getContent:a}=n,l=ee(i)?i(s,!1):i,c=(a?a(s):r)||void 0;e.push(o.createChecked(l,c))}function ix(t,e,n){const r=[];switch(e.type){case"mark":return go(nx,n)({fragment:t,nodes:r,rule:e});case"node":return go(sx,n)({fragment:t,nodes:r,rule:e});default:return go(rx,n)({fragment:t,nodes:r,rule:e})}}var ox=["mark","node","text"];function ax(t){return gt(ox,t.type)}function lx(t){var e;return t.type.spec.code||((e=t.type.spec.group)==null?void 0:e.split(" ").includes("code"))}function cx(t){var e;return t.type.name==="code"||((e=t.type.spec.group)==null?void 0:e.split(" ").includes("code"))}function ux(t){var e,n;const{dataTransfer:r}=t;return r?((e=r.files)==null?void 0:e.length)>0?[...r.files]:(n=r.items)!=null&&n.length?[...r.items].map(s=>s.getAsFile()).filter(s=>!!s):[]:[]}function dx(t){const e=S.maxOpen(t.content);return e.openStart<t.openStart||e.openEnd<t.openEnd?e:t}let Hi=()=>({events:{},emit(t,...e){(this.events[t]||[]).forEach(n=>n(...e))},on(t,e){return(this.events[t]=this.events[t]||[]).push(e),()=>this.events[t]=(this.events[t]||[]).filter(n=>n!==e)}});var hx=Object.defineProperty,fx=Object.getOwnPropertyDescriptor,T=(t,e,n,r)=>{for(var s=r>1?void 0:r?fx(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&hx(e,n,s),s},mh=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},v=(t,e,n)=>(mh(t,e,"read from private field"),n?n.call(t):e.get(t)),ce=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ye=(t,e,n,r)=>(mh(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function px(t,e){return t===e}function bc(t){const{previousOptions:e,update:n,equals:r=px}=t,s=xn({...e,...n}),i=M(),o=Qs(e);for(const l of o){const c=e[l],u=s[l];if(r(c,u)){i[l]={changed:!1};continue}i[l]={changed:!0,previousValue:c,value:u}}const a=l=>{const c=M();for(const u of l){const d=i[u];d!=null&&d.changed&&(c[u]=d.value)}return c};return{changes:xn(i),options:s,pickChanged:a}}var mx={[b.DUPLICATE_HELPER_NAMES]:"helper method",[b.DUPLICATE_COMMAND_NAMES]:"command method"};function gh(t){const{name:e,set:n,code:r}=t,s=mx[r];R(!n.has(e),{code:r,message:`There is a naming conflict for the name: ${e} used in this '${s}'. Please rename or remove from the editor to avoid runtime errors.`}),n.add(e)}function qo(...t){return es(M0(...t).split(" ")).join(" ")}var kc="__IGNORE__",gx="__ALL__",xr=class{constructor(t,...[e]){this["~O"]={},this._mappedHandlers=M(),this.populateMappedHandlers(),this._options=this._initialOptions=sp(t,this.constructor.defaultOptions,e??M(),this.createDefaultHandlerOptions()),this._dynamicKeys=this.getDynamicKeys(),this.init()}get options(){return this._options}get dynamicKeys(){return this._dynamicKeys}get initialOptions(){return this._initialOptions}init(){}getDynamicKeys(){const t=[],{customHandlerKeys:e,handlerKeys:n,staticKeys:r}=this.constructor;for(const s of Qs(this._options))r.includes(s)||n.includes(s)||e.includes(s)||t.push(s);return t}ensureAllKeysAreDynamic(t){}setOptions(t){var e;const n=this.getDynamicOptions();this.ensureAllKeysAreDynamic(t);const{changes:r,options:s,pickChanged:i}=bc({previousOptions:n,update:t});this.updateDynamicOptions(s),(e=this.onSetOptions)==null||e.call(this,{reason:"set",changes:r,options:s,pickChanged:i,initialOptions:this._initialOptions})}resetOptions(){var t;const e=this.getDynamicOptions(),{changes:n,options:r,pickChanged:s}=bc({previousOptions:e,update:this._initialOptions});this.updateDynamicOptions(r),(t=this.onSetOptions)==null||t.call(this,{reason:"reset",options:r,changes:n,pickChanged:s,initialOptions:this._initialOptions})}getDynamicOptions(){return vu(this._options,[...this.constructor.customHandlerKeys,...this.constructor.handlerKeys])}updateDynamicOptions(t){this._options={...this._options,...t}}populateMappedHandlers(){for(const t of this.constructor.handlerKeys)this._mappedHandlers[t]=[]}createDefaultHandlerOptions(){const t=M();for(const e of this.constructor.handlerKeys)t[e]=(...n)=>{var r;const{handlerKeyOptions:s}=this.constructor,i=(r=s[e])==null?void 0:r.reducer;let o=i==null?void 0:i.getDefault(...n);for(const[,a]of this._mappedHandlers[e]){const l=a(...n);if(o=i?i.accumulator(o,l,...n):l,yx(s,o,e))return o}return o};return t}addHandler(t,e,n=X.Default){return this._mappedHandlers[t].push([n,e]),this.sortHandlers(t),()=>this._mappedHandlers[t]=this._mappedHandlers[t].filter(([,r])=>r!==e)}hasHandlers(t){return(this._mappedHandlers[t]??[]).length>0}sortHandlers(t){this._mappedHandlers[t]=tr(this._mappedHandlers[t],([e],[n])=>n-e)}addCustomHandler(t,e){var n;return((n=this.onAddCustomHandler)==null?void 0:n.call(this,{[t]:e}))??_u}};xr.defaultOptions={};xr.staticKeys=[];xr.handlerKeys=[];xr.handlerKeyOptions={};xr.customHandlerKeys=[];function yx(t,e,n){const{[gx]:r}=t,s=t[n];return!r&&!s?!1:!!(s&&s.earlyReturnValue!==kc&&(ee(s.earlyReturnValue)?s.earlyReturnValue(e)===!0:e===s.earlyReturnValue)||r&&r.earlyReturnValue!==kc&&(ee(r.earlyReturnValue)?r.earlyReturnValue(e)===!0:e===r.earlyReturnValue))}var Ui=class extends xr{constructor(...t){super(xx,...t),this["~E"]={},this._extensions=cp(this.createExtensions(),e=>e.constructor),this.extensionMap=new Map;for(const e of this._extensions)this.extensionMap.set(e.constructor,e)}get priority(){return this.priorityOverride??this.options.priority??this.constructor.defaultPriority}get constructorName(){return`${Cu(this.name)}Extension`}get store(){return R(this._store,{code:b.MANAGER_PHASE_ERROR,message:"An error occurred while attempting to access the 'extension.store' when the Manager has not yet set created the lifecycle methods."}),xn(this._store,{requireKeys:!0})}get extensions(){return this._extensions}replaceChildExtension(t,e){this.extensionMap.has(t)&&(this.extensionMap.set(t,e),this._extensions=this.extensions.map(n=>e.constructor===t?e:n))}createExtensions(){return[]}getExtension(t){const e=this.extensionMap.get(t);return R(e,{code:b.INVALID_GET_EXTENSION,message:`'${t.name}' does not exist within the preset: '${this.name}'`}),e}isOfType(t){return this.constructor===t}setStore(t){this._store||(this._store=t)}clone(...t){return new this.constructor(...t)}setPriority(t){this.priorityOverride=t}};Ui.defaultPriority=X.Default;var te=class extends Ui{static get[At](){return xe.PlainExtensionConstructor}get[At](){return xe.PlainExtension}},ji=class extends Ui{static get[At](){return xe.MarkExtensionConstructor}get[At](){return xe.MarkExtension}get type(){return re(this.store.schema.marks,this.name)}constructor(...t){super(...t)}};ji.disableExtraAttributes=!1;var Rt=class extends Ui{static get[At](){return xe.NodeExtensionConstructor}get[At](){return xe.NodeExtension}get type(){return re(this.store.schema.nodes,this.name)}constructor(...t){super(...t)}};Rt.disableExtraAttributes=!1;var xx={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function yh(t){return mr(t)&&gr(t,[xe.PlainExtension,xe.MarkExtension,xe.NodeExtension])}function bx(t){return mr(t)&&gr(t,[xe.PlainExtensionConstructor,xe.MarkExtensionConstructor,xe.NodeExtensionConstructor])}function xh(t){return mr(t)&&gr(t,xe.PlainExtension)}function Ts(t){return mr(t)&&gr(t,xe.NodeExtension)}function Wi(t){return mr(t)&&gr(t,xe.MarkExtension)}function G(t){return e=>{const{defaultOptions:n,customHandlerKeys:r,handlerKeys:s,staticKeys:i,defaultPriority:o,handlerKeyOptions:a,...l}=t,c=e;n&&(c.defaultOptions=n),o&&(c.defaultPriority=o),a&&(c.handlerKeyOptions=a),c.staticKeys=i??[],c.handlerKeys=s??[],c.customHandlerKeys=r??[];for(const[u,d]of Object.entries(l))c[u]||(c[u]=d);return c}}var kx=class extends te{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=M(),this.updateAttributes=(t=!0)=>{this.transformAttributes(),t&&this.store.commands.forceUpdate("attributes")}}get name(){return"attributes"}onCreate(){this.transformAttributes(),this.store.setExtensionStore("updateAttributes",this.updateAttributes)}transformAttributes(){var t,e,n;if(this.attributeObject=M(),(t=this.store.managerSettings.exclude)!=null&&t.attributes){this.store.setStoreKey("attributes",this.attributeObject);return}this.attributeList=[];for(const r of this.store.extensions){if((e=r.options.exclude)!=null&&e.attributes)continue;const s=(n=r.createAttributes)==null?void 0:n.call(r),i={...s,class:qo(...r.classNames??[],s==null?void 0:s.class)};this.attributeList.unshift(i)}for(const r of this.attributeList)this.attributeObject={...this.attributeObject,...r,class:qo(this.attributeObject.class,r.class)};this.store.setStoreKey("attributes",this.attributeObject)}};function se(t={}){return(e,n,r)=>{(e.decoratedHelpers??(e.decoratedHelpers={}))[n]=t}}function _(t={}){return(e,n,r)=>{(e.decoratedCommands??(e.decoratedCommands={}))[n]=t}}function Ye(t){return(e,n,r)=>{(e.decoratedKeybindings??(e.decoratedKeybindings={}))[n]=t}}var Sx=class{constructor(t){this.promiseCreator=t,this.failureHandlers=[],this.successHandlers=[],this.validateHandlers=[],this.generateCommand=()=>e=>{let n=!0;const{view:r,tr:s,dispatch:i}=e;if(!r)return!1;for(const a of this.validateHandlers)if(!a({...e,dispatch:()=>{}})){n=!1;break}return!i||!n?n:(this.promiseCreator(e).then(a=>{this.runHandlers(this.successHandlers,{value:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}).catch(a=>{this.runHandlers(this.failureHandlers,{error:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}),i(s),!0)}}validate(t,e="push"){return this.validateHandlers[e](t),this}success(t,e="push"){return this.successHandlers[e](t),this}failure(t,e="push"){return this.failureHandlers[e](t),this}runHandlers(t,e){var n;for(const r of t)if(!r({...e,dispatch:()=>{}}))break;(n=e.dispatch)==null||n.call(e,e.tr)}};function ar(t){const{type:e,attrs:n,range:r,selection:s}=t;return i=>{const{dispatch:o,tr:a,state:l}=i,c=D(e)?l.schema.marks[e]:e;if(R(c,{code:b.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),r||s){const{from:u,to:d}=lt(s??r??a.selection,a.doc);return eh({trState:a,type:e,...r})?o==null||o(a.removeMark(u,d,c)):o==null||o(a.addMark(u,d,c.create(n))),!0}return zs(K0(c,n))(i)}}function vx(t,e,n){for(const{$from:r,$to:s}of n){let i=r.depth===0?e.type.allowsMarkType(t):!1;if(e.nodesBetween(r.pos,s.pos,o=>{if(i)return!1;i=o.inlineContent&&o.type.allowsMarkType(t)}),i)return!0}return!1}function wx(t,e,n){return({tr:r,dispatch:s,state:i})=>{const o=lt(n??r.selection,r.doc),a=a0(o),l=D(t)?i.schema.marks[t]:t;if(R(l,{code:b.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),o.empty&&!a||!vx(l,r.doc,o.ranges))return!1;if(!s)return!0;if(a)return r.removeStoredMark(l),e&&r.addStoredMark(l.create(e)),s(r),!0;let c=!1;for(const{$from:u,$to:d}of o.ranges){if(c)break;c=r.doc.rangeHasMark(u.pos,d.pos,l)}for(const{$from:u,$to:d}of o.ranges)c&&r.removeMark(u.pos,d.pos,l),e&&r.addMark(u.pos,d.pos,l.create(e));return s(r),!0}}function Ex(t,e={}){return({tr:n,dispatch:r,state:s})=>{const i=s.schema,o=n.selection,{from:a=o.from,to:l=a??o.to,marks:c={}}=e;if(!r)return!0;n.insertText(t,a,l);const u=re(n.steps,n.steps.length-1).getMap().map(l);for(const[d,h]of he(c))n.addMark(a,u,re(i.marks,d).create(h));return r(n),!0}}var H=class extends te{constructor(){super(...arguments),this.decorated=new Map,this.forceUpdateTransaction=(t,...e)=>{const{forcedUpdates:n}=this.getCommandMeta(t);return this.setCommandMeta(t,{forcedUpdates:es([...n,...e])}),t}}get name(){return"commands"}get transaction(){const t=this.store.getState();this._transaction||(this._transaction=t.tr);const e=this._transaction.before.eq(t.doc),n=!tn(this._transaction.steps);if(!e){const r=t.tr;if(n)for(const s of this._transaction.steps)r.step(s);this._transaction=r}return this._transaction}onCreate(){this.store.setStoreKey("getForcedUpdates",this.getForcedUpdates.bind(this))}onView(t){var e;const{extensions:n,helpers:r}=this.store,s=M(),i=new Set;let o=M();const a=c=>{var u;const d=M(),h=()=>c??this.transaction;let f=[];const p=()=>f;for(const[g,y]of Object.entries(s))(u=o[g])!=null&&u.disableChaining||(d[g]=this.chainedFactory({chain:d,command:y.original,getTr:h,getChain:p}));const m=g=>{R(g===h(),{message:"Chaining currently only supports `CommandFunction` methods which do not use the `state.tr` property. Instead you should use the provided `tr` property."})};return d.run=(g={})=>{const y=f;f=[];for(const E of y)if(!E(m)&&g.exitEarly)return;t.dispatch(h())},d.tr=()=>{const g=f;f=[];for(const y of g)y(m);return h()},d.enabled=()=>{for(const g of f)if(!g())return!1;return!0},d.new=g=>a(g),d};for(const c of n){const u=((e=c.createCommands)==null?void 0:e.call(c))??{},d=c.decoratedCommands??{},h={};o={...o,decoratedCommands:d};for(const[f,p]of Object.entries(d)){const m=D(p.shortcut)&&p.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(p.shortcut,c.options)}:void 0;this.updateDecorated(f,{...p,name:c.name,...m}),u[f]=c[f].bind(c),p.active&&(h[f]=()=>{var g;return((g=p.active)==null?void 0:g.call(p,c.options,this.store))??!1})}ei(u)||this.addCommands({active:h,names:i,commands:s,extensionCommands:u})}const l=a();for(const[c,u]of Object.entries(l))a[c]=u;this.store.setStoreKey("commands",s),this.store.setStoreKey("chain",a),this.store.setExtensionStore("commands",s),this.store.setExtensionStore("chain",a)}onStateUpdate({state:t}){this._transaction=t.tr}createPlugin(){return{}}customDispatch(t){return t}insertText(t,e={}){return D(t)?Ex(t,e):this.store.createPlaceholderCommand({promise:t,placeholder:{type:"inline"},onSuccess:(n,r,s)=>this.insertText(n,{...e,...r})(s)}).generateCommand()}selectText(t,e={}){return({tr:n,dispatch:r})=>{const s=lt(t,n.doc);return n.selection.anchor===s.anchor&&n.selection.head===s.head&&!e.forceUpdate?!1:(r==null||r(n.setSelection(s)),!0)}}selectMark(t){return e=>{const{tr:n}=e,r=In(n.selection.$from,t);return r?this.store.commands.selectText.original({from:r.from,to:r.to})(e):!1}}delete(t){return({tr:e,dispatch:n})=>{const{from:r,to:s}=t??e.selection;return n==null||n(e.delete(r,s)),!0}}emptyUpdate(t){return({tr:e,dispatch:n})=>(n&&(t==null||t(),n(e)),!0)}forceUpdate(...t){return({tr:e,dispatch:n})=>(n==null||n(this.forceUpdateTransaction(e,...t)),!0)}updateNodeAttributes(t,e){return({tr:n,dispatch:r})=>(r==null||r(n.setNodeMarkup(t,void 0,e)),!0)}setContent(t,e){return n=>{const{tr:r,dispatch:s}=n,i=this.store.manager.createState({content:t,selection:e});return i?(s==null||s(r.replaceRangeWith(0,r.doc.nodeSize-2,i.doc)),!0):!1}}resetContent(){return t=>{const{tr:e,dispatch:n}=t,r=this.store.manager.createEmptyDoc();return r?this.setContent(r)(t):(n==null||n(e.delete(0,e.doc.nodeSize)),!0)}}emptySelection(){return({tr:t,dispatch:e})=>t.selection.empty?!1:(e==null||e(t.setSelection(P.near(t.selection.$anchor))),!0)}insertNewLine(){return({dispatch:t,tr:e})=>yr(e.selection)?(t==null||t(e.insertText(`
47
+ `)),!0):!1}insertNode(t,e={}){return({dispatch:n,tr:r,state:s})=>{var i;const{attrs:o,range:a,selection:l,replaceEmptyParentBlock:c=!1}=e,{from:u,to:d,$from:h}=lt(l??a??r.selection,r.doc);if(Bi(t)||Qy(t)){const y=h.before(h.depth);return n==null||n(c&&u===d&&Ia(h.parent)?r.replaceWith(y,y+h.parent.nodeSize,t):r.replaceWith(u,d,t)),!0}const f=D(t)?s.schema.nodes[t]:t;R(f,{code:b.SCHEMA,message:`The requested node type ${t} does not exist in the schema.`});const p=(i=e.marks)==null?void 0:i.map(y=>{if(y instanceof U)return y;const E=D(y)?s.schema.marks[y]:y;return R(E,{code:b.SCHEMA,message:`The requested mark type ${y} does not exist in the schema.`}),E.create()}),m=f.createAndFill(o,D(e.content)?s.schema.text(e.content):e.content,p);if(!m)return!1;const g=u!==d;return n==null||n(g?r.replaceRangeWith(u,d,m):r.insert(u,m)),!0}}focus(t){return e=>{const{dispatch:n,tr:r}=e,{view:s}=this.store;if(t===!1||s.hasFocus()&&(t===void 0||t===!0))return!1;if(t===void 0||t===!0){const{from:i=0,to:o=i}=r.selection;t={from:i,to:o}}return n&&this.delayedFocus(),this.selectText(t)(e)}}blur(t){return e=>{const{view:n}=this.store;return n.hasFocus()?(requestAnimationFrame(()=>{n.dom.blur()}),t?this.selectText(t)(e):!0):!1}}setBlockNodeType(t,e,n,r=!0){return Ko(t,e,n,r)}toggleWrappingNode(t,e,n){return k0(t,e,n)}toggleBlockNodeItem(t){return S0(t)}wrapInNode(t,e,n){return ih(t,e,n)}applyMark(t,e,n){return wx(t,e,n)}toggleMark(t){return ar(t)}removeMark(t){return C0(t)}setMeta(t,e){return({tr:n})=>(n.setMeta(t,e),!0)}selectAll(){return this.selectText("all")}copy(){return t=>t.tr.selection.empty?!1:(t.dispatch&&document.execCommand("copy"),!0)}paste(){return this.store.createPlaceholderCommand({promise:async()=>{var t;return(t=navigator.clipboard)!=null&&t.readText?await navigator.clipboard.readText():""},placeholder:{type:"inline"},onSuccess:(t,e,n)=>this.insertNode(jo({content:t,schema:n.state.schema}),{selection:e})(n)}).generateCommand()}cut(){return t=>t.tr.selection.empty?!1:(t.dispatch&&document.execCommand("cut"),!0)}replaceText(t){return E0(t)}getAllCommandOptions(){const t={};for(const[e,n]of this.decorated)ei(n)||(t[e]=n);return t}getCommandOptions(t){return this.decorated.get(t)}getCommandProp(){return{tr:this.transaction,dispatch:this.store.view.dispatch,state:this.store.view.state,view:this.store.view}}updateDecorated(t,e){if(!e){this.decorated.delete(t);return}const n=this.decorated.get(t)??{name:""};this.decorated.set(t,{...n,...e})}handleIosFocus(){rt.isIos&&this.store.view.dom.focus()}delayedFocus(){this.handleIosFocus(),requestAnimationFrame(()=>{this.store.view.focus(),this.store.view.dispatch(this.transaction.scrollIntoView())})}getForcedUpdates(t){return this.getCommandMeta(t).forcedUpdates}getCommandMeta(t){const e=t.getMeta(this.pluginKey)??{};return{...Cx,...e}}setCommandMeta(t,e){const n=this.getCommandMeta(t);t.setMeta(this.pluginKey,{...n,...e})}addCommands(t){const{extensionCommands:e,commands:n,names:r,active:s}=t;for(const[i,o]of he(e))gh({name:i,set:r,code:b.DUPLICATE_COMMAND_NAMES}),R(!Tx.has(i),{code:b.DUPLICATE_COMMAND_NAMES,message:"The command name you chose is forbidden."}),n[i]=this.createUnchainedCommand(o,s[i])}unchainedFactory(t){return(...e)=>{const{shouldDispatch:n=!0,command:r}=t,{view:s}=this.store,{state:i}=s;let o;return n&&(o=s.dispatch),r(...e)({state:i,dispatch:o,view:s,tr:i.tr})}}createUnchainedCommand(t,e){const n=this.unchainedFactory({command:t});return n.enabled=this.unchainedFactory({command:t,shouldDispatch:!1}),n.isEnabled=n.enabled,n.original=t,n.active=e,n}chainedFactory(t){return(...e)=>{const{chain:n,command:r,getTr:s,getChain:i}=t,o=i(),{view:a}=this.store,{state:l}=a;return o.push(c=>r(...e)({state:l,dispatch:c,view:a,tr:s()})),n}}};T([_()],H.prototype,"customDispatch",1);T([_()],H.prototype,"insertText",1);T([_()],H.prototype,"selectText",1);T([_()],H.prototype,"selectMark",1);T([_()],H.prototype,"delete",1);T([_()],H.prototype,"emptyUpdate",1);T([_()],H.prototype,"forceUpdate",1);T([_()],H.prototype,"updateNodeAttributes",1);T([_()],H.prototype,"setContent",1);T([_()],H.prototype,"resetContent",1);T([_()],H.prototype,"emptySelection",1);T([_()],H.prototype,"insertNewLine",1);T([_()],H.prototype,"insertNode",1);T([_()],H.prototype,"focus",1);T([_()],H.prototype,"blur",1);T([_()],H.prototype,"setBlockNodeType",1);T([_()],H.prototype,"toggleWrappingNode",1);T([_()],H.prototype,"toggleBlockNodeItem",1);T([_()],H.prototype,"wrapInNode",1);T([_()],H.prototype,"applyMark",1);T([_()],H.prototype,"toggleMark",1);T([_()],H.prototype,"removeMark",1);T([_()],H.prototype,"setMeta",1);T([_({description:({t})=>t(nn.SELECT_ALL_DESCRIPTION),label:({t})=>t(nn.SELECT_ALL_LABEL),shortcut:w.SelectAll})],H.prototype,"selectAll",1);T([_({description:({t})=>t(nn.COPY_DESCRIPTION),label:({t})=>t(nn.COPY_LABEL),shortcut:w.Copy,icon:"fileCopyLine"})],H.prototype,"copy",1);T([_({description:({t})=>t(nn.PASTE_DESCRIPTION),label:({t})=>t(nn.PASTE_LABEL),shortcut:w.Paste,icon:"clipboardLine"})],H.prototype,"paste",1);T([_({description:({t})=>t(nn.CUT_DESCRIPTION),label:({t})=>t(nn.CUT_LABEL),shortcut:w.Cut,icon:"scissorsFill"})],H.prototype,"cut",1);T([_()],H.prototype,"replaceText",1);T([se()],H.prototype,"getAllCommandOptions",1);T([se()],H.prototype,"getCommandOptions",1);T([se()],H.prototype,"getCommandProp",1);H=T([G({defaultPriority:X.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],H);var Cx={forcedUpdates:[]},Tx=new Set(["run","chain","original","raw","enabled","tr","new"]),ct=class extends te{constructor(){super(...arguments),this.placeholders=W.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=t=>{const e=ni(),{promise:n,placeholder:r,onFailure:s,onSuccess:i}=t;return new Sx(n).validate(o=>this.addPlaceholder(e,r)(o)).success(o=>{const{state:a,tr:l,dispatch:c,view:u,value:d}=o,h=this.store.helpers.findPlaceholder(e);if(!h){const f=new Error("The placeholder has been removed");return(s==null?void 0:s({error:f,state:a,tr:l,dispatch:c,view:u}))??!1}return this.removePlaceholder(e)({state:a,tr:l,view:u,dispatch:()=>{}}),i(d,h,{state:a,tr:l,dispatch:c,view:u})}).failure(o=>(this.removePlaceholder(e)({...o,dispatch:()=>{}}),(s==null?void 0:s(o))??!1))}}get name(){return"decorations"}onCreate(){this.store.setExtensionStore("createPlaceholderCommand",this.createPlaceholderCommand)}createPlugin(){return{state:{init:()=>{},apply:t=>{var e,n,r,s,i,o;const{added:a,clearTrackers:l,removed:c,updated:u}=this.getMeta(t);if(l){this.placeholders=W.empty;for(const[,d]of this.placeholderWidgets)(n=(e=d.spec).onDestroy)==null||n.call(e,this.store.view,d.spec.element);this.placeholderWidgets.clear();return}this.placeholders=this.placeholders.map(t.mapping,t.doc,{onRemove:d=>{var h,f;const p=this.placeholderWidgets.get(d.id);p&&((f=(h=p.spec).onDestroy)==null||f.call(h,this.store.view,p.spec.element))}});for(const[,d]of this.placeholderWidgets)(s=(r=d.spec).onUpdate)==null||s.call(r,this.store.view,d.from,d.spec.element,d.spec.data);for(const d of a){if(d.type==="inline"){this.addInlinePlaceholder(d,t);continue}if(d.type==="node"){this.addNodePlaceholder(d,t);continue}if(d.type==="widget"){this.addWidgetPlaceholder(d,t);continue}}for(const{id:d,data:h}of u){const f=this.placeholderWidgets.get(d);if(!f)continue;const p=Q.widget(f.from,f.spec.element,{...f.spec,data:h});this.placeholders=this.placeholders.remove([f]).add(t.doc,[p]),this.placeholderWidgets.set(d,p)}for(const d of c){const h=this.placeholders.find(void 0,void 0,p=>p.id===d&&p.__type===zn),f=this.placeholderWidgets.get(d);f&&((o=(i=f.spec).onDestroy)==null||o.call(i,this.store.view,f.spec.element)),this.placeholders=this.placeholders.remove(h),this.placeholderWidgets.delete(d)}}},props:{decorations:t=>{let e=this.options.decorations(t);e=e.add(t.doc,this.placeholders.find());for(const n of this.store.extensions){if(!n.createDecorations)continue;const r=n.createDecorations(t).find();e=e.add(t.doc,r)}return e},handleDOMEvents:{blur:t=>(this.options.persistentSelectionClass&&t.dispatch(t.state.tr.setMeta(Sc,!1)),!1),focus:t=>(this.options.persistentSelectionClass&&t.dispatch(t.state.tr.setMeta(Sc,!0)),!1)}}}}updateDecorations(){return({tr:t,dispatch:e})=>(e==null||e(t),!0)}addPlaceholder(t,e,n){return({dispatch:r,tr:s})=>this.addPlaceholderTransaction(t,e,s,!r)?(r==null||r(n?s.deleteSelection():s),!0):!1}updatePlaceholder(t,e){return({dispatch:n,tr:r})=>this.updatePlaceholderTransaction({id:t,data:e,tr:r,checkOnly:!n})?(n==null||n(r),!0):!1}removePlaceholder(t){return({dispatch:e,tr:n})=>this.removePlaceholderTransaction({id:t,tr:n,checkOnly:!e})?(e==null||e(n),!0):!1}clearPlaceholders(){return({tr:t,dispatch:e})=>this.clearPlaceholdersTransaction({tr:t,checkOnly:!e})?(e==null||e(t),!0):!1}findPlaceholder(t){return this.findAllPlaceholders().get(t)}findAllPlaceholders(){const t=new Map,e=this.placeholders.find(void 0,void 0,n=>n.__type===zn);for(const n of e)t.set(n.spec.id,{from:n.from,to:n.to});return t}createDecorations(t){var e,n,r;const{persistentSelectionClass:s}=this.options;return!s||(e=this.store.view)!=null&&e.hasFocus()||(r=(n=this.store.helpers).isInteracting)!=null&&r.call(n)?W.empty:Mx(t,W.empty,{class:D(s)?s:"selection"})}onApplyState(){}addWidgetPlaceholder(t,e){const{pos:n,createElement:r,onDestroy:s,onUpdate:i,className:o,nodeName:a,id:l,type:c}=t,u=(r==null?void 0:r(this.store.view,n))??document.createElement(a);u.classList.add(o);const d=Q.widget(n,u,{id:l,__type:zn,type:c,element:u,onDestroy:s,onUpdate:i});this.placeholderWidgets.set(l,d),this.placeholders=this.placeholders.add(e.doc,[d])}addInlinePlaceholder(t,e){const{from:n=e.selection.from,to:r=e.selection.to,className:s,nodeName:i,id:o,type:a}=t;let l;if(n===r){const c=document.createElement(i);c.classList.add(s),l=Q.widget(n,c,{id:o,type:a,__type:zn,widget:c})}else l=Q.inline(n,r,{nodeName:i,class:s},{id:o,__type:zn});this.placeholders=this.placeholders.add(e.doc,[l])}addNodePlaceholder(t,e){const{pos:n,className:r,nodeName:s,id:i}=t,o=Ge(n)?e.doc.resolve(n):e.selection.$from,a=Ge(n)?o.nodeAfter?{pos:n,end:o.nodeAfter.nodeSize}:void 0:jy(o);if(!a)return;const l=Q.node(a.pos,a.end,{nodeName:s,class:r},{id:i,__type:zn});this.placeholders=this.placeholders.add(e.doc,[l])}withRequiredBase(t,e){const{placeholderNodeName:n,placeholderClassName:r}=this.options,{nodeName:s=n,className:i,...o}=e,a=(i?[r,i]:[r]).join(" ");return{nodeName:s,className:a,...o,id:t}}getMeta(t){const e=t.getMeta(this.pluginKey)??{};return{...Ox,...e}}setMeta(t,e){const n=this.getMeta(t);t.setMeta(this.pluginKey,{...n,...e})}addPlaceholderTransaction(t,e,n,r=!1){if(this.findPlaceholder(t))return!1;if(r)return!0;const{added:i}=this.getMeta(n);return this.setMeta(n,{added:[...i,this.withRequiredBase(t,e)]}),!0}updatePlaceholderTransaction(t){const{id:e,tr:n,checkOnly:r=!1,data:s}=t;if(!this.findPlaceholder(e))return!1;if(r)return!0;const{updated:o}=this.getMeta(n);return this.setMeta(n,{updated:es([...o,{id:e,data:s}])}),!0}removePlaceholderTransaction(t){const{id:e,tr:n,checkOnly:r=!1}=t;if(!this.findPlaceholder(e))return!1;if(r)return!0;const{removed:i}=this.getMeta(n);return this.setMeta(n,{removed:es([...i,e])}),!0}clearPlaceholdersTransaction(t){const{tr:e,checkOnly:n=!1}=t;return this.getPluginState()===W.empty?!1:(n||this.setMeta(e,{clearTrackers:!0}),!0)}};T([_()],ct.prototype,"updateDecorations",1);T([_()],ct.prototype,"addPlaceholder",1);T([_()],ct.prototype,"updatePlaceholder",1);T([_()],ct.prototype,"removePlaceholder",1);T([_()],ct.prototype,"clearPlaceholders",1);T([se()],ct.prototype,"findPlaceholder",1);T([se()],ct.prototype,"findAllPlaceholders",1);ct=T([G({defaultOptions:{persistentSelectionClass:void 0,placeholderClassName:"placeholder",placeholderNodeName:"span"},staticKeys:["placeholderClassName","placeholderNodeName"],handlerKeys:["decorations"],handlerKeyOptions:{decorations:{reducer:{accumulator:(t,e,n)=>t.add(n.doc,e.find()),getDefault:()=>W.empty}}},defaultPriority:X.Low})],ct);var Ox={added:[],updated:[],clearTrackers:!1,removed:[]},zn="placeholderDecoration",Sc="persistentSelectionFocus";function Mx(t,e,n){const{selection:r,doc:s}=t;if(r.empty)return e;const{from:i,to:o}=r,a=zi(r)?Q.node(i,o,n):Q.inline(i,o,n);return e.add(s,[a])}var Jo=class extends te{get name(){return"docChanged"}onStateUpdate(t){const{firstUpdate:e,transactions:n,tr:r}=t;e||(n??[r]).some(s=>s==null?void 0:s.docChanged)&&this.options.docChanged(t)}};Jo=T([G({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:X.Lowest})],Jo);var Xe=class extends te{get name(){return"helpers"}onCreate(){var t;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",jo);const e=M(),n=M(),r=M(),s=new Set;for(const i of this.store.extensions){Ts(i)&&(n[i.name]=a=>qy({state:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{var l;return(l=ls({state:this.store.getState(),type:i.type,attrs:a}))==null?void 0:l.node.attrs}),Wi(i)&&(n[i.name]=a=>eh({trState:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{const l=In(this.store.getState().selection.$from,i.type);if(!l||!a)return l==null?void 0:l.mark.attrs;if(Na(l.mark,a))return l.mark.attrs});const o=((t=i.createHelpers)==null?void 0:t.call(i))??{};for(const a of Object.keys(i.decoratedHelpers??{}))o[a]=i[a].bind(i);if(!ei(o))for(const[a,l]of he(o))gh({name:a,set:s,code:b.DUPLICATE_HELPER_NAMES}),e[a]=l}this.store.setStoreKey("attrs",r),this.store.setStoreKey("active",n),this.store.setStoreKey("helpers",e),this.store.setExtensionStore("attrs",r),this.store.setExtensionStore("active",n),this.store.setExtensionStore("helpers",e)}isSelectionEmpty(t=this.store.getState()){return Yd(t)}isViewEditable(t=this.store.getState()){var e,n;return((n=(e=this.store.view.props).editable)==null?void 0:n.call(e,t))??!1}getStateJSON(t=this.store.getState()){return t.toJSON()}getJSON(t=this.store.getState()){return t.doc.toJSON()}getRemirrorJSON(t=this.store.getState()){return this.getJSON(t)}insertHtml(t,e){return n=>{const{state:r}=n,s=jo({content:t,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(s,e)(n)}}getText({lineBreakDivider:t=`
48
48
 
49
49
  `,state:e=this.store.getState()}={}){return e.doc.textBetween(0,e.doc.content.size,t,Wt)}getTextBetween(t,e,n=this.store.getState().doc){return n.textBetween(t,e,`
50
50
 
51
- `,Wt)}getHTML(t=this.store.getState()){return g0(t.doc,this.store.document)}textToProsemirrorNode(t){const e=`<pre>${t.content}</pre>`;return this.store.stringHandlers.html({...t,content:e})}};T([se()],Xe.prototype,"isSelectionEmpty",1);T([se()],Xe.prototype,"isViewEditable",1);T([se()],Xe.prototype,"getStateJSON",1);T([se()],Xe.prototype,"getJSON",1);T([se()],Xe.prototype,"getRemirrorJSON",1);T([_()],Xe.prototype,"insertHtml",1);T([se()],Xe.prototype,"getText",1);T([se()],Xe.prototype,"getTextBetween",1);T([se()],Xe.prototype,"getHTML",1);Xe=T([G({})],Xe);var Go=class extends te{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var t,e;const n=[],r=this.store.markTags[j.ExcludeInputRules];for(const s of this.store.extensions)if(!((t=this.store.managerSettings.exclude)!=null&&t.inputRules||!s.createInputRules||(e=s.options.exclude)!=null&&e.inputRules))for(const i of s.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,n.push(i);return $m({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};Go=T([G({defaultPriority:X.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],Go);var st=class extends te{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:t})=>{var e,n;if(t)return this.extraKeyBindings=[...this.extraKeyBindings,t],(n=(e=this.store).rebuildKeymap)==null||n.call(e),()=>{var r,s;this.extraKeyBindings=this.extraKeyBindings.filter(i=>i!==t),(s=(r=this.store).rebuildKeymap)==null||s.call(r)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){const{shortcuts:t}=this.options;return D(t)?Ix[t]:t}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var t;return(t=this.store.managerSettings.exclude)!=null&&t.keymap?[]:(this.setupKeydownHandler(),[new un({props:{handleKeyDown:(e,n)=>{var r;return(r=this.keydownHandler)==null?void 0:r.call(this,e,n)}}})])}setupKeydownHandler(){const t=this.generateKeymapBindings();this.keydownHandler=ph(t)}generateKeymapBindings(){var t;const e=[],n=this.shortcutMap,r=this.store.getExtension(H),s=a=>l=>$s({shortcut:l,map:n,store:this.store,options:a.options});for(const a of this.store.extensions){const l=a.decoratedKeybindings??{};if(!((t=a.options.exclude)!=null&&t.keymap)){a.createKeymap&&e.push(Ax(a.createKeymap(s(a)),n));for(const[c,u]of he(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const d=a[c].bind(a),h=$s({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),f=ee(u.priority)?u.priority(a.options,this.store):u.priority??X.Low,p=M();for(const m of h)p[m]=d;e.push([f,p]),u.command&&r.updateDecorated(u.command,{shortcut:h})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...e]);return Xy(i)}arrowRightShortcut(t){const e=this.store.markTags[j.PreventExits],n=this.store.nodeTags[j.PreventExits];return this.exitMarkForwards(e,n)(t)}arrowLeftShortcut(t){const e=this.store.markTags[j.PreventExits],n=this.store.nodeTags[j.PreventExits];return gi(this.exitNodeBackwards(n),this.exitMarkBackwards(e,n))(t)}backspace(t){const e=this.store.markTags[j.PreventExits],n=this.store.nodeTags[j.PreventExits];return gi(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(e,n,!0))(t)}createKeymap(){const{selectParentNodeOnEscape:t,undoInputRuleOnBackspace:e,excludeBaseKeymap:n}=this.options,r=M();if(!n)for(const[s,i]of he(fo))r[s]=zs(i);return e&&fo.Backspace&&(r.Backspace=zs(Vi(Fm,fo.Backspace))),t&&(r.Escape=zs(V0)),[X.Low,r]}getNamedShortcut(t,e={}){return t.startsWith("_|")?$s({shortcut:t,map:this.shortcutMap,store:this.store,options:e}):[t]}onSetOptions(t){var e,n;const{changes:r}=t;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&((n=(e=this.store).rebuildKeymap)==null||n.call(e))}sortKeymaps(t){return tr(t.map(e=>pe(e)?e:[X.Default,e]),(e,n)=>n[0]-e[0]).map(e=>e[1])}exitMarkForwards(t,e){return n=>{const{tr:r,dispatch:s}=n;if(!b0(r.selection)||as({selection:r.selection,types:e}))return!1;const a=r.selection.$from.marks().filter(l=>!t.includes(l.type.name));if(tn(a))return!1;if(!s)return!0;for(const l of a)r.removeStoredMark(l);return s(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(t,e=!1){return n=>{const{tr:r}=n;if(!(e?yc:Wo)(r.selection))return!1;const i=r.selection.$anchor.node();return!Ia(i)||s0(i)||t.includes(i.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:i.type})(n)}}exitMarkBackwards(t,e,n=!1){return r=>{const{tr:s,dispatch:i}=r;if(!(n?yc:Wo)(s.selection)||this.backwardMarkExitTracker.has(s.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(as({selection:s.selection,types:e}))return!1;const l=[...s.storedMarks??[],...s.selection.$from.marks()].filter(c=>!t.includes(c.type.name));if(tn(l))return!1;if(!i)return!0;for(const c of l)s.removeStoredMark(c);return this.backwardMarkExitTracker.set(s.selection.anchor,!0),i(s),!0}}};T([Ye({shortcut:"ArrowRight",isActive:t=>t.exitMarksOnArrowPress})],st.prototype,"arrowRightShortcut",1);T([Ye({shortcut:"ArrowLeft",isActive:t=>t.exitMarksOnArrowPress})],st.prototype,"arrowLeftShortcut",1);T([Ye({shortcut:"Backspace",isActive:t=>t.exitMarksOnArrowPress})],st.prototype,"backspace",1);T([se()],st.prototype,"getNamedShortcut",1);st=T([G({defaultPriority:X.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],st);function Nx(t){return gt(Ni(w),t)}function $s({shortcut:t,map:e,options:n,store:r}){return D(t)?[Xo(t,e)]:pe(t)?t.map(s=>Xo(s,e)):(t=t(n,r),$s({shortcut:t,map:e,options:n,store:r}))}function Xo(t,e){return Nx(t)?e[t]:t}function Ax(t,e){const n={};let r,s;pe(t)?[s,r]=t:r=t;for(const[i,o]of he(r))n[Xo(i,e)]=o;return Ai(s)?n:[s,n]}var bh={[w.Copy]:"Mod-c",[w.Cut]:"Mod-x",[w.Paste]:"Mod-v",[w.PastePlain]:"Mod-Shift-v",[w.SelectAll]:"Mod-a",[w.Undo]:"Mod-z",[w.Redo]:rt.isMac?"Shift-Mod-z":"Mod-y",[w.Bold]:"Mod-b",[w.Italic]:"Mod-i",[w.Underline]:"Mod-u",[w.Strike]:"Mod-d",[w.Code]:"Mod-`",[w.Paragraph]:"Mod-Shift-0",[w.H1]:"Mod-Shift-1",[w.H2]:"Mod-Shift-2",[w.H3]:"Mod-Shift-3",[w.H4]:"Mod-Shift-4",[w.H5]:"Mod-Shift-5",[w.H6]:"Mod-Shift-6",[w.TaskList]:"Mod-Shift-7",[w.BulletList]:"Mod-Shift-8",[w.OrderedList]:"Mod-Shift-9",[w.Quote]:"Mod->",[w.Divider]:"Mod-Shift-|",[w.Codeblock]:"Mod-Shift-~",[w.ClearFormatting]:"Mod-Shift-C",[w.Superscript]:"Mod-.",[w.Subscript]:"Mod-,",[w.LeftAlignment]:"Mod-Shift-L",[w.CenterAlignment]:"Mod-Shift-E",[w.RightAlignment]:"Mod-Shift-R",[w.JustifyAlignment]:"Mod-Shift-J",[w.InsertLink]:"Mod-k",[w.Find]:"Mod-f",[w.FindBackwards]:"Mod-Shift-f",[w.FindReplace]:"Mod-Shift-H",[w.AddFootnote]:"Mod-Alt-f",[w.AddComment]:"Mod-Alt-m",[w.ContextMenu]:"Mod-Shift-\\",[w.IncreaseFontSize]:"Mod-Shift-.",[w.DecreaseFontSize]:"Mod-Shift-,",[w.IncreaseIndent]:"Tab",[w.DecreaseIndent]:"Shift-Tab",[w.Shortcuts]:"Mod-/",[w.Format]:rt.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},Rx={...bh,[w.Strike]:"Mod-Shift-S",[w.Code]:"Mod-Shift-M",[w.Paragraph]:"Mod-Alt-0",[w.H1]:"Mod-Alt-1",[w.H2]:"Mod-Alt-2",[w.H3]:"Mod-Alt-3",[w.H4]:"Mod-Alt-4",[w.H5]:"Mod-Alt-5",[w.H6]:"Mod-Alt-6",[w.OrderedList]:"Mod-Alt-7",[w.BulletList]:"Mod-Alt-8",[w.Quote]:"Mod-Alt-9",[w.ClearFormatting]:"Mod-\\",[w.IncreaseIndent]:"Mod-[",[w.DecreaseIndent]:"Mod-]"},Ix={default:bh,googleDoc:Rx},Dx=class extends te{get name(){return"nodeViews"}createPlugin(){const t=[],e=M();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();t.unshift(ee(r)?{[n.name]:r}:r)}t.unshift(this.store.managerSettings.nodeViews??{});for(const n of t)Object.assign(e,n);return{props:{nodeViews:e}}}},Px=class extends te{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var t,e;const n=[];for(const r of this.store.extensions){if((t=this.store.managerSettings.exclude)!=null&&t.pasteRules||!r.createPasteRules||(e=r.options.exclude)!=null&&e.pasteRules)continue;const s=r.createPasteRules(),i=pe(s)?s:[s];n.push(...i)}return tx(n)}},Yo=class extends te{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=M(),this.stateGetters=new Map,this.getPluginStateCreator=t=>e=>t.getState(e??this.store.getState()),this.getStateByName=t=>{const e=this.stateGetters.get(t);return R(e,{message:"No plugin exists for the requested extension name."}),e()}}get name(){return"plugins"}onCreate(){const{setStoreKey:t,setExtensionStore:e,managerSettings:n,extensions:r}=this.store;this.updateExtensionStore();const{plugins:s=[]}=n;this.updatePlugins(s,this.managerPlugins);for(const i of r)i.onApplyState&&this.applyStateHandlers.push(i.onApplyState.bind(i)),i.onInitState&&this.initStateHandlers.push(i.onInitState.bind(i)),i.onAppendTransaction&&this.appendTransactionHandlers.push(i.onAppendTransaction.bind(i)),this.extractExtensionPlugins(i);this.managerPlugins=s,this.store.setStoreKey("plugins",this.plugins),t("pluginKeys",this.pluginKeys),t("getPluginState",this.getStateByName),e("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(t,e,n)=>{const r=n.tr,s={previousState:e,tr:r,transactions:t,state:n};for(const i of this.appendTransactionHandlers)i(s);return this.options.appendTransaction(s),r.docChanged||r.steps.length>0||r.selectionSet||r.storedMarksSet?r:void 0},state:{init:(t,e)=>{for(const n of this.initStateHandlers)n(e)},apply:(t,e,n,r)=>{const s={previousState:n,state:r,tr:t};for(const i of this.applyStateHandlers)i(s);this.options.applyState(s)}}}}extractExtensionPlugins(t){var e,n;if(!(!t.createPlugin&&!t.createExternalPlugins||(e=this.store.managerSettings.exclude)!=null&&e.plugins||(n=t.options.exclude)!=null&&n.plugins)){if(t.createPlugin){const s=new pr(t.name);this.pluginKeys[t.name]=s;const i=this.getPluginStateCreator(s);t.pluginKey=s,t.getPluginState=i,this.stateGetters.set(t.name,i),this.stateGetters.set(t.constructor,i);const o={...t.createPlugin(),key:s},a=new un(o);this.updatePlugins([a],t.plugin?[t.plugin]:void 0),t.plugin=a}if(t.createExternalPlugins){const s=t.createExternalPlugins();this.updatePlugins(s,t.externalPlugins),t.externalPlugins=s}}}updatePlugins(t,e){if(!e||tn(e)){this.plugins=[...this.plugins,...t];return}if(t.length!==e.length){this.plugins=[...this.plugins.filter(r=>!e.includes(r)),...t];return}const n=new Map;for(const[r,s]of t.entries())n.set(re(e,r),s);this.plugins=this.plugins.map(r=>e.includes(r)?n.get(r):r)}updateExtensionStore(){const{setExtensionStore:t}=this.store;t("updatePlugins",this.updatePlugins.bind(this)),t("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),t("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(t){const e=yh(t)?t:kx(t)?this.store.manager.getExtension(t):this.store.extensions.find(n=>n.name===t);R(e,{code:b.INVALID_MANAGER_EXTENSION,message:`The extension ${t} does not exist within the editor.`}),this.extractExtensionPlugins(e),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){R(this.store.phase>=Pe.EditorView,{code:b.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});const{view:t,updateState:e}=this.store,n=t.state.reconfigure({plugins:this.plugins});e(n)}};Yo=T([G({defaultPriority:X.Highest,handlerKeys:["applyState","appendTransaction"]})],Yo);var Zo=class extends te{constructor(){super(...arguments),this.dynamicAttributes={marks:M(),nodes:M()}}get name(){return"schema"}onCreate(){const{managerSettings:t,tags:e,markNames:n,nodeNames:r,extensions:s}=this.store,{defaultBlockNode:i,disableExtraAttributes:o,nodeOverride:a,markOverride:l}=t,c=p=>!!(p&&e[j.Block].includes(p));if(t.schema){const{nodes:p,marks:m}=Ux(t.schema);this.addSchema(t.schema,p,m);return}const u=c(i)?{doc:M(),[i]:M()}:M(),d=M(),h=Lx({settings:t,gatheredSchemaAttributes:this.gatherExtraAttributes(s),nodeNames:r,markNames:n,tags:e});for(const p of s){h[p.name]={...h[p.name],...p.options.extraAttributes};const m=o===!0||p.options.disableExtraAttributes===!0||p.constructor.disableExtraAttributes===!0;if(Ts(p)){const{spec:g,dynamic:y}=vc({createExtensionSpec:(E,L)=>p.createNodeSpec(E,L),extraAttributes:re(h,p.name),override:{...a,...p.options.nodeOverride},ignoreExtraAttributes:m,name:p.constructorName,tags:p.tags});p.spec=g,u[p.name]=g,Object.keys(y).length>0&&(this.dynamicAttributes.nodes[p.name]=y)}if(Wi(p)){const{spec:g,dynamic:y}=vc({createExtensionSpec:(E,L)=>p.createMarkSpec(E,L),extraAttributes:re(h,p.name),override:{...l,...p.options.markOverride},ignoreExtraAttributes:m,name:p.constructorName,tags:p.tags??[]});p.spec=g,d[p.name]=g,Object.keys(y).length>0&&(this.dynamicAttributes.marks[p.name]=y)}}const f=new Mp({nodes:u,marks:d,topNode:"doc"});this.addSchema(f,u,d)}createPlugin(){return{appendTransaction:(t,e,n)=>{const{tr:r}=n;return!t.some(i=>i.docChanged)||Object.keys(this.dynamicAttributes.nodes).length===0&&Object.keys(this.dynamicAttributes.marks).length===0?null:(r.doc.descendants((i,o)=>(this.checkAndUpdateDynamicNodes(i,o,r),this.checkAndUpdateDynamicMarks(i,o,r),!0)),r.steps.length>0?r:null)}}}addSchema(t,e,n){this.store.setStoreKey("nodes",e),this.store.setStoreKey("marks",n),this.store.setStoreKey("schema",t),this.store.setExtensionStore("schema",t),this.store.setStoreKey("defaultBlockNode",$i(t).name);for(const r of Object.values(t.nodes))if(r.name!=="doc"&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(t,e,n){for(const[r,s]of he(this.dynamicAttributes.nodes))if(t.type.name===r)for(const[i,o]of he(s)){if(!en(t.attrs[i]))continue;const a={...t.attrs,[i]:o(t)};n.setNodeMarkup(e,void 0,a),hc(n)}}checkAndUpdateDynamicMarks(t,e,n){for(const[r,s]of he(this.dynamicAttributes.marks)){const i=re(this.store.schema.marks,r),o=t.marks.find(a=>a.type.name===r);if(o)for(const[a,l]of he(s)){if(!en(o.attrs[a]))continue;const c=In(n.doc.resolve(e),i);if(!c)continue;const{from:u,to:d}=c,h=i.create({...o.attrs,[a]:l(o)});n.removeMark(u,d,i).addMark(u,d,h),hc(n)}}}gatherExtraAttributes(t){const e=[];for(const n of t)n.createSchemaAttributes&&e.push(...n.createSchemaAttributes());return e}};Zo=T([G({defaultPriority:X.Highest})],Zo);function Lx(t){const{settings:e,gatheredSchemaAttributes:n,nodeNames:r,markNames:s,tags:i}=t,o=M();if(e.disableExtraAttributes)return o;const a=[...n,...e.extraAttributes??[]];for(const l of a??[]){const c=zx({identifiers:l.identifiers,nodeNames:r,markNames:s,tags:i});for(const u of c){const d=o[u]??{};o[u]={...d,...l.attributes}}}return o}function Bx(t){return Rn(t)&&pe(t.tags)}function zx(t){const{identifiers:e,nodeNames:n,markNames:r,tags:s}=t;if(e==="nodes")return n;if(e==="marks")return r;if(e==="all")return[...n,...r];if(pe(e))return e;R(Bx(e),{code:b.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:i=[],names:o=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=e,d=new Set,h=u==="mark"?r:u==="node"?n:[...r,...n],f=m=>h.includes(m)&&!(l!=null&&l.includes(m));for(const m of o)f(m)&&d.add(m);const p=new Map;for(const m of i)if(!(c!=null&&c.includes(m)))for(const g of s[m]){if(!f(g))continue;if(a==="any"){d.add(g);continue}const y=p.get(g)??new Set;y.add(m),p.set(g,y)}for(const[m,g]of p)g.size===i.length&&d.add(m);return[...d]}function vc(t){var e;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:s,name:i,tags:o,override:a}=t,l=M();function c(g,y){l[g]=y}let u=!1;function d(){u=!0}const h=$x(r,s,d,c),f=Fx(r,s),p=Vx(r,s),m=n({defaults:h,parse:f,dom:p},a);return R(s||u,{code:b.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${i}' to 'true'.`}),m.group=[...((e=m.group)==null?void 0:e.split(" "))??[],...o].join(" ")||void 0,{spec:m,dynamic:l}}function Pa(t){return D(t)||ee(t)?{default:t}:(R(t,{message:`${Ou(t)} is not supported`,code:b.EXTENSION_EXTRA_ATTRIBUTES}),t)}function $x(t,e,n,r){return()=>{n();const s=M();if(e)return s;for(const[i,o]of he(t)){let l=Pa(o).default;ee(l)&&(r(i,l),l=null),s[i]=l===void 0?{}:{default:l}}return s}}function Fx(t,e){return n=>{const r=M();if(e)return r;for(const[s,i]of he(t)){const{parseDOM:o,...a}=Pa(i);if(Ie(n)){if(en(o)){r[s]=n.getAttribute(s)??a.default;continue}if(ee(o)){r[s]=o(n)??a.default;continue}r[s]=n.getAttribute(o)??a.default}}return r}}function Vx(t,e){return n=>{const r=M();if(e)return r;function s(i,o){if(i){if(D(i)){r[o]=i;return}if(pe(i)){const[a,l]=i;r[a]=l??n.attrs[o];return}for(const[a,l]of he(i))r[a]=l}}for(const[i,o]of he(t)){const{toDOM:a,parseDOM:l}=Pa(o);if(en(a)){const c=D(l)?l:i;r[c]=n.attrs[i];continue}if(ee(a)){s(a(n.attrs,Hx(n)),i);continue}s(a,i)}return r}}function Hx(t){return Bi(t)?{node:t}:t0(t)?{mark:t}:{}}function Ux(t){const e=M(),n=M();for(const[r,s]of Object.entries(t.nodes))e[r]=s.spec;for(const[r,s]of Object.entries(t.marks))n[r]=s.spec;return{nodes:e,marks:n}}var lr=class extends te{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:t})=>{var e;if(!(!t||(e=this.store.managerSettings.exclude)!=null&&e.suggesters))return dc(this.store.getState(),t)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",t=>dc(this.store.getState(),t)),this.store.setExtensionStore("removeSuggester",t=>Hy(this.store.getState(),t))}createExternalPlugins(){var t,e;const n=[];for(const r of this.store.extensions){if((t=this.store.managerSettings.exclude)!=null&&t.suggesters)break;if(!r.createSuggesters||(e=r.options.exclude)!=null&&e.suggesters)continue;const s=r.createSuggesters(),i=pe(s)?s:[s];n.push(...i)}return[Uy(...n)]}getSuggestState(t){return Oa(t??this.store.getState())}getSuggestMethods(){const{addIgnored:t,clearIgnored:e,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:s,findMatchAtPosition:i,findNextTextSelection:o,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:t,clearIgnored:e,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:s,findMatchAtPosition:i,findNextTextSelection:o,setLastChangeFromAppend:a}}isSuggesterActive(t){var e;return gt(pe(t)?t:[t],(e=this.getSuggestState().match)==null?void 0:e.suggester.name)}};T([se()],lr.prototype,"getSuggestState",1);T([se()],lr.prototype,"getSuggestMethods",1);T([se()],lr.prototype,"isSuggesterActive",1);lr=T([G({customHandlerKeys:["suggester"]})],lr);var Qo=class extends te{constructor(){super(...arguments),this.allTags=M(),this.plainTags=M(),this.markTags=M(),this.nodeTags=M()}get name(){return"tags"}onCreate(){this.resetTags();for(const t of this.store.extensions)this.updateTagForExtension(t);this.store.setStoreKey("tags",this.allTags),this.store.setExtensionStore("tags",this.allTags),this.store.setStoreKey("plainTags",this.plainTags),this.store.setExtensionStore("plainTags",this.plainTags),this.store.setStoreKey("markTags",this.markTags),this.store.setExtensionStore("markTags",this.markTags),this.store.setStoreKey("nodeTags",this.nodeTags),this.store.setExtensionStore("nodeTags",this.nodeTags)}resetTags(){const t=M(),e=M(),n=M(),r=M();for(const s of Ni(j))t[s]=[],e[s]=[],n[s]=[],r[s]=[];this.allTags=t,this.plainTags=e,this.markTags=n,this.nodeTags=r}updateTagForExtension(t){var e,n;const r=new Set([...t.tags??[],...((e=t.createTags)==null?void 0:e.call(t))??[],...t.options.extraTags??[],...((n=this.store.managerSettings.extraTags)==null?void 0:n[t.name])??[]]);for(const s of r)R(jx(s),{code:b.EXTENSION,message:`The tag provided by the extension: ${t.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[s].push(t.name),xh(t)&&this.plainTags[s].push(t.name),Wi(t)&&this.markTags[s].push(t.name),Ts(t)&&this.nodeTags[s].push(t.name);t.tags=[...r]}};Qo=T([G({defaultPriority:X.Highest})],Qo);function jx(t){return gt(Ni(j),t)}var Wx=new pr("remirrorFilePlaceholderPlugin");function Kx(){const t=new un({key:Wx,state:{init(){return{set:W.empty,payloads:new Map}},apply(e,{set:n,payloads:r}){n=n.map(e.mapping,e.doc);const s=e.getMeta(t);if(s)if(s.type===0){const i=document.createElement("placeholder"),o=Q.widget(s.pos,i,{id:s.id});n=n.add(e.doc,[o]),r.set(s.id,s.payload)}else s.type===1&&(n=n.remove(n.find(void 0,void 0,i=>i.id===s.id)),r.delete(s.id));return{set:n,payloads:r}}},props:{decorations(e){var n;return((n=t.getState(e))==null?void 0:n.set)??null}}});return t}var qx=class extends te{get name(){return"upload"}createExternalPlugins(){return[Kx()]}};function Jx(t={}){t={...{exitMarksOnArrowPress:st.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:st.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:st.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:st.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:ct.defaultOptions.persistentSelectionClass},...t};const n=Co(t,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=Co(t,["persistentSelectionClass"]);return[new Qo,new Zo,new Sx,new Yo,new Go,new Px,new Dx,new lr,new H,new Xe,new st(n),new Jo,new qx,new ct(r)]}var wc=class extends te{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),!!this.options.capture)for(const t of this.store.extensions)this.captureCommands(t),this.captureKeybindings(t)}createPlugin(){return{}}captureCommands(t){const e=t.decoratedCommands??{},n=t.createCommands;for(const r of Object.keys(e)){const s=t[r];t[r]=(...i)=>o=>{var a;const l=s(...i)(o);return o.dispatch&&l&&this.setCommandMeta(o.tr,{type:"command",chain:o.dispatch!==((a=o.view)==null?void 0:a.dispatch),name:r,extension:t.name,decorated:!0}),l}}n&&(t.createCommands=()=>{const r=n();for(const[s,i]of Object.entries(r))r[s]=(...o)=>a=>{var l;const c=i(...o)(a);return a.dispatch&&c&&this.setCommandMeta(a.tr,{type:"command",chain:a.dispatch!==((l=a.view)==null?void 0:l.dispatch),name:s,extension:t.name,decorated:!1}),c};return r})}captureKeybindings(t){}getCommandMeta(t){return t.getMeta(this.pluginKey)??[]}setCommandMeta(t,e){const n=this.getCommandMeta(t);t.setMeta(this.pluginKey,[...n,e])}};wc=T([G({defaultOptions:{capture:rt.isDevelopment},staticKeys:["capture"],defaultPriority:X.Highest})],wc);var Fs,Cr,Vs,jn,Ft,Hs,Us,Gx=class{constructor(t){ce(this,Fs,ni()),ce(this,Cr,void 0),ce(this,Vs,void 0),ce(this,jn,!0),ce(this,Ft,Hi()),ce(this,Hs,void 0),ce(this,Us,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var o,a;R(!this.manager.destroyed,{code:b.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),i=((a=(o=this.props).onDispatchTransaction)==null?void 0:a.call(o,i,this.getState()))??i;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(i);ye(this,Vs,l),this.updateState({state:c,tr:i,transactions:u});const d=this.manager.store.getForcedUpdates(i);tn(d)||this.updateViewProps(...d)},this.onChange=(i=M())=>{var o,a;const l=this.eventListenerProps(i);v(this,jn)&&ye(this,jn,!1),(a=(o=this.props).onChange)==null||a.call(o,l)},this.onBlur=i=>{var o,a;const l=this.eventListenerProps();(a=(o=this.props).onBlur)==null||a.call(o,l,i),v(this,Ft).emit("blur",l,i)},this.onFocus=i=>{var o,a;const l=this.eventListenerProps();(a=(o=this.props).onFocus)==null||a.call(o,l,i),v(this,Ft).emit("focus",l,i)},this.setContent=(i,{triggerChange:o=!1}={})=>{const{doc:a}=this.manager.createState({content:i}),l=this.getState(),{state:c}=this.getState().applyTransaction(l.tr.replaceRangeWith(0,l.doc.nodeSize-2,a));if(o)return this.updateState({state:c,triggerChange:o});this.view.updateState(c)},this.clearContent=({triggerChange:i=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:i})},this.createStateFromContent=(i,o)=>this.manager.createState({content:i,selection:o}),this.focus=i=>{this.manager.store.commands.focus(i)},this.blur=i=>{this.manager.store.commands.blur(i)};const{getProps:e,initialEditorState:n,element:r}=t;if(ye(this,Cr,e),ye(this,Us,n),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;const s=this.createView(n,r);this.manager.addView(s)}get addHandler(){return v(this,Hs)??ye(this,Hs,v(this,Ft).on.bind(v(this,Ft)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return v(this,jn)}get props(){return v(this,Cr).call(this)}get previousState(){return this.previousStateOverride??v(this,Vs)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return v(this,Fs)}get initialEditorState(){return v(this,Us)}updateListener(t){const{state:e,tr:n}=t;return v(this,Ft).emit("updated",this.eventListenerProps({state:e,tr:n}))}update(t){const{getProps:e}=t;return ye(this,Cr,e),this}updateViewProps(...t){const e=Co(this.updatableViewProps,t);this.view.setProps({...this.view.props,...e})}getAttributes(t){var e;const{attributes:n,autoFocus:r,classNames:s=[],label:i,editable:o}=this.props,a=(e=this.manager.store)==null?void 0:e.attributes,l=ee(n)?n(this.eventListenerProps()):n;let c={};(r||Ge(r))&&(c=t?{autoFocus:!0}:{autofocus:"true"});const u=es(qo(t&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...s).split(" ")).join(" "),d={role:"textbox",...c,"aria-multiline":"true",...o??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return np({...d,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){v(this,Ft).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(t=M()){const{state:e,tr:n,transactions:r}=t;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:v(this,jn),state:e??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:v(this,Fs),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};Fs=new WeakMap;Cr=new WeakMap;Vs=new WeakMap;jn=new WeakMap;Ft=new WeakMap;Hs=new WeakMap;Us=new WeakMap;function Xx(t,e){const n=[],r=new WeakMap,s=[],i=new WeakMap;let o=[];const a={duplicateMap:i,parentExtensions:s,gatheredExtensions:o,settings:e};for(const d of t)kh(a,{extension:d});o=tr(o,(d,h)=>h.priority-d.priority);const l=new WeakSet,c=new Set;for(const d of o){const h=d.constructor,f=d.name,p=i.get(h);R(p,{message:`No entries were found for the ExtensionConstructor ${d.name}`,code:b.INTERNAL}),!(l.has(h)||c.has(f))&&(l.add(h),c.add(f),n.push(d),r.set(h,d),p.forEach(m=>m==null?void 0:m.replaceChildExtension(h,d)))}const u=[];for(const d of n)Yx({extension:d,found:l,missing:u});return R(tn(u),{code:b.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:d,extension:h})=>`The extension '${h.name}' requires '${d.name} in order to run correctly.`).join(`
52
- `)}),{extensions:n,extensionMap:r}}function kh(t,e){var n;const{gatheredExtensions:r,duplicateMap:s,parentExtensions:i,settings:o}=t,{extension:a,parentExtension:l}=e;let{names:c=[]}=e;R(yh(a),{code:b.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=o.priority)==null?void 0:n[a.name]),r.push(a),Zx({duplicateMap:s,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],i.push(a);for(const d of u)kh(t,{names:c,extension:d,parentExtension:a})}}function Yx(t){const{extension:e,found:n,missing:r}=t;if(e.requiredExtensions)for(const s of e.requiredExtensions??[])n.has(s)||r.push({Constructor:s,extension:e})}function Zx(t){const{duplicateMap:e,extension:n,parentExtension:r}=t,s=n.constructor,i=e.get(s),o=r?[r]:[];e.set(s,i?[...i,...o]:o)}function Qx(t){var e,n,r,s;const{extension:i,nodeNames:o,markNames:a,plainNames:l,store:c,handlers:u}=t;i.setStore(c);const d=(e=i.onCreate)==null?void 0:e.bind(i),h=(n=i.onView)==null?void 0:n.bind(i),f=(r=i.onStateUpdate)==null?void 0:r.bind(i),p=(s=i.onDestroy)==null?void 0:s.bind(i);d&&u.create.push(d),h&&u.view.push(h),f&&u.update.push(f),p&&u.destroy.push(p),Wi(i)&&a.push(i.name),Ts(i)&&i.name!=="doc"&&o.push(i.name),xh(i)&&l.push(i.name)}var Vt,Tr,Qe,wt,Or,He,fn,Mr,pn,_r,mn,et,Nr,js=class{constructor(t,e={}){ce(this,Vt,void 0),ce(this,Tr,M()),ce(this,Qe,M()),ce(this,wt,void 0),ce(this,Or,void 0),ce(this,He,Pe.None),ce(this,fn,void 0),ce(this,Mr,!0),ce(this,pn,{create:[],view:[],update:[],destroy:[]}),ce(this,_r,[]),ce(this,mn,Hi()),ce(this,et,void 0),ce(this,Nr,void 0),this.getState=()=>{var s;return v(this,He)>=Pe.EditorView?this.view.state:(R(v(this,et),{code:b.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),(s=v(this,et))==null?void 0:s.initialEditorState)},this.updateState=s=>{const i=this.getState();this.view.updateState(s),this.onStateUpdate({previousState:i,state:s})};const{extensions:n,extensionMap:r}=Xx(t,e);ye(this,fn,e),ye(this,wt,xn(n)),ye(this,Or,r),ye(this,Vt,this.createExtensionStore()),ye(this,He,Pe.Create),this.setupLifecycleHandlers();for(const s of v(this,pn).create){const i=s();i&&v(this,_r).push(i)}}static create(t,e={}){return new js([...Au(t),...Jx(e.builtin)],e)}get[At](){return xe.Manager}get destroyed(){return v(this,He)===Pe.Destroy}get mounted(){return v(this,He)>=Pe.EditorView&&v(this,He)<Pe.Destroy}get output(){var t;return(t=v(this,et))==null?void 0:t.frameworkOutput}get frameworkAttached(){return!!v(this,et)}get extensions(){return v(this,wt)}get stringHandlers(){return v(this,Tr)}get store(){return xn(v(this,Qe))}get extensionStore(){return xn(v(this,Vt))}get tr(){return this.getExtension(H).transaction}get nodes(){return v(this,Qe).nodes}get marks(){return v(this,Qe).marks}get schema(){return v(this,Qe).schema}get extensionTags(){return v(this,Qe).tags}get view(){return v(this,Qe).view}get settings(){return v(this,fn)}get document(){return v(this,fn).document??Fi()}setupLifecycleHandlers(){const t=v(this,Vt),e=v(this,pn),n=[],r=[],s=[];t.nodeNames=n,t.markNames=r,t.plainNames=s;for(const i of v(this,wt))Qx({extension:i,nodeNames:n,markNames:r,plainNames:s,handlers:e,store:t})}setStringHandler(t,e){v(this,Tr)[t]=e}setStoreKey(t,e){v(this,Qe)[t]=e}getStoreKey(t){const e=v(this,Qe)[t];return R(!en(e),{code:b.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),e}setExtensionStore(t,e){R(v(this,He)<=Pe.EditorView,{code:b.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),v(this,Vt)[t]=e}createExtensionStore(){const t=M(),e=!0;let n,r;return Object.defineProperties(t,{extensions:{get:()=>v(this,wt),enumerable:e},phase:{get:()=>v(this,He),enumerable:e},view:{get:()=>this.view,enumerable:e},managerSettings:{get:()=>xn(v(this,fn)),enumerable:e},getState:{value:this.getState,enumerable:e},updateState:{value:this.updateState,enumerable:e},isMounted:{value:()=>this.mounted,enumerable:e},getExtension:{value:this.getExtension.bind(this),enumerable:e},manager:{get:()=>this,enumerable:e},document:{get:()=>this.document,enumerable:e},stringHandlers:{get:()=>v(this,Tr),enumerable:e},currentState:{get:()=>n??(n=this.getState()),set:s=>{n=s},enumerable:e},previousState:{get:()=>r,set:s=>{r=s},enumerable:e}}),t.getStoreKey=this.getStoreKey.bind(this),t.setStoreKey=this.setStoreKey.bind(this),t.setExtensionStore=this.setExtensionStore.bind(this),t.setStringHandler=this.setStringHandler.bind(this),t}addView(t){if(v(this,He)>=Pe.EditorView)return this;ye(this,Mr,!0),ye(this,He,Pe.EditorView),v(this,Qe).view=t;for(const e of v(this,pn).view){const n=e(t);n&&v(this,_r).push(n)}return this}attachFramework(t,e){var n;v(this,et)!==t&&(v(this,et)&&(v(this,et).destroy(),(n=v(this,Nr))==null||n.call(this)),ye(this,et,t),ye(this,Nr,this.addHandler("stateUpdate",e)))}createEmptyDoc(){var t;const e=(t=this.schema.nodes.doc)==null?void 0:t.createAndFill();return R(e,{code:b.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),e}createState(t={}){const{onError:e,defaultSelection:n="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:s=n,stringHandler:i=this.settings.stringHandler}=t,{schema:o,plugins:a}=this.store,l=nh({stringHandler:D(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:e,schema:o,selection:s});return bn.create({schema:o,doc:l,plugins:a,selection:lt(s,l)})}addHandler(t,e){return v(this,mn).on(t,e)}onStateUpdate(t){const e=v(this,Mr);v(this,Vt).currentState=t.state,v(this,Vt).previousState=t.previousState,e&&(ye(this,He,Pe.Runtime),ye(this,Mr,!1));const n={...t,firstUpdate:e};for(const r of v(this,pn).update)r(n);v(this,mn).emit("stateUpdate",n)}getExtension(t){const e=v(this,Or).get(t);return R(e,{code:b.INVALID_MANAGER_EXTENSION,message:`'${t.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),e}hasExtension(t){return!!v(this,Or).get(t)}clone(){const t=v(this,wt).map(n=>n.clone(n.options)),e=js.create(()=>t,v(this,fn));return v(this,mn).emit("clone",e),e}recreate(t=[],e={}){const n=v(this,wt).map(s=>s.clone(s.initialOptions)),r=js.create(()=>[...n,...t],e);return v(this,mn).emit("recreate",r),r}destroy(){var t,e,n,r,s,i;ye(this,He,Pe.Destroy);for(const o of((t=this.view)==null?void 0:t.state.plugins)??[])(n=(e=o.getState(this.view.state))==null?void 0:e.destroy)==null||n.call(e);(r=v(this,et))==null||r.destroy(),(s=v(this,Nr))==null||s.call(this);for(const o of v(this,_r))o();for(const o of v(this,pn).destroy)o();(i=this.view)==null||i.destroy(),v(this,mn).emit("destroy")}includes(t){const e=[],n=[];for(const r of v(this,wt))e.push(r.name,r.constructorName),n.push(r.constructor);return t.every(r=>D(r)?gt(e,r):gt(n,r))}},eb=js;Vt=new WeakMap;Tr=new WeakMap;Qe=new WeakMap;wt=new WeakMap;Or=new WeakMap;He=new WeakMap;fn=new WeakMap;Mr=new WeakMap;pn=new WeakMap;_r=new WeakMap;mn=new WeakMap;et=new WeakMap;Nr=new WeakMap;function tb(t,e){return!mr(t)||!gr(t,xe.Manager)?!1:e?t.includes(e):!0}function Ot(t,e,n){return Math.min(Math.max(t,n),e)}class nb extends Error{constructor(e){super(`Failed to parse color: "${e}"`)}}var Ar=nb;function La(t){if(typeof t!="string")throw new Ar(t);if(t.trim().toLowerCase()==="transparent")return[0,0,0,0];let e=t.trim();e=ub.test(t)?ib(t):t;const n=ob.exec(e);if(n){const o=Array.from(n).slice(1);return[...o.slice(0,3).map(a=>parseInt(cs(a,2),16)),parseInt(cs(o[3]||"f",2),16)/255]}const r=ab.exec(e);if(r){const o=Array.from(r).slice(1);return[...o.slice(0,3).map(a=>parseInt(a,16)),parseInt(o[3]||"ff",16)/255]}const s=lb.exec(e);if(s){const o=Array.from(s).slice(1);return[...o.slice(0,3).map(a=>parseInt(a,10)),parseFloat(o[3]||"1")]}const i=cb.exec(e);if(i){const[o,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(Ot(0,100,a)!==a)throw new Ar(t);if(Ot(0,100,l)!==l)throw new Ar(t);return[...db(o,a,l),Number.isNaN(c)?1:c]}throw new Ar(t)}function rb(t){let e=5381,n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return(e>>>0)%2341}const Ec=t=>parseInt(t.replace(/_/g,""),36),sb="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((t,e)=>{const n=Ec(e.substring(0,3)),r=Ec(e.substring(3)).toString(16);let s="";for(let i=0;i<6-r.length;i++)s+="0";return t[n]=`${s}${r}`,t},{});function ib(t){const e=t.toLowerCase().trim(),n=sb[rb(e)];if(!n)throw new Ar(t);return`#${n}`}const cs=(t,e)=>Array.from(Array(e)).map(()=>t).join(""),ob=new RegExp(`^#${cs("([a-f0-9])",3)}([a-f0-9])?$`,"i"),ab=new RegExp(`^#${cs("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),lb=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${cs(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),cb=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,ub=/^[a-z]+$/i,Cc=t=>Math.round(t*255),db=(t,e,n)=>{let r=n/100;if(e===0)return[r,r,r].map(Cc);const s=(t%360+360)%360/60,i=(1-Math.abs(2*r-1))*(e/100),o=i*(1-Math.abs(s%2-1));let a=0,l=0,c=0;s>=0&&s<1?(a=i,l=o):s>=1&&s<2?(a=o,l=i):s>=2&&s<3?(l=i,c=o):s>=3&&s<4?(l=o,c=i):s>=4&&s<5?(a=o,c=i):s>=5&&s<6&&(a=i,c=o);const u=r-i/2,d=a+u,h=l+u,f=c+u;return[d,h,f].map(Cc)};function hb(t){const[e,n,r,s]=La(t).map((d,h)=>h===3?d:d/255),i=Math.max(e,n,r),o=Math.min(e,n,r),a=(i+o)/2;if(i===o)return[0,0,a,s];const l=i-o,c=a>.5?l/(2-i-o):l/(i+o);return[60*(e===i?(n-r)/l+(n<r?6:0):n===i?(r-e)/l+2:(e-n)/l+4),c,a,s]}function fb(t,e,n,r){return`hsla(${(t%360).toFixed()}, ${Ot(0,100,e*100).toFixed()}%, ${Ot(0,100,n*100).toFixed()}%, ${parseFloat(Ot(0,1,r).toFixed(3))})`}function je(t,e){const[n,r,s,i]=hb(t);return fb(n,r,s-e,i)}function pb(t){if(t==="transparent")return 0;function e(i){const o=i/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}const[n,r,s]=La(t);return .2126*e(n)+.7152*e(r)+.0722*e(s)}function mb(t,e,n,r){return`rgba(${Ot(0,255,t).toFixed()}, ${Ot(0,255,e).toFixed()}, ${Ot(0,255,n).toFixed()}, ${parseFloat(Ot(0,1,r).toFixed(3))})`}function Ws(t,e){return je(t,-e)}function bi(t,e){const[n,r,s,i]=La(t);return mb(n,r,s,i-e)}function gb(t){return pb(t)>.179}function Qn(t){return gb(t)?"#000":"#fff"}const yb="remirror-editor-wrapper",xb="remirror-button-active",bb="remirror-button",kb="remirror-composite",Sb="remirror-dialog",vb="remirror-dialog-backdrop",wb="remirror-form",Eb="remirror-form-message",Cb="remirror-form-label",Tb="remirror-form-group",Ob="remirror-group",Mb="remirror-input",_b="remirror-menu",Nb="remirror-menu-pane",Ab="remirror-menu-pane-active",Rb="remirror-menu-dropdown-label",Ib="remirror-menu-pane-icon",Db="remirror-menu-pane-label",Pb="remirror-menu-pane-shortcut",Lb="remirror-menu-button-left",Bb="remirror-menu-button-right",zb="remirror-menu-button-nested-left",$b="remirror-menu-button-nested-right",Fb="remirror-menu-button",Vb="remirror-menu-bar",Hb="remirror-flex-column",Ub="remirror-flex-row",jb="remirror-menu-item",Wb="remirror-menu-item-row",Kb="remirror-menu-item-column",qb="remirror-menu-item-checkbox",Jb="remirror-menu-item-radio",Gb="remirror-menu-group",Xb="remirror-floating-popover",Yb="remirror-popover",Zb="remirror-animated-popover",Qb="remirror-role",e1="remirror-separator",t1="remirror-tab",n1="remirror-tab-list",r1="remirror-tabbable",s1="remirror-toolbar",i1="remirror-tooltip",o1="remirror-table-size-editor",a1="remirror-table-size-editor-body",l1="remirror-table-size-editor-cell",c1="remirror-table-size-editor-cell-selected",u1="remirror-table-size-editor-footer",d1="remirror-color-picker",h1="remirror-color-picker-cell",f1="remirror-color-picker-cell-selected";var p1=Object.freeze({__proto__:null,ANIMATED_POPOVER:Zb,BUTTON:bb,BUTTON_ACTIVE:xb,COLOR_PICKER:d1,COLOR_PICKER_CELL:h1,COLOR_PICKER_CELL_SELECTED:f1,COMPOSITE:kb,DIALOG:Sb,DIALOG_BACKDROP:vb,EDITOR_WRAPPER:yb,FLEX_COLUMN:Hb,FLEX_ROW:Ub,FLOATING_POPOVER:Xb,FORM:wb,FORM_GROUP:Tb,FORM_LABEL:Cb,FORM_MESSAGE:Eb,GROUP:Ob,INPUT:Mb,MENU:_b,MENU_BAR:Vb,MENU_BUTTON:Fb,MENU_BUTTON_LEFT:Lb,MENU_BUTTON_NESTED_LEFT:zb,MENU_BUTTON_NESTED_RIGHT:$b,MENU_BUTTON_RIGHT:Bb,MENU_DROPDOWN_LABEL:Rb,MENU_GROUP:Gb,MENU_ITEM:jb,MENU_ITEM_CHECKBOX:qb,MENU_ITEM_COLUMN:Kb,MENU_ITEM_RADIO:Jb,MENU_ITEM_ROW:Wb,MENU_PANE:Nb,MENU_PANE_ACTIVE:Ab,MENU_PANE_ICON:Ib,MENU_PANE_LABEL:Db,MENU_PANE_SHORTCUT:Pb,POPOVER:Yb,ROLE:Qb,SEPARATOR:e1,TAB:t1,TABBABLE:r1,TABLE_SIZE_EDITOR:o1,TABLE_SIZE_EDITOR_BODY:a1,TABLE_SIZE_EDITOR_CELL:l1,TABLE_SIZE_EDITOR_CELL_SELECTED:c1,TABLE_SIZE_EDITOR_FOOTER:u1,TAB_LIST:n1,TOOLBAR:s1,TOOLTIP:i1});const m1="remirror-list-item-with-custom-mark",g1="remirror-ul-list-content",y1="remirror-editor",x1="remirror-list-item-marker-container",b1="remirror-list-item-checkbox",k1="remirror-collapsible-list-item-closed",S1="remirror-collapsible-list-item-button",v1="remirror-list-spine";var sn=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:S1,COLLAPSIBLE_LIST_ITEM_CLOSED:k1,EDITOR:y1,LIST_ITEM_CHECKBOX:b1,LIST_ITEM_MARKER_CONTAINER:x1,LIST_ITEM_WITH_CUSTOM_MARKER:m1,LIST_SPINE:v1,UL_LIST_CONTENT:g1});const w1="remirror-is-empty";var E1=Object.freeze({__proto__:null,IS_EMPTY:w1});const C1="remirror-editor",T1="remirror-positioner",O1="remirror-positioner-widget";var M1=Object.freeze({__proto__:null,EDITOR:C1,POSITIONER:T1,POSITIONER_WIDGET:O1});const tt={gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},Mt="#000000",Ba="#ffffff",_1="#252103",za=bi(Mt,.75),Ki="#7963d2",$a="#bcd263",N1="#fff",A1="#fff",Fa=tt.gray[1],Tc="rgba(10,31,68,0.08)",Oc="rgba(10,31,68,0.10)",Mc="rgba(10,31,68,0.12)",R1=Ws(bi(Mt,.1),.13),Va={background:Ba,border:za,foreground:Mt,muted:Fa,primary:Ki,secondary:$a,primaryText:N1,secondaryText:A1,text:_1,faded:R1},I1={...Va,background:je(Ba,.15),border:je(za,.15),foreground:je(Mt,.15),muted:je(Fa,.15),primary:je(Ki,.15),secondary:je($a,.15),get text(){return Qn(this.background)},get primaryText(){return Qn(this.primary)},get secondaryText(){return Qn(this.secondary)}},D1={...Va,background:je(Ba,.075),border:je(za,.075),foreground:je(Mt,.075),muted:je(Fa,.075),primary:je(Ki,.075),secondary:je($a,.075),get text(){return Qn(this.background)},get primaryText(){return Qn(this.primary)},get secondaryText(){return Qn(this.secondary)}};({...Va,backdrop:bi(Mt,.1),outline:bi(Ki,.6),table:(Ws(Mt,.8),Ws(Mt,.4),tt.gray[3],tt.blue[7],tt.blue[1],tt.blue[5],tt.blue[7],Ws(Mt,.4),tt.blue[5],tt.red[7],tt.red[1],tt.red[5])},`${Tc}`,`${Oc}`,`${Mc}`);var P1=Object.defineProperty,L1=Object.getOwnPropertyDescriptor,Ha=(t,e,n,r)=>{for(var s=r>1?void 0:r?L1(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&P1(e,n,s),s},Sh=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},ue=(t,e,n)=>(Sh(t,e,"read from private field"),n?n.call(t):e.get(t)),vt=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Lt=(t,e,n,r)=>(Sh(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Rr,Ir,Wn,Dr,Ks,Pr,Lr,Br,zr,qs=class{constructor(t){vt(this,Rr,Hi()),vt(this,Ir,[]),vt(this,Wn,new Map),vt(this,Dr,[]),vt(this,Ks,!1),vt(this,Pr,void 0),vt(this,Lr,void 0),vt(this,Br,void 0),vt(this,zr,void 0),this.addListener=(e,n)=>ue(this,Rr).on(e,n),Lt(this,Pr,t),Lt(this,Lr,t.getActive),Lt(this,zr,t.getPosition),Lt(this,Br,t.getID),this.hasChanged=t.hasChanged,this.events=t.events??["state","scroll"]}static create(t){return new qs(t)}static fromPositioner(t,e){return qs.create({...t.basePositioner,...e})}get basePositioner(){return{getActive:ue(this,Lr),getPosition:ue(this,zr),hasChanged:this.hasChanged,events:this.events,getID:ue(this,Br)}}onActiveChanged(t){this.recentUpdate=t;const e=ue(this,Lr).call(this,t);Lt(this,Ir,e),Lt(this,Wn,new Map),Lt(this,Ks,!1),Lt(this,Dr,[]);const n=[];for(const[r,s]of e.entries()){const i=this.getID(s,r);ue(this,Dr).push(i),n.push({setElement:o=>this.addProps({...t,data:s,element:o},r),id:i,data:s})}ue(this,Rr).emit("update",n)}getID(t,e){var n;return((n=ue(this,Br))==null?void 0:n.call(this,t,e))??e.toString()}addProps(t,e){if(ue(this,Ks)||(ue(this,Wn).set(e,t),ue(this,Wn).size<ue(this,Ir).length))return;const n=[];for(const r of ue(this,Ir).keys()){const s=ue(this,Wn).get(r);R(s,{code:b.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=ue(this,Dr)[r];if(!i)return;n.push({position:ue(this,zr).call(this,s),element:s.element,id:i})}ue(this,Rr).emit("done",n)}clone(t){return qs.create({...ue(this,Pr),...ee(t)?t(ue(this,Pr)):t})}active(t){const e=ee(t)?t:()=>t;return this.clone(n=>({getActive:r=>n.getActive(r).filter(e)}))}},ot=qs;Rr=new WeakMap;Ir=new WeakMap;Wn=new WeakMap;Dr=new WeakMap;Ks=new WeakMap;Pr=new WeakMap;Lr=new WeakMap;Br=new WeakMap;zr=new WeakMap;ot.EMPTY=[];function B1(t,e=Ch){const{key:n}=(t==null?void 0:t.getMeta(Eh))??{};return n===e}function vh(t){const{tr:e,state:n,previousState:r}=t;return!r||e&&B1(e)?!0:e?qy(e):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function wh(t,e,n={}){const r=e.getBoundingClientRect(),{accountForPadding:s=!1}=n;let i=0,o=0,a=0,l=0;if(Ie(e)&&s){const u=Number.parseFloat(Pt(e,"padding-left").replace("px","")),d=Number.parseFloat(Pt(e,"padding-right").replace("px","")),h=Number.parseFloat(Pt(e,"padding-top").replace("px","")),f=Number.parseFloat(Pt(e,"padding-bottom").replace("px","")),p=Number.parseFloat(Pt(e,"border-left").replace("px","")),m=Number.parseFloat(Pt(e,"border-right").replace("px","")),g=Number.parseFloat(Pt(e,"border-top").replace("px","")),y=Number.parseFloat(Pt(e,"border-bottom").replace("px","")),E=e.offsetWidth-e.clientWidth,L=e.offsetHeight-e.clientHeight;i+=u+p+(e.dir==="rtl"?E:0),o+=d+m+(e.dir==="rtl"?0:E),a+=h+g,l+=f+y+L}const c=new DOMRect(r.left+i,r.top+a,r.width-o,r.height-l);for(const[u,d]of[[t.top,t.left],[t.top,t.right],[t.bottom,t.left],[t.bottom,t.right]])if(cl(u,c.top,c.bottom)&&cl(d,c.left,c.right))return!0;return!1}var z1="remirror-positioner-widget",Eh="positionerUpdate",Ch="__all_positioners__",Th={y:-999999,x:-999999,width:0,height:0},_c={...Th,left:-999999,top:-999999,bottom:-999999,right:-999999},$1={...Th,rect:{..._c,toJSON:()=>_c},visible:!1},F1=ot.create({hasChanged:vh,getActive(t){const{state:e}=t;if(!Yd(e)||e.selection.$anchor.depth>2)return ot.EMPTY;const n=Li({predicate:r=>r.type.isBlock,selection:e});return n?[n]:ot.EMPTY},getPosition(t){const{view:e,data:n}=t,r=e.nodeDOM(n.pos);if(!Ie(r))return $1;const s=r.getBoundingClientRect(),i=e.dom.getBoundingClientRect(),o=s.height,a=s.width,l=e.dom.scrollLeft+s.left-i.left,c=e.dom.scrollTop+s.top-i.top,u=wh(s,e.dom);return{y:c,x:l,height:o,width:a,rect:s,visible:u}}}),Oh=F1.clone(({getActive:t})=>({getActive:e=>{const[n]=t(e);return n&&Ia(n.node)&&n.node.type===$i(e.state.schema)?[n]:ot.EMPTY}}));Oh.clone(({getPosition:t})=>({getPosition:e=>({...t(e),width:1})}));Oh.clone(({getPosition:t})=>({getPosition:e=>{const{width:n,x:r,y:s,height:i}=t(e);return{...t(e),width:1,x:n+r,rect:new DOMRect(n+r,s,1,i)}}}));function Ua(t){return ot.create({hasChanged:vh,getActive:e=>{const{state:n,view:r}=e;if(!t(n)||!yr(n.selection))return ot.EMPTY;try{const{head:s,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(s)}]}catch{return ot.EMPTY}},getPosition(e){const{element:n,data:r,view:s}=e,{from:i,to:o}=r,a=n.offsetParent??s.dom,l=a.getBoundingClientRect(),c=Math.abs(o.bottom-i.top),u=c>i.bottom-i.top,d=Math.min(i.left,o.left),h=Math.min(i.top,o.top),f=a.scrollLeft+(u?o.left-l.left:d-l.left),p=a.scrollTop+h-l.top,m=u?1:Math.abs(i.left-o.right),g=new DOMRect(u?o.left:d,h,m,c),y=wh(g,s.dom);return{rect:g,y:p,x:f,height:c,width:m,visible:y}}})}var V1=Ua(t=>!t.selection.empty);Ua(t=>t.selection.empty);Ua(()=>!0);V1.clone(()=>({getActive:t=>{const{state:e,view:n}=t;if(!e.selection.empty)return ot.EMPTY;const r=a0(e);if(!r)return ot.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return ot.EMPTY}}}));var us=class extends te{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:t})=>{if(t)return this.positioners=[...this.positioners,t],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(e=>e!==t)}}}get name(){return"positioner"}createAttributes(){return{class:M1.EDITOR}}init(){this.onScroll=Jf(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(t,e)=>(this.positioner(this.getBaseProps("hover",{hover:e})),!1),contextmenu:(t,e)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:e})),!1)}}onStateUpdate(t){this.positioner({...t,previousState:t.firstUpdate?void 0:t.previousState,event:"state",helpers:this.store.helpers})}createDecorations(t){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return W.empty;const e=Q.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return W.create(t.doc,[e])}forceUpdatePositioners(t=Ch){return({tr:e,dispatch:n})=>(n==null||n(e.setMeta(Eh,{key:t})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const t=document.createElement("span");return t.dataset.id=z1,t.setAttribute("role","presentation"),t}triggerPositioner(t,e){t.hasChanged(e)&&t.onActiveChanged({...e,view:this.store.view})}positioner(t){for(const e of this.positioners)e.events.includes(t.event)&&this.triggerPositioner(e,t)}getBaseProps(t,e){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:t,firstUpdate:!1,previousState:r,state:n,...e}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};Ha([_()],us.prototype,"forceUpdatePositioners",1);Ha([se()],us.prototype,"getPositionerWidget",1);us=Ha([G({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],us);var H1=Object.defineProperty,U1=Object.getOwnPropertyDescriptor,Os=(t,e,n,r)=>{for(var s=r>1?void 0:r?U1(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&H1(e,n,s),s},j1={icon:"bold",label:({t})=>t(Cl.LABEL),description:({t})=>t(Cl.DESCRIPTION)},Nn=class extends ji{get name(){return"bold"}createTags(){return[j.FormattingMark,j.FontStyle]}createMarkSpec(t,e){return{...e,attrs:t.defaults(),parseDOM:[{tag:"strong",getAttrs:t.parse},{tag:"b",getAttrs:n=>Ie(n)&&n.style.fontWeight!=="normal"?t.parse(n):!1},{style:"font-weight",getAttrs:n=>D(n)&&/^(bold(er)?|[5-9]\d{2,})$/.test(n)?null:!1},...e.parseDOM??[]],toDOM:n=>{const{weight:r}=this.options;return r?["strong",{"font-weight":r.toString()},0]:["strong",t.dom(n),0]}}}createInputRules(){return[yi({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(t){return ar({type:this.type,selection:t})}setBold(t){return({tr:e,dispatch:n})=>{const{from:r,to:s}=lt(t??e.selection,e.doc);return n==null||n(e.addMark(r,s,this.type.create())),!0}}removeBold(t){return({tr:e,dispatch:n})=>{const{from:r,to:s}=lt(t??e.selection,e.doc);return e.doc.rangeHasMark(r,s,this.type)?(n==null||n(e.removeMark(r,s,this.type)),!0):!1}}shortcut(t){return this.toggleBold()(t)}};Os([_(j1)],Nn.prototype,"toggleBold",1);Os([_()],Nn.prototype,"setBold",1);Os([_()],Nn.prototype,"removeBold",1);Os([Ye({shortcut:w.Bold,command:"toggleBold"})],Nn.prototype,"shortcut",1);Nn=Os([G({defaultOptions:{weight:void 0},staticKeys:["weight"]})],Nn);var W1=Object.defineProperty,K1=Object.getOwnPropertyDescriptor,ja=(t,e,n,r)=>{for(var s=r>1?void 0:r?K1(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&W1(e,n,s),s},{DESCRIPTION:q1,LABEL:J1}=wm,G1={icon:"codeLine",description:({t})=>t(q1),label:({t})=>t(J1)},ds=class extends ji{get name(){return"code"}createTags(){return[j.Code,j.ExcludeInputRules]}createMarkSpec(t,e){return{excludes:"_",...e,attrs:t.defaults(),parseDOM:[{tag:"code",getAttrs:t.parse},...e.parseDOM??[]],toDOM:n=>["code",{spellcheck:"false",...t.dom(n)},0]}}createKeymap(){return{"Mod-`":ar({type:this.type})}}keyboardShortcut(t){return this.toggleCode()(t)}toggleCode(){return ar({type:this.type})}createInputRules(){return[yi({regexp:new RegExp(`(?:\`)([^\`${la}]+)(?:\`)$`),type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{type:"mark",regexp:/`([^`]+)`/g,markType:this.type}]}};ja([Ye({shortcut:w.Code,command:"toggleCode"})],ds.prototype,"keyboardShortcut",1);ja([_(G1)],ds.prototype,"toggleCode",1);ds=ja([G({})],ds);var ki=200,be=function(){};be.prototype.append=function(e){return e.length?(e=be.from(e),!this.length&&e||e.length<ki&&this.leafAppend(e)||this.length<ki&&e.leafPrepend(this)||this.appendInner(e)):this};be.prototype.prepend=function(e){return e.length?be.from(e).append(this):this};be.prototype.appendInner=function(e){return new X1(this,e)};be.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?be.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};be.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};be.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};be.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};be.from=function(e){return e instanceof be?e:e&&e.length?new Mh(e):be.empty};var Mh=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=ki)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=ki)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(be);be.empty=new Mh([]);var X1=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(be);const Y1=500;class it{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new ht(d.map));let f=d.step.map(s.slice(i)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new ht(p,void 0,void 0,c.length+u.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(i)):d.selection,l=new it(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new ht(e.mapping.maps[u],d,n),f;(f=l&&l.merge(h))&&(h=f,u?i.pop():a=a.slice(0,a.length-1)),i.push(h),n&&(o++,n=void 0),s||(l=h)}let c=o-r.depth;return c>Q1&&(a=Z1(a,c),o-=c),new it(a.append(i),o)}remapping(e,n){let r=new Gn;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new it(this.items.append(e.map(n=>new ht(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},s);let l=n;this.items.forEach(h=>{let f=i.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=i.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(i.slice(l+1,f));g&&a++,r.push(new ht(p,m,g))}else r.push(new ht(p))},s);let c=[];for(let h=n;h<o;h++)c.push(new ht(i.maps[h]));let u=this.items.slice(0,s).append(c).append(r),d=new it(u,a);return d.emptyItemCount()>Y1&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&i++;let d=new ht(c.invert(),l,u),h,f=s.length-1;(h=s.length&&s[f].merge(d))?s[f]=h:s.push(d)}}else o.map&&r--},this.items.length,0),new it(be.from(s.reverse()),i)}}it.empty=new it(be.empty,0);function Z1(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class ht{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new ht(n.getMap().invert(),n,this.selection)}}}class Ut{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const Q1=20;function ek(t,e,n,r){let s=n.getMeta(mt),i;if(s)return s.historyState;n.getMeta(nk)&&(t=new Ut(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(mt))return o.getMeta(mt).redo?new Ut(t.done.addTransform(n,void 0,r,Js(e)),t.undone,Nc(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new Ut(t.done,t.undone.addTransform(n,void 0,r,Js(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!tk(n,t.prevRanges)),c=o?yo(t.prevRanges,n.mapping):Nc(n.mapping.maps[n.steps.length-1]);return new Ut(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Js(e)),it.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Ut(t.done.rebased(n,i),t.undone.rebased(n,i),yo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ut(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),yo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function tk(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function Nc(t){let e=[];return t.forEach((n,r,s,i)=>e.push(s,i)),e}function yo(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function _h(t,e,n,r){let s=Js(e),i=mt.get(e).spec.config,o=(r?t.undone:t.done).popEvent(e,s);if(!o)return;let a=o.selection.resolve(o.transform.doc),l=(r?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,s),c=new Ut(r?l:o.remaining,r?o.remaining:l,null,0,-1);n(o.transform.setSelection(a).setMeta(mt,{redo:r,historyState:c}).scrollIntoView())}let xo=!1,Ac=null;function Js(t){let e=t.plugins;if(Ac!=e){xo=!1,Ac=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){xo=!0;break}}return xo}const mt=new pr("history"),nk=new pr("closeHistory");function rk(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new un({key:mt,state:{init(){return new Ut(it.empty,it.empty,null,0,-1)},apply(e,n,r){return ek(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?Gs:r=="historyRedo"?$r:null;return s?(n.preventDefault(),s(e.state,e.dispatch)):!1}}}})}const Gs=(t,e)=>{let n=mt.getState(t);return!n||n.done.eventCount==0?!1:(e&&_h(n,t,e,!1),!0)},$r=(t,e)=>{let n=mt.getState(t);return!n||n.undone.eventCount==0?!1:(e&&_h(n,t,e,!0),!0)};function sk(t){let e=mt.getState(t);return e?e.done.eventCount:0}function ik(t){let e=mt.getState(t);return e?e.undone.eventCount:0}var ok=Object.defineProperty,ak=Object.getOwnPropertyDescriptor,Wa=(t,e,n,r)=>{for(var s=r>1?void 0:r?ak(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&ok(e,n,s),s},cr=class extends Rt{get name(){return"doc"}createNodeSpec(t,e){const{docAttributes:n,content:r}=this.options,s=M();if(Rn(n))for(const[i,o]of he(n))s[i]={default:o};else for(const i of n)s[i]={default:null};return{attrs:s,content:r,...e}}setDocAttributes(t){return({tr:e,dispatch:n})=>{if(n){for(const[r,s]of Object.entries(t))e.step(new hs(r,s));n(e)}return!0}}isDefaultDocNode({state:t=this.store.getState(),options:e}={}){return Ra(t.doc,e)}};Wa([_()],cr.prototype,"setDocAttributes",1);Wa([se()],cr.prototype,"isDefaultDocNode",1);cr=Wa([G({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:X.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],cr);var Nh="SetDocAttribute",Ah="RevertSetDocAttribute",hs=class extends me{constructor(t,e,n=Nh){super(),this.stepType=n,this.key=t,this.value=e}static fromJSON(t,e){return new hs(e.key,e.value,e.stepType)}apply(t){this.previous=t.attrs[this.key];const e={...t.attrs,[this.key]:this.value};return le.ok(t.type.create(e,t.content,t.marks))}invert(){return new hs(this.key,this.previous,Ah)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{me.jsonID(Nh,hs),me.jsonID(Ah,hs)}catch(t){if(!t.message.startsWith("Duplicate use of step JSON ID"))throw t}var lk=Object.defineProperty,ck=Object.getOwnPropertyDescriptor,Rh=(t,e,n,r)=>{for(var s=r>1?void 0:r?ck(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&lk(e,n,s),s};function uk(t,e,n,r){const s=t.docView.posFromDOM(e,n,r);return s===null||s<0?null:s}function dk(t,e){const n=e.target;if(n){const r=uk(t,n,0);if(r!==null){const s=t.state.doc.resolve(r),i=s.node().isLeaf?0:1,o=s.start()-i;return{pos:r,inside:o}}}return t.posAtCoords({left:e.clientX,top:e.clientY})??void 0}var Si=class extends te{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=t=>(e,n)=>{const r=n,s=dk(e,r);if(!s)return!1;const i=[],o=[],{inside:a,pos:l}=s;if(a===-1)return!1;const c=e.state.doc.resolve(l),u=c.depth+1;for(const d of Nu(u,1))i.push({node:d>c.depth&&c.nodeAfter?c.nodeAfter:c.node(d),pos:c.before(d)});for(const{type:d}of c.marksAcross(c)??[]){const h=In(c,d);h&&o.push(h)}return t(r,{view:e,nodes:i,marks:o,getMark:d=>{const h=D(d)?e.state.schema.marks[d]:d;return R(h,{code:b.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),o.find(f=>f.mark.type===h)},getNode:d=>{var h;const f=D(d)?e.state.schema.nodes[d]:d;R(f,{code:b.EXTENSION,message:"The node being checked does not exist"});const p=i.find(({node:m})=>m.type===f);if(p)return{...p,isRoot:!!((h=i[0])!=null&&h.node.eq(p.node))}}})}}get name(){return"events"}onView(){var t,e;if(!((t=this.store.managerSettings.exclude)!=null&&t.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(e=n.options.exclude)!=null&&e.clickHandler)continue;const r=n.createEventHandlers();for(const[s,i]of he(r))this.addHandler(s,i)}}createPlugin(){const t=new WeakMap,e=(n,r,s,i,o,a,l,c)=>{const u=this.store.currentState,{schema:d,doc:h}=u,f=h.resolve(i),p=t.has(l),m=hk({$pos:f,handled:p,view:s,state:u});let g=!1;p||(g=n(l,m)||g);const y={...m,pos:i,direct:c,nodeWithPosition:{node:o,pos:a},getNode:E=>{const L=D(E)?d.nodes[E]:E;return R(L,{code:b.EXTENSION,message:"The node being checked does not exist"}),L===o.type?{node:o,pos:a}:void 0}};return t.set(l,!0),r(l,y)||g};return{props:{handleKeyPress:(n,r)=>this.options.keypress(r)||!1,handleKeyDown:(n,r)=>this.options.keydown(r)||!1,handleTextInput:(n,r,s,i)=>this.options.textInput({from:r,to:s,text:i})||!1,handleClickOn:(n,r,s,i,o,a)=>e(this.options.clickMark,this.options.click,n,r,s,i,o,a),handleDoubleClickOn:(n,r,s,i,o,a)=>e(this.options.doubleClickMark,this.options.doubleClick,n,r,s,i,o,a),handleTripleClickOn:(n,r,s,i,o,a)=>e(this.options.tripleClickMark,this.options.tripleClick,n,r,s,i,o,a),handleDOMEvents:{focus:(n,r)=>this.options.focus(r)||!1,blur:(n,r)=>this.options.blur(r)||!1,mousedown:(n,r)=>(this.startMouseover(),this.options.mousedown(r)||!1),mouseup:(n,r)=>(this.endMouseover(),this.options.mouseup(r)||!1),mouseleave:(n,r)=>(this.mouseover=!1,this.options.mouseleave(r)||!1),mouseenter:(n,r)=>(this.mouseover=!0,this.options.mouseenter(r)||!1),keyup:(n,r)=>this.options.keyup(r)||!1,mouseout:this.createMouseEventHandler((n,r)=>{const s={...r,hovering:!1};return this.options.hover(n,s)||!1}),mouseover:this.createMouseEventHandler((n,r)=>{const s={...r,hovering:!0};return this.options.hover(n,s)||!1}),contextmenu:this.createMouseEventHandler((n,r)=>this.options.contextmenu(n,r)||!1),scroll:(n,r)=>this.options.scroll(r)||!1,copy:(n,r)=>this.options.copy(r)||!1,cut:(n,r)=>this.options.cut(r)||!1,paste:(n,r)=>this.options.paste(r)||!1}},view:n=>{let r=n.editable;const s=this.options;return{update(i){const o=i.editable;o!==r&&(s.editable(o),r=o)}}}}}isInteracting(){return this.mousedown&&this.mouseover}startMouseover(){this.mouseover=!0,!this.mousedown&&(this.mousedown=!0,this.store.document.documentElement.addEventListener("mouseup",()=>{this.endMouseover()},{once:!0}))}endMouseover(){this.mousedown&&(this.mousedown=!1,this.store.commands.emptyUpdate())}};Rh([se()],Si.prototype,"isInteracting",1);Si=Rh([G({handlerKeys:["blur","focus","mousedown","mouseup","mouseenter","mouseleave","textInput","keypress","keyup","keydown","click","clickMark","doubleClick","doubleClickMark","tripleClick","tripleClickMark","contextmenu","hover","scroll","copy","cut","paste","editable"],handlerKeyOptions:{blur:{earlyReturnValue:!0},focus:{earlyReturnValue:!0},mousedown:{earlyReturnValue:!0},mouseleave:{earlyReturnValue:!0},mouseup:{earlyReturnValue:!0},click:{earlyReturnValue:!0},doubleClick:{earlyReturnValue:!0},tripleClick:{earlyReturnValue:!0},hover:{earlyReturnValue:!0},contextmenu:{earlyReturnValue:!0},scroll:{earlyReturnValue:!0},copy:{earlyReturnValue:!0},cut:{earlyReturnValue:!0},paste:{earlyReturnValue:!0}},defaultPriority:X.High})],Si);function hk(t){const{handled:e,view:n,$pos:r,state:s}=t,i={getMark:_u,markRanges:[],view:n,state:s};if(e)return i;for(const{type:o}of r.marksAcross(r)??[]){const a=In(r,o);a&&i.markRanges.push(a)}return i.getMark=o=>{const a=D(o)?s.schema.marks[o]:o;return R(a,{code:b.EXTENSION,message:`The mark ${o} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class ie extends V{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ie.valid(r)?new ie(r):V.near(r)}content(){return S.empty}eq(e){return e instanceof ie&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ie(e.resolve(n.pos))}getBookmark(){return new Ka(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!fk(e)||!pk(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ie.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let l=e.doc.resolve(s);if(ie.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!I.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(ie.valid(a))return a}return null}}}ie.prototype.visible=!1;ie.findFrom=ie.findGapCursorFrom;V.jsonID("gapcursor",ie);class Ka{constructor(e){this.pos=e}map(e){return new Ka(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ie.valid(n)?new ie(n):V.near(n)}}function fk(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function pk(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function mk(){return new un({props:{decorations:bk,createSelectionBetween(t,e,n){return e.pos==n.pos&&ie.valid(n)?new ie(n):null},handleClick:yk,handleKeyDown:gk,handleDOMEvents:{beforeinput:xk}}})}const gk=ph({ArrowLeft:Rs("horiz",-1),ArrowRight:Rs("horiz",1),ArrowUp:Rs("vert",-1),ArrowDown:Rs("vert",1)});function Rs(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof P){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ie.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new ie(c))),!0):!1}}function yk(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ie.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&I.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ie(r))),!0)}function xk(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ie))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=x.empty;for(let o=r.length-1;o>=0;o--)s=x.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new S(s,0,0));return i.setSelection(P.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function bk(t){if(!(t.selection instanceof ie))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",W.create(t.doc,[Q.widget(t.selection.head,e,{key:"gapcursor"})])}var kk=Object.defineProperty,Sk=Object.getOwnPropertyDescriptor,vk=(t,e,n,r)=>{for(var s=r>1?void 0:r?Sk(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&kk(e,n,s),s},ea=class extends te{get name(){return"gapCursor"}createExternalPlugins(){return[mk()]}};ea=vk([G({})],ea);var wk=Object.defineProperty,Ek=Object.getOwnPropertyDescriptor,Dn=(t,e,n,r)=>{for(var s=r>1?void 0:r?Ek(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&wk(e,n,s),s},bt=class extends te{constructor(){super(...arguments),this.wrapMethod=(t,e)=>({state:n,dispatch:r,view:s})=>{const{getState:i,getDispatch:o}=this.options,a=ee(i)?i():n,l=ee(o)&&r?o():r,c=t(a,l,s);return e==null||e(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":rt.isMac?()=>!1:this.wrapMethod($r,this.options.onRedo),"Mod-z":this.wrapMethod(Gs,this.options.onUndo),"Shift-Mod-z":this.wrapMethod($r,this.options.onRedo)}}undoShortcut(t){return this.wrapMethod(Gs,this.options.onUndo)(t)}redoShortcut(t){return this.wrapMethod($r,this.options.onRedo)(t)}createExternalPlugins(){const{depth:t,newGroupDelay:e}=this.options;return[rk({depth:t,newGroupDelay:e})]}undo(){return fc(this.wrapMethod(Gs,this.options.onUndo))}redo(){return fc(this.wrapMethod($r,this.options.onRedo))}undoDepth(t=this.store.getState()){return sk(t)}redoDepth(t=this.store.getState()){return ik(t)}};Dn([Ye({shortcut:w.Undo,command:"undo"})],bt.prototype,"undoShortcut",1);Dn([Ye({shortcut:w.Redo,command:"redo"})],bt.prototype,"redoShortcut",1);Dn([_({disableChaining:!0,description:({t})=>t(ci.UNDO_DESCRIPTION),label:({t})=>t(ci.UNDO_LABEL),icon:"arrowGoBackFill"})],bt.prototype,"undo",1);Dn([_({disableChaining:!0,description:({t})=>t(ci.REDO_DESCRIPTION),label:({t})=>t(ci.REDO_LABEL),icon:"arrowGoForwardFill"})],bt.prototype,"redo",1);Dn([se()],bt.prototype,"undoDepth",1);Dn([se()],bt.prototype,"redoDepth",1);bt=Dn([G({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],bt);var Ck=Object.defineProperty,Tk=Object.getOwnPropertyDescriptor,qa=(t,e,n,r)=>{for(var s=r>1?void 0:r?Tk(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&Ck(e,n,s),s},Ok={icon:"italic",label:({t})=>t(Tl.LABEL),description:({t})=>t(Tl.DESCRIPTION)},fs=class extends ji{get name(){return"italic"}createTags(){return[j.FontStyle,j.FormattingMark]}createMarkSpec(t,e){return{...e,attrs:t.defaults(),parseDOM:[{tag:"i",getAttrs:t.parse},{tag:"em",getAttrs:t.parse},{style:"font-style=italic"},...e.parseDOM??[]],toDOM:n=>["em",t.dom(n),0]}}createKeymap(){return{"Mod-i":ar({type:this.type})}}createInputRules(){return[yi({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:t,start:e})=>t.startsWith("*")?{}:{fullMatch:t.slice(1),start:e+1}}),yi({regexp:/(?:^|\W)_([^_]+)_$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:t,start:e})=>t.startsWith("_")?{}:{fullMatch:t.slice(1),start:e+1}})]}createPasteRules(){return[{type:"mark",markType:this.type,regexp:/(?:^|\W)_([^_]+)_/g},{type:"mark",markType:this.type,regexp:/\*([^*]+)\*/g}]}toggleItalic(t){return ar({type:this.type,selection:t})}shortcut(t){return this.toggleItalic()(t)}};qa([_(Ok)],fs.prototype,"toggleItalic",1);qa([Ye({shortcut:w.Italic,command:"toggleItalic"})],fs.prototype,"shortcut",1);fs=qa([G({})],fs);function Mk(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=!1,l=o;if(!o)return!1;if(o.depth>=2&&s.node(o.depth-1).type.compatibleContent(t)&&o.startIndex==0){if(s.index(o.depth-1)==0)return!1;let u=n.doc.resolve(o.start-2);l=new Tn(u,u,o.depth),o.endIndex<o.parent.childCount&&(o=new Tn(s,n.doc.resolve(i.end(o.depth)),o.depth)),a=!0}let c=fa(l,t,e,o);return c?(r&&r(_k(n.tr,o,c,a,t).scrollIntoView()),!0):!1}}function _k(t,e,n,r,s){let i=x.empty;for(let u=n.length-1;u>=0;u--)i=x.from(n[u].type.create(n[u].attrs,i));t.step(new fe(e.start-(r?2:0),e.end,e.start,e.end,new S(i,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==s&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,h=!0;u<d;u++,h=!1)!h&&Xn(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function Nk(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?Ak(e,n,t,i):Rk(e,n,i):!0:!1}}function Ak(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new fe(i-1,o,i,o,new S(x.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Tn(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=fr(r);if(a==null)return!1;s.lift(r,a);let l=s.mapping.map(i,-1)-1;return vs(s.doc,l)&&s.join(l),e(s.scrollIntoView()),!0}function Rk(t,e,n){let r=t.tr,s=n.parent;for(let f=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)f-=s.child(p).nodeSize,r.delete(f-1,f+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?x.empty:x.from(s))))return!1;let d=i.pos,h=d+o.nodeSize;return r.step(new fe(d-(a?1:0),h+(l?1:0),d+1,h-1,new S((a?x.empty:x.from(s.copy(x.empty))).append(l?x.empty:x.from(s.copy(x.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}var Ik=Object.defineProperty,Dk=Object.getOwnPropertyDescriptor,Ze=(t,e,n,r)=>{for(var s=r>1?void 0:r?Dk(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&Ik(e,n,s),s};function ta(t){var e;return!!((e=t.spec.group)!=null&&e.includes(j.ListContainerNode))}function Pk(t){var e;return!!((e=t.spec.group)!=null&&e.includes(j.ListItemNode))}function on(t){return ta(t.type)}function Qt(t){return Pk(t.type)}function Ja(t,e){return n=>{const{dispatch:r,tr:s}=n,i=Ma(s,n.state),{$from:o,$to:a}=s.selection,l=o.blockRange(a);if(!l)return!1;const c=Li({predicate:u=>ta(u.type),selection:s.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===t)return Ph(e)(n);if(ta(c.node.type))return t.validContent(c.node.content)?(r==null||r(s.setNodeMarkup(c.pos,t)),!0):Lk(s,c,t,e)?(r==null||r(s.scrollIntoView()),!0):!1}return Mk(t)(i,r)}}function Ih(t,e=["checked"]){return function({tr:n,dispatch:r,state:s}){var i,o;const a=Zy(t,s.schema),{$from:l,$to:c}=n.selection;if(zi(n.selection)&&n.selection.node.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){const m=l.index(-1)>0;let g=x.empty;for(let L=l.depth-(m?1:2);L>=l.depth-3;L--)g=x.from(l.node(L).copy(g));const y=((i=a.contentMatch.defaultType)==null?void 0:i.createAndFill())||void 0;g=g.append(x.from(a.createAndFill(null,y)||void 0));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3;n.replace(l.before(m?void 0:-1),l.after(-E),new S(g,m?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(l.pos+(m?3:2)))),r(n.scrollIntoView())}return!0}if(u.attrs.closed&&l.sameParent(c)&&c.pos===c.end()){if(r){const m=l.after(-1),g=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill())||void 0,y=a.createAndFill(null,g);y&&(n.insert(m,y),n.setSelection(P.near(n.doc.resolve(m+1)))),n.delete(l.pos,c.pos),r(n.scrollIntoView())}return!0}const d=Object.fromEntries(Object.entries(u.attrs).filter(([m])=>!e.includes(m))),h=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,f={...l.node().attrs};n.delete(l.pos,c.pos);const p=h?[{type:a,attrs:d},{type:h,attrs:f}]:[{type:a,attrs:d}];return Xn(n.doc,l.pos,2)?(r&&r(n.split(l.pos,2,p).scrollIntoView()),!0):!1}}function Lk(t,e,n,r){const s=e.node,i=t.doc.resolve(e.start),o=i.node(-1),a=i.index(-1);if(!o||!o.canReplace(a,a+1,x.from(n.create())))return!1;const l=[];for(let f=0;f<s.childCount;f++){const p=s.child(f);if(!r.validContent(p.content))return!1;const m=r.createChecked(null,p.content);l.push(m)}const c=n.createChecked(null,l),u=e.pos,d=u+s.nodeSize,h=t.selection.from;return t.replaceRangeWith(u,d,c),t.setSelection(t.selection.constructor.near(t.doc.resolve(h))),!0}function Bk({listType:t,itemType:e,tr:n,range:r}){var s;const i=r.parent,o=n.doc.slice(r.start,r.end);if(i.type===t&&((s=o.content.firstChild)==null?void 0:s.type)===e)return!1;const a=[];for(let c=0;c<o.content.childCount;c++){const u=o.content.child(c);if(!e.validContent(u.content))return!1;const d=e.createChecked(null,u.content);a.push(d)}const l=t.createChecked(null,a);return n.replaceRange(r.start,r.end,new S(x.from(l),0,0)),!0}function ur({listType:t,itemType:e,tr:n}){const r=vi(n.selection);if(!r)return!1;const s=r.startIndex===0,{from:i,to:o}=n.selection;return Bk({listType:t,itemType:e,tr:n,range:r})?(n.setSelection(P.between(n.doc.resolve(s?i:i+2),n.doc.resolve(s?o:o+2))),n.scrollIntoView(),!0):!1}function zk(t,e,n){const r=t.tr,s=n.parent,i=r.mapping.maps.length;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);const o=r.doc.resolve(n.start),a=o.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===s.childCount,u=o.node(-1),d=o.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?x.empty:x.from(s))))return!1;const h=o.pos,f=h+a.nodeSize;return r.step(new fe(h-(l?1:0),f+(c?1:0),h+1,f-1,new S((l?x.empty:x.from(s.copy(x.empty))).append(c?x.empty:x.from(s.copy(x.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Dh(t,e){const n=e||t.selection.$from;let r=[],s,i,o,a;for(let c=n.depth;c>=0;c--){if(i=n.node(c),s=n.index(c),o=i.maybeChild(s-1),a=i.maybeChild(s),o&&a&&o.type.name===a.type.name&&on(o)){const u=n.before(c+1);r.push(u)}if(s=n.indexAfter(c),o=i.maybeChild(s-1),a=i.maybeChild(s),o&&a&&o.type.name===a.type.name&&on(o)){const u=n.after(c+1);r.push(u)}}r=[...new Set(r)].sort((c,u)=>u-c);let l=!1;for(const c of r)vs(t.doc,c)&&(t.join(c),l=!0);return l}function Ph(t){return e=>{const{dispatch:n,tr:r}=e,s=Ma(r,e.state),i=$k(t,r.selection);return i?(n&&zk(s,n,i),!0):!1}}function $k(t,e){const{$from:n,$to:r}=e;return n.blockRange(r,i=>{var o;return((o=i.firstChild)==null?void 0:o.type)===t})}function vi(t){const{$from:e,$to:n}=t;return e.blockRange(n,on)}function Fk(t){const e=t.selection.$from,n=e.blockRange();if(!n||!Qt(n.parent)||n.startIndex!==0)return!1;const r=e.node(n.depth-2),s=e.index(n.depth),i=e.index(n.depth-1),o=e.index(n.depth-2),a=r.maybeChild(o-1),l=a==null?void 0:a.lastChild;if(s!==0||i!==0)return!1;if(a&&on(a)&&l&&Qt(l))return ur({listType:a.type,itemType:l.type,tr:t});if(Qt(r)){const c=r,u=e.node(n.depth-3);if(on(u))return ur({listType:u.type,itemType:c.type,tr:t})}return!1}function Rc({view:t}){if(!t)return!1;{const e=t.state.selection.$cursor;if(!e||e.parentOffset>0)return!1;const n=e.blockRange();if(!n||!Qt(n.parent)||n.startIndex!==0)return!1}{const e=t.state.tr;Fk(e)&&t.dispatch(e)}{const e=t.state.selection.$cursor;if(!e||e.parentOffset>0)return!1;const n=e.blockRange();if(!n||!Qt(n.parent)||n.startIndex!==0)return!1;const r=e.index(n.depth),s=e.index(n.depth-1),i=e.index(n.depth-2),o=n.depth-2>=1&&Qt(e.node(n.depth-2));r===0&&s===0&&i<=1&&o&&Nk(n.parent.type)(t.state,t.dispatch)}return lh(t.state,t.dispatch,t),!0}function Lh({node:t,mark:e,updateDOM:n,updateMark:r}){const s=document.createElement("label");s.contentEditable="false",s.classList.add(sn.LIST_ITEM_MARKER_CONTAINER),s.append(e);const i=document.createElement("div"),o=document.createElement("li");o.classList.add(sn.LIST_ITEM_WITH_CUSTOM_MARKER),o.append(s),o.append(i);const a=l=>l.type!==t.type?!1:(t=l,n(t,o),r(t,e),!0);return a(t),{dom:o,contentDOM:i,update:a}}function Vk(t,e){const n=t.node(e.depth-1),r=t.node(e.depth-2);return!Qt(n)||!on(r)?!1:{parentItem:n,parentList:r}}function Hk(t,e){const n=e.parent,r=e.parent.child(e.endIndex-1),s=e.end,i=e.$to.end(e.depth);return s<i?(t.step(new fe(s-1,i,s,i,new S(x.from(r.type.create(null,n.copy())),1,0),1,!0)),new Tn(t.doc.resolve(e.$from.pos),t.doc.resolve(i),e.depth)):e}function Uk(t,e){const n=e.parent,r=e.parent.child(e.endIndex-1),s=e.end,i=e.$to.end(e.depth-1);return s+1<i?(t.step(new fe(s-1,i,s+1,i,new S(x.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new Tn(t.selection.$from,t.selection.$to,e.depth)):e}function jk(t,e,n,r){return ur({listType:n.type,itemType:r.type,tr:t})?new Tn(t.selection.$from,t.selection.$to,e.depth):e}function Wk(t){let e=vi(t.selection);if(!e)return!1;const n=Vk(t.selection.$from,e);if(!n)return!1;const{parentItem:r,parentList:s}=n;e=Hk(t,e),e=Uk(t,e),e=jk(t,e,s,r);const i=fr(e);return typeof i!="number"||(t.lift(e,i),e=vi(t.selection),e&&Dh(t,t.doc.resolve(e.end-2))),!0}var Kk=({tr:t,dispatch:e})=>Wk(t)?(e==null||e(t.scrollIntoView()),!0):!1;function qk(t,e,n){let r,s,i,o;const a=e.doc;if(n.startIndex>=1){r=t.child(n.startIndex-1),s=t,o=a.resolve(n.start).start(n.depth),i=o+1;for(let l=0;l<n.startIndex-1;l++)i+=s.child(l).nodeSize}else{const l=e.index(n.depth-1);if(l>=1){const c=e.node(n.depth-1),u=e.start(n.depth-1);if(s=c.child(l-1),!on(s))return!1;o=u+1;for(let d=0;d<l-1;d++)o+=c.child(d).nodeSize;if(r=s.child(s.childCount-1),i=o+s.nodeSize-r.nodeSize-1,!Qt(r))return!1}else return!1}return{previousItem:r,previousList:s,previousItemStart:i,previousListStart:o}}function Jk(t,e,n){let r,s;const i=n.start,o=e.depth>=n.depth+2?e.end(n.depth+2):n.end-1,a=n.end;return o+1>=a?(r=t.slice(i,a),s=null):(r=t.slice(i,o),s=t.slice(o+1,a-1)),{selectedSlice:r,unselectedSlice:s}}function Gk(t){const{$from:e,$to:n}=t.selection,r=vi(t.selection);if(!r)return!1;const s=t.doc.resolve(r.start).node();if(!on(s))return!1;const i=qk(s,e,r);if(!i)return!1;const{previousItem:o,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=Jk(t.doc,n,r),d=o.content.append(x.fromArray([s.copy(c.content)])).append(u?u.content:x.empty);t.deleteRange(r.start,r.end);const h=l+o.nodeSize-2,f=o.copy(d);return f.check(),t.replaceRangeWith(l-1,h+1,f),t.setSelection(a===s?P.between(t.doc.resolve(e.pos),t.doc.resolve(n.pos)):P.between(t.doc.resolve(e.pos-2),t.doc.resolve(n.pos-2))),!0}var Xk=({tr:t,dispatch:e})=>Gk(t)?(e==null||e(t.scrollIntoView()),!0):!1,Bh=class extends te{get name(){return"listItemShared"}createKeymap(){const t={Tab:Xk,"Shift-Tab":Kk,Backspace:Rc,"Mod-Backspace":Rc};if(rt.isMac){const e={"Ctrl-h":t.Backspace,"Alt-Backspace":t["Mod-Backspace"]};return{...t,...e}}return t}createPlugin(){return{appendTransaction:(t,e,n)=>{const r=n.tr;return Dh(r)?r:null}}}},dr=class extends Rt{get name(){return"listItem"}createTags(){return[j.ListItemNode]}createNodeSpec(t,e){return{content:"paragraph block*",defining:!0,draggable:!1,...e,attrs:{...t.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:t.parse,priority:X.Lowest},...e.parseDOM??[]],toDOM:n=>["li",t.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(t,e,n)=>{const r=document.createElement("div");return r.classList.add(sn.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const s=n(),i=I.create(e.state.doc,s);return e.dispatch(e.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),Lh({mark:r,node:t,updateDOM:Yk,updateMark:Zk})}:{}}createKeymap(){return{Enter:Ih(this.type)}}createExtensions(){return[new Bh]}toggleListItemClosed(t){return({state:{tr:e,selection:n},dispatch:r})=>{if(!zi(n)||n.node.type.name!==this.name)return!1;const{node:s,from:i}=n;return t=Yf(t)?t:!s.attrs.closed,r==null||r(e.setNodeMarkup(i,void 0,{...s.attrs,closed:t})),!0}}liftListItemOutOfList(t){return Ph(t??this.type)}};Ze([_()],dr.prototype,"toggleListItemClosed",1);Ze([_()],dr.prototype,"liftListItemOutOfList",1);dr=Ze([G({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],dr);function Yk(t,e){t.attrs.closed?e.classList.add(sn.COLLAPSIBLE_LIST_ITEM_CLOSED):e.classList.remove(sn.COLLAPSIBLE_LIST_ITEM_CLOSED)}function Zk(t,e){t.childCount<=1?e.classList.add("disabled"):e.classList.remove("disabled")}var ps=class extends Rt{get name(){return"bulletList"}createTags(){return[j.Block,j.ListContainerNode]}createNodeSpec(t,e){return{content:"listItem+",...e,attrs:t.defaults(),parseDOM:[{tag:"ul",getAttrs:t.parse},...e.parseDOM??[]],toDOM:n=>["ul",t.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(t,e,n)=>{var r;const s=document.createElement("div");s.style.position="relative";const i=n(),o=e.state.doc.resolve(i+1),a=o.node(o.depth-1);if(!(((r=a==null?void 0:a.type)==null?void 0:r.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(sn.LIST_SPINE),u.addEventListener("click",d=>{const h=n(),f=e.state.doc.resolve(h+1),p=f.start(f.depth-1),m=I.create(e.state.doc,p-1);e.dispatch(e.state.tr.setSelection(m)),this.store.commands.toggleListItemClosed(),d.preventDefault(),d.stopPropagation()}),s.append(u)}const c=document.createElement("ul");return c.classList.add(sn.UL_LIST_CONTENT),s.append(c),{dom:s,contentDOM:c}}:{}}createExtensions(){return[new dr({priority:X.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return Ja(this.type,re(this.store.schema.nodes,"listItem"))}listShortcut(t){return this.toggleBulletList()(t)}createInputRules(){const t=/^\s*([*+-])\s$/;return[ya(t,this.type),new ws(t,(e,n,r,s)=>{const i=e.tr;return i.deleteRange(r,s),ur({listType:this.type,itemType:re(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};Ze([_({icon:"listUnordered",label:({t})=>t(ga.BULLET_LIST_LABEL)})],ps.prototype,"toggleBulletList",1);Ze([Ye({shortcut:w.BulletList,command:"toggleBulletList"})],ps.prototype,"listShortcut",1);ps=Ze([G({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],ps);var ms=class extends Rt{get name(){return"orderedList"}createTags(){return[j.Block,j.ListContainerNode]}createNodeSpec(t,e){return{content:"listItem+",...e,attrs:{...t.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>Ie(n)?{...t.parse(n),order:+(n.getAttribute("start")??1)}:{}},...e.parseDOM??[]],toDOM:n=>{const r=t.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new dr({priority:X.Low})]}toggleOrderedList(){return Ja(this.type,re(this.store.schema.nodes,"listItem"))}listShortcut(t){return this.toggleOrderedList()(t)}createInputRules(){const t=/^(\d+)\.\s$/;return[ya(t,this.type,e=>({order:+re(e,1)}),(e,n)=>n.childCount+n.attrs.order===+re(e,1)),new ws(t,(e,n,r,s)=>{const i=e.tr;if(i.deleteRange(r,s),!ur({listType:this.type,itemType:re(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+re(n,1);if(a!==1){const l=as({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};Ze([_({icon:"listOrdered",label:({t})=>t(ga.ORDERED_LIST_LABEL)})],ms.prototype,"toggleOrderedList",1);Ze([Ye({shortcut:w.OrderedList,command:"toggleOrderedList"})],ms.prototype,"listShortcut",1);ms=Ze([G({})],ms);var zh=class extends Rt{get name(){return"taskListItem"}createTags(){return[j.ListItemNode]}createNodeSpec(t,e){return{content:"paragraph block*",defining:!0,draggable:!1,...e,attrs:{...t.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return Ie(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...t.parse(n)}},priority:X.Medium},...e.parseDOM??[]],toDOM:n=>["li",{...t.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(t,e,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(sn.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",s=>{e.editable||s.preventDefault()}),r.addEventListener("change",()=>{const s=n(),i=e.state.doc.resolve(s+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=t.attrs.checked,Lh({node:t,mark:r,updateDOM:Qk,updateMark:eS})}}createKeymap(){return{Enter:Ih(this.type)}}createExtensions(){return[new Bh]}toggleCheckboxChecked(t){let e,n;return typeof t=="boolean"?e=t:t&&(e=t.checked,n=t.$pos),({tr:r,dispatch:s})=>{const i=as({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:o,pos:a}=i,l={...o.attrs,checked:e??!o.attrs.checked};return s==null||s(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const t=/^\s*(\[( ?|x|X)]\s)$/;return[ya(t,this.type,e=>({checked:["x","X"].includes(mc(e,2))})),new ws(t,(e,n,r,s)=>{const i=e.tr;if(i.deleteRange(r,s),!ur({listType:re(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(mc(n,2));if(a){const l=as({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};Ze([_()],zh.prototype,"toggleCheckboxChecked",1);function Qk(t,e){t.attrs.checked?e.setAttribute("data-checked",""):e.removeAttribute("data-checked"),e.setAttribute("data-task-list-item","")}function eS(t,e){e.checked=!!t.attrs.checked}var $h=class extends Rt{get name(){return"taskList"}createTags(){return[j.Block,j.ListContainerNode]}createNodeSpec(t,e){return{content:"taskListItem+",...e,attrs:t.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:t.parse,priority:X.Medium},...e.parseDOM??[]],toDOM:n=>["ul",{...t.dom(n),"data-task-list":""},0]}}createExtensions(){return[new zh({})]}toggleTaskList(){return Ja(this.type,re(this.store.schema.nodes,"taskListItem"))}listShortcut(t){return this.toggleTaskList()(t)}};Ze([_({icon:"checkboxMultipleLine",label:({t})=>t(ga.TASK_LIST_LABEL)})],$h.prototype,"toggleTaskList",1);Ze([Ye({shortcut:w.TaskList,command:"toggleTaskList"})],$h.prototype,"listShortcut",1);function tS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t}function na(t,e){return Array(e+1).join(t)}function nS(t){return t.replace(/^\n*/,"")}function rS(t){for(var e=t.length;e>0&&t[e-1]===`
53
- `;)e--;return t.substring(0,e)}var sS=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Ga(t){return Xa(t,sS)}var Fh=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Vh(t){return Xa(t,Fh)}function iS(t){return Uh(t,Fh)}var Hh=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function oS(t){return Xa(t,Hh)}function aS(t){return Uh(t,Hh)}function Xa(t,e){return e.indexOf(t.nodeName)>=0}function Uh(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var Te={};Te.paragraph={filter:"p",replacement:function(t){return`
51
+ `,Wt)}getHTML(t=this.store.getState()){return m0(t.doc,this.store.document)}textToProsemirrorNode(t){const e=`<pre>${t.content}</pre>`;return this.store.stringHandlers.html({...t,content:e})}};T([se()],Xe.prototype,"isSelectionEmpty",1);T([se()],Xe.prototype,"isViewEditable",1);T([se()],Xe.prototype,"getStateJSON",1);T([se()],Xe.prototype,"getJSON",1);T([se()],Xe.prototype,"getRemirrorJSON",1);T([_()],Xe.prototype,"insertHtml",1);T([se()],Xe.prototype,"getText",1);T([se()],Xe.prototype,"getTextBetween",1);T([se()],Xe.prototype,"getHTML",1);Xe=T([G({})],Xe);var Go=class extends te{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var t,e;const n=[],r=this.store.markTags[j.ExcludeInputRules];for(const s of this.store.extensions)if(!((t=this.store.managerSettings.exclude)!=null&&t.inputRules||!s.createInputRules||(e=s.options.exclude)!=null&&e.inputRules))for(const i of s.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,n.push(i);return zm({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};Go=T([G({defaultPriority:X.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],Go);var st=class extends te{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:t})=>{var e,n;if(t)return this.extraKeyBindings=[...this.extraKeyBindings,t],(n=(e=this.store).rebuildKeymap)==null||n.call(e),()=>{var r,s;this.extraKeyBindings=this.extraKeyBindings.filter(i=>i!==t),(s=(r=this.store).rebuildKeymap)==null||s.call(r)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){const{shortcuts:t}=this.options;return D(t)?Rx[t]:t}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var t;return(t=this.store.managerSettings.exclude)!=null&&t.keymap?[]:(this.setupKeydownHandler(),[new un({props:{handleKeyDown:(e,n)=>{var r;return(r=this.keydownHandler)==null?void 0:r.call(this,e,n)}}})])}setupKeydownHandler(){const t=this.generateKeymapBindings();this.keydownHandler=ph(t)}generateKeymapBindings(){var t;const e=[],n=this.shortcutMap,r=this.store.getExtension(H),s=a=>l=>$s({shortcut:l,map:n,store:this.store,options:a.options});for(const a of this.store.extensions){const l=a.decoratedKeybindings??{};if(!((t=a.options.exclude)!=null&&t.keymap)){a.createKeymap&&e.push(Nx(a.createKeymap(s(a)),n));for(const[c,u]of he(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const d=a[c].bind(a),h=$s({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),f=ee(u.priority)?u.priority(a.options,this.store):u.priority??X.Low,p=M();for(const m of h)p[m]=d;e.push([f,p]),u.command&&r.updateDecorated(u.command,{shortcut:h})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...e]);return Gy(i)}arrowRightShortcut(t){const e=this.store.markTags[j.PreventExits],n=this.store.nodeTags[j.PreventExits];return this.exitMarkForwards(e,n)(t)}arrowLeftShortcut(t){const e=this.store.markTags[j.PreventExits],n=this.store.nodeTags[j.PreventExits];return gi(this.exitNodeBackwards(n),this.exitMarkBackwards(e,n))(t)}backspace(t){const e=this.store.markTags[j.PreventExits],n=this.store.nodeTags[j.PreventExits];return gi(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(e,n,!0))(t)}createKeymap(){const{selectParentNodeOnEscape:t,undoInputRuleOnBackspace:e,excludeBaseKeymap:n}=this.options,r=M();if(!n)for(const[s,i]of he(fo))r[s]=zs(i);return e&&fo.Backspace&&(r.Backspace=zs(Vi($m,fo.Backspace))),t&&(r.Escape=zs(F0)),[X.Low,r]}getNamedShortcut(t,e={}){return t.startsWith("_|")?$s({shortcut:t,map:this.shortcutMap,store:this.store,options:e}):[t]}onSetOptions(t){var e,n;const{changes:r}=t;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&((n=(e=this.store).rebuildKeymap)==null||n.call(e))}sortKeymaps(t){return tr(t.map(e=>pe(e)?e:[X.Default,e]),(e,n)=>n[0]-e[0]).map(e=>e[1])}exitMarkForwards(t,e){return n=>{const{tr:r,dispatch:s}=n;if(!x0(r.selection)||as({selection:r.selection,types:e}))return!1;const a=r.selection.$from.marks().filter(l=>!t.includes(l.type.name));if(tn(a))return!1;if(!s)return!0;for(const l of a)r.removeStoredMark(l);return s(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(t,e=!1){return n=>{const{tr:r}=n;if(!(e?yc:Wo)(r.selection))return!1;const i=r.selection.$anchor.node();return!Ia(i)||r0(i)||t.includes(i.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:i.type})(n)}}exitMarkBackwards(t,e,n=!1){return r=>{const{tr:s,dispatch:i}=r;if(!(n?yc:Wo)(s.selection)||this.backwardMarkExitTracker.has(s.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(as({selection:s.selection,types:e}))return!1;const l=[...s.storedMarks??[],...s.selection.$from.marks()].filter(c=>!t.includes(c.type.name));if(tn(l))return!1;if(!i)return!0;for(const c of l)s.removeStoredMark(c);return this.backwardMarkExitTracker.set(s.selection.anchor,!0),i(s),!0}}};T([Ye({shortcut:"ArrowRight",isActive:t=>t.exitMarksOnArrowPress})],st.prototype,"arrowRightShortcut",1);T([Ye({shortcut:"ArrowLeft",isActive:t=>t.exitMarksOnArrowPress})],st.prototype,"arrowLeftShortcut",1);T([Ye({shortcut:"Backspace",isActive:t=>t.exitMarksOnArrowPress})],st.prototype,"backspace",1);T([se()],st.prototype,"getNamedShortcut",1);st=T([G({defaultPriority:X.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],st);function _x(t){return gt(Ni(w),t)}function $s({shortcut:t,map:e,options:n,store:r}){return D(t)?[Xo(t,e)]:pe(t)?t.map(s=>Xo(s,e)):(t=t(n,r),$s({shortcut:t,map:e,options:n,store:r}))}function Xo(t,e){return _x(t)?e[t]:t}function Nx(t,e){const n={};let r,s;pe(t)?[s,r]=t:r=t;for(const[i,o]of he(r))n[Xo(i,e)]=o;return Ai(s)?n:[s,n]}var bh={[w.Copy]:"Mod-c",[w.Cut]:"Mod-x",[w.Paste]:"Mod-v",[w.PastePlain]:"Mod-Shift-v",[w.SelectAll]:"Mod-a",[w.Undo]:"Mod-z",[w.Redo]:rt.isMac?"Shift-Mod-z":"Mod-y",[w.Bold]:"Mod-b",[w.Italic]:"Mod-i",[w.Underline]:"Mod-u",[w.Strike]:"Mod-d",[w.Code]:"Mod-`",[w.Paragraph]:"Mod-Shift-0",[w.H1]:"Mod-Shift-1",[w.H2]:"Mod-Shift-2",[w.H3]:"Mod-Shift-3",[w.H4]:"Mod-Shift-4",[w.H5]:"Mod-Shift-5",[w.H6]:"Mod-Shift-6",[w.TaskList]:"Mod-Shift-7",[w.BulletList]:"Mod-Shift-8",[w.OrderedList]:"Mod-Shift-9",[w.Quote]:"Mod->",[w.Divider]:"Mod-Shift-|",[w.Codeblock]:"Mod-Shift-~",[w.ClearFormatting]:"Mod-Shift-C",[w.Superscript]:"Mod-.",[w.Subscript]:"Mod-,",[w.LeftAlignment]:"Mod-Shift-L",[w.CenterAlignment]:"Mod-Shift-E",[w.RightAlignment]:"Mod-Shift-R",[w.JustifyAlignment]:"Mod-Shift-J",[w.InsertLink]:"Mod-k",[w.Find]:"Mod-f",[w.FindBackwards]:"Mod-Shift-f",[w.FindReplace]:"Mod-Shift-H",[w.AddFootnote]:"Mod-Alt-f",[w.AddComment]:"Mod-Alt-m",[w.ContextMenu]:"Mod-Shift-\\",[w.IncreaseFontSize]:"Mod-Shift-.",[w.DecreaseFontSize]:"Mod-Shift-,",[w.IncreaseIndent]:"Tab",[w.DecreaseIndent]:"Shift-Tab",[w.Shortcuts]:"Mod-/",[w.Format]:rt.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},Ax={...bh,[w.Strike]:"Mod-Shift-S",[w.Code]:"Mod-Shift-M",[w.Paragraph]:"Mod-Alt-0",[w.H1]:"Mod-Alt-1",[w.H2]:"Mod-Alt-2",[w.H3]:"Mod-Alt-3",[w.H4]:"Mod-Alt-4",[w.H5]:"Mod-Alt-5",[w.H6]:"Mod-Alt-6",[w.OrderedList]:"Mod-Alt-7",[w.BulletList]:"Mod-Alt-8",[w.Quote]:"Mod-Alt-9",[w.ClearFormatting]:"Mod-\\",[w.IncreaseIndent]:"Mod-[",[w.DecreaseIndent]:"Mod-]"},Rx={default:bh,googleDoc:Ax},Ix=class extends te{get name(){return"nodeViews"}createPlugin(){const t=[],e=M();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();t.unshift(ee(r)?{[n.name]:r}:r)}t.unshift(this.store.managerSettings.nodeViews??{});for(const n of t)Object.assign(e,n);return{props:{nodeViews:e}}}},Dx=class extends te{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var t,e;const n=[];for(const r of this.store.extensions){if((t=this.store.managerSettings.exclude)!=null&&t.pasteRules||!r.createPasteRules||(e=r.options.exclude)!=null&&e.pasteRules)continue;const s=r.createPasteRules(),i=pe(s)?s:[s];n.push(...i)}return ex(n)}},Yo=class extends te{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=M(),this.stateGetters=new Map,this.getPluginStateCreator=t=>e=>t.getState(e??this.store.getState()),this.getStateByName=t=>{const e=this.stateGetters.get(t);return R(e,{message:"No plugin exists for the requested extension name."}),e()}}get name(){return"plugins"}onCreate(){const{setStoreKey:t,setExtensionStore:e,managerSettings:n,extensions:r}=this.store;this.updateExtensionStore();const{plugins:s=[]}=n;this.updatePlugins(s,this.managerPlugins);for(const i of r)i.onApplyState&&this.applyStateHandlers.push(i.onApplyState.bind(i)),i.onInitState&&this.initStateHandlers.push(i.onInitState.bind(i)),i.onAppendTransaction&&this.appendTransactionHandlers.push(i.onAppendTransaction.bind(i)),this.extractExtensionPlugins(i);this.managerPlugins=s,this.store.setStoreKey("plugins",this.plugins),t("pluginKeys",this.pluginKeys),t("getPluginState",this.getStateByName),e("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(t,e,n)=>{const r=n.tr,s={previousState:e,tr:r,transactions:t,state:n};for(const i of this.appendTransactionHandlers)i(s);return this.options.appendTransaction(s),r.docChanged||r.steps.length>0||r.selectionSet||r.storedMarksSet?r:void 0},state:{init:(t,e)=>{for(const n of this.initStateHandlers)n(e)},apply:(t,e,n,r)=>{const s={previousState:n,state:r,tr:t};for(const i of this.applyStateHandlers)i(s);this.options.applyState(s)}}}}extractExtensionPlugins(t){var e,n;if(!(!t.createPlugin&&!t.createExternalPlugins||(e=this.store.managerSettings.exclude)!=null&&e.plugins||(n=t.options.exclude)!=null&&n.plugins)){if(t.createPlugin){const s=new pr(t.name);this.pluginKeys[t.name]=s;const i=this.getPluginStateCreator(s);t.pluginKey=s,t.getPluginState=i,this.stateGetters.set(t.name,i),this.stateGetters.set(t.constructor,i);const o={...t.createPlugin(),key:s},a=new un(o);this.updatePlugins([a],t.plugin?[t.plugin]:void 0),t.plugin=a}if(t.createExternalPlugins){const s=t.createExternalPlugins();this.updatePlugins(s,t.externalPlugins),t.externalPlugins=s}}}updatePlugins(t,e){if(!e||tn(e)){this.plugins=[...this.plugins,...t];return}if(t.length!==e.length){this.plugins=[...this.plugins.filter(r=>!e.includes(r)),...t];return}const n=new Map;for(const[r,s]of t.entries())n.set(re(e,r),s);this.plugins=this.plugins.map(r=>e.includes(r)?n.get(r):r)}updateExtensionStore(){const{setExtensionStore:t}=this.store;t("updatePlugins",this.updatePlugins.bind(this)),t("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),t("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(t){const e=yh(t)?t:bx(t)?this.store.manager.getExtension(t):this.store.extensions.find(n=>n.name===t);R(e,{code:b.INVALID_MANAGER_EXTENSION,message:`The extension ${t} does not exist within the editor.`}),this.extractExtensionPlugins(e),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){R(this.store.phase>=Pe.EditorView,{code:b.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});const{view:t,updateState:e}=this.store,n=t.state.reconfigure({plugins:this.plugins});e(n)}};Yo=T([G({defaultPriority:X.Highest,handlerKeys:["applyState","appendTransaction"]})],Yo);var Zo=class extends te{constructor(){super(...arguments),this.dynamicAttributes={marks:M(),nodes:M()}}get name(){return"schema"}onCreate(){const{managerSettings:t,tags:e,markNames:n,nodeNames:r,extensions:s}=this.store,{defaultBlockNode:i,disableExtraAttributes:o,nodeOverride:a,markOverride:l}=t,c=p=>!!(p&&e[j.Block].includes(p));if(t.schema){const{nodes:p,marks:m}=Hx(t.schema);this.addSchema(t.schema,p,m);return}const u=c(i)?{doc:M(),[i]:M()}:M(),d=M(),h=Px({settings:t,gatheredSchemaAttributes:this.gatherExtraAttributes(s),nodeNames:r,markNames:n,tags:e});for(const p of s){h[p.name]={...h[p.name],...p.options.extraAttributes};const m=o===!0||p.options.disableExtraAttributes===!0||p.constructor.disableExtraAttributes===!0;if(Ts(p)){const{spec:g,dynamic:y}=vc({createExtensionSpec:(E,L)=>p.createNodeSpec(E,L),extraAttributes:re(h,p.name),override:{...a,...p.options.nodeOverride},ignoreExtraAttributes:m,name:p.constructorName,tags:p.tags});p.spec=g,u[p.name]=g,Object.keys(y).length>0&&(this.dynamicAttributes.nodes[p.name]=y)}if(Wi(p)){const{spec:g,dynamic:y}=vc({createExtensionSpec:(E,L)=>p.createMarkSpec(E,L),extraAttributes:re(h,p.name),override:{...l,...p.options.markOverride},ignoreExtraAttributes:m,name:p.constructorName,tags:p.tags??[]});p.spec=g,d[p.name]=g,Object.keys(y).length>0&&(this.dynamicAttributes.marks[p.name]=y)}}const f=new Mp({nodes:u,marks:d,topNode:"doc"});this.addSchema(f,u,d)}createPlugin(){return{appendTransaction:(t,e,n)=>{const{tr:r}=n;return!t.some(i=>i.docChanged)||Object.keys(this.dynamicAttributes.nodes).length===0&&Object.keys(this.dynamicAttributes.marks).length===0?null:(r.doc.descendants((i,o)=>(this.checkAndUpdateDynamicNodes(i,o,r),this.checkAndUpdateDynamicMarks(i,o,r),!0)),r.steps.length>0?r:null)}}}addSchema(t,e,n){this.store.setStoreKey("nodes",e),this.store.setStoreKey("marks",n),this.store.setStoreKey("schema",t),this.store.setExtensionStore("schema",t),this.store.setStoreKey("defaultBlockNode",$i(t).name);for(const r of Object.values(t.nodes))if(r.name!=="doc"&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(t,e,n){for(const[r,s]of he(this.dynamicAttributes.nodes))if(t.type.name===r)for(const[i,o]of he(s)){if(!en(t.attrs[i]))continue;const a={...t.attrs,[i]:o(t)};n.setNodeMarkup(e,void 0,a),hc(n)}}checkAndUpdateDynamicMarks(t,e,n){for(const[r,s]of he(this.dynamicAttributes.marks)){const i=re(this.store.schema.marks,r),o=t.marks.find(a=>a.type.name===r);if(o)for(const[a,l]of he(s)){if(!en(o.attrs[a]))continue;const c=In(n.doc.resolve(e),i);if(!c)continue;const{from:u,to:d}=c,h=i.create({...o.attrs,[a]:l(o)});n.removeMark(u,d,i).addMark(u,d,h),hc(n)}}}gatherExtraAttributes(t){const e=[];for(const n of t)n.createSchemaAttributes&&e.push(...n.createSchemaAttributes());return e}};Zo=T([G({defaultPriority:X.Highest})],Zo);function Px(t){const{settings:e,gatheredSchemaAttributes:n,nodeNames:r,markNames:s,tags:i}=t,o=M();if(e.disableExtraAttributes)return o;const a=[...n,...e.extraAttributes??[]];for(const l of a??[]){const c=Bx({identifiers:l.identifiers,nodeNames:r,markNames:s,tags:i});for(const u of c){const d=o[u]??{};o[u]={...d,...l.attributes}}}return o}function Lx(t){return Rn(t)&&pe(t.tags)}function Bx(t){const{identifiers:e,nodeNames:n,markNames:r,tags:s}=t;if(e==="nodes")return n;if(e==="marks")return r;if(e==="all")return[...n,...r];if(pe(e))return e;R(Lx(e),{code:b.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:i=[],names:o=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=e,d=new Set,h=u==="mark"?r:u==="node"?n:[...r,...n],f=m=>h.includes(m)&&!(l!=null&&l.includes(m));for(const m of o)f(m)&&d.add(m);const p=new Map;for(const m of i)if(!(c!=null&&c.includes(m)))for(const g of s[m]){if(!f(g))continue;if(a==="any"){d.add(g);continue}const y=p.get(g)??new Set;y.add(m),p.set(g,y)}for(const[m,g]of p)g.size===i.length&&d.add(m);return[...d]}function vc(t){var e;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:s,name:i,tags:o,override:a}=t,l=M();function c(g,y){l[g]=y}let u=!1;function d(){u=!0}const h=zx(r,s,d,c),f=$x(r,s),p=Fx(r,s),m=n({defaults:h,parse:f,dom:p},a);return R(s||u,{code:b.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${i}' to 'true'.`}),m.group=[...((e=m.group)==null?void 0:e.split(" "))??[],...o].join(" ")||void 0,{spec:m,dynamic:l}}function Pa(t){return D(t)||ee(t)?{default:t}:(R(t,{message:`${Ou(t)} is not supported`,code:b.EXTENSION_EXTRA_ATTRIBUTES}),t)}function zx(t,e,n,r){return()=>{n();const s=M();if(e)return s;for(const[i,o]of he(t)){let l=Pa(o).default;ee(l)&&(r(i,l),l=null),s[i]=l===void 0?{}:{default:l}}return s}}function $x(t,e){return n=>{const r=M();if(e)return r;for(const[s,i]of he(t)){const{parseDOM:o,...a}=Pa(i);if(Ie(n)){if(en(o)){r[s]=n.getAttribute(s)??a.default;continue}if(ee(o)){r[s]=o(n)??a.default;continue}r[s]=n.getAttribute(o)??a.default}}return r}}function Fx(t,e){return n=>{const r=M();if(e)return r;function s(i,o){if(i){if(D(i)){r[o]=i;return}if(pe(i)){const[a,l]=i;r[a]=l??n.attrs[o];return}for(const[a,l]of he(i))r[a]=l}}for(const[i,o]of he(t)){const{toDOM:a,parseDOM:l}=Pa(o);if(en(a)){const c=D(l)?l:i;r[c]=n.attrs[i];continue}if(ee(a)){s(a(n.attrs,Vx(n)),i);continue}s(a,i)}return r}}function Vx(t){return Bi(t)?{node:t}:e0(t)?{mark:t}:{}}function Hx(t){const e=M(),n=M();for(const[r,s]of Object.entries(t.nodes))e[r]=s.spec;for(const[r,s]of Object.entries(t.marks))n[r]=s.spec;return{nodes:e,marks:n}}var lr=class extends te{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:t})=>{var e;if(!(!t||(e=this.store.managerSettings.exclude)!=null&&e.suggesters))return dc(this.store.getState(),t)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",t=>dc(this.store.getState(),t)),this.store.setExtensionStore("removeSuggester",t=>Vy(this.store.getState(),t))}createExternalPlugins(){var t,e;const n=[];for(const r of this.store.extensions){if((t=this.store.managerSettings.exclude)!=null&&t.suggesters)break;if(!r.createSuggesters||(e=r.options.exclude)!=null&&e.suggesters)continue;const s=r.createSuggesters(),i=pe(s)?s:[s];n.push(...i)}return[Hy(...n)]}getSuggestState(t){return Oa(t??this.store.getState())}getSuggestMethods(){const{addIgnored:t,clearIgnored:e,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:s,findMatchAtPosition:i,findNextTextSelection:o,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:t,clearIgnored:e,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:s,findMatchAtPosition:i,findNextTextSelection:o,setLastChangeFromAppend:a}}isSuggesterActive(t){var e;return gt(pe(t)?t:[t],(e=this.getSuggestState().match)==null?void 0:e.suggester.name)}};T([se()],lr.prototype,"getSuggestState",1);T([se()],lr.prototype,"getSuggestMethods",1);T([se()],lr.prototype,"isSuggesterActive",1);lr=T([G({customHandlerKeys:["suggester"]})],lr);var Qo=class extends te{constructor(){super(...arguments),this.allTags=M(),this.plainTags=M(),this.markTags=M(),this.nodeTags=M()}get name(){return"tags"}onCreate(){this.resetTags();for(const t of this.store.extensions)this.updateTagForExtension(t);this.store.setStoreKey("tags",this.allTags),this.store.setExtensionStore("tags",this.allTags),this.store.setStoreKey("plainTags",this.plainTags),this.store.setExtensionStore("plainTags",this.plainTags),this.store.setStoreKey("markTags",this.markTags),this.store.setExtensionStore("markTags",this.markTags),this.store.setStoreKey("nodeTags",this.nodeTags),this.store.setExtensionStore("nodeTags",this.nodeTags)}resetTags(){const t=M(),e=M(),n=M(),r=M();for(const s of Ni(j))t[s]=[],e[s]=[],n[s]=[],r[s]=[];this.allTags=t,this.plainTags=e,this.markTags=n,this.nodeTags=r}updateTagForExtension(t){var e,n;const r=new Set([...t.tags??[],...((e=t.createTags)==null?void 0:e.call(t))??[],...t.options.extraTags??[],...((n=this.store.managerSettings.extraTags)==null?void 0:n[t.name])??[]]);for(const s of r)R(Ux(s),{code:b.EXTENSION,message:`The tag provided by the extension: ${t.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[s].push(t.name),xh(t)&&this.plainTags[s].push(t.name),Wi(t)&&this.markTags[s].push(t.name),Ts(t)&&this.nodeTags[s].push(t.name);t.tags=[...r]}};Qo=T([G({defaultPriority:X.Highest})],Qo);function Ux(t){return gt(Ni(j),t)}var jx=new pr("remirrorFilePlaceholderPlugin");function Wx(){const t=new un({key:jx,state:{init(){return{set:W.empty,payloads:new Map}},apply(e,{set:n,payloads:r}){n=n.map(e.mapping,e.doc);const s=e.getMeta(t);if(s)if(s.type===0){const i=document.createElement("placeholder"),o=Q.widget(s.pos,i,{id:s.id});n=n.add(e.doc,[o]),r.set(s.id,s.payload)}else s.type===1&&(n=n.remove(n.find(void 0,void 0,i=>i.id===s.id)),r.delete(s.id));return{set:n,payloads:r}}},props:{decorations(e){var n;return((n=t.getState(e))==null?void 0:n.set)??null}}});return t}var Kx=class extends te{get name(){return"upload"}createExternalPlugins(){return[Wx()]}};function qx(t={}){t={...{exitMarksOnArrowPress:st.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:st.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:st.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:st.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:ct.defaultOptions.persistentSelectionClass},...t};const n=Co(t,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=Co(t,["persistentSelectionClass"]);return[new Qo,new Zo,new kx,new Yo,new Go,new Dx,new Ix,new lr,new H,new Xe,new st(n),new Jo,new Kx,new ct(r)]}var wc=class extends te{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),!!this.options.capture)for(const t of this.store.extensions)this.captureCommands(t),this.captureKeybindings(t)}createPlugin(){return{}}captureCommands(t){const e=t.decoratedCommands??{},n=t.createCommands;for(const r of Object.keys(e)){const s=t[r];t[r]=(...i)=>o=>{var a;const l=s(...i)(o);return o.dispatch&&l&&this.setCommandMeta(o.tr,{type:"command",chain:o.dispatch!==((a=o.view)==null?void 0:a.dispatch),name:r,extension:t.name,decorated:!0}),l}}n&&(t.createCommands=()=>{const r=n();for(const[s,i]of Object.entries(r))r[s]=(...o)=>a=>{var l;const c=i(...o)(a);return a.dispatch&&c&&this.setCommandMeta(a.tr,{type:"command",chain:a.dispatch!==((l=a.view)==null?void 0:l.dispatch),name:s,extension:t.name,decorated:!1}),c};return r})}captureKeybindings(t){}getCommandMeta(t){return t.getMeta(this.pluginKey)??[]}setCommandMeta(t,e){const n=this.getCommandMeta(t);t.setMeta(this.pluginKey,[...n,e])}};wc=T([G({defaultOptions:{capture:rt.isDevelopment},staticKeys:["capture"],defaultPriority:X.Highest})],wc);var Fs,Cr,Vs,jn,Ft,Hs,Us,Jx=class{constructor(t){ce(this,Fs,ni()),ce(this,Cr,void 0),ce(this,Vs,void 0),ce(this,jn,!0),ce(this,Ft,Hi()),ce(this,Hs,void 0),ce(this,Us,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var o,a;R(!this.manager.destroyed,{code:b.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),i=((a=(o=this.props).onDispatchTransaction)==null?void 0:a.call(o,i,this.getState()))??i;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(i);ye(this,Vs,l),this.updateState({state:c,tr:i,transactions:u});const d=this.manager.store.getForcedUpdates(i);tn(d)||this.updateViewProps(...d)},this.onChange=(i=M())=>{var o,a;const l=this.eventListenerProps(i);v(this,jn)&&ye(this,jn,!1),(a=(o=this.props).onChange)==null||a.call(o,l)},this.onBlur=i=>{var o,a;const l=this.eventListenerProps();(a=(o=this.props).onBlur)==null||a.call(o,l,i),v(this,Ft).emit("blur",l,i)},this.onFocus=i=>{var o,a;const l=this.eventListenerProps();(a=(o=this.props).onFocus)==null||a.call(o,l,i),v(this,Ft).emit("focus",l,i)},this.setContent=(i,{triggerChange:o=!1}={})=>{const{doc:a}=this.manager.createState({content:i}),l=this.getState(),{state:c}=this.getState().applyTransaction(l.tr.replaceRangeWith(0,l.doc.nodeSize-2,a));if(o)return this.updateState({state:c,triggerChange:o});this.view.updateState(c)},this.clearContent=({triggerChange:i=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:i})},this.createStateFromContent=(i,o)=>this.manager.createState({content:i,selection:o}),this.focus=i=>{this.manager.store.commands.focus(i)},this.blur=i=>{this.manager.store.commands.blur(i)};const{getProps:e,initialEditorState:n,element:r}=t;if(ye(this,Cr,e),ye(this,Us,n),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;const s=this.createView(n,r);this.manager.addView(s)}get addHandler(){return v(this,Hs)??ye(this,Hs,v(this,Ft).on.bind(v(this,Ft)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return v(this,jn)}get props(){return v(this,Cr).call(this)}get previousState(){return this.previousStateOverride??v(this,Vs)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return v(this,Fs)}get initialEditorState(){return v(this,Us)}updateListener(t){const{state:e,tr:n}=t;return v(this,Ft).emit("updated",this.eventListenerProps({state:e,tr:n}))}update(t){const{getProps:e}=t;return ye(this,Cr,e),this}updateViewProps(...t){const e=Co(this.updatableViewProps,t);this.view.setProps({...this.view.props,...e})}getAttributes(t){var e;const{attributes:n,autoFocus:r,classNames:s=[],label:i,editable:o}=this.props,a=(e=this.manager.store)==null?void 0:e.attributes,l=ee(n)?n(this.eventListenerProps()):n;let c={};(r||Ge(r))&&(c=t?{autoFocus:!0}:{autofocus:"true"});const u=es(qo(t&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...s).split(" ")).join(" "),d={role:"textbox",...c,"aria-multiline":"true",...o??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return np({...d,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){v(this,Ft).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(t=M()){const{state:e,tr:n,transactions:r}=t;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:v(this,jn),state:e??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:v(this,Fs),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};Fs=new WeakMap;Cr=new WeakMap;Vs=new WeakMap;jn=new WeakMap;Ft=new WeakMap;Hs=new WeakMap;Us=new WeakMap;function Gx(t,e){const n=[],r=new WeakMap,s=[],i=new WeakMap;let o=[];const a={duplicateMap:i,parentExtensions:s,gatheredExtensions:o,settings:e};for(const d of t)kh(a,{extension:d});o=tr(o,(d,h)=>h.priority-d.priority);const l=new WeakSet,c=new Set;for(const d of o){const h=d.constructor,f=d.name,p=i.get(h);R(p,{message:`No entries were found for the ExtensionConstructor ${d.name}`,code:b.INTERNAL}),!(l.has(h)||c.has(f))&&(l.add(h),c.add(f),n.push(d),r.set(h,d),p.forEach(m=>m==null?void 0:m.replaceChildExtension(h,d)))}const u=[];for(const d of n)Xx({extension:d,found:l,missing:u});return R(tn(u),{code:b.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:d,extension:h})=>`The extension '${h.name}' requires '${d.name} in order to run correctly.`).join(`
52
+ `)}),{extensions:n,extensionMap:r}}function kh(t,e){var n;const{gatheredExtensions:r,duplicateMap:s,parentExtensions:i,settings:o}=t,{extension:a,parentExtension:l}=e;let{names:c=[]}=e;R(yh(a),{code:b.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=o.priority)==null?void 0:n[a.name]),r.push(a),Yx({duplicateMap:s,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],i.push(a);for(const d of u)kh(t,{names:c,extension:d,parentExtension:a})}}function Xx(t){const{extension:e,found:n,missing:r}=t;if(e.requiredExtensions)for(const s of e.requiredExtensions??[])n.has(s)||r.push({Constructor:s,extension:e})}function Yx(t){const{duplicateMap:e,extension:n,parentExtension:r}=t,s=n.constructor,i=e.get(s),o=r?[r]:[];e.set(s,i?[...i,...o]:o)}function Zx(t){var e,n,r,s;const{extension:i,nodeNames:o,markNames:a,plainNames:l,store:c,handlers:u}=t;i.setStore(c);const d=(e=i.onCreate)==null?void 0:e.bind(i),h=(n=i.onView)==null?void 0:n.bind(i),f=(r=i.onStateUpdate)==null?void 0:r.bind(i),p=(s=i.onDestroy)==null?void 0:s.bind(i);d&&u.create.push(d),h&&u.view.push(h),f&&u.update.push(f),p&&u.destroy.push(p),Wi(i)&&a.push(i.name),Ts(i)&&i.name!=="doc"&&o.push(i.name),xh(i)&&l.push(i.name)}var Vt,Tr,Qe,wt,Or,He,fn,Mr,pn,_r,mn,et,Nr,js=class{constructor(t,e={}){ce(this,Vt,void 0),ce(this,Tr,M()),ce(this,Qe,M()),ce(this,wt,void 0),ce(this,Or,void 0),ce(this,He,Pe.None),ce(this,fn,void 0),ce(this,Mr,!0),ce(this,pn,{create:[],view:[],update:[],destroy:[]}),ce(this,_r,[]),ce(this,mn,Hi()),ce(this,et,void 0),ce(this,Nr,void 0),this.getState=()=>{var s;return v(this,He)>=Pe.EditorView?this.view.state:(R(v(this,et),{code:b.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),(s=v(this,et))==null?void 0:s.initialEditorState)},this.updateState=s=>{const i=this.getState();this.view.updateState(s),this.onStateUpdate({previousState:i,state:s})};const{extensions:n,extensionMap:r}=Gx(t,e);ye(this,fn,e),ye(this,wt,xn(n)),ye(this,Or,r),ye(this,Vt,this.createExtensionStore()),ye(this,He,Pe.Create),this.setupLifecycleHandlers();for(const s of v(this,pn).create){const i=s();i&&v(this,_r).push(i)}}static create(t,e={}){return new js([...Au(t),...qx(e.builtin)],e)}get[At](){return xe.Manager}get destroyed(){return v(this,He)===Pe.Destroy}get mounted(){return v(this,He)>=Pe.EditorView&&v(this,He)<Pe.Destroy}get output(){var t;return(t=v(this,et))==null?void 0:t.frameworkOutput}get frameworkAttached(){return!!v(this,et)}get extensions(){return v(this,wt)}get stringHandlers(){return v(this,Tr)}get store(){return xn(v(this,Qe))}get extensionStore(){return xn(v(this,Vt))}get tr(){return this.getExtension(H).transaction}get nodes(){return v(this,Qe).nodes}get marks(){return v(this,Qe).marks}get schema(){return v(this,Qe).schema}get extensionTags(){return v(this,Qe).tags}get view(){return v(this,Qe).view}get settings(){return v(this,fn)}get document(){return v(this,fn).document??Fi()}setupLifecycleHandlers(){const t=v(this,Vt),e=v(this,pn),n=[],r=[],s=[];t.nodeNames=n,t.markNames=r,t.plainNames=s;for(const i of v(this,wt))Zx({extension:i,nodeNames:n,markNames:r,plainNames:s,handlers:e,store:t})}setStringHandler(t,e){v(this,Tr)[t]=e}setStoreKey(t,e){v(this,Qe)[t]=e}getStoreKey(t){const e=v(this,Qe)[t];return R(!en(e),{code:b.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),e}setExtensionStore(t,e){R(v(this,He)<=Pe.EditorView,{code:b.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),v(this,Vt)[t]=e}createExtensionStore(){const t=M(),e=!0;let n,r;return Object.defineProperties(t,{extensions:{get:()=>v(this,wt),enumerable:e},phase:{get:()=>v(this,He),enumerable:e},view:{get:()=>this.view,enumerable:e},managerSettings:{get:()=>xn(v(this,fn)),enumerable:e},getState:{value:this.getState,enumerable:e},updateState:{value:this.updateState,enumerable:e},isMounted:{value:()=>this.mounted,enumerable:e},getExtension:{value:this.getExtension.bind(this),enumerable:e},manager:{get:()=>this,enumerable:e},document:{get:()=>this.document,enumerable:e},stringHandlers:{get:()=>v(this,Tr),enumerable:e},currentState:{get:()=>n??(n=this.getState()),set:s=>{n=s},enumerable:e},previousState:{get:()=>r,set:s=>{r=s},enumerable:e}}),t.getStoreKey=this.getStoreKey.bind(this),t.setStoreKey=this.setStoreKey.bind(this),t.setExtensionStore=this.setExtensionStore.bind(this),t.setStringHandler=this.setStringHandler.bind(this),t}addView(t){if(v(this,He)>=Pe.EditorView)return this;ye(this,Mr,!0),ye(this,He,Pe.EditorView),v(this,Qe).view=t;for(const e of v(this,pn).view){const n=e(t);n&&v(this,_r).push(n)}return this}attachFramework(t,e){var n;v(this,et)!==t&&(v(this,et)&&(v(this,et).destroy(),(n=v(this,Nr))==null||n.call(this)),ye(this,et,t),ye(this,Nr,this.addHandler("stateUpdate",e)))}createEmptyDoc(){var t;const e=(t=this.schema.nodes.doc)==null?void 0:t.createAndFill();return R(e,{code:b.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),e}createState(t={}){const{onError:e,defaultSelection:n="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:s=n,stringHandler:i=this.settings.stringHandler}=t,{schema:o,plugins:a}=this.store,l=nh({stringHandler:D(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:e,schema:o,selection:s});return bn.create({schema:o,doc:l,plugins:a,selection:lt(s,l)})}addHandler(t,e){return v(this,mn).on(t,e)}onStateUpdate(t){const e=v(this,Mr);v(this,Vt).currentState=t.state,v(this,Vt).previousState=t.previousState,e&&(ye(this,He,Pe.Runtime),ye(this,Mr,!1));const n={...t,firstUpdate:e};for(const r of v(this,pn).update)r(n);v(this,mn).emit("stateUpdate",n)}getExtension(t){const e=v(this,Or).get(t);return R(e,{code:b.INVALID_MANAGER_EXTENSION,message:`'${t.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),e}hasExtension(t){return!!v(this,Or).get(t)}clone(){const t=v(this,wt).map(n=>n.clone(n.options)),e=js.create(()=>t,v(this,fn));return v(this,mn).emit("clone",e),e}recreate(t=[],e={}){const n=v(this,wt).map(s=>s.clone(s.initialOptions)),r=js.create(()=>[...n,...t],e);return v(this,mn).emit("recreate",r),r}destroy(){var t,e,n,r,s,i;ye(this,He,Pe.Destroy);for(const o of((t=this.view)==null?void 0:t.state.plugins)??[])(n=(e=o.getState(this.view.state))==null?void 0:e.destroy)==null||n.call(e);(r=v(this,et))==null||r.destroy(),(s=v(this,Nr))==null||s.call(this);for(const o of v(this,_r))o();for(const o of v(this,pn).destroy)o();(i=this.view)==null||i.destroy(),v(this,mn).emit("destroy")}includes(t){const e=[],n=[];for(const r of v(this,wt))e.push(r.name,r.constructorName),n.push(r.constructor);return t.every(r=>D(r)?gt(e,r):gt(n,r))}},Qx=js;Vt=new WeakMap;Tr=new WeakMap;Qe=new WeakMap;wt=new WeakMap;Or=new WeakMap;He=new WeakMap;fn=new WeakMap;Mr=new WeakMap;pn=new WeakMap;_r=new WeakMap;mn=new WeakMap;et=new WeakMap;Nr=new WeakMap;function eb(t,e){return!mr(t)||!gr(t,xe.Manager)?!1:e?t.includes(e):!0}function Ot(t,e,n){return Math.min(Math.max(t,n),e)}class tb extends Error{constructor(e){super(`Failed to parse color: "${e}"`)}}var Ar=tb;function La(t){if(typeof t!="string")throw new Ar(t);if(t.trim().toLowerCase()==="transparent")return[0,0,0,0];let e=t.trim();e=cb.test(t)?sb(t):t;const n=ib.exec(e);if(n){const o=Array.from(n).slice(1);return[...o.slice(0,3).map(a=>parseInt(cs(a,2),16)),parseInt(cs(o[3]||"f",2),16)/255]}const r=ob.exec(e);if(r){const o=Array.from(r).slice(1);return[...o.slice(0,3).map(a=>parseInt(a,16)),parseInt(o[3]||"ff",16)/255]}const s=ab.exec(e);if(s){const o=Array.from(s).slice(1);return[...o.slice(0,3).map(a=>parseInt(a,10)),parseFloat(o[3]||"1")]}const i=lb.exec(e);if(i){const[o,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(Ot(0,100,a)!==a)throw new Ar(t);if(Ot(0,100,l)!==l)throw new Ar(t);return[...ub(o,a,l),Number.isNaN(c)?1:c]}throw new Ar(t)}function nb(t){let e=5381,n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return(e>>>0)%2341}const Ec=t=>parseInt(t.replace(/_/g,""),36),rb="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((t,e)=>{const n=Ec(e.substring(0,3)),r=Ec(e.substring(3)).toString(16);let s="";for(let i=0;i<6-r.length;i++)s+="0";return t[n]=`${s}${r}`,t},{});function sb(t){const e=t.toLowerCase().trim(),n=rb[nb(e)];if(!n)throw new Ar(t);return`#${n}`}const cs=(t,e)=>Array.from(Array(e)).map(()=>t).join(""),ib=new RegExp(`^#${cs("([a-f0-9])",3)}([a-f0-9])?$`,"i"),ob=new RegExp(`^#${cs("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),ab=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${cs(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),lb=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,cb=/^[a-z]+$/i,Cc=t=>Math.round(t*255),ub=(t,e,n)=>{let r=n/100;if(e===0)return[r,r,r].map(Cc);const s=(t%360+360)%360/60,i=(1-Math.abs(2*r-1))*(e/100),o=i*(1-Math.abs(s%2-1));let a=0,l=0,c=0;s>=0&&s<1?(a=i,l=o):s>=1&&s<2?(a=o,l=i):s>=2&&s<3?(l=i,c=o):s>=3&&s<4?(l=o,c=i):s>=4&&s<5?(a=o,c=i):s>=5&&s<6&&(a=i,c=o);const u=r-i/2,d=a+u,h=l+u,f=c+u;return[d,h,f].map(Cc)};function db(t){const[e,n,r,s]=La(t).map((d,h)=>h===3?d:d/255),i=Math.max(e,n,r),o=Math.min(e,n,r),a=(i+o)/2;if(i===o)return[0,0,a,s];const l=i-o,c=a>.5?l/(2-i-o):l/(i+o);return[60*(e===i?(n-r)/l+(n<r?6:0):n===i?(r-e)/l+2:(e-n)/l+4),c,a,s]}function hb(t,e,n,r){return`hsla(${(t%360).toFixed()}, ${Ot(0,100,e*100).toFixed()}%, ${Ot(0,100,n*100).toFixed()}%, ${parseFloat(Ot(0,1,r).toFixed(3))})`}function je(t,e){const[n,r,s,i]=db(t);return hb(n,r,s-e,i)}function fb(t){if(t==="transparent")return 0;function e(i){const o=i/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}const[n,r,s]=La(t);return .2126*e(n)+.7152*e(r)+.0722*e(s)}function pb(t,e,n,r){return`rgba(${Ot(0,255,t).toFixed()}, ${Ot(0,255,e).toFixed()}, ${Ot(0,255,n).toFixed()}, ${parseFloat(Ot(0,1,r).toFixed(3))})`}function Ws(t,e){return je(t,-e)}function bi(t,e){const[n,r,s,i]=La(t);return pb(n,r,s,i-e)}function mb(t){return fb(t)>.179}function Qn(t){return mb(t)?"#000":"#fff"}const gb="remirror-editor-wrapper",yb="remirror-button-active",xb="remirror-button",bb="remirror-composite",kb="remirror-dialog",Sb="remirror-dialog-backdrop",vb="remirror-form",wb="remirror-form-message",Eb="remirror-form-label",Cb="remirror-form-group",Tb="remirror-group",Ob="remirror-input",Mb="remirror-menu",_b="remirror-menu-pane",Nb="remirror-menu-pane-active",Ab="remirror-menu-dropdown-label",Rb="remirror-menu-pane-icon",Ib="remirror-menu-pane-label",Db="remirror-menu-pane-shortcut",Pb="remirror-menu-button-left",Lb="remirror-menu-button-right",Bb="remirror-menu-button-nested-left",zb="remirror-menu-button-nested-right",$b="remirror-menu-button",Fb="remirror-menu-bar",Vb="remirror-flex-column",Hb="remirror-flex-row",Ub="remirror-menu-item",jb="remirror-menu-item-row",Wb="remirror-menu-item-column",Kb="remirror-menu-item-checkbox",qb="remirror-menu-item-radio",Jb="remirror-menu-group",Gb="remirror-floating-popover",Xb="remirror-popover",Yb="remirror-animated-popover",Zb="remirror-role",Qb="remirror-separator",e1="remirror-tab",t1="remirror-tab-list",n1="remirror-tabbable",r1="remirror-toolbar",s1="remirror-tooltip",i1="remirror-table-size-editor",o1="remirror-table-size-editor-body",a1="remirror-table-size-editor-cell",l1="remirror-table-size-editor-cell-selected",c1="remirror-table-size-editor-footer",u1="remirror-color-picker",d1="remirror-color-picker-cell",h1="remirror-color-picker-cell-selected";var f1=Object.freeze({__proto__:null,ANIMATED_POPOVER:Yb,BUTTON:xb,BUTTON_ACTIVE:yb,COLOR_PICKER:u1,COLOR_PICKER_CELL:d1,COLOR_PICKER_CELL_SELECTED:h1,COMPOSITE:bb,DIALOG:kb,DIALOG_BACKDROP:Sb,EDITOR_WRAPPER:gb,FLEX_COLUMN:Vb,FLEX_ROW:Hb,FLOATING_POPOVER:Gb,FORM:vb,FORM_GROUP:Cb,FORM_LABEL:Eb,FORM_MESSAGE:wb,GROUP:Tb,INPUT:Ob,MENU:Mb,MENU_BAR:Fb,MENU_BUTTON:$b,MENU_BUTTON_LEFT:Pb,MENU_BUTTON_NESTED_LEFT:Bb,MENU_BUTTON_NESTED_RIGHT:zb,MENU_BUTTON_RIGHT:Lb,MENU_DROPDOWN_LABEL:Ab,MENU_GROUP:Jb,MENU_ITEM:Ub,MENU_ITEM_CHECKBOX:Kb,MENU_ITEM_COLUMN:Wb,MENU_ITEM_RADIO:qb,MENU_ITEM_ROW:jb,MENU_PANE:_b,MENU_PANE_ACTIVE:Nb,MENU_PANE_ICON:Rb,MENU_PANE_LABEL:Ib,MENU_PANE_SHORTCUT:Db,POPOVER:Xb,ROLE:Zb,SEPARATOR:Qb,TAB:e1,TABBABLE:n1,TABLE_SIZE_EDITOR:i1,TABLE_SIZE_EDITOR_BODY:o1,TABLE_SIZE_EDITOR_CELL:a1,TABLE_SIZE_EDITOR_CELL_SELECTED:l1,TABLE_SIZE_EDITOR_FOOTER:c1,TAB_LIST:t1,TOOLBAR:r1,TOOLTIP:s1});const p1="remirror-list-item-with-custom-mark",m1="remirror-ul-list-content",g1="remirror-editor",y1="remirror-list-item-marker-container",x1="remirror-list-item-checkbox",b1="remirror-collapsible-list-item-closed",k1="remirror-collapsible-list-item-button",S1="remirror-list-spine";var sn=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:k1,COLLAPSIBLE_LIST_ITEM_CLOSED:b1,EDITOR:g1,LIST_ITEM_CHECKBOX:x1,LIST_ITEM_MARKER_CONTAINER:y1,LIST_ITEM_WITH_CUSTOM_MARKER:p1,LIST_SPINE:S1,UL_LIST_CONTENT:m1});const v1="remirror-is-empty";var w1=Object.freeze({__proto__:null,IS_EMPTY:v1});const E1="remirror-editor",C1="remirror-positioner",T1="remirror-positioner-widget";var O1=Object.freeze({__proto__:null,EDITOR:E1,POSITIONER:C1,POSITIONER_WIDGET:T1});const tt={gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},Mt="#000000",Ba="#ffffff",M1="#252103",za=bi(Mt,.75),Ki="#7963d2",$a="#bcd263",_1="#fff",N1="#fff",Fa=tt.gray[1],Tc="rgba(10,31,68,0.08)",Oc="rgba(10,31,68,0.10)",Mc="rgba(10,31,68,0.12)",A1=Ws(bi(Mt,.1),.13),Va={background:Ba,border:za,foreground:Mt,muted:Fa,primary:Ki,secondary:$a,primaryText:_1,secondaryText:N1,text:M1,faded:A1},R1={...Va,background:je(Ba,.15),border:je(za,.15),foreground:je(Mt,.15),muted:je(Fa,.15),primary:je(Ki,.15),secondary:je($a,.15),get text(){return Qn(this.background)},get primaryText(){return Qn(this.primary)},get secondaryText(){return Qn(this.secondary)}},I1={...Va,background:je(Ba,.075),border:je(za,.075),foreground:je(Mt,.075),muted:je(Fa,.075),primary:je(Ki,.075),secondary:je($a,.075),get text(){return Qn(this.background)},get primaryText(){return Qn(this.primary)},get secondaryText(){return Qn(this.secondary)}};({...Va,backdrop:bi(Mt,.1),outline:bi(Ki,.6),table:(Ws(Mt,.8),Ws(Mt,.4),tt.gray[3],tt.blue[7],tt.blue[1],tt.blue[5],tt.blue[7],Ws(Mt,.4),tt.blue[5],tt.red[7],tt.red[1],tt.red[5])},`${Tc}`,`${Oc}`,`${Mc}`);var D1=Object.defineProperty,P1=Object.getOwnPropertyDescriptor,Ha=(t,e,n,r)=>{for(var s=r>1?void 0:r?P1(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&D1(e,n,s),s},Sh=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},ue=(t,e,n)=>(Sh(t,e,"read from private field"),n?n.call(t):e.get(t)),vt=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Lt=(t,e,n,r)=>(Sh(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Rr,Ir,Wn,Dr,Ks,Pr,Lr,Br,zr,qs=class{constructor(t){vt(this,Rr,Hi()),vt(this,Ir,[]),vt(this,Wn,new Map),vt(this,Dr,[]),vt(this,Ks,!1),vt(this,Pr,void 0),vt(this,Lr,void 0),vt(this,Br,void 0),vt(this,zr,void 0),this.addListener=(e,n)=>ue(this,Rr).on(e,n),Lt(this,Pr,t),Lt(this,Lr,t.getActive),Lt(this,zr,t.getPosition),Lt(this,Br,t.getID),this.hasChanged=t.hasChanged,this.events=t.events??["state","scroll"]}static create(t){return new qs(t)}static fromPositioner(t,e){return qs.create({...t.basePositioner,...e})}get basePositioner(){return{getActive:ue(this,Lr),getPosition:ue(this,zr),hasChanged:this.hasChanged,events:this.events,getID:ue(this,Br)}}onActiveChanged(t){this.recentUpdate=t;const e=ue(this,Lr).call(this,t);Lt(this,Ir,e),Lt(this,Wn,new Map),Lt(this,Ks,!1),Lt(this,Dr,[]);const n=[];for(const[r,s]of e.entries()){const i=this.getID(s,r);ue(this,Dr).push(i),n.push({setElement:o=>this.addProps({...t,data:s,element:o},r),id:i,data:s})}ue(this,Rr).emit("update",n)}getID(t,e){var n;return((n=ue(this,Br))==null?void 0:n.call(this,t,e))??e.toString()}addProps(t,e){if(ue(this,Ks)||(ue(this,Wn).set(e,t),ue(this,Wn).size<ue(this,Ir).length))return;const n=[];for(const r of ue(this,Ir).keys()){const s=ue(this,Wn).get(r);R(s,{code:b.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=ue(this,Dr)[r];if(!i)return;n.push({position:ue(this,zr).call(this,s),element:s.element,id:i})}ue(this,Rr).emit("done",n)}clone(t){return qs.create({...ue(this,Pr),...ee(t)?t(ue(this,Pr)):t})}active(t){const e=ee(t)?t:()=>t;return this.clone(n=>({getActive:r=>n.getActive(r).filter(e)}))}},ot=qs;Rr=new WeakMap;Ir=new WeakMap;Wn=new WeakMap;Dr=new WeakMap;Ks=new WeakMap;Pr=new WeakMap;Lr=new WeakMap;Br=new WeakMap;zr=new WeakMap;ot.EMPTY=[];function L1(t,e=Ch){const{key:n}=(t==null?void 0:t.getMeta(Eh))??{};return n===e}function vh(t){const{tr:e,state:n,previousState:r}=t;return!r||e&&L1(e)?!0:e?Ky(e):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function wh(t,e,n={}){const r=e.getBoundingClientRect(),{accountForPadding:s=!1}=n;let i=0,o=0,a=0,l=0;if(Ie(e)&&s){const u=Number.parseFloat(Pt(e,"padding-left").replace("px","")),d=Number.parseFloat(Pt(e,"padding-right").replace("px","")),h=Number.parseFloat(Pt(e,"padding-top").replace("px","")),f=Number.parseFloat(Pt(e,"padding-bottom").replace("px","")),p=Number.parseFloat(Pt(e,"border-left").replace("px","")),m=Number.parseFloat(Pt(e,"border-right").replace("px","")),g=Number.parseFloat(Pt(e,"border-top").replace("px","")),y=Number.parseFloat(Pt(e,"border-bottom").replace("px","")),E=e.offsetWidth-e.clientWidth,L=e.offsetHeight-e.clientHeight;i+=u+p+(e.dir==="rtl"?E:0),o+=d+m+(e.dir==="rtl"?0:E),a+=h+g,l+=f+y+L}const c=new DOMRect(r.left+i,r.top+a,r.width-o,r.height-l);for(const[u,d]of[[t.top,t.left],[t.top,t.right],[t.bottom,t.left],[t.bottom,t.right]])if(cl(u,c.top,c.bottom)&&cl(d,c.left,c.right))return!0;return!1}var B1="remirror-positioner-widget",Eh="positionerUpdate",Ch="__all_positioners__",Th={y:-999999,x:-999999,width:0,height:0},_c={...Th,left:-999999,top:-999999,bottom:-999999,right:-999999},z1={...Th,rect:{..._c,toJSON:()=>_c},visible:!1},$1=ot.create({hasChanged:vh,getActive(t){const{state:e}=t;if(!Yd(e)||e.selection.$anchor.depth>2)return ot.EMPTY;const n=Li({predicate:r=>r.type.isBlock,selection:e});return n?[n]:ot.EMPTY},getPosition(t){const{view:e,data:n}=t,r=e.nodeDOM(n.pos);if(!Ie(r))return z1;const s=r.getBoundingClientRect(),i=e.dom.getBoundingClientRect(),o=s.height,a=s.width,l=e.dom.scrollLeft+s.left-i.left,c=e.dom.scrollTop+s.top-i.top,u=wh(s,e.dom);return{y:c,x:l,height:o,width:a,rect:s,visible:u}}}),Oh=$1.clone(({getActive:t})=>({getActive:e=>{const[n]=t(e);return n&&Ia(n.node)&&n.node.type===$i(e.state.schema)?[n]:ot.EMPTY}}));Oh.clone(({getPosition:t})=>({getPosition:e=>({...t(e),width:1})}));Oh.clone(({getPosition:t})=>({getPosition:e=>{const{width:n,x:r,y:s,height:i}=t(e);return{...t(e),width:1,x:n+r,rect:new DOMRect(n+r,s,1,i)}}}));function Ua(t){return ot.create({hasChanged:vh,getActive:e=>{const{state:n,view:r}=e;if(!t(n)||!yr(n.selection))return ot.EMPTY;try{const{head:s,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(s)}]}catch{return ot.EMPTY}},getPosition(e){const{element:n,data:r,view:s}=e,{from:i,to:o}=r,a=n.offsetParent??s.dom,l=a.getBoundingClientRect(),c=Math.abs(o.bottom-i.top),u=c>i.bottom-i.top,d=Math.min(i.left,o.left),h=Math.min(i.top,o.top),f=a.scrollLeft+(u?o.left-l.left:d-l.left),p=a.scrollTop+h-l.top,m=u?1:Math.abs(i.left-o.right),g=new DOMRect(u?o.left:d,h,m,c),y=wh(g,s.dom);return{rect:g,y:p,x:f,height:c,width:m,visible:y}}})}var F1=Ua(t=>!t.selection.empty);Ua(t=>t.selection.empty);Ua(()=>!0);F1.clone(()=>({getActive:t=>{const{state:e,view:n}=t;if(!e.selection.empty)return ot.EMPTY;const r=o0(e);if(!r)return ot.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return ot.EMPTY}}}));var us=class extends te{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:t})=>{if(t)return this.positioners=[...this.positioners,t],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(e=>e!==t)}}}get name(){return"positioner"}createAttributes(){return{class:O1.EDITOR}}init(){this.onScroll=Jf(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(t,e)=>(this.positioner(this.getBaseProps("hover",{hover:e})),!1),contextmenu:(t,e)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:e})),!1)}}onStateUpdate(t){this.positioner({...t,previousState:t.firstUpdate?void 0:t.previousState,event:"state",helpers:this.store.helpers})}createDecorations(t){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return W.empty;const e=Q.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return W.create(t.doc,[e])}forceUpdatePositioners(t=Ch){return({tr:e,dispatch:n})=>(n==null||n(e.setMeta(Eh,{key:t})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const t=document.createElement("span");return t.dataset.id=B1,t.setAttribute("role","presentation"),t}triggerPositioner(t,e){t.hasChanged(e)&&t.onActiveChanged({...e,view:this.store.view})}positioner(t){for(const e of this.positioners)e.events.includes(t.event)&&this.triggerPositioner(e,t)}getBaseProps(t,e){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:t,firstUpdate:!1,previousState:r,state:n,...e}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};Ha([_()],us.prototype,"forceUpdatePositioners",1);Ha([se()],us.prototype,"getPositionerWidget",1);us=Ha([G({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],us);var V1=Object.defineProperty,H1=Object.getOwnPropertyDescriptor,Os=(t,e,n,r)=>{for(var s=r>1?void 0:r?H1(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&V1(e,n,s),s},U1={icon:"bold",label:({t})=>t(Cl.LABEL),description:({t})=>t(Cl.DESCRIPTION)},Nn=class extends ji{get name(){return"bold"}createTags(){return[j.FormattingMark,j.FontStyle]}createMarkSpec(t,e){return{...e,attrs:t.defaults(),parseDOM:[{tag:"strong",getAttrs:t.parse},{tag:"b",getAttrs:n=>Ie(n)&&n.style.fontWeight!=="normal"?t.parse(n):!1},{style:"font-weight",getAttrs:n=>D(n)&&/^(bold(er)?|[5-9]\d{2,})$/.test(n)?null:!1},...e.parseDOM??[]],toDOM:n=>{const{weight:r}=this.options;return r?["strong",{"font-weight":r.toString()},0]:["strong",t.dom(n),0]}}}createInputRules(){return[yi({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(t){return ar({type:this.type,selection:t})}setBold(t){return({tr:e,dispatch:n})=>{const{from:r,to:s}=lt(t??e.selection,e.doc);return n==null||n(e.addMark(r,s,this.type.create())),!0}}removeBold(t){return({tr:e,dispatch:n})=>{const{from:r,to:s}=lt(t??e.selection,e.doc);return e.doc.rangeHasMark(r,s,this.type)?(n==null||n(e.removeMark(r,s,this.type)),!0):!1}}shortcut(t){return this.toggleBold()(t)}};Os([_(U1)],Nn.prototype,"toggleBold",1);Os([_()],Nn.prototype,"setBold",1);Os([_()],Nn.prototype,"removeBold",1);Os([Ye({shortcut:w.Bold,command:"toggleBold"})],Nn.prototype,"shortcut",1);Nn=Os([G({defaultOptions:{weight:void 0},staticKeys:["weight"]})],Nn);var j1=Object.defineProperty,W1=Object.getOwnPropertyDescriptor,ja=(t,e,n,r)=>{for(var s=r>1?void 0:r?W1(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&j1(e,n,s),s},{DESCRIPTION:K1,LABEL:q1}=vm,J1={icon:"codeLine",description:({t})=>t(K1),label:({t})=>t(q1)},ds=class extends ji{get name(){return"code"}createTags(){return[j.Code,j.ExcludeInputRules]}createMarkSpec(t,e){return{excludes:"_",...e,attrs:t.defaults(),parseDOM:[{tag:"code",getAttrs:t.parse},...e.parseDOM??[]],toDOM:n=>["code",{spellcheck:"false",...t.dom(n)},0]}}createKeymap(){return{"Mod-`":ar({type:this.type})}}keyboardShortcut(t){return this.toggleCode()(t)}toggleCode(){return ar({type:this.type})}createInputRules(){return[yi({regexp:new RegExp(`(?:\`)([^\`${la}]+)(?:\`)$`),type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{type:"mark",regexp:/`([^`]+)`/g,markType:this.type}]}};ja([Ye({shortcut:w.Code,command:"toggleCode"})],ds.prototype,"keyboardShortcut",1);ja([_(J1)],ds.prototype,"toggleCode",1);ds=ja([G({})],ds);var ki=200,be=function(){};be.prototype.append=function(e){return e.length?(e=be.from(e),!this.length&&e||e.length<ki&&this.leafAppend(e)||this.length<ki&&e.leafPrepend(this)||this.appendInner(e)):this};be.prototype.prepend=function(e){return e.length?be.from(e).append(this):this};be.prototype.appendInner=function(e){return new G1(this,e)};be.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?be.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};be.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};be.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};be.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};be.from=function(e){return e instanceof be?e:e&&e.length?new Mh(e):be.empty};var Mh=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=ki)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=ki)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(be);be.empty=new Mh([]);var G1=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(be);const X1=500;class it{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new ht(d.map));let f=d.step.map(s.slice(i)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new ht(p,void 0,void 0,c.length+u.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(i)):d.selection,l=new it(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new ht(e.mapping.maps[u],d,n),f;(f=l&&l.merge(h))&&(h=f,u?i.pop():a=a.slice(0,a.length-1)),i.push(h),n&&(o++,n=void 0),s||(l=h)}let c=o-r.depth;return c>Z1&&(a=Y1(a,c),o-=c),new it(a.append(i),o)}remapping(e,n){let r=new Gn;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new it(this.items.append(e.map(n=>new ht(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},s);let l=n;this.items.forEach(h=>{let f=i.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=i.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(i.slice(l+1,f));g&&a++,r.push(new ht(p,m,g))}else r.push(new ht(p))},s);let c=[];for(let h=n;h<o;h++)c.push(new ht(i.maps[h]));let u=this.items.slice(0,s).append(c).append(r),d=new it(u,a);return d.emptyItemCount()>X1&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&i++;let d=new ht(c.invert(),l,u),h,f=s.length-1;(h=s.length&&s[f].merge(d))?s[f]=h:s.push(d)}}else o.map&&r--},this.items.length,0),new it(be.from(s.reverse()),i)}}it.empty=new it(be.empty,0);function Y1(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class ht{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new ht(n.getMap().invert(),n,this.selection)}}}class Ut{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const Z1=20;function Q1(t,e,n,r){let s=n.getMeta(mt),i;if(s)return s.historyState;n.getMeta(tk)&&(t=new Ut(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(mt))return o.getMeta(mt).redo?new Ut(t.done.addTransform(n,void 0,r,Js(e)),t.undone,Nc(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new Ut(t.done,t.undone.addTransform(n,void 0,r,Js(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!ek(n,t.prevRanges)),c=o?yo(t.prevRanges,n.mapping):Nc(n.mapping.maps[n.steps.length-1]);return new Ut(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Js(e)),it.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Ut(t.done.rebased(n,i),t.undone.rebased(n,i),yo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ut(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),yo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function ek(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function Nc(t){let e=[];return t.forEach((n,r,s,i)=>e.push(s,i)),e}function yo(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function _h(t,e,n,r){let s=Js(e),i=mt.get(e).spec.config,o=(r?t.undone:t.done).popEvent(e,s);if(!o)return;let a=o.selection.resolve(o.transform.doc),l=(r?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,s),c=new Ut(r?l:o.remaining,r?o.remaining:l,null,0,-1);n(o.transform.setSelection(a).setMeta(mt,{redo:r,historyState:c}).scrollIntoView())}let xo=!1,Ac=null;function Js(t){let e=t.plugins;if(Ac!=e){xo=!1,Ac=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){xo=!0;break}}return xo}const mt=new pr("history"),tk=new pr("closeHistory");function nk(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new un({key:mt,state:{init(){return new Ut(it.empty,it.empty,null,0,-1)},apply(e,n,r){return Q1(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?Gs:r=="historyRedo"?$r:null;return s?(n.preventDefault(),s(e.state,e.dispatch)):!1}}}})}const Gs=(t,e)=>{let n=mt.getState(t);return!n||n.done.eventCount==0?!1:(e&&_h(n,t,e,!1),!0)},$r=(t,e)=>{let n=mt.getState(t);return!n||n.undone.eventCount==0?!1:(e&&_h(n,t,e,!0),!0)};function rk(t){let e=mt.getState(t);return e?e.done.eventCount:0}function sk(t){let e=mt.getState(t);return e?e.undone.eventCount:0}var ik=Object.defineProperty,ok=Object.getOwnPropertyDescriptor,Wa=(t,e,n,r)=>{for(var s=r>1?void 0:r?ok(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&ik(e,n,s),s},cr=class extends Rt{get name(){return"doc"}createNodeSpec(t,e){const{docAttributes:n,content:r}=this.options,s=M();if(Rn(n))for(const[i,o]of he(n))s[i]={default:o};else for(const i of n)s[i]={default:null};return{attrs:s,content:r,...e}}setDocAttributes(t){return({tr:e,dispatch:n})=>{if(n){for(const[r,s]of Object.entries(t))e.step(new hs(r,s));n(e)}return!0}}isDefaultDocNode({state:t=this.store.getState(),options:e}={}){return Ra(t.doc,e)}};Wa([_()],cr.prototype,"setDocAttributes",1);Wa([se()],cr.prototype,"isDefaultDocNode",1);cr=Wa([G({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:X.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],cr);var Nh="SetDocAttribute",Ah="RevertSetDocAttribute",hs=class extends me{constructor(t,e,n=Nh){super(),this.stepType=n,this.key=t,this.value=e}static fromJSON(t,e){return new hs(e.key,e.value,e.stepType)}apply(t){this.previous=t.attrs[this.key];const e={...t.attrs,[this.key]:this.value};return le.ok(t.type.create(e,t.content,t.marks))}invert(){return new hs(this.key,this.previous,Ah)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{me.jsonID(Nh,hs),me.jsonID(Ah,hs)}catch(t){if(!t.message.startsWith("Duplicate use of step JSON ID"))throw t}var ak=Object.defineProperty,lk=Object.getOwnPropertyDescriptor,Rh=(t,e,n,r)=>{for(var s=r>1?void 0:r?lk(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&ak(e,n,s),s};function ck(t,e,n,r){const s=t.docView.posFromDOM(e,n,r);return s===null||s<0?null:s}function uk(t,e){const n=e.target;if(n){const r=ck(t,n,0);if(r!==null){const s=t.state.doc.resolve(r),i=s.node().isLeaf?0:1,o=s.start()-i;return{pos:r,inside:o}}}return t.posAtCoords({left:e.clientX,top:e.clientY})??void 0}var Si=class extends te{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=t=>(e,n)=>{const r=n,s=uk(e,r);if(!s)return!1;const i=[],o=[],{inside:a,pos:l}=s;if(a===-1)return!1;const c=e.state.doc.resolve(l),u=c.depth+1;for(const d of Nu(u,1))i.push({node:d>c.depth&&c.nodeAfter?c.nodeAfter:c.node(d),pos:c.before(d)});for(const{type:d}of c.marksAcross(c)??[]){const h=In(c,d);h&&o.push(h)}return t(r,{view:e,nodes:i,marks:o,getMark:d=>{const h=D(d)?e.state.schema.marks[d]:d;return R(h,{code:b.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),o.find(f=>f.mark.type===h)},getNode:d=>{var h;const f=D(d)?e.state.schema.nodes[d]:d;R(f,{code:b.EXTENSION,message:"The node being checked does not exist"});const p=i.find(({node:m})=>m.type===f);if(p)return{...p,isRoot:!!((h=i[0])!=null&&h.node.eq(p.node))}}})}}get name(){return"events"}onView(){var t,e;if(!((t=this.store.managerSettings.exclude)!=null&&t.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(e=n.options.exclude)!=null&&e.clickHandler)continue;const r=n.createEventHandlers();for(const[s,i]of he(r))this.addHandler(s,i)}}createPlugin(){const t=new WeakMap,e=(n,r,s,i,o,a,l,c)=>{const u=this.store.currentState,{schema:d,doc:h}=u,f=h.resolve(i),p=t.has(l),m=dk({$pos:f,handled:p,view:s,state:u});let g=!1;p||(g=n(l,m)||g);const y={...m,pos:i,direct:c,nodeWithPosition:{node:o,pos:a},getNode:E=>{const L=D(E)?d.nodes[E]:E;return R(L,{code:b.EXTENSION,message:"The node being checked does not exist"}),L===o.type?{node:o,pos:a}:void 0}};return t.set(l,!0),r(l,y)||g};return{props:{handleKeyPress:(n,r)=>this.options.keypress(r)||!1,handleKeyDown:(n,r)=>this.options.keydown(r)||!1,handleTextInput:(n,r,s,i)=>this.options.textInput({from:r,to:s,text:i})||!1,handleClickOn:(n,r,s,i,o,a)=>e(this.options.clickMark,this.options.click,n,r,s,i,o,a),handleDoubleClickOn:(n,r,s,i,o,a)=>e(this.options.doubleClickMark,this.options.doubleClick,n,r,s,i,o,a),handleTripleClickOn:(n,r,s,i,o,a)=>e(this.options.tripleClickMark,this.options.tripleClick,n,r,s,i,o,a),handleDOMEvents:{focus:(n,r)=>this.options.focus(r)||!1,blur:(n,r)=>this.options.blur(r)||!1,mousedown:(n,r)=>(this.startMouseover(),this.options.mousedown(r)||!1),mouseup:(n,r)=>(this.endMouseover(),this.options.mouseup(r)||!1),mouseleave:(n,r)=>(this.mouseover=!1,this.options.mouseleave(r)||!1),mouseenter:(n,r)=>(this.mouseover=!0,this.options.mouseenter(r)||!1),keyup:(n,r)=>this.options.keyup(r)||!1,mouseout:this.createMouseEventHandler((n,r)=>{const s={...r,hovering:!1};return this.options.hover(n,s)||!1}),mouseover:this.createMouseEventHandler((n,r)=>{const s={...r,hovering:!0};return this.options.hover(n,s)||!1}),contextmenu:this.createMouseEventHandler((n,r)=>this.options.contextmenu(n,r)||!1),scroll:(n,r)=>this.options.scroll(r)||!1,copy:(n,r)=>this.options.copy(r)||!1,cut:(n,r)=>this.options.cut(r)||!1,paste:(n,r)=>this.options.paste(r)||!1}},view:n=>{let r=n.editable;const s=this.options;return{update(i){const o=i.editable;o!==r&&(s.editable(o),r=o)}}}}}isInteracting(){return this.mousedown&&this.mouseover}startMouseover(){this.mouseover=!0,!this.mousedown&&(this.mousedown=!0,this.store.document.documentElement.addEventListener("mouseup",()=>{this.endMouseover()},{once:!0}))}endMouseover(){this.mousedown&&(this.mousedown=!1,this.store.commands.emptyUpdate())}};Rh([se()],Si.prototype,"isInteracting",1);Si=Rh([G({handlerKeys:["blur","focus","mousedown","mouseup","mouseenter","mouseleave","textInput","keypress","keyup","keydown","click","clickMark","doubleClick","doubleClickMark","tripleClick","tripleClickMark","contextmenu","hover","scroll","copy","cut","paste","editable"],handlerKeyOptions:{blur:{earlyReturnValue:!0},focus:{earlyReturnValue:!0},mousedown:{earlyReturnValue:!0},mouseleave:{earlyReturnValue:!0},mouseup:{earlyReturnValue:!0},click:{earlyReturnValue:!0},doubleClick:{earlyReturnValue:!0},tripleClick:{earlyReturnValue:!0},hover:{earlyReturnValue:!0},contextmenu:{earlyReturnValue:!0},scroll:{earlyReturnValue:!0},copy:{earlyReturnValue:!0},cut:{earlyReturnValue:!0},paste:{earlyReturnValue:!0}},defaultPriority:X.High})],Si);function dk(t){const{handled:e,view:n,$pos:r,state:s}=t,i={getMark:_u,markRanges:[],view:n,state:s};if(e)return i;for(const{type:o}of r.marksAcross(r)??[]){const a=In(r,o);a&&i.markRanges.push(a)}return i.getMark=o=>{const a=D(o)?s.schema.marks[o]:o;return R(a,{code:b.EXTENSION,message:`The mark ${o} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class ie extends V{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ie.valid(r)?new ie(r):V.near(r)}content(){return S.empty}eq(e){return e instanceof ie&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ie(e.resolve(n.pos))}getBookmark(){return new Ka(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!hk(e)||!fk(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ie.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let l=e.doc.resolve(s);if(ie.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!I.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(ie.valid(a))return a}return null}}}ie.prototype.visible=!1;ie.findFrom=ie.findGapCursorFrom;V.jsonID("gapcursor",ie);class Ka{constructor(e){this.pos=e}map(e){return new Ka(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ie.valid(n)?new ie(n):V.near(n)}}function hk(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function fk(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function pk(){return new un({props:{decorations:xk,createSelectionBetween(t,e,n){return e.pos==n.pos&&ie.valid(n)?new ie(n):null},handleClick:gk,handleKeyDown:mk,handleDOMEvents:{beforeinput:yk}}})}const mk=ph({ArrowLeft:Rs("horiz",-1),ArrowRight:Rs("horiz",1),ArrowUp:Rs("vert",-1),ArrowDown:Rs("vert",1)});function Rs(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof P){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ie.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new ie(c))),!0):!1}}function gk(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ie.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&I.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ie(r))),!0)}function yk(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ie))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=x.empty;for(let o=r.length-1;o>=0;o--)s=x.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new S(s,0,0));return i.setSelection(P.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function xk(t){if(!(t.selection instanceof ie))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",W.create(t.doc,[Q.widget(t.selection.head,e,{key:"gapcursor"})])}var bk=Object.defineProperty,kk=Object.getOwnPropertyDescriptor,Sk=(t,e,n,r)=>{for(var s=r>1?void 0:r?kk(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&bk(e,n,s),s},ea=class extends te{get name(){return"gapCursor"}createExternalPlugins(){return[pk()]}};ea=Sk([G({})],ea);var vk=Object.defineProperty,wk=Object.getOwnPropertyDescriptor,Dn=(t,e,n,r)=>{for(var s=r>1?void 0:r?wk(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&vk(e,n,s),s},bt=class extends te{constructor(){super(...arguments),this.wrapMethod=(t,e)=>({state:n,dispatch:r,view:s})=>{const{getState:i,getDispatch:o}=this.options,a=ee(i)?i():n,l=ee(o)&&r?o():r,c=t(a,l,s);return e==null||e(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":rt.isMac?()=>!1:this.wrapMethod($r,this.options.onRedo),"Mod-z":this.wrapMethod(Gs,this.options.onUndo),"Shift-Mod-z":this.wrapMethod($r,this.options.onRedo)}}undoShortcut(t){return this.wrapMethod(Gs,this.options.onUndo)(t)}redoShortcut(t){return this.wrapMethod($r,this.options.onRedo)(t)}createExternalPlugins(){const{depth:t,newGroupDelay:e}=this.options;return[nk({depth:t,newGroupDelay:e})]}undo(){return fc(this.wrapMethod(Gs,this.options.onUndo))}redo(){return fc(this.wrapMethod($r,this.options.onRedo))}undoDepth(t=this.store.getState()){return rk(t)}redoDepth(t=this.store.getState()){return sk(t)}};Dn([Ye({shortcut:w.Undo,command:"undo"})],bt.prototype,"undoShortcut",1);Dn([Ye({shortcut:w.Redo,command:"redo"})],bt.prototype,"redoShortcut",1);Dn([_({disableChaining:!0,description:({t})=>t(ci.UNDO_DESCRIPTION),label:({t})=>t(ci.UNDO_LABEL),icon:"arrowGoBackFill"})],bt.prototype,"undo",1);Dn([_({disableChaining:!0,description:({t})=>t(ci.REDO_DESCRIPTION),label:({t})=>t(ci.REDO_LABEL),icon:"arrowGoForwardFill"})],bt.prototype,"redo",1);Dn([se()],bt.prototype,"undoDepth",1);Dn([se()],bt.prototype,"redoDepth",1);bt=Dn([G({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],bt);var Ek=Object.defineProperty,Ck=Object.getOwnPropertyDescriptor,qa=(t,e,n,r)=>{for(var s=r>1?void 0:r?Ck(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&Ek(e,n,s),s},Tk={icon:"italic",label:({t})=>t(Tl.LABEL),description:({t})=>t(Tl.DESCRIPTION)},fs=class extends ji{get name(){return"italic"}createTags(){return[j.FontStyle,j.FormattingMark]}createMarkSpec(t,e){return{...e,attrs:t.defaults(),parseDOM:[{tag:"i",getAttrs:t.parse},{tag:"em",getAttrs:t.parse},{style:"font-style=italic"},...e.parseDOM??[]],toDOM:n=>["em",t.dom(n),0]}}createKeymap(){return{"Mod-i":ar({type:this.type})}}createInputRules(){return[yi({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:t,start:e})=>t.startsWith("*")?{}:{fullMatch:t.slice(1),start:e+1}}),yi({regexp:/(?:^|\W)_([^_]+)_$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:t,start:e})=>t.startsWith("_")?{}:{fullMatch:t.slice(1),start:e+1}})]}createPasteRules(){return[{type:"mark",markType:this.type,regexp:/(?:^|\W)_([^_]+)_/g},{type:"mark",markType:this.type,regexp:/\*([^*]+)\*/g}]}toggleItalic(t){return ar({type:this.type,selection:t})}shortcut(t){return this.toggleItalic()(t)}};qa([_(Tk)],fs.prototype,"toggleItalic",1);qa([Ye({shortcut:w.Italic,command:"toggleItalic"})],fs.prototype,"shortcut",1);fs=qa([G({})],fs);function Ok(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=!1,l=o;if(!o)return!1;if(o.depth>=2&&s.node(o.depth-1).type.compatibleContent(t)&&o.startIndex==0){if(s.index(o.depth-1)==0)return!1;let u=n.doc.resolve(o.start-2);l=new Tn(u,u,o.depth),o.endIndex<o.parent.childCount&&(o=new Tn(s,n.doc.resolve(i.end(o.depth)),o.depth)),a=!0}let c=fa(l,t,e,o);return c?(r&&r(Mk(n.tr,o,c,a,t).scrollIntoView()),!0):!1}}function Mk(t,e,n,r,s){let i=x.empty;for(let u=n.length-1;u>=0;u--)i=x.from(n[u].type.create(n[u].attrs,i));t.step(new fe(e.start-(r?2:0),e.end,e.start,e.end,new S(i,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==s&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,h=!0;u<d;u++,h=!1)!h&&Xn(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function _k(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?Nk(e,n,t,i):Ak(e,n,i):!0:!1}}function Nk(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new fe(i-1,o,i,o,new S(x.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Tn(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=fr(r);if(a==null)return!1;s.lift(r,a);let l=s.mapping.map(i,-1)-1;return vs(s.doc,l)&&s.join(l),e(s.scrollIntoView()),!0}function Ak(t,e,n){let r=t.tr,s=n.parent;for(let f=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)f-=s.child(p).nodeSize,r.delete(f-1,f+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?x.empty:x.from(s))))return!1;let d=i.pos,h=d+o.nodeSize;return r.step(new fe(d-(a?1:0),h+(l?1:0),d+1,h-1,new S((a?x.empty:x.from(s.copy(x.empty))).append(l?x.empty:x.from(s.copy(x.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}var Rk=Object.defineProperty,Ik=Object.getOwnPropertyDescriptor,Ze=(t,e,n,r)=>{for(var s=r>1?void 0:r?Ik(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&Rk(e,n,s),s};function ta(t){var e;return!!((e=t.spec.group)!=null&&e.includes(j.ListContainerNode))}function Dk(t){var e;return!!((e=t.spec.group)!=null&&e.includes(j.ListItemNode))}function on(t){return ta(t.type)}function Qt(t){return Dk(t.type)}function Ja(t,e){return n=>{const{dispatch:r,tr:s}=n,i=Ma(s,n.state),{$from:o,$to:a}=s.selection,l=o.blockRange(a);if(!l)return!1;const c=Li({predicate:u=>ta(u.type),selection:s.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===t)return Ph(e)(n);if(ta(c.node.type))return t.validContent(c.node.content)?(r==null||r(s.setNodeMarkup(c.pos,t)),!0):Pk(s,c,t,e)?(r==null||r(s.scrollIntoView()),!0):!1}return Ok(t)(i,r)}}function Ih(t,e=["checked"]){return function({tr:n,dispatch:r,state:s}){var i,o;const a=Yy(t,s.schema),{$from:l,$to:c}=n.selection;if(zi(n.selection)&&n.selection.node.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){const m=l.index(-1)>0;let g=x.empty;for(let L=l.depth-(m?1:2);L>=l.depth-3;L--)g=x.from(l.node(L).copy(g));const y=((i=a.contentMatch.defaultType)==null?void 0:i.createAndFill())||void 0;g=g.append(x.from(a.createAndFill(null,y)||void 0));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3;n.replace(l.before(m?void 0:-1),l.after(-E),new S(g,m?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(l.pos+(m?3:2)))),r(n.scrollIntoView())}return!0}if(u.attrs.closed&&l.sameParent(c)&&c.pos===c.end()){if(r){const m=l.after(-1),g=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill())||void 0,y=a.createAndFill(null,g);y&&(n.insert(m,y),n.setSelection(P.near(n.doc.resolve(m+1)))),n.delete(l.pos,c.pos),r(n.scrollIntoView())}return!0}const d=Object.fromEntries(Object.entries(u.attrs).filter(([m])=>!e.includes(m))),h=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,f={...l.node().attrs};n.delete(l.pos,c.pos);const p=h?[{type:a,attrs:d},{type:h,attrs:f}]:[{type:a,attrs:d}];return Xn(n.doc,l.pos,2)?(r&&r(n.split(l.pos,2,p).scrollIntoView()),!0):!1}}function Pk(t,e,n,r){const s=e.node,i=t.doc.resolve(e.start),o=i.node(-1),a=i.index(-1);if(!o||!o.canReplace(a,a+1,x.from(n.create())))return!1;const l=[];for(let f=0;f<s.childCount;f++){const p=s.child(f);if(!r.validContent(p.content))return!1;const m=r.createChecked(null,p.content);l.push(m)}const c=n.createChecked(null,l),u=e.pos,d=u+s.nodeSize,h=t.selection.from;return t.replaceRangeWith(u,d,c),t.setSelection(t.selection.constructor.near(t.doc.resolve(h))),!0}function Lk({listType:t,itemType:e,tr:n,range:r}){var s;const i=r.parent,o=n.doc.slice(r.start,r.end);if(i.type===t&&((s=o.content.firstChild)==null?void 0:s.type)===e)return!1;const a=[];for(let c=0;c<o.content.childCount;c++){const u=o.content.child(c);if(!e.validContent(u.content))return!1;const d=e.createChecked(null,u.content);a.push(d)}const l=t.createChecked(null,a);return n.replaceRange(r.start,r.end,new S(x.from(l),0,0)),!0}function ur({listType:t,itemType:e,tr:n}){const r=vi(n.selection);if(!r)return!1;const s=r.startIndex===0,{from:i,to:o}=n.selection;return Lk({listType:t,itemType:e,tr:n,range:r})?(n.setSelection(P.between(n.doc.resolve(s?i:i+2),n.doc.resolve(s?o:o+2))),n.scrollIntoView(),!0):!1}function Bk(t,e,n){const r=t.tr,s=n.parent,i=r.mapping.maps.length;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);const o=r.doc.resolve(n.start),a=o.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===s.childCount,u=o.node(-1),d=o.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?x.empty:x.from(s))))return!1;const h=o.pos,f=h+a.nodeSize;return r.step(new fe(h-(l?1:0),f+(c?1:0),h+1,f-1,new S((l?x.empty:x.from(s.copy(x.empty))).append(c?x.empty:x.from(s.copy(x.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Dh(t,e){const n=e||t.selection.$from;let r=[],s,i,o,a;for(let c=n.depth;c>=0;c--){if(i=n.node(c),s=n.index(c),o=i.maybeChild(s-1),a=i.maybeChild(s),o&&a&&o.type.name===a.type.name&&on(o)){const u=n.before(c+1);r.push(u)}if(s=n.indexAfter(c),o=i.maybeChild(s-1),a=i.maybeChild(s),o&&a&&o.type.name===a.type.name&&on(o)){const u=n.after(c+1);r.push(u)}}r=[...new Set(r)].sort((c,u)=>u-c);let l=!1;for(const c of r)vs(t.doc,c)&&(t.join(c),l=!0);return l}function Ph(t){return e=>{const{dispatch:n,tr:r}=e,s=Ma(r,e.state),i=zk(t,r.selection);return i?(n&&Bk(s,n,i),!0):!1}}function zk(t,e){const{$from:n,$to:r}=e;return n.blockRange(r,i=>{var o;return((o=i.firstChild)==null?void 0:o.type)===t})}function vi(t){const{$from:e,$to:n}=t;return e.blockRange(n,on)}function $k(t){const e=t.selection.$from,n=e.blockRange();if(!n||!Qt(n.parent)||n.startIndex!==0)return!1;const r=e.node(n.depth-2),s=e.index(n.depth),i=e.index(n.depth-1),o=e.index(n.depth-2),a=r.maybeChild(o-1),l=a==null?void 0:a.lastChild;if(s!==0||i!==0)return!1;if(a&&on(a)&&l&&Qt(l))return ur({listType:a.type,itemType:l.type,tr:t});if(Qt(r)){const c=r,u=e.node(n.depth-3);if(on(u))return ur({listType:u.type,itemType:c.type,tr:t})}return!1}function Rc({view:t}){if(!t)return!1;{const e=t.state.selection.$cursor;if(!e||e.parentOffset>0)return!1;const n=e.blockRange();if(!n||!Qt(n.parent)||n.startIndex!==0)return!1}{const e=t.state.tr;$k(e)&&t.dispatch(e)}{const e=t.state.selection.$cursor;if(!e||e.parentOffset>0)return!1;const n=e.blockRange();if(!n||!Qt(n.parent)||n.startIndex!==0)return!1;const r=e.index(n.depth),s=e.index(n.depth-1),i=e.index(n.depth-2),o=n.depth-2>=1&&Qt(e.node(n.depth-2));r===0&&s===0&&i<=1&&o&&_k(n.parent.type)(t.state,t.dispatch)}return lh(t.state,t.dispatch,t),!0}function Lh({node:t,mark:e,updateDOM:n,updateMark:r}){const s=document.createElement("label");s.contentEditable="false",s.classList.add(sn.LIST_ITEM_MARKER_CONTAINER),s.append(e);const i=document.createElement("div"),o=document.createElement("li");o.classList.add(sn.LIST_ITEM_WITH_CUSTOM_MARKER),o.append(s),o.append(i);const a=l=>l.type!==t.type?!1:(t=l,n(t,o),r(t,e),!0);return a(t),{dom:o,contentDOM:i,update:a}}function Fk(t,e){const n=t.node(e.depth-1),r=t.node(e.depth-2);return!Qt(n)||!on(r)?!1:{parentItem:n,parentList:r}}function Vk(t,e){const n=e.parent,r=e.parent.child(e.endIndex-1),s=e.end,i=e.$to.end(e.depth);return s<i?(t.step(new fe(s-1,i,s,i,new S(x.from(r.type.create(null,n.copy())),1,0),1,!0)),new Tn(t.doc.resolve(e.$from.pos),t.doc.resolve(i),e.depth)):e}function Hk(t,e){const n=e.parent,r=e.parent.child(e.endIndex-1),s=e.end,i=e.$to.end(e.depth-1);return s+1<i?(t.step(new fe(s-1,i,s+1,i,new S(x.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new Tn(t.selection.$from,t.selection.$to,e.depth)):e}function Uk(t,e,n,r){return ur({listType:n.type,itemType:r.type,tr:t})?new Tn(t.selection.$from,t.selection.$to,e.depth):e}function jk(t){let e=vi(t.selection);if(!e)return!1;const n=Fk(t.selection.$from,e);if(!n)return!1;const{parentItem:r,parentList:s}=n;e=Vk(t,e),e=Hk(t,e),e=Uk(t,e,s,r);const i=fr(e);return typeof i!="number"||(t.lift(e,i),e=vi(t.selection),e&&Dh(t,t.doc.resolve(e.end-2))),!0}var Wk=({tr:t,dispatch:e})=>jk(t)?(e==null||e(t.scrollIntoView()),!0):!1;function Kk(t,e,n){let r,s,i,o;const a=e.doc;if(n.startIndex>=1){r=t.child(n.startIndex-1),s=t,o=a.resolve(n.start).start(n.depth),i=o+1;for(let l=0;l<n.startIndex-1;l++)i+=s.child(l).nodeSize}else{const l=e.index(n.depth-1);if(l>=1){const c=e.node(n.depth-1),u=e.start(n.depth-1);if(s=c.child(l-1),!on(s))return!1;o=u+1;for(let d=0;d<l-1;d++)o+=c.child(d).nodeSize;if(r=s.child(s.childCount-1),i=o+s.nodeSize-r.nodeSize-1,!Qt(r))return!1}else return!1}return{previousItem:r,previousList:s,previousItemStart:i,previousListStart:o}}function qk(t,e,n){let r,s;const i=n.start,o=e.depth>=n.depth+2?e.end(n.depth+2):n.end-1,a=n.end;return o+1>=a?(r=t.slice(i,a),s=null):(r=t.slice(i,o),s=t.slice(o+1,a-1)),{selectedSlice:r,unselectedSlice:s}}function Jk(t){const{$from:e,$to:n}=t.selection,r=vi(t.selection);if(!r)return!1;const s=t.doc.resolve(r.start).node();if(!on(s))return!1;const i=Kk(s,e,r);if(!i)return!1;const{previousItem:o,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=qk(t.doc,n,r),d=o.content.append(x.fromArray([s.copy(c.content)])).append(u?u.content:x.empty);t.deleteRange(r.start,r.end);const h=l+o.nodeSize-2,f=o.copy(d);return f.check(),t.replaceRangeWith(l-1,h+1,f),t.setSelection(a===s?P.between(t.doc.resolve(e.pos),t.doc.resolve(n.pos)):P.between(t.doc.resolve(e.pos-2),t.doc.resolve(n.pos-2))),!0}var Gk=({tr:t,dispatch:e})=>Jk(t)?(e==null||e(t.scrollIntoView()),!0):!1,Bh=class extends te{get name(){return"listItemShared"}createKeymap(){const t={Tab:Gk,"Shift-Tab":Wk,Backspace:Rc,"Mod-Backspace":Rc};if(rt.isMac){const e={"Ctrl-h":t.Backspace,"Alt-Backspace":t["Mod-Backspace"]};return{...t,...e}}return t}createPlugin(){return{appendTransaction:(t,e,n)=>{const r=n.tr;return Dh(r)?r:null}}}},dr=class extends Rt{get name(){return"listItem"}createTags(){return[j.ListItemNode]}createNodeSpec(t,e){return{content:"paragraph block*",defining:!0,draggable:!1,...e,attrs:{...t.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:t.parse,priority:X.Lowest},...e.parseDOM??[]],toDOM:n=>["li",t.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(t,e,n)=>{const r=document.createElement("div");return r.classList.add(sn.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const s=n(),i=I.create(e.state.doc,s);return e.dispatch(e.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),Lh({mark:r,node:t,updateDOM:Xk,updateMark:Yk})}:{}}createKeymap(){return{Enter:Ih(this.type)}}createExtensions(){return[new Bh]}toggleListItemClosed(t){return({state:{tr:e,selection:n},dispatch:r})=>{if(!zi(n)||n.node.type.name!==this.name)return!1;const{node:s,from:i}=n;return t=Yf(t)?t:!s.attrs.closed,r==null||r(e.setNodeMarkup(i,void 0,{...s.attrs,closed:t})),!0}}liftListItemOutOfList(t){return Ph(t??this.type)}};Ze([_()],dr.prototype,"toggleListItemClosed",1);Ze([_()],dr.prototype,"liftListItemOutOfList",1);dr=Ze([G({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],dr);function Xk(t,e){t.attrs.closed?e.classList.add(sn.COLLAPSIBLE_LIST_ITEM_CLOSED):e.classList.remove(sn.COLLAPSIBLE_LIST_ITEM_CLOSED)}function Yk(t,e){t.childCount<=1?e.classList.add("disabled"):e.classList.remove("disabled")}var ps=class extends Rt{get name(){return"bulletList"}createTags(){return[j.Block,j.ListContainerNode]}createNodeSpec(t,e){return{content:"listItem+",...e,attrs:t.defaults(),parseDOM:[{tag:"ul",getAttrs:t.parse},...e.parseDOM??[]],toDOM:n=>["ul",t.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(t,e,n)=>{var r;const s=document.createElement("div");s.style.position="relative";const i=n(),o=e.state.doc.resolve(i+1),a=o.node(o.depth-1);if(!(((r=a==null?void 0:a.type)==null?void 0:r.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(sn.LIST_SPINE),u.addEventListener("click",d=>{const h=n(),f=e.state.doc.resolve(h+1),p=f.start(f.depth-1),m=I.create(e.state.doc,p-1);e.dispatch(e.state.tr.setSelection(m)),this.store.commands.toggleListItemClosed(),d.preventDefault(),d.stopPropagation()}),s.append(u)}const c=document.createElement("ul");return c.classList.add(sn.UL_LIST_CONTENT),s.append(c),{dom:s,contentDOM:c}}:{}}createExtensions(){return[new dr({priority:X.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return Ja(this.type,re(this.store.schema.nodes,"listItem"))}listShortcut(t){return this.toggleBulletList()(t)}createInputRules(){const t=/^\s*([*+-])\s$/;return[ya(t,this.type),new ws(t,(e,n,r,s)=>{const i=e.tr;return i.deleteRange(r,s),ur({listType:this.type,itemType:re(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};Ze([_({icon:"listUnordered",label:({t})=>t(ga.BULLET_LIST_LABEL)})],ps.prototype,"toggleBulletList",1);Ze([Ye({shortcut:w.BulletList,command:"toggleBulletList"})],ps.prototype,"listShortcut",1);ps=Ze([G({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],ps);var ms=class extends Rt{get name(){return"orderedList"}createTags(){return[j.Block,j.ListContainerNode]}createNodeSpec(t,e){return{content:"listItem+",...e,attrs:{...t.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>Ie(n)?{...t.parse(n),order:+(n.getAttribute("start")??1)}:{}},...e.parseDOM??[]],toDOM:n=>{const r=t.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new dr({priority:X.Low})]}toggleOrderedList(){return Ja(this.type,re(this.store.schema.nodes,"listItem"))}listShortcut(t){return this.toggleOrderedList()(t)}createInputRules(){const t=/^(\d+)\.\s$/;return[ya(t,this.type,e=>({order:+re(e,1)}),(e,n)=>n.childCount+n.attrs.order===+re(e,1)),new ws(t,(e,n,r,s)=>{const i=e.tr;if(i.deleteRange(r,s),!ur({listType:this.type,itemType:re(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+re(n,1);if(a!==1){const l=as({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};Ze([_({icon:"listOrdered",label:({t})=>t(ga.ORDERED_LIST_LABEL)})],ms.prototype,"toggleOrderedList",1);Ze([Ye({shortcut:w.OrderedList,command:"toggleOrderedList"})],ms.prototype,"listShortcut",1);ms=Ze([G({})],ms);var zh=class extends Rt{get name(){return"taskListItem"}createTags(){return[j.ListItemNode]}createNodeSpec(t,e){return{content:"paragraph block*",defining:!0,draggable:!1,...e,attrs:{...t.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return Ie(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...t.parse(n)}},priority:X.Medium},...e.parseDOM??[]],toDOM:n=>["li",{...t.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(t,e,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(sn.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",s=>{e.editable||s.preventDefault()}),r.addEventListener("change",()=>{const s=n(),i=e.state.doc.resolve(s+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=t.attrs.checked,Lh({node:t,mark:r,updateDOM:Zk,updateMark:Qk})}}createKeymap(){return{Enter:Ih(this.type)}}createExtensions(){return[new Bh]}toggleCheckboxChecked(t){let e,n;return typeof t=="boolean"?e=t:t&&(e=t.checked,n=t.$pos),({tr:r,dispatch:s})=>{const i=as({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:o,pos:a}=i,l={...o.attrs,checked:e??!o.attrs.checked};return s==null||s(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const t=/^\s*(\[( ?|x|X)]\s)$/;return[ya(t,this.type,e=>({checked:["x","X"].includes(mc(e,2))})),new ws(t,(e,n,r,s)=>{const i=e.tr;if(i.deleteRange(r,s),!ur({listType:re(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(mc(n,2));if(a){const l=as({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};Ze([_()],zh.prototype,"toggleCheckboxChecked",1);function Zk(t,e){t.attrs.checked?e.setAttribute("data-checked",""):e.removeAttribute("data-checked"),e.setAttribute("data-task-list-item","")}function Qk(t,e){e.checked=!!t.attrs.checked}var $h=class extends Rt{get name(){return"taskList"}createTags(){return[j.Block,j.ListContainerNode]}createNodeSpec(t,e){return{content:"taskListItem+",...e,attrs:t.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:t.parse,priority:X.Medium},...e.parseDOM??[]],toDOM:n=>["ul",{...t.dom(n),"data-task-list":""},0]}}createExtensions(){return[new zh({})]}toggleTaskList(){return Ja(this.type,re(this.store.schema.nodes,"taskListItem"))}listShortcut(t){return this.toggleTaskList()(t)}};Ze([_({icon:"checkboxMultipleLine",label:({t})=>t(ga.TASK_LIST_LABEL)})],$h.prototype,"toggleTaskList",1);Ze([Ye({shortcut:w.TaskList,command:"toggleTaskList"})],$h.prototype,"listShortcut",1);function eS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t}function na(t,e){return Array(e+1).join(t)}function tS(t){return t.replace(/^\n*/,"")}function nS(t){for(var e=t.length;e>0&&t[e-1]===`
53
+ `;)e--;return t.substring(0,e)}var rS=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Ga(t){return Xa(t,rS)}var Fh=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Vh(t){return Xa(t,Fh)}function sS(t){return Uh(t,Fh)}var Hh=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function iS(t){return Xa(t,Hh)}function oS(t){return Uh(t,Hh)}function Xa(t,e){return e.indexOf(t.nodeName)>=0}function Uh(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var Te={};Te.paragraph={filter:"p",replacement:function(t){return`
54
54
 
55
55
  `+t+`
56
56
 
@@ -97,7 +97,7 @@ If you are using Node.js, you can install JSDOM and Remirror will try to use it
97
97
  `)+`
98
98
 
99
99
  `,this.references=[]),e}};Te.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}};Te.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}};Te.code={filter:function(t){var e=t.previousSibling||t.nextSibling,n=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!n},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",n="`",r=t.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+e+t+e+n}};Te.image={filter:"img",replacement:function(t,e){var n=wi(e.getAttribute("alt")),r=e.getAttribute("src")||"",s=wi(e.getAttribute("title")),i=s?' "'+s+'"':"";return r?"!["+n+"]("+r+i+")":""}};function wi(t){return t?t.replace(/(\n+\s*)+/g,`
100
- `):""}function jh(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}jh.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=bo(this.array,t,this.options))||(e=bo(this._keep,t,this.options))||(e=bo(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function bo(t,e,n){for(var r=0;r<t.length;r++){var s=t[r];if(lS(s,e,n))return s}}function lS(t,e,n){var r=t.filter;if(typeof r=="string"){if(r===e.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function cS(t){var e=t.element,n=t.isBlock,r=t.isVoid,s=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||s(e))){for(var i=null,o=!1,a=null,l=Ic(a,e,s);l!==e;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!o&&c[0]===" "&&(c=c.substr(1)),!c){l=ko(l);continue}l.data=c,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,o=!1):r(l)||s(l)?(i=null,o=!0):i&&(o=!1);else{l=ko(l);continue}var u=Ic(a,l,s);a=l,l=u}i&&(i.data=i.data.replace(/ $/,""),i.data||ko(i))}}function ko(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function Ic(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var Wh=typeof window<"u"?window:{};function uS(){var t=Wh.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function dS(){var t=function(){};return hS()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function hS(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{window.ActiveXObject&&(t=!0)}return t}var fS=uS()?Wh.DOMParser:dS();function pS(t,e){var n;if(typeof t=="string"){var r=mS().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return cS({element:n,isBlock:Ga,isVoid:Vh,isPre:e.preformattedCode?gS:null}),n}var So;function mS(){return So=So||new fS,So}function gS(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function yS(t,e){return t.isBlock=Ga(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=xS(t),t.flankingWhitespace=bS(t,e),t}function xS(t){return!Vh(t)&&!oS(t)&&/^\s*$/i.test(t.textContent)&&!iS(t)&&!aS(t)}function bS(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=kS(t.textContent);return n.leadingAscii&&Dc("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Dc("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function kS(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function Dc(t,e,n){var r,s,i;return t==="left"?(r=e.previousSibling,s=/ $/):(r=e.nextSibling,s=/^ /),r&&(r.nodeType===3?i=s.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Ga(r)&&(i=s.test(r.textContent))),i}var SS=Array.prototype.reduce,vS=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Ei(t){if(!(this instanceof Ei))return new Ei(t);var e={rules:Te,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
100
+ `):""}function jh(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}jh.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=bo(this.array,t,this.options))||(e=bo(this._keep,t,this.options))||(e=bo(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function bo(t,e,n){for(var r=0;r<t.length;r++){var s=t[r];if(aS(s,e,n))return s}}function aS(t,e,n){var r=t.filter;if(typeof r=="string"){if(r===e.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function lS(t){var e=t.element,n=t.isBlock,r=t.isVoid,s=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||s(e))){for(var i=null,o=!1,a=null,l=Ic(a,e,s);l!==e;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!o&&c[0]===" "&&(c=c.substr(1)),!c){l=ko(l);continue}l.data=c,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,o=!1):r(l)||s(l)?(i=null,o=!0):i&&(o=!1);else{l=ko(l);continue}var u=Ic(a,l,s);a=l,l=u}i&&(i.data=i.data.replace(/ $/,""),i.data||ko(i))}}function ko(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function Ic(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var Wh=typeof window<"u"?window:{};function cS(){var t=Wh.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function uS(){var t=function(){};return dS()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function dS(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{window.ActiveXObject&&(t=!0)}return t}var hS=cS()?Wh.DOMParser:uS();function fS(t,e){var n;if(typeof t=="string"){var r=pS().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return lS({element:n,isBlock:Ga,isVoid:Vh,isPre:e.preformattedCode?mS:null}),n}var So;function pS(){return So=So||new hS,So}function mS(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function gS(t,e){return t.isBlock=Ga(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=yS(t),t.flankingWhitespace=xS(t,e),t}function yS(t){return!Vh(t)&&!iS(t)&&/^\s*$/i.test(t.textContent)&&!sS(t)&&!oS(t)}function xS(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=bS(t.textContent);return n.leadingAscii&&Dc("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Dc("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function bS(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function Dc(t,e,n){var r,s,i;return t==="left"?(r=e.previousSibling,s=/ $/):(r=e.nextSibling,s=/^ /),r&&(r.nodeType===3?i=s.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Ga(r)&&(i=s.test(r.textContent))),i}var kS=Array.prototype.reduce,SS=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Ei(t){if(!(this instanceof Ei))return new Ei(t);var e={rules:Te,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
101
101
 
102
102
  `:""},keepReplacement:function(n,r){return r.isBlock?`
103
103
 
@@ -107,12 +107,12 @@ If you are using Node.js, you can install JSDOM and Remirror will try to use it
107
107
 
108
108
  `+n+`
109
109
 
110
- `:n}};this.options=tS({},e,t),this.rules=new jh(this.options)}Ei.prototype={turndown:function(t){if(!CS(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=Kh.call(this,new pS(t,this.options));return wS.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return vS.reduce(function(e,n){return e.replace(n[0],n[1])},t)}};function Kh(t){var e=this;return SS.call(t.childNodes,function(n,r){r=new yS(r,e.options);var s="";return r.nodeType===3?s=r.isCode?r.nodeValue:e.escape(r.nodeValue):r.nodeType===1&&(s=ES.call(e,r)),qh(n,s)},"")}function wS(t){var e=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(t=qh(t,n.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function ES(t){var e=this.rules.forNode(t),n=Kh.call(this,t),r=t.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+e.replacement(n,t,this.options)+r.trailing}function qh(t,e){var n=rS(t),r=nS(e),s=Math.max(t.length-n.length,e.length-r.length),i=`
110
+ `:n}};this.options=eS({},e,t),this.rules=new jh(this.options)}Ei.prototype={turndown:function(t){if(!ES(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=Kh.call(this,new fS(t,this.options));return vS.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return SS.reduce(function(e,n){return e.replace(n[0],n[1])},t)}};function Kh(t){var e=this;return kS.call(t.childNodes,function(n,r){r=new gS(r,e.options);var s="";return r.nodeType===3?s=r.isCode?r.nodeValue:e.escape(r.nodeValue):r.nodeType===1&&(s=wS.call(e,r)),qh(n,s)},"")}function vS(t){var e=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(t=qh(t,n.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function wS(t){var e=this.rules.forNode(t),n=Kh.call(this,t),r=t.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+e.replacement(n,t,this.options)+r.trailing}function qh(t,e){var n=nS(t),r=tS(e),s=Math.max(t.length-n.length,e.length-r.length),i=`
111
111
 
112
- `.substring(0,s);return n+i+r}function CS(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}function Jh(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let Pn=Jh();function TS(t){Pn=t}const Gh=/[&<>"']/,OS=new RegExp(Gh.source,"g"),Xh=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,MS=new RegExp(Xh.source,"g"),_S={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Pc=t=>_S[t];function we(t,e){if(e){if(Gh.test(t))return t.replace(OS,Pc)}else if(Xh.test(t))return t.replace(MS,Pc);return t}const NS=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Yh(t){return t.replace(NS,(e,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const AS=/(^|[^\[])\^/g;function Y(t,e){t=typeof t=="string"?t:t.source,e=e||"";const n={replace:(r,s)=>(s=s.source||s,s=s.replace(AS,"$1"),t=t.replace(r,s),n),getRegex:()=>new RegExp(t,e)};return n}const RS=/[^\w:]/g,IS=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Lc(t,e,n){if(t){let r;try{r=decodeURIComponent(Yh(n)).replace(RS,"").toLowerCase()}catch{return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}e&&!IS.test(n)&&(n=BS(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch{return null}return n}const Is={},DS=/^[^:]+:\/*[^/]*$/,PS=/^([^:]+:)[\s\S]*$/,LS=/^([^:]+:\/*[^/]*)[\s\S]*$/;function BS(t,e){Is[" "+t]||(DS.test(t)?Is[" "+t]=t+"/":Is[" "+t]=Xs(t,"/",!0)),t=Is[" "+t];const n=t.indexOf(":")===-1;return e.substring(0,2)==="//"?n?e:t.replace(PS,"$1")+e:e.charAt(0)==="/"?n?e:t.replace(LS,"$1")+e:t+e}const Ci={exec:function(){}};function Bc(t,e){const n=t.replace(/\|/g,(i,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(/ \|/);let s=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(/\\\|/g,"|");return r}function Xs(t,e,n){const r=t.length;if(r===0)return"";let s=0;for(;s<r;){const i=t.charAt(r-s-1);if(i===e&&!n)s++;else if(i!==e&&n)s++;else break}return t.slice(0,r-s)}function zS(t,e){if(t.indexOf(e[1])===-1)return-1;const n=t.length;let r=0,s=0;for(;s<n;s++)if(t[s]==="\\")s++;else if(t[s]===e[0])r++;else if(t[s]===e[1]&&(r--,r<0))return s;return-1}function $S(t){t&&t.sanitize&&!t.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function zc(t,e){if(e<1)return"";let n="";for(;e>1;)e&1&&(n+=t),e>>=1,t+=t;return n+t}function $c(t,e,n,r){const s=e.href,i=e.title?we(e.title):null,o=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){r.state.inLink=!0;const a={type:"link",raw:n,href:s,title:i,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,a}return{type:"image",raw:n,href:s,title:i,text:we(o)}}function FS(t,e){const n=t.match(/^(\s+)(?:```)/);if(n===null)return e;const r=n[1];return e.split(`
112
+ `.substring(0,s);return n+i+r}function ES(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}function Jh(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let Pn=Jh();function CS(t){Pn=t}const Gh=/[&<>"']/,TS=new RegExp(Gh.source,"g"),Xh=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,OS=new RegExp(Xh.source,"g"),MS={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Pc=t=>MS[t];function we(t,e){if(e){if(Gh.test(t))return t.replace(TS,Pc)}else if(Xh.test(t))return t.replace(OS,Pc);return t}const _S=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Yh(t){return t.replace(_S,(e,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const NS=/(^|[^\[])\^/g;function Y(t,e){t=typeof t=="string"?t:t.source,e=e||"";const n={replace:(r,s)=>(s=s.source||s,s=s.replace(NS,"$1"),t=t.replace(r,s),n),getRegex:()=>new RegExp(t,e)};return n}const AS=/[^\w:]/g,RS=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Lc(t,e,n){if(t){let r;try{r=decodeURIComponent(Yh(n)).replace(AS,"").toLowerCase()}catch{return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}e&&!RS.test(n)&&(n=LS(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch{return null}return n}const Is={},IS=/^[^:]+:\/*[^/]*$/,DS=/^([^:]+:)[\s\S]*$/,PS=/^([^:]+:\/*[^/]*)[\s\S]*$/;function LS(t,e){Is[" "+t]||(IS.test(t)?Is[" "+t]=t+"/":Is[" "+t]=Xs(t,"/",!0)),t=Is[" "+t];const n=t.indexOf(":")===-1;return e.substring(0,2)==="//"?n?e:t.replace(DS,"$1")+e:e.charAt(0)==="/"?n?e:t.replace(PS,"$1")+e:t+e}const Ci={exec:function(){}};function Bc(t,e){const n=t.replace(/\|/g,(i,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(/ \|/);let s=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(/\\\|/g,"|");return r}function Xs(t,e,n){const r=t.length;if(r===0)return"";let s=0;for(;s<r;){const i=t.charAt(r-s-1);if(i===e&&!n)s++;else if(i!==e&&n)s++;else break}return t.slice(0,r-s)}function BS(t,e){if(t.indexOf(e[1])===-1)return-1;const n=t.length;let r=0,s=0;for(;s<n;s++)if(t[s]==="\\")s++;else if(t[s]===e[0])r++;else if(t[s]===e[1]&&(r--,r<0))return s;return-1}function zS(t){t&&t.sanitize&&!t.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function zc(t,e){if(e<1)return"";let n="";for(;e>1;)e&1&&(n+=t),e>>=1,t+=t;return n+t}function $c(t,e,n,r){const s=e.href,i=e.title?we(e.title):null,o=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){r.state.inLink=!0;const a={type:"link",raw:n,href:s,title:i,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,a}return{type:"image",raw:n,href:s,title:i,text:we(o)}}function $S(t,e){const n=t.match(/^(\s+)(?:```)/);if(n===null)return e;const r=n[1];return e.split(`
113
113
  `).map(s=>{const i=s.match(/^\s+/);if(i===null)return s;const[o]=i;return o.length>=r.length?s.slice(r.length):s}).join(`
114
114
  `)}class Ya{constructor(e){this.options=e||Pn}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const r=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Xs(r,`
115
- `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],s=FS(r,n[3]||"");return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline._escapes,"$1"):n[2],text:s}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(/#$/.test(r)){const s=Xs(r,"#");(this.options.pedantic||!s||/ $/.test(s))&&(r=s.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:n[0]}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){const r=n[0].replace(/^ *>[ \t]?/gm,""),s=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(r);return this.lexer.state.top=s,{type:"blockquote",raw:n[0],tokens:i,text:r}}}list(e){let n=this.rules.block.list.exec(e);if(n){let r,s,i,o,a,l,c,u,d,h,f,p,m=n[1].trim();const g=m.length>1,y={type:"list",raw:"",ordered:g,start:g?+m.slice(0,-1):"",loose:!1,items:[]};m=g?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=g?m:"[*+-]");const E=new RegExp(`^( {0,3}${m})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;e&&(p=!1,!(!(n=E.exec(e))||this.rules.block.hr.test(e)));){if(r=n[0],e=e.substring(r.length),u=n[2].split(`
115
+ `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],s=$S(r,n[3]||"");return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline._escapes,"$1"):n[2],text:s}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(/#$/.test(r)){const s=Xs(r,"#");(this.options.pedantic||!s||/ $/.test(s))&&(r=s.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:n[0]}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){const r=n[0].replace(/^ *>[ \t]?/gm,""),s=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(r);return this.lexer.state.top=s,{type:"blockquote",raw:n[0],tokens:i,text:r}}}list(e){let n=this.rules.block.list.exec(e);if(n){let r,s,i,o,a,l,c,u,d,h,f,p,m=n[1].trim();const g=m.length>1,y={type:"list",raw:"",ordered:g,start:g?+m.slice(0,-1):"",loose:!1,items:[]};m=g?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=g?m:"[*+-]");const E=new RegExp(`^( {0,3}${m})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;e&&(p=!1,!(!(n=E.exec(e))||this.rules.block.hr.test(e)));){if(r=n[0],e=e.substring(r.length),u=n[2].split(`
116
116
  `,1)[0].replace(/^\t+/,q=>" ".repeat(3*q.length)),d=e.split(`
117
117
  `,1)[0],this.options.pedantic?(o=2,f=u.trimLeft()):(o=n[2].search(/[^ ]/),o=o>4?1:o,f=u.slice(o),o+=n[1].length),l=!1,!u&&/^ *$/.test(d)&&(r+=d+`
118
118
  `,e=e.substring(d.length+1),p=!0),!p){const q=new RegExp(`^ {0,${Math.min(3,o-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),J=new RegExp(`^ {0,${Math.min(3,o-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),F=new RegExp(`^ {0,${Math.min(3,o-1)}}(?:\`\`\`|~~~)`),oe=new RegExp(`^ {0,${Math.min(3,o-1)}}#`);for(;e&&(h=e.split(`
@@ -121,8 +121,8 @@ If you are using Node.js, you can install JSDOM and Remirror will try to use it
121
121
  `+d}!l&&!d.trim()&&(l=!0),r+=h+`
122
122
  `,e=e.substring(h.length+1),u=d.slice(o)}}y.loose||(c?y.loose=!0:/\n *\n *$/.test(r)&&(c=!0)),this.options.gfm&&(s=/^\[[ xX]\] /.exec(f),s&&(i=s[0]!=="[ ] ",f=f.replace(/^\[[ xX]\] +/,""))),y.items.push({type:"list_item",raw:r,task:!!s,checked:i,loose:!1,text:f}),y.raw+=r}y.items[y.items.length-1].raw=r.trimRight(),y.items[y.items.length-1].text=f.trimRight(),y.raw=y.raw.trimRight();const L=y.items.length;for(a=0;a<L;a++)if(this.lexer.state.top=!1,y.items[a].tokens=this.lexer.blockTokens(y.items[a].text,[]),!y.loose){const q=y.items[a].tokens.filter(F=>F.type==="space"),J=q.length>0&&q.some(F=>/\n.*\n/.test(F.raw));y.loose=J}if(y.loose)for(a=0;a<L;a++)y.items[a].loose=!0;return y}}html(e){const n=this.rules.block.html.exec(e);if(n){const r={type:"html",raw:n[0],pre:!this.options.sanitizer&&(n[1]==="pre"||n[1]==="script"||n[1]==="style"),text:n[0]};if(this.options.sanitize){const s=this.options.sanitizer?this.options.sanitizer(n[0]):we(n[0]);r.type="paragraph",r.text=s,r.tokens=this.lexer.inline(s)}return r}}def(e){const n=this.rules.block.def.exec(e);if(n){const r=n[1].toLowerCase().replace(/\s+/g," "),s=n[2]?n[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",i=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline._escapes,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:s,title:i}}}table(e){const n=this.rules.block.table.exec(e);if(n){const r={type:"table",header:Bc(n[1]).map(s=>({text:s})),align:n[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(`
123
123
  `):[]};if(r.header.length===r.align.length){r.raw=n[0];let s=r.align.length,i,o,a,l;for(i=0;i<s;i++)/^ *-+: *$/.test(r.align[i])?r.align[i]="right":/^ *:-+: *$/.test(r.align[i])?r.align[i]="center":/^ *:-+ *$/.test(r.align[i])?r.align[i]="left":r.align[i]=null;for(s=r.rows.length,i=0;i<s;i++)r.rows[i]=Bc(r.rows[i],r.header.length).map(c=>({text:c}));for(s=r.header.length,o=0;o<s;o++)r.header[o].tokens=this.lexer.inline(r.header[o].text);for(s=r.rows.length,o=0;o<s;o++)for(l=r.rows[o],a=0;a<l.length;a++)l[a].tokens=this.lexer.inline(l[a].text);return r}}}lheading(e){const n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){const n=this.rules.block.paragraph.exec(e);if(n){const r=n[1].charAt(n[1].length-1)===`
124
- `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:we(n[1])}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&/^<a /i.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):we(n[0]):n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const r=n[2].trim();if(!this.options.pedantic&&/^</.test(r)){if(!/>$/.test(r))return;const o=Xs(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{const o=zS(n[2],"()");if(o>-1){const l=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,l).trim(),n[3]=""}}let s=n[2],i="";if(this.options.pedantic){const o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);o&&(s=o[1],i=o[3])}else i=n[3]?n[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(this.options.pedantic&&!/>$/.test(r)?s=s.slice(1):s=s.slice(1,-1)),$c(n,{href:s&&s.replace(this.rules.inline._escapes,"$1"),title:i&&i.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=(r[2]||r[1]).replace(/\s+/g," ");if(s=n[s.toLowerCase()],!s){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return $c(r,s,r[0],this.lexer)}}emStrong(e,n,r=""){let s=this.rules.inline.emStrong.lDelim.exec(e);if(!s||s[3]&&r.match(/[\p{L}\p{N}]/u))return;const i=s[1]||s[2]||"";if(!i||i&&(r===""||this.rules.inline.punctuation.exec(r))){const o=s[0].length-1;let a,l,c=o,u=0;const d=s[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(d.lastIndex=0,n=n.slice(-1*e.length+o);(s=d.exec(n))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(l=a.length,s[3]||s[4]){c+=l;continue}else if((s[5]||s[6])&&o%3&&!((o+l)%3)){u+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+u);const h=e.slice(0,o+s.index+(s[0].length-a.length)+l);if(Math.min(o,l)%2){const p=h.slice(1,-1);return{type:"em",raw:h,text:p,tokens:this.lexer.inlineTokens(p)}}const f=h.slice(2,-2);return{type:"strong",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(/\n/g," ");const s=/[^ ]/.test(r),i=/^ /.test(r)&&/ $/.test(r);return s&&i&&(r=r.substring(1,r.length-1)),r=we(r,!0),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e,n){const r=this.rules.inline.autolink.exec(e);if(r){let s,i;return r[2]==="@"?(s=we(this.options.mangle?n(r[1]):r[1]),i="mailto:"+s):(s=we(r[1]),i=s),{type:"link",raw:r[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}url(e,n){let r;if(r=this.rules.inline.url.exec(e)){let s,i;if(r[2]==="@")s=we(this.options.mangle?n(r[0]):r[0]),i="mailto:"+s;else{let o;do o=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])[0];while(o!==r[0]);s=we(r[0]),r[1]==="www."?i="http://"+r[0]:i=r[0]}return{type:"link",raw:r[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e,n){const r=this.rules.inline.text.exec(e);if(r){let s;return this.lexer.state.inRawBlock?s=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):we(r[0]):r[0]:s=we(this.options.smartypants?n(r[0]):r[0]),{type:"text",raw:r[0],text:s}}}}const A={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Ci,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};A._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;A._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;A.def=Y(A.def).replace("label",A._label).replace("title",A._title).getRegex();A.bullet=/(?:[*+-]|\d{1,9}[.)])/;A.listItemStart=Y(/^( *)(bull) */).replace("bull",A.bullet).getRegex();A.list=Y(A.list).replace(/bull/g,A.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+A.def.source+")").getRegex();A._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";A._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/;A.html=Y(A.html,"i").replace("comment",A._comment).replace("tag",A._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();A.paragraph=Y(A._paragraph).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",A._tag).getRegex();A.blockquote=Y(A.blockquote).replace("paragraph",A.paragraph).getRegex();A.normal={...A};A.gfm={...A.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"};A.gfm.table=Y(A.gfm.table).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",A._tag).getRegex();A.gfm.paragraph=Y(A._paragraph).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",A.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",A._tag).getRegex();A.pedantic={...A.normal,html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",A._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ci,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(A.normal._paragraph).replace("hr",A.hr).replace("heading",` *#{1,6} *[^
125
- ]`).replace("lheading",A.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const C={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ci,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Ci,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};C._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";C.punctuation=Y(C.punctuation).replace(/punctuation/g,C._punctuation).getRegex();C.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;C.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;C._comment=Y(A._comment).replace("(?:-->|$)","-->").getRegex();C.emStrong.lDelim=Y(C.emStrong.lDelim).replace(/punct/g,C._punctuation).getRegex();C.emStrong.rDelimAst=Y(C.emStrong.rDelimAst,"g").replace(/punct/g,C._punctuation).getRegex();C.emStrong.rDelimUnd=Y(C.emStrong.rDelimUnd,"g").replace(/punct/g,C._punctuation).getRegex();C._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;C._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;C._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;C.autolink=Y(C.autolink).replace("scheme",C._scheme).replace("email",C._email).getRegex();C._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;C.tag=Y(C.tag).replace("comment",C._comment).replace("attribute",C._attribute).getRegex();C._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;C._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;C._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;C.link=Y(C.link).replace("label",C._label).replace("href",C._href).replace("title",C._title).getRegex();C.reflink=Y(C.reflink).replace("label",C._label).replace("ref",A._label).getRegex();C.nolink=Y(C.nolink).replace("ref",A._label).getRegex();C.reflinkSearch=Y(C.reflinkSearch,"g").replace("reflink",C.reflink).replace("nolink",C.nolink).getRegex();C.normal={...C};C.pedantic={...C.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",C._label).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",C._label).getRegex()};C.gfm={...C.normal,escape:Y(C.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/};C.gfm.url=Y(C.gfm.url,"i").replace("email",C.gfm._extended_email).getRegex();C.breaks={...C.gfm,br:Y(C.br).replace("{2,}","*").getRegex(),text:Y(C.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};function VS(t){return t.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function Fc(t){let e="",n,r;const s=t.length;for(n=0;n<s;n++)r=t.charCodeAt(n),Math.random()>.5&&(r="x"+r.toString(16)),e+="&#"+r+";";return e}class an{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Pn,this.options.tokenizer=this.options.tokenizer||new Ya,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:A.normal,inline:C.normal};this.options.pedantic?(n.block=A.pedantic,n.inline=C.pedantic):this.options.gfm&&(n.block=A.gfm,this.options.breaks?n.inline=C.breaks:n.inline=C.gfm),this.tokenizer.rules=n}static get rules(){return{block:A,inline:C}}static lex(e,n){return new an(n).lex(e)}static lexInline(e,n){return new an(n).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
124
+ `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:we(n[1])}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&/^<a /i.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):we(n[0]):n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const r=n[2].trim();if(!this.options.pedantic&&/^</.test(r)){if(!/>$/.test(r))return;const o=Xs(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{const o=BS(n[2],"()");if(o>-1){const l=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,l).trim(),n[3]=""}}let s=n[2],i="";if(this.options.pedantic){const o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);o&&(s=o[1],i=o[3])}else i=n[3]?n[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(this.options.pedantic&&!/>$/.test(r)?s=s.slice(1):s=s.slice(1,-1)),$c(n,{href:s&&s.replace(this.rules.inline._escapes,"$1"),title:i&&i.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=(r[2]||r[1]).replace(/\s+/g," ");if(s=n[s.toLowerCase()],!s){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return $c(r,s,r[0],this.lexer)}}emStrong(e,n,r=""){let s=this.rules.inline.emStrong.lDelim.exec(e);if(!s||s[3]&&r.match(/[\p{L}\p{N}]/u))return;const i=s[1]||s[2]||"";if(!i||i&&(r===""||this.rules.inline.punctuation.exec(r))){const o=s[0].length-1;let a,l,c=o,u=0;const d=s[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(d.lastIndex=0,n=n.slice(-1*e.length+o);(s=d.exec(n))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(l=a.length,s[3]||s[4]){c+=l;continue}else if((s[5]||s[6])&&o%3&&!((o+l)%3)){u+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+u);const h=e.slice(0,o+s.index+(s[0].length-a.length)+l);if(Math.min(o,l)%2){const p=h.slice(1,-1);return{type:"em",raw:h,text:p,tokens:this.lexer.inlineTokens(p)}}const f=h.slice(2,-2);return{type:"strong",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(/\n/g," ");const s=/[^ ]/.test(r),i=/^ /.test(r)&&/ $/.test(r);return s&&i&&(r=r.substring(1,r.length-1)),r=we(r,!0),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e,n){const r=this.rules.inline.autolink.exec(e);if(r){let s,i;return r[2]==="@"?(s=we(this.options.mangle?n(r[1]):r[1]),i="mailto:"+s):(s=we(r[1]),i=s),{type:"link",raw:r[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}url(e,n){let r;if(r=this.rules.inline.url.exec(e)){let s,i;if(r[2]==="@")s=we(this.options.mangle?n(r[0]):r[0]),i="mailto:"+s;else{let o;do o=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])[0];while(o!==r[0]);s=we(r[0]),r[1]==="www."?i="http://"+r[0]:i=r[0]}return{type:"link",raw:r[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e,n){const r=this.rules.inline.text.exec(e);if(r){let s;return this.lexer.state.inRawBlock?s=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):we(r[0]):r[0]:s=we(this.options.smartypants?n(r[0]):r[0]),{type:"text",raw:r[0],text:s}}}}const A={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Ci,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};A._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;A._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;A.def=Y(A.def).replace("label",A._label).replace("title",A._title).getRegex();A.bullet=/(?:[*+-]|\d{1,9}[.)])/;A.listItemStart=Y(/^( *)(bull) */).replace("bull",A.bullet).getRegex();A.list=Y(A.list).replace(/bull/g,A.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+A.def.source+")").getRegex();A._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";A._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/;A.html=Y(A.html,"i").replace("comment",A._comment).replace("tag",A._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();A.paragraph=Y(A._paragraph).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",A._tag).getRegex();A.blockquote=Y(A.blockquote).replace("paragraph",A.paragraph).getRegex();A.normal={...A};A.gfm={...A.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"};A.gfm.table=Y(A.gfm.table).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",A._tag).getRegex();A.gfm.paragraph=Y(A._paragraph).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",A.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",A._tag).getRegex();A.pedantic={...A.normal,html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",A._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ci,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(A.normal._paragraph).replace("hr",A.hr).replace("heading",` *#{1,6} *[^
125
+ ]`).replace("lheading",A.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const C={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ci,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Ci,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};C._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";C.punctuation=Y(C.punctuation).replace(/punctuation/g,C._punctuation).getRegex();C.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;C.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;C._comment=Y(A._comment).replace("(?:-->|$)","-->").getRegex();C.emStrong.lDelim=Y(C.emStrong.lDelim).replace(/punct/g,C._punctuation).getRegex();C.emStrong.rDelimAst=Y(C.emStrong.rDelimAst,"g").replace(/punct/g,C._punctuation).getRegex();C.emStrong.rDelimUnd=Y(C.emStrong.rDelimUnd,"g").replace(/punct/g,C._punctuation).getRegex();C._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;C._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;C._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;C.autolink=Y(C.autolink).replace("scheme",C._scheme).replace("email",C._email).getRegex();C._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;C.tag=Y(C.tag).replace("comment",C._comment).replace("attribute",C._attribute).getRegex();C._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;C._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;C._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;C.link=Y(C.link).replace("label",C._label).replace("href",C._href).replace("title",C._title).getRegex();C.reflink=Y(C.reflink).replace("label",C._label).replace("ref",A._label).getRegex();C.nolink=Y(C.nolink).replace("ref",A._label).getRegex();C.reflinkSearch=Y(C.reflinkSearch,"g").replace("reflink",C.reflink).replace("nolink",C.nolink).getRegex();C.normal={...C};C.pedantic={...C.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",C._label).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",C._label).getRegex()};C.gfm={...C.normal,escape:Y(C.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/};C.gfm.url=Y(C.gfm.url,"i").replace("email",C.gfm._extended_email).getRegex();C.breaks={...C.gfm,br:Y(C.br).replace("{2,}","*").getRegex(),text:Y(C.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};function FS(t){return t.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function Fc(t){let e="",n,r;const s=t.length;for(n=0;n<s;n++)r=t.charCodeAt(n),Math.random()>.5&&(r="x"+r.toString(16)),e+="&#"+r+";";return e}class an{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Pn,this.options.tokenizer=this.options.tokenizer||new Ya,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:A.normal,inline:C.normal};this.options.pedantic?(n.block=A.pedantic,n.inline=C.pedantic):this.options.gfm&&(n.block=A.gfm,this.options.breaks?n.inline=C.breaks:n.inline=C.gfm),this.tokenizer.rules=n}static get rules(){return{block:A,inline:C}}static lex(e,n){return new an(n).lex(e)}static lexInline(e,n){return new an(n).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
126
126
  `),this.blockTokens(e,this.tokens);let n;for(;n=this.inlineQueue.shift();)this.inlineTokens(n.src,n.tokens);return this.tokens}blockTokens(e,n=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(a,l,c)=>l+" ".repeat(c.length));let r,s,i,o;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(r=a.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length),r.raw.length===1&&n.length>0?n[n.length-1].raw+=`
127
127
  `:n.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length),s=n[n.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
128
128
  `+r.raw,s.text+=`
@@ -132,7 +132,7 @@ If you are using Node.js, you can install JSDOM and Remirror will try to use it
132
132
  `+r.raw,s.text+=`
133
133
  `+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):n.push(r),o=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length),s=n[n.length-1],s&&s.type==="text"?(s.raw+=`
134
134
  `+r.raw,s.text+=`
135
- `+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):n.push(r);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r,s,i,o=e,a,l,c;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)u.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,a.index)+"["+zc("a",a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,a.index)+"["+zc("a",a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.escapedEmSt.exec(o))!=null;)o=o.slice(0,a.index+a[0].length-2)+"++"+o.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(l||(c=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(r=u.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),s=n[n.length-1],s&&r.type==="text"&&s.type==="text"?(s.raw+=r.raw,s.text+=r.text):n.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length),s=n[n.length-1],s&&r.type==="text"&&s.type==="text"?(s.raw+=r.raw,s.text+=r.text):n.push(r);continue}if(r=this.tokenizer.emStrong(e,o,c)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.autolink(e,Fc)){e=e.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e,Fc))){e=e.substring(r.raw.length),n.push(r);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let u=1/0;const d=e.slice(1);let h;this.options.extensions.startInline.forEach(function(f){h=f.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(i=e.substring(0,u+1))}if(r=this.tokenizer.inlineText(i,VS)){e=e.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(c=r.raw.slice(-1)),l=!0,s=n[n.length-1],s&&s.type==="text"?(s.raw+=r.raw,s.text+=r.text):n.push(r);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return n}}class Za{constructor(e){this.options=e||Pn}code(e,n,r){const s=(n||"").match(/\S*/)[0];if(this.options.highlight){const i=this.options.highlight(e,s);i!=null&&i!==e&&(r=!0,e=i)}return e=e.replace(/\n$/,"")+`
135
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):n.push(r);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r,s,i,o=e,a,l,c;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)u.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,a.index)+"["+zc("a",a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,a.index)+"["+zc("a",a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.escapedEmSt.exec(o))!=null;)o=o.slice(0,a.index+a[0].length-2)+"++"+o.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(l||(c=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(r=u.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),s=n[n.length-1],s&&r.type==="text"&&s.type==="text"?(s.raw+=r.raw,s.text+=r.text):n.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length),s=n[n.length-1],s&&r.type==="text"&&s.type==="text"?(s.raw+=r.raw,s.text+=r.text):n.push(r);continue}if(r=this.tokenizer.emStrong(e,o,c)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.autolink(e,Fc)){e=e.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e,Fc))){e=e.substring(r.raw.length),n.push(r);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let u=1/0;const d=e.slice(1);let h;this.options.extensions.startInline.forEach(function(f){h=f.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(i=e.substring(0,u+1))}if(r=this.tokenizer.inlineText(i,FS)){e=e.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(c=r.raw.slice(-1)),l=!0,s=n[n.length-1],s&&s.type==="text"?(s.raw+=r.raw,s.text+=r.text):n.push(r);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return n}}class Za{constructor(e){this.options=e||Pn}code(e,n,r){const s=(n||"").match(/\S*/)[0];if(this.options.highlight){const i=this.options.highlight(e,s);i!=null&&i!==e&&(r=!0,e=i)}return e=e.replace(/\n$/,"")+`
136
136
  `,s?'<pre><code class="'+this.options.langPrefix+we(s)+'">'+(r?e:we(e,!0))+`</code></pre>
137
137
  `:"<pre><code>"+(r?e:we(e,!0))+`</code></pre>
138
138
  `}blockquote(e){return`<blockquote>
@@ -153,10 +153,10 @@ ${e}</blockquote>
153
153
  ${e}</tr>
154
154
  `}tablecell(e,n){const r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+e+`</${r}>
155
155
  `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return`<del>${e}</del>`}link(e,n,r){if(e=Lc(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let s='<a href="'+e+'"';return n&&(s+=' title="'+n+'"'),s+=">"+r+"</a>",s}image(e,n,r){if(e=Lc(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let s=`<img src="${e}" alt="${r}"`;return n&&(s+=` title="${n}"`),s+=this.options.xhtml?"/>":">",s}text(e){return e}}class Zh{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,n,r){return""+r}image(e,n,r){return""+r}br(){return""}}class Qh{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,n){let r=e,s=0;if(this.seen.hasOwnProperty(r)){s=this.seen[e];do s++,r=e+"-"+s;while(this.seen.hasOwnProperty(r))}return n||(this.seen[e]=s,this.seen[r]=0),r}slug(e,n={}){const r=this.serialize(e);return this.getNextSafeSlug(r,n.dryrun)}}class ln{constructor(e){this.options=e||Pn,this.options.renderer=this.options.renderer||new Za,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Zh,this.slugger=new Qh}static parse(e,n){return new ln(n).parse(e)}static parseInline(e,n){return new ln(n).parseInline(e)}parse(e,n=!0){let r="",s,i,o,a,l,c,u,d,h,f,p,m,g,y,E,L,q,J,F;const oe=e.length;for(s=0;s<oe;s++){if(f=e[s],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[f.type]&&(F=this.options.extensions.renderers[f.type].call({parser:this},f),F!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(f.type))){r+=F||"";continue}switch(f.type){case"space":continue;case"hr":{r+=this.renderer.hr();continue}case"heading":{r+=this.renderer.heading(this.parseInline(f.tokens),f.depth,Yh(this.parseInline(f.tokens,this.textRenderer)),this.slugger);continue}case"code":{r+=this.renderer.code(f.text,f.lang,f.escaped);continue}case"table":{for(d="",u="",a=f.header.length,i=0;i<a;i++)u+=this.renderer.tablecell(this.parseInline(f.header[i].tokens),{header:!0,align:f.align[i]});for(d+=this.renderer.tablerow(u),h="",a=f.rows.length,i=0;i<a;i++){for(c=f.rows[i],u="",l=c.length,o=0;o<l;o++)u+=this.renderer.tablecell(this.parseInline(c[o].tokens),{header:!1,align:f.align[o]});h+=this.renderer.tablerow(u)}r+=this.renderer.table(d,h);continue}case"blockquote":{h=this.parse(f.tokens),r+=this.renderer.blockquote(h);continue}case"list":{for(p=f.ordered,m=f.start,g=f.loose,a=f.items.length,h="",i=0;i<a;i++)E=f.items[i],L=E.checked,q=E.task,y="",E.task&&(J=this.renderer.checkbox(L),g?E.tokens.length>0&&E.tokens[0].type==="paragraph"?(E.tokens[0].text=J+" "+E.tokens[0].text,E.tokens[0].tokens&&E.tokens[0].tokens.length>0&&E.tokens[0].tokens[0].type==="text"&&(E.tokens[0].tokens[0].text=J+" "+E.tokens[0].tokens[0].text)):E.tokens.unshift({type:"text",text:J}):y+=J),y+=this.parse(E.tokens,g),h+=this.renderer.listitem(y,q,L);r+=this.renderer.list(h,p,m);continue}case"html":{r+=this.renderer.html(f.text);continue}case"paragraph":{r+=this.renderer.paragraph(this.parseInline(f.tokens));continue}case"text":{for(h=f.tokens?this.parseInline(f.tokens):f.text;s+1<oe&&e[s+1].type==="text";)f=e[++s],h+=`
156
- `+(f.tokens?this.parseInline(f.tokens):f.text);r+=n?this.renderer.paragraph(h):h;continue}default:{const Fe='Token with "'+f.type+'" type was not found.';if(this.options.silent){console.error(Fe);return}else throw new Error(Fe)}}}return r}parseInline(e,n){n=n||this.renderer;let r="",s,i,o;const a=e.length;for(s=0;s<a;s++){if(i=e[s],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]&&(o=this.options.extensions.renderers[i.type].call({parser:this},i),o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type))){r+=o||"";continue}switch(i.type){case"escape":{r+=n.text(i.text);break}case"html":{r+=n.html(i.text);break}case"link":{r+=n.link(i.href,i.title,this.parseInline(i.tokens,n));break}case"image":{r+=n.image(i.href,i.title,i.text);break}case"strong":{r+=n.strong(this.parseInline(i.tokens,n));break}case"em":{r+=n.em(this.parseInline(i.tokens,n));break}case"codespan":{r+=n.codespan(i.text);break}case"br":{r+=n.br();break}case"del":{r+=n.del(this.parseInline(i.tokens,n));break}case"text":{r+=n.text(i.text);break}default:{const l='Token with "'+i.type+'" type was not found.';if(this.options.silent){console.error(l);return}else throw new Error(l)}}}return r}}class Ti{constructor(e){this.options=e||Pn}preprocess(e){return e}postprocess(e){return e}}tl(Ti,"passThroughHooks",new Set(["preprocess","postprocess"]));function HS(t,e,n){return r=>{if(r.message+=`
157
- Please report this to https://github.com/markedjs/marked.`,t){const s="<p>An error occurred:</p><pre>"+we(r.message+"",!0)+"</pre>";if(e)return Promise.resolve(s);if(n){n(null,s);return}return s}if(e)return Promise.reject(r);if(n){n(r);return}throw r}}function ef(t,e){return(n,r,s)=>{typeof r=="function"&&(s=r,r=null);const i={...r};r={...N.defaults,...i};const o=HS(r.silent,r.async,s);if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if($S(r),r.hooks&&(r.hooks.options=r),s){const a=r.highlight;let l;try{r.hooks&&(n=r.hooks.preprocess(n)),l=t(n,r)}catch(d){return o(d)}const c=function(d){let h;if(!d)try{r.walkTokens&&N.walkTokens(l,r.walkTokens),h=e(l,r),r.hooks&&(h=r.hooks.postprocess(h))}catch(f){d=f}return r.highlight=a,d?o(d):s(null,h)};if(!a||a.length<3||(delete r.highlight,!l.length))return c();let u=0;N.walkTokens(l,function(d){d.type==="code"&&(u++,setTimeout(()=>{a(d.text,d.lang,function(h,f){if(h)return c(h);f!=null&&f!==d.text&&(d.text=f,d.escaped=!0),u--,u===0&&c()})},0))}),u===0&&c();return}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(a=>t(a,r)).then(a=>r.walkTokens?Promise.all(N.walkTokens(a,r.walkTokens)).then(()=>a):a).then(a=>e(a,r)).then(a=>r.hooks?r.hooks.postprocess(a):a).catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));const a=t(n,r);r.walkTokens&&N.walkTokens(a,r.walkTokens);let l=e(a,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(a){return o(a)}}}function N(t,e,n){return ef(an.lex,ln.parse)(t,e,n)}N.options=N.setOptions=function(t){return N.defaults={...N.defaults,...t},TS(N.defaults),N};N.getDefaults=Jh;N.defaults=Pn;N.use=function(...t){const e=N.defaults.extensions||{renderers:{},childTokens:{}};t.forEach(n=>{const r={...n};if(r.async=N.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if(s.renderer){const i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if(s.tokenizer){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");e[s.level]?e[s.level].unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){const s=N.defaults.renderer||new Za;for(const i in n.renderer){const o=s[i];s[i]=(...a)=>{let l=n.renderer[i].apply(s,a);return l===!1&&(l=o.apply(s,a)),l}}r.renderer=s}if(n.tokenizer){const s=N.defaults.tokenizer||new Ya;for(const i in n.tokenizer){const o=s[i];s[i]=(...a)=>{let l=n.tokenizer[i].apply(s,a);return l===!1&&(l=o.apply(s,a)),l}}r.tokenizer=s}if(n.hooks){const s=N.defaults.hooks||new Ti;for(const i in n.hooks){const o=s[i];Ti.passThroughHooks.has(i)?s[i]=a=>{if(N.defaults.async)return Promise.resolve(n.hooks[i].call(s,a)).then(c=>o.call(s,c));const l=n.hooks[i].call(s,a);return o.call(s,l)}:s[i]=(...a)=>{let l=n.hooks[i].apply(s,a);return l===!1&&(l=o.apply(s,a)),l}}r.hooks=s}if(n.walkTokens){const s=N.defaults.walkTokens;r.walkTokens=function(i){let o=[];return o.push(n.walkTokens.call(this,i)),s&&(o=o.concat(s.call(this,i))),o}}N.setOptions(r)})};N.walkTokens=function(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(N,r)),r.type){case"table":{for(const s of r.header)n=n.concat(N.walkTokens(s.tokens,e));for(const s of r.rows)for(const i of s)n=n.concat(N.walkTokens(i.tokens,e));break}case"list":{n=n.concat(N.walkTokens(r.items,e));break}default:N.defaults.extensions&&N.defaults.extensions.childTokens&&N.defaults.extensions.childTokens[r.type]?N.defaults.extensions.childTokens[r.type].forEach(function(s){n=n.concat(N.walkTokens(r[s],e))}):r.tokens&&(n=n.concat(N.walkTokens(r.tokens,e)))}return n};N.parseInline=ef(an.lexInline,ln.parseInline);N.Parser=ln;N.parser=ln.parse;N.Renderer=Za;N.TextRenderer=Zh;N.Lexer=an;N.lexer=an.lex;N.Tokenizer=Ya;N.Slugger=Qh;N.Hooks=Ti;N.parse=N;N.options;N.setOptions;N.use;N.walkTokens;N.parseInline;ln.parse;an.lex;var US=Object.defineProperty,jS=Object.getOwnPropertyDescriptor,qi=(t,e,n,r)=>{for(var s=r>1?void 0:r?jS(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&US(e,n,s),s},WS=fp(Ei);function KS(t){return JS.turndown(t)}function vo(t){const e=t.parentNode;if(!Ie(e))return!1;if(e.nodeName==="THEAD")return!0;if(e.nodeName!=="TABLE"&&!tf(e))return!1;const n=[...t.childNodes];return n.every(r=>r.nodeName==="TH")&&n.some(r=>!!r.textContent)}function Oi(t){return Ie(t)&&t.matches("th[data-controller-cell]")}function qS(t){const e=t.parentNode;return!Ie(e)||e.nodeName!=="TABLE"&&!tf(e)?!1:[...t.childNodes].every(r=>Oi(r))}function tf(t){var e;if(t.nodeName!=="TBODY")return!1;const n=t.previousSibling;return n?Ie(n)&&n.nodeName==="THEAD"&&!((e=n.textContent)!=null&&e.trim()):!0}function Vc(t){const e=t.closest("table");if(!e)return!1;const{parentNode:n}=e;return n?!!n.closest("table"):!0}function Hc(t,e){var n;const r=[];for(const o of((n=e.parentNode)==null?void 0:n.childNodes)??[])Oi(o)||r.push(o);return`${(r.indexOf(e)===0?"| ":" ")+t.trim()} |`}var JS=new WS({codeBlockStyle:"fenced",headingStyle:"atx"}).addRule("taskListItems",{filter:t=>t.nodeName==="LI"&&t.hasAttribute("data-task-list-item"),replacement:(t,e)=>`- ${e.hasAttribute("data-checked")?"[x]":"[ ]"} ${t.trimStart()}`}).addRule("tableCell",{filter:["th","td"],replacement:(t,e)=>Oi(e)?"":Hc(t,e)}).addRule("tableRow",{filter:"tr",replacement:(t,e)=>{let n="";const r={left:":--",right:"--:",center:":-:"},s=[...e.childNodes].filter(i=>!Oi(i));if(vo(e))for(const i of s){if(!Ie(i))continue;let o="---";const a=(i.getAttribute("align")??"").toLowerCase();a&&(o=r[a]||o),n+=Hc(o,i)}return`
156
+ `+(f.tokens?this.parseInline(f.tokens):f.text);r+=n?this.renderer.paragraph(h):h;continue}default:{const Fe='Token with "'+f.type+'" type was not found.';if(this.options.silent){console.error(Fe);return}else throw new Error(Fe)}}}return r}parseInline(e,n){n=n||this.renderer;let r="",s,i,o;const a=e.length;for(s=0;s<a;s++){if(i=e[s],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]&&(o=this.options.extensions.renderers[i.type].call({parser:this},i),o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type))){r+=o||"";continue}switch(i.type){case"escape":{r+=n.text(i.text);break}case"html":{r+=n.html(i.text);break}case"link":{r+=n.link(i.href,i.title,this.parseInline(i.tokens,n));break}case"image":{r+=n.image(i.href,i.title,i.text);break}case"strong":{r+=n.strong(this.parseInline(i.tokens,n));break}case"em":{r+=n.em(this.parseInline(i.tokens,n));break}case"codespan":{r+=n.codespan(i.text);break}case"br":{r+=n.br();break}case"del":{r+=n.del(this.parseInline(i.tokens,n));break}case"text":{r+=n.text(i.text);break}default:{const l='Token with "'+i.type+'" type was not found.';if(this.options.silent){console.error(l);return}else throw new Error(l)}}}return r}}class Ti{constructor(e){this.options=e||Pn}preprocess(e){return e}postprocess(e){return e}}tl(Ti,"passThroughHooks",new Set(["preprocess","postprocess"]));function VS(t,e,n){return r=>{if(r.message+=`
157
+ Please report this to https://github.com/markedjs/marked.`,t){const s="<p>An error occurred:</p><pre>"+we(r.message+"",!0)+"</pre>";if(e)return Promise.resolve(s);if(n){n(null,s);return}return s}if(e)return Promise.reject(r);if(n){n(r);return}throw r}}function ef(t,e){return(n,r,s)=>{typeof r=="function"&&(s=r,r=null);const i={...r};r={...N.defaults,...i};const o=VS(r.silent,r.async,s);if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(zS(r),r.hooks&&(r.hooks.options=r),s){const a=r.highlight;let l;try{r.hooks&&(n=r.hooks.preprocess(n)),l=t(n,r)}catch(d){return o(d)}const c=function(d){let h;if(!d)try{r.walkTokens&&N.walkTokens(l,r.walkTokens),h=e(l,r),r.hooks&&(h=r.hooks.postprocess(h))}catch(f){d=f}return r.highlight=a,d?o(d):s(null,h)};if(!a||a.length<3||(delete r.highlight,!l.length))return c();let u=0;N.walkTokens(l,function(d){d.type==="code"&&(u++,setTimeout(()=>{a(d.text,d.lang,function(h,f){if(h)return c(h);f!=null&&f!==d.text&&(d.text=f,d.escaped=!0),u--,u===0&&c()})},0))}),u===0&&c();return}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(a=>t(a,r)).then(a=>r.walkTokens?Promise.all(N.walkTokens(a,r.walkTokens)).then(()=>a):a).then(a=>e(a,r)).then(a=>r.hooks?r.hooks.postprocess(a):a).catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));const a=t(n,r);r.walkTokens&&N.walkTokens(a,r.walkTokens);let l=e(a,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(a){return o(a)}}}function N(t,e,n){return ef(an.lex,ln.parse)(t,e,n)}N.options=N.setOptions=function(t){return N.defaults={...N.defaults,...t},CS(N.defaults),N};N.getDefaults=Jh;N.defaults=Pn;N.use=function(...t){const e=N.defaults.extensions||{renderers:{},childTokens:{}};t.forEach(n=>{const r={...n};if(r.async=N.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if(s.renderer){const i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if(s.tokenizer){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");e[s.level]?e[s.level].unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){const s=N.defaults.renderer||new Za;for(const i in n.renderer){const o=s[i];s[i]=(...a)=>{let l=n.renderer[i].apply(s,a);return l===!1&&(l=o.apply(s,a)),l}}r.renderer=s}if(n.tokenizer){const s=N.defaults.tokenizer||new Ya;for(const i in n.tokenizer){const o=s[i];s[i]=(...a)=>{let l=n.tokenizer[i].apply(s,a);return l===!1&&(l=o.apply(s,a)),l}}r.tokenizer=s}if(n.hooks){const s=N.defaults.hooks||new Ti;for(const i in n.hooks){const o=s[i];Ti.passThroughHooks.has(i)?s[i]=a=>{if(N.defaults.async)return Promise.resolve(n.hooks[i].call(s,a)).then(c=>o.call(s,c));const l=n.hooks[i].call(s,a);return o.call(s,l)}:s[i]=(...a)=>{let l=n.hooks[i].apply(s,a);return l===!1&&(l=o.apply(s,a)),l}}r.hooks=s}if(n.walkTokens){const s=N.defaults.walkTokens;r.walkTokens=function(i){let o=[];return o.push(n.walkTokens.call(this,i)),s&&(o=o.concat(s.call(this,i))),o}}N.setOptions(r)})};N.walkTokens=function(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(N,r)),r.type){case"table":{for(const s of r.header)n=n.concat(N.walkTokens(s.tokens,e));for(const s of r.rows)for(const i of s)n=n.concat(N.walkTokens(i.tokens,e));break}case"list":{n=n.concat(N.walkTokens(r.items,e));break}default:N.defaults.extensions&&N.defaults.extensions.childTokens&&N.defaults.extensions.childTokens[r.type]?N.defaults.extensions.childTokens[r.type].forEach(function(s){n=n.concat(N.walkTokens(r[s],e))}):r.tokens&&(n=n.concat(N.walkTokens(r.tokens,e)))}return n};N.parseInline=ef(an.lexInline,ln.parseInline);N.Parser=ln;N.parser=ln.parse;N.Renderer=Za;N.TextRenderer=Zh;N.Lexer=an;N.lexer=an.lex;N.Tokenizer=Ya;N.Slugger=Qh;N.Hooks=Ti;N.parse=N;N.options;N.setOptions;N.use;N.walkTokens;N.parseInline;ln.parse;an.lex;var HS=Object.defineProperty,US=Object.getOwnPropertyDescriptor,qi=(t,e,n,r)=>{for(var s=r>1?void 0:r?US(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&HS(e,n,s),s},jS=fp(Ei);function WS(t){return qS.turndown(t)}function vo(t){const e=t.parentNode;if(!Ie(e))return!1;if(e.nodeName==="THEAD")return!0;if(e.nodeName!=="TABLE"&&!tf(e))return!1;const n=[...t.childNodes];return n.every(r=>r.nodeName==="TH")&&n.some(r=>!!r.textContent)}function Oi(t){return Ie(t)&&t.matches("th[data-controller-cell]")}function KS(t){const e=t.parentNode;return!Ie(e)||e.nodeName!=="TABLE"&&!tf(e)?!1:[...t.childNodes].every(r=>Oi(r))}function tf(t){var e;if(t.nodeName!=="TBODY")return!1;const n=t.previousSibling;return n?Ie(n)&&n.nodeName==="THEAD"&&!((e=n.textContent)!=null&&e.trim()):!0}function Vc(t){const e=t.closest("table");if(!e)return!1;const{parentNode:n}=e;return n?!!n.closest("table"):!0}function Hc(t,e){var n;const r=[];for(const o of((n=e.parentNode)==null?void 0:n.childNodes)??[])Oi(o)||r.push(o);return`${(r.indexOf(e)===0?"| ":" ")+t.trim()} |`}var qS=new jS({codeBlockStyle:"fenced",headingStyle:"atx"}).addRule("taskListItems",{filter:t=>t.nodeName==="LI"&&t.hasAttribute("data-task-list-item"),replacement:(t,e)=>`- ${e.hasAttribute("data-checked")?"[x]":"[ ]"} ${t.trimStart()}`}).addRule("tableCell",{filter:["th","td"],replacement:(t,e)=>Oi(e)?"":Hc(t,e)}).addRule("tableRow",{filter:"tr",replacement:(t,e)=>{let n="";const r={left:":--",right:"--:",center:":-:"},s=[...e.childNodes].filter(i=>!Oi(i));if(vo(e))for(const i of s){if(!Ie(i))continue;let o="---";const a=(i.getAttribute("align")??"").toLowerCase();a&&(o=r[a]||o),n+=Hc(o,i)}return`
158
158
  ${t}${n?`
159
- ${n}`:""}`}}).addRule("table",{filter:t=>{if(t.nodeName!=="TABLE"||Vc(t))return!1;const e=[...t.rows].filter(n=>!qS(n));return vo(e[0])},replacement:t=>(t=t.replace(`
159
+ ${n}`:""}`}}).addRule("table",{filter:t=>{if(t.nodeName!=="TABLE"||Vc(t))return!1;const e=[...t.rows].filter(n=>!KS(n));return vo(e[0])},replacement:t=>(t=t.replace(`
160
160
 
161
161
  `,`
162
162
  `),`
@@ -175,14 +175,14 @@ ${t}</ol>
175
175
  ${t}</ul>
176
176
  `},listitem(t,e,n){return e?`<li data-task-list-item ${n?"data-checked":""}>${t}</li>
177
177
  `:`<li>${t}</li>
178
- `}}});function GS(t,e){return N(t,{gfm:!0,smartLists:!0,xhtml:!0,sanitizer:e})}function XS(t){R(typeof document,{code:b.EXTENSION,message:"Attempting to sanitize html within a non-browser environment. Please provide your own `sanitizeHtml` method to the `MarkdownExtension`."});const e=new DOMParser().parseFromString(`<!DOCTYPE html><html><body>${t}</body>`,"text/html");return e.normalize(),nf(e.body),e.body.innerHTML}function nf(t){if(!jy(t)){if(!Ie(t)||/^(script|iframe|object|embed|svg)$/i.test(t.tagName))return t==null?void 0:t.remove();for(const{name:e}of t.attributes)/^(class|id|name|href|src|alt|align|valign)$/i.test(e)||t.attributes.removeNamedItem(e);for(const e of t.childNodes)nf(e)}}var hr=class extends te{get name(){return"markdown"}onCreate(){this.store.setStringHandler("markdown",this.markdownToProsemirrorNode.bind(this))}createPlugin(){return{props:{clipboardTextSerializer:this.options.copyAsMarkdown?e=>{const n=document.createElement("div"),r=qe.fromSchema(this.store.schema);return n.append(r.serializeFragment(e.content)),this.options.htmlToMarkdown(n.innerHTML)}:void 0}}}markdownToProsemirrorNode(t){return this.store.stringHandlers.html({...t,content:this.options.markdownToHtml(t.content,this.options.htmlSanitizer)})}insertMarkdown(t,e){return n=>{const{state:r}=n;let s=this.options.markdownToHtml(t,this.options.htmlSanitizer);s=!(e!=null&&e.alwaysWrapInBlock)&&s.startsWith("<p><")&&s.endsWith(`</p>
179
- `)?s.slice(3,-5):`<div>${s}</div>`;const i=this.store.stringHandlers.html({content:s,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(i,{...e,replaceEmptyParentBlock:!0})(n)}}getMarkdown(t){return this.options.htmlToMarkdown(this.store.helpers.getHTML(t))}toggleBoldMarkdown(){return t=>!1}};qi([_()],hr.prototype,"insertMarkdown",1);qi([se()],hr.prototype,"getMarkdown",1);qi([_()],hr.prototype,"toggleBoldMarkdown",1);hr=qi([G({defaultOptions:{htmlToMarkdown:KS,markdownToHtml:GS,htmlSanitizer:XS,activeNodes:[j.Code],copyAsMarkdown:!1},staticKeys:["htmlToMarkdown","markdownToHtml","htmlSanitizer"]})],hr);var YS=Object.defineProperty,ZS=Object.getOwnPropertyDescriptor,Ji=(t,e,n,r)=>{for(var s=r>1?void 0:r?ZS(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&YS(e,n,s),s},QS={icon:"paragraph",label:({t})=>t(ui.INSERT_LABEL),description:({t})=>t(ui.INSERT_DESCRIPTION)},ev={icon:"paragraph",label:({t})=>t(ui.CONVERT_LABEL),description:({t})=>t(ui.CONVERT_DESCRIPTION)},An=class extends Rt{get name(){return"paragraph"}createTags(){return[j.LastNodeCompatible,j.TextBlock,j.Block,j.FormattingNode]}createNodeSpec(t,e){return{content:"inline*",draggable:!1,...e,attrs:{...t.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...t.parse(n)})},...e.parseDOM??[]],toDOM:n=>["p",t.dom(n),0]}}convertParagraph(t={}){const{attrs:e,selection:n,preserveAttrs:r}=t;return this.store.commands.setBlockNodeType.original(this.type,e,n,r)}insertParagraph(t,e={}){const{selection:n,attrs:r}=e;return this.store.commands.insertNode.original(this.type,{content:t,selection:n,attrs:r})}shortcut(t){return this.convertParagraph()(t)}};Ji([_(ev)],An.prototype,"convertParagraph",1);Ji([_(QS)],An.prototype,"insertParagraph",1);Ji([Ye({shortcut:w.Paragraph,command:"convertParagraph"})],An.prototype,"shortcut",1);An=Ji([G({defaultPriority:X.Medium})],An);var tv=Object.defineProperty,nv=Object.getOwnPropertyDescriptor,rv=(t,e,n,r)=>{for(var s=r>1?void 0:r?nv(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&tv(e,n,s),s},cn=class extends te{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(t,e)=>({...this.options,empty:Ra(e.doc,{ignoreAttributes:!0})}),apply:(t,e,n,r)=>sv({pluginState:e,tr:t,extension:this,state:r})},props:{decorations:t=>iv({state:t,extension:this})}}}onSetOptions(t){const{changes:e}=t;e.placeholder.changed&&this.store.phase>=Pe.EditorView&&this.store.updateAttributes()}};cn=rv([G({defaultOptions:{emptyNodeClass:E1.IS_EMPTY,placeholder:""}})],cn);function sv(t){const{pluginState:e,extension:n,tr:r,state:s}=t;return r.docChanged?{...n.options,empty:Ra(s.doc)}:e}function iv(t){const{extension:e,state:n}=t,{empty:r}=e.pluginKey.getState(n),{emptyNodeClass:s,placeholder:i}=e.options;if(!r)return null;const o=[];return n.doc.descendants((a,l)=>{const c=Q.node(l,l+a.nodeSize,{class:s,"data-placeholder":i});o.push(c)}),W.create(n.doc,o)}var ov=Object.defineProperty,av=Object.getOwnPropertyDescriptor,lv=(t,e,n,r)=>{for(var s=r>1?void 0:r?av(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&ov(e,n,s),s},ra=class extends Rt{get name(){return"text"}createTags(){return[j.InlineNode]}createNodeSpec(){return{}}};ra=lv([G({disableExtraAttributes:!0,defaultPriority:X.Medium})],ra);var cv={...cr.defaultOptions,...An.defaultOptions,...bt.defaultOptions,excludeExtensions:[]};function uv(t={}){t={...cv,...t};const{content:e,depth:n,getDispatch:r,getState:s,newGroupDelay:i,excludeExtensions:o}=t,a={};for(const c of o??[])a[c]=!0;const l=[];if(!a.history){const c=new bt({depth:n,getDispatch:r,getState:s,newGroupDelay:i});l.push(c)}return a.doc||l.push(new cr({content:e})),a.text||l.push(new ra),a.paragraph||l.push(new An),a.positioner||l.push(new us),a.gapCursor||l.push(new ea),a.events||l.push(new Si),l}var dv=Object.defineProperty,hv=Object.getOwnPropertyDescriptor,fv=(t,e,n,r)=>{for(var s=r>1?void 0:r?hv(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&dv(e,n,s),s},rf=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},O=(t,e,n)=>(rf(t,e,"read from private field"),n?n.call(t):e.get(t)),Ue=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Ve=(t,e,n,r)=>(rf(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Fr,pv=class{constructor(){this.portals=new Map,Ue(this,Fr,Hi()),this.on=t=>O(this,Fr).on("update",t),this.once=t=>{const e=O(this,Fr).on("update",n=>{e(),t(n)});return e}}update(){O(this,Fr).emit("update",this.portals)}render({Component:t,container:e}){const n=this.portals.get(e);this.portals.set(e,{Component:t,key:(n==null?void 0:n.key)??ni()}),this.update()}forceUpdate(){for(const[t,{Component:e}]of this.portals)this.portals.set(t,{Component:e,key:ni()})}remove(t){this.portals.delete(t),this.update()}};Fr=new WeakMap;var mv=t=>{const{portals:e}=t;return Me.createElement(Me.Fragment,null,e.map(([n,{Component:r,key:s}])=>bf.createPortal(Me.createElement(r,null),n,s)))};function gv(t){const[e,n]=$.useState(()=>Array.from(t.portals.entries()));return $.useEffect(()=>t.on(r=>{n(Array.from(r.entries()))}),[t]),$.useMemo(()=>e,[e])}var ne,Vr,gn,Hr,Ys,Ur,Kn,jr,Zs,Et,Oe,sa,sf=class{constructor({getPosition:t,node:e,portalContainer:n,view:r,ReactComponent:s,options:i}){Ue(this,ne,void 0),Ue(this,Vr,[]),Ue(this,gn,void 0),Ue(this,Hr,void 0),Ue(this,Ys,void 0),Ue(this,Ur,void 0),Ue(this,Kn,void 0),Ue(this,jr,!1),Ue(this,Zs,void 0),Ue(this,Et,void 0),Ue(this,Oe,void 0),Ue(this,sa,l=>{l&&(R(O(this,Et),{code:b.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${O(this,ne).type.name}' which doesn't support content.`}),l.append(O(this,Et)))}),this.Component=()=>{const l=O(this,Ys);return R(l,{code:b.REACT_NODE_VIEW,message:`The custom react node view provided for ${O(this,ne).type.name} doesn't have a valid ReactComponent`}),Me.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:O(this,gn),getPosition:O(this,Ur),node:O(this,ne),forwardRef:O(this,sa),decorations:O(this,Vr)})},this.updateAttributes=l=>{if(!O(this,gn).editable)return;const c=O(this,Ur).call(this);if(c==null)return;const u=O(this,gn).state.tr.setNodeMarkup(c,void 0,{...O(this,ne).attrs,...l});O(this,gn).dispatch(u)},R(ee(t),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),Ve(this,ne,e),Ve(this,gn,r),Ve(this,Hr,n),Ve(this,Ys,s),Ve(this,Ur,t),Ve(this,Kn,i),Ve(this,Oe,this.createDom());const{contentDOM:o,wrapper:a}=this.createContentDom()??{};Ve(this,Zs,o??void 0),Ve(this,Et,a),O(this,Et)&&O(this,Oe).append(O(this,Et)),this.setDomAttributes(O(this,ne),O(this,Oe)),this.Component.displayName=Cu(`${O(this,ne).type.name}NodeView`),this.renderComponent()}static create(t){const{portalContainer:e,ReactComponent:n,options:r}=t;return(s,i,o)=>new sf({options:r,node:s,view:i,getPosition:o,portalContainer:e,ReactComponent:n})}get selected(){return O(this,jr)}get contentDOM(){return O(this,Zs)}get dom(){return O(this,Oe)}renderComponent(){O(this,Hr).render({Component:this.Component,container:O(this,Oe)})}createDom(){const{defaultBlockNode:t,defaultInlineNode:e}=O(this,Kn),n=O(this,ne).isInline?document.createElement(e):document.createElement(t);return n.classList.add(`${ol(O(this,ne).type.name)}-node-view-wrapper`),n}createContentDom(){var t,e;if(O(this,ne).isLeaf)return;const n=(e=(t=O(this,ne).type.spec).toDOM)==null?void 0:e.call(t,O(this,ne));if(!n)return;const{contentDOM:r,dom:s}=qe.renderSpec(document,n);let i;if(Ie(s))return i=s,s===r&&(i=document.createElement("span"),i.classList.add(`${ol(O(this,ne).type.name)}-node-view-content-wrapper`),i.append(r)),Ie(r),{wrapper:i,contentDOM:r}}update(t,e){return _a({types:O(this,ne).type,node:t})?(O(this,ne)===t&&O(this,Vr)===e||(O(this,ne).sameMarkup(t)||this.setDomAttributes(t,O(this,Oe)),Ve(this,ne,t),Ve(this,Vr,e),this.renderComponent()),!0):!1}setDomAttributes(t,e){const{toDOM:n}=O(this,ne).type.spec;let r=t.attrs;if(n){const s=n(t);if(D(s)||yv(s))return;Rn(s[1])&&(r=s[1])}for(const[s,i]of he(r))e.setAttribute(s,i)}selectNode(){Ve(this,jr,!0),O(this,Oe)&&O(this,Oe).classList.add(nl),this.renderComponent()}deselectNode(){Ve(this,jr,!1),O(this,Oe)&&O(this,Oe).classList.remove(nl),this.renderComponent()}destroy(){O(this,Hr).remove(O(this,Oe))}ignoreMutation(t){return t.type==="selection"?!O(this,ne).type.spec.selectable:O(this,Et)?!O(this,Et).contains(t.target):!0}stopEvent(t){var e;if(!O(this,Oe))return!1;if(ee(O(this,Kn).stopEvent))return O(this,Kn).stopEvent({event:t});const n=t.target;if(!(O(this,Oe).contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s)return!0;const o=!!O(this,ne).type.spec.draggable,a=I.isSelectable(O(this,ne)),l=t.type==="copy",c=t.type==="paste",u=t.type==="cut",d=t.type==="mousedown",h=t.type.startsWith("drag");return!o&&a&&h&&t.preventDefault(),!(h||s||l||c||u||d&&a)}},Uc=sf;ne=new WeakMap;Vr=new WeakMap;gn=new WeakMap;Hr=new WeakMap;Ys=new WeakMap;Ur=new WeakMap;Kn=new WeakMap;jr=new WeakMap;Zs=new WeakMap;Et=new WeakMap;Oe=new WeakMap;sa=new WeakMap;function yv(t){return mi(t)||Rn(t)&&mi(t.dom)}var gs=class extends te{constructor(){super(...arguments),this.portalContainer=new pv}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const t=M(),e=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!Ts(r)||r.reactComponentEnvironment==="ssr"||(t[r.name]=Uc.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=he({...this.options.nodeViewComponents,...e});for(const[r,s]of n)t[r]=Uc.create({options:this.options,ReactComponent:s,portalContainer:this.portalContainer});return t}};gs=fv([G({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],gs);function xv(t){const e=$.createContext(null),n=bv(e);return[s=>{const i=t(s);return Me.createElement(e.Provider,{value:i},s.children)},n,e]}function bv(t){return(e,n)=>{const r=$.useContext(t),s=kv(r);if(!r)throw new Error("`useContextHook` must be placed inside the `Provider` returned by the `createContextState` method");if(!e)return r;if(typeof e!="function")throw new TypeError("invalid arguments passed to `useContextHook`. This hook must be called with zero arguments, a getter function or a path string.");const i=e(r);if(!s||!n)return i;const o=e(s);return n(o,i)?o:i}}function kv(t){const e=$.useRef();return Sv(()=>{e.current=t}),e.current}var Sv=typeof document<"u"?$.useLayoutEffect:$.useEffect;function vv(t,e){return xv(n=>{const r=$.useRef(null),s=$.useRef(),i=e==null?void 0:e(n),[o,a]=$.useState(()=>t({get:jc(r),set:Wc(s),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return $.useEffect(()=>{l.length!==0&&a(c=>t({get:jc(r),set:Wc(s),previousContext:c,props:n,state:i}))},l),r.current=o,s.current=a,o})}function jc(t){return e=>{if(!t.current)throw new Error("`get` called outside of function scope. `get` can only be called within a function.");if(!e)return t.current;if(typeof e!="function")throw new TypeError("Invalid arguments passed to `useContextHook`. The hook must be called with zero arguments, a getter function or a path string.");return e(t.current)}}function Wc(t){return e=>{if(!t.current)throw new Error("`set` called outside of function scope. `set` can only be called within a function.");t.current(n=>({...n,...typeof e=="function"?e(n):e}))}}var of={},af={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.errorMessages=t.ErrorType=void 0;var e;(function(n){n.MalformedUnicode="MALFORMED_UNICODE",n.MalformedHexadecimal="MALFORMED_HEXADECIMAL",n.CodePointLimit="CODE_POINT_LIMIT",n.OctalDeprecation="OCTAL_DEPRECATION",n.EndOfString="END_OF_STRING"})(e=t.ErrorType||(t.ErrorType={})),t.errorMessages=new Map([[e.MalformedUnicode,"malformed Unicode character escape sequence"],[e.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[e.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[e.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[e.EndOfString,"malformed escape sequence at end of string"]])})(af);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.unraw=t.errorMessages=t.ErrorType=void 0;const e=af;Object.defineProperty(t,"ErrorType",{enumerable:!0,get:function(){return e.ErrorType}}),Object.defineProperty(t,"errorMessages",{enumerable:!0,get:function(){return e.errorMessages}});function n(f){return!f.match(/[^a-f0-9]/i)?parseInt(f,16):NaN}function r(f,p,m){const g=n(f);if(Number.isNaN(g)||m!==void 0&&m!==f.length)throw new SyntaxError(e.errorMessages.get(p));return g}function s(f){const p=r(f,e.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(p)}function i(f,p){const m=r(f,e.ErrorType.MalformedUnicode,4);if(p!==void 0){const g=r(p,e.ErrorType.MalformedUnicode,4);return String.fromCharCode(m,g)}return String.fromCharCode(m)}function o(f){return f.charAt(0)==="{"&&f.charAt(f.length-1)==="}"}function a(f){if(!o(f))throw new SyntaxError(e.errorMessages.get(e.ErrorType.MalformedUnicode));const p=f.slice(1,-1),m=r(p,e.ErrorType.MalformedUnicode);try{return String.fromCodePoint(m)}catch(g){throw g instanceof RangeError?new SyntaxError(e.errorMessages.get(e.ErrorType.CodePointLimit)):g}}function l(f,p=!1){if(p)throw new SyntaxError(e.errorMessages.get(e.ErrorType.OctalDeprecation));const m=parseInt(f,8);return String.fromCharCode(m)}const c=new Map([["b","\b"],["f","\f"],["n",`
180
- `],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(f){return c.get(f)||f}const d=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function h(f,p=!1){return f.replace(d,function(m,g,y,E,L,q,J,F,oe){if(g!==void 0)return"\\";if(y!==void 0)return s(y);if(E!==void 0)return a(E);if(L!==void 0)return i(L,q);if(J!==void 0)return i(J);if(F==="0")return"\0";if(F!==void 0)return l(F,!p);if(oe!==void 0)return u(oe);throw new SyntaxError(e.errorMessages.get(e.ErrorType.EndOfString))})}t.unraw=h,t.default=h})(of);const wv=bs(of),_t=t=>typeof t=="string",Ev=t=>typeof t=="function",Kc=new Map;function Qa(t){return[...Array.isArray(t)?t:[t],"en"]}function lf(t,e,n){const r=Qa(t);return Mi(()=>_i("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(_t(e)?new Date(e):e)}function ia(t,e,n){const r=Qa(t);return Mi(()=>_i("number",r,n),()=>new Intl.NumberFormat(r,n)).format(e)}function qc(t,e,n,{offset:r=0,...s}){const i=Qa(t),o=e?Mi(()=>_i("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):Mi(()=>_i("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return s[n]??s[o.select(n-r)]??s.other}function Mi(t,e){const n=t();let r=Kc.get(n);return r||(r=e(),Kc.set(n,r)),r}function _i(t,e,n){const r=e.join("-");return`${t}-${r}-${JSON.stringify(n)}`}const cf=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g,Cv=(t,e,n={})=>{e=e||t;const r=i=>_t(i)?n[i]||{style:i}:i,s=(i,o)=>{const a=Object.keys(n).length?r("number"):{},l=ia(e,i,a);return o.replace("#",l)};return{plural:(i,o)=>{const{offset:a=0}=o,l=qc(e,!1,i,o);return s(i-a,l)},selectordinal:(i,o)=>{const{offset:a=0}=o,l=qc(e,!0,i,o);return s(i-a,l)},select:(i,o)=>o[i]??o.other,number:(i,o)=>ia(e,i,r(o)),date:(i,o)=>lf(e,i,r(o)),undefined:i=>i}};function Tv(t,e,n){return(r,s={})=>{const i=Cv(e,n,s),o=l=>Array.isArray(l)?l.reduce((c,u)=>{if(_t(u))return c+u;const[d,h,f]=u;let p={};f!=null&&!_t(f)?Object.keys(f).forEach(g=>{p[g]=o(f[g])}):p=f;const m=i[h](r[d],p);return m==null?c:c+m},""):l,a=o(t);return _t(a)&&cf.test(a)?wv(a.trim()):_t(a)?a.trim():a}}var Ov=Object.defineProperty,Mv=(t,e,n)=>e in t?Ov(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_v=(t,e,n)=>(Mv(t,typeof e!="symbol"?e+"":e,n),n);class Nv{constructor(){_v(this,"_events",{})}on(e,n){return this._hasEvent(e)||(this._events[e]=[]),this._events[e].push(n),()=>this.removeListener(e,n)}removeListener(e,n){if(!this._hasEvent(e))return;const r=this._events[e].indexOf(n);~r&&this._events[e].splice(r,1)}emit(e,...n){this._hasEvent(e)&&this._events[e].map(r=>r.apply(this,n))}_hasEvent(e){return Array.isArray(this._events[e])}}var Av=Object.defineProperty,Rv=(t,e,n)=>e in t?Av(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$n=(t,e,n)=>(Rv(t,typeof e!="symbol"?e+"":e,n),n);class Iv extends Nv{constructor(e){super(),$n(this,"_locale"),$n(this,"_locales"),$n(this,"_localeData"),$n(this,"_messages"),$n(this,"_missing"),$n(this,"t",this._.bind(this)),this._messages={},this._localeData={},e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(e.locale!=null||e.locales!=null)&&this.activate(e.locale,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(e,n){this._localeData[e]==null?this._localeData[e]=n:Object.assign(this._localeData[e],n)}loadLocaleData(e,n){n!=null?this._loadLocaleData(e,n):Object.keys(e).forEach(r=>this._loadLocaleData(r,e[r])),this.emit("change")}_load(e,n){this._messages[e]==null?this._messages[e]=n:Object.assign(this._messages[e],n)}load(e,n){n!=null?this._load(e,n):Object.keys(e).forEach(r=>this._load(r,e[r])),this.emit("change")}loadAndActivate({locale:e,locales:n,messages:r}){this._locale=e,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(e,n){this._locale=e,this._locales=n,this.emit("change")}_(e,n={},{message:r,formats:s}={}){_t(e)||(n=e.values||n,r=e.message,e=e.id);const i=!this.messages[e],o=this._missing;if(o&&i)return Ev(o)?o(this._locale,e):o;i&&this.emit("missing",{id:e,locale:this._locale});let a=this.messages[e]||r||e;return _t(a)&&cf.test(a)?JSON.parse(`"${a}"`):_t(a)?a:Tv(a,this._locale,this._locales)(n,s)}date(e,n){return lf(this._locales||this._locale,e,n)}number(e,n){return ia(this._locales||this._locale,e,n)}}function Dv(t={}){return new Iv(t)}const Gi=Dv();function k(t,e){return e?"other":t==1?"one":"other"}function It(t,e){return e?"other":t==0||t==1?"one":"other"}function $e(t,e){var n=String(t).split("."),r=!n[1];return e?"other":t==1&&r?"one":"other"}function K(t,e){return"other"}function hn(t,e){return e?"other":t==1?"one":t==2?"two":"other"}const Pv=K,Lv=k,Bv=It;function zv(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const $v=k;function Fv(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-2);return e?"other":t==0?"zero":t==1?"one":t==2?"two":s>=3&&s<=10?"few":s>=11&&s<=99?"many":"other"}function Vv(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-2);return e?"other":t==0?"zero":t==1?"one":t==2?"two":s>=3&&s<=10?"few":s>=11&&s<=99?"many":"other"}function Hv(t,e){return e?t==1||t==5||t==7||t==8||t==9||t==10?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const Uv=k,jv=$e;function Wv(t,e){var n=String(t).split("."),r=n[0],s=r.slice(-1),i=r.slice(-2),o=r.slice(-3);return e?s==1||s==2||s==5||s==7||s==8||i==20||i==50||i==70||i==80?"one":s==3||s==4||o==100||o==200||o==300||o==400||o==500||o==600||o==700||o==800||o==900?"few":r==0||s==6||i==40||i==60||i==90?"many":"other":t==1?"one":"other"}function Kv(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return e?(s==2||s==3)&&i!=12&&i!=13?"few":"other":s==1&&i!=11?"one":s>=2&&s<=4&&(i<12||i>14)?"few":r&&s==0||s>=5&&s<=9||i>=11&&i<=14?"many":"other"}const qv=k,Jv=k,Gv=k,Xv=It,Yv=K;function Zv(t,e){return e?t==1||t==5||t==7||t==8||t==9||t==10?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const Qv=K;function ew(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1),i=r&&n[0].slice(-2),o=r&&n[0].slice(-6);return e?"other":s==1&&i!=11&&i!=71&&i!=91?"one":s==2&&i!=12&&i!=72&&i!=92?"two":(s==3||s==4||s==9)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":t!=0&&r&&o==0?"many":"other"}const tw=k;function nw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?"other":i&&o==1&&a!=11||l==1&&c!=11?"one":i&&o>=2&&o<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function rw(t,e){var n=String(t).split("."),r=!n[1];return e?t==1||t==3?"one":t==2?"two":t==4?"few":"other":t==1&&r?"one":"other"}const sw=k;function iw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=s.slice(-1);return e?"other":i&&(r==1||r==2||r==3)||i&&o!=4&&o!=6&&o!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const ow=k,aw=k,lw=k;function cw(t,e){var n=String(t).split("."),r=n[0],s=!n[1];return e?"other":t==1&&s?"one":r>=2&&r<=4&&s?"few":s?"other":"many"}function uw(t,e){return e?t==0||t==7||t==8||t==9?"zero":t==1?"one":t==2?"two":t==3||t==4?"few":t==5||t==6?"many":"other":t==0?"zero":t==1?"one":t==2?"two":t==3?"few":t==6?"many":"other"}function dw(t,e){var n=String(t).split("."),r=n[0],s=Number(n[0])==t;return e?"other":t==1||!s&&(r==0||r==1)?"one":"other"}const hw=$e;function fw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-2),a=s.slice(-2);return e?"other":i&&o==1||a==1?"one":i&&o==2||a==2?"two":i&&(o==3||o==4)||a==3||a==4?"few":"other"}const pw=k,mw=K,gw=k,yw=k;function xw(t,e){var n=String(t).split("."),r=!n[1],s=Number(n[0])==t,i=s&&n[0].slice(-1),o=s&&n[0].slice(-2);return e?i==1&&o!=11?"one":i==2&&o!=12?"two":i==3&&o!=13?"few":"other":t==1&&r?"one":"other"}const bw=k,kw=k,Sw=$e,vw=k;function ww(t,e){return e?"other":t>=0&&t<=1?"one":"other"}function Ew(t,e){return e?"other":t>=0&&t<2?"one":"other"}const Cw=$e;function Tw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=s.slice(-1);return e?t==1?"one":"other":i&&(r==1||r==2||r==3)||i&&o!=4&&o!=6&&o!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Ow=k;function Mw(t,e){return e?t==1?"one":"other":t>=0&&t<2?"one":"other"}const _w=k,Nw=$e;function Aw(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1?"one":"other":t==1?"one":t==2?"two":r&&t>=3&&t<=6?"few":r&&t>=7&&t<=10?"many":"other"}function Rw(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1||t==11?"one":t==2||t==12?"two":t==3||t==13?"few":"other":t==1||t==11?"one":t==2||t==12?"two":r&&t>=3&&t<=10||r&&t>=13&&t<=19?"few":"other"}const Iw=$e,Dw=k;function Pw(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const Lw=It;function Bw(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=r.slice(-1),o=r.slice(-2);return e?"other":s&&i==1?"one":s&&i==2?"two":s&&(o==0||o==20||o==40||o==60||o==80)?"few":s?"other":"many"}const zw=k,$w=k;function Fw(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=Number(n[0])==t,o=i&&n[0].slice(-1);return e?"other":t==1&&s?"one":r==2&&s?"two":s&&(t<0||t>10)&&i&&o==0?"many":"other"}function Vw(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}function Hw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?"other":i&&o==1&&a!=11||l==1&&c!=11?"one":i&&o>=2&&o<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Uw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-2),a=s.slice(-2);return e?"other":i&&o==1||a==1?"one":i&&o==2||a==2?"two":i&&(o==3||o==4)||a==3||a==4?"few":"other"}function jw(t,e){return e?t==1||t==5?"one":"other":t==1?"one":"other"}function Ww(t,e){return e?t==1?"one":"other":t>=0&&t<2?"one":"other"}const Kw=$e,qw=K,Jw=K,Gw=K,Xw=$e;function Yw(t,e){var n=String(t).split("."),r=n[0],s=Number(n[0])==t,i=r.slice(-1),o=r.slice(-2);return e?"other":s&&i==1&&o!=11||!s?"one":"other"}function Zw(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}const Qw=hn;function eE(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=Number(n[0])==t,o=i&&n[0].slice(-1);return e?"other":t==1&&s?"one":r==2&&s?"two":s&&(t<0||t>10)&&i&&o==0?"many":"other"}const tE=K,nE=K,rE=k,sE=$e,iE=k,oE=K,aE=K;function lE(t,e){var n=String(t).split("."),r=n[0],s=r.slice(-2);return e?r==1?"one":r==0||s>=2&&s<=20||s==40||s==60||s==80?"many":"other":t==1?"one":"other"}function cE(t,e){return e?"other":t>=0&&t<2?"one":"other"}const uE=k,dE=k,hE=K,fE=K;function pE(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1);return e?s==6||s==9||r&&s==0&&t!=0?"many":"other":t==1?"one":"other"}const mE=k,gE=k,yE=K;function xE(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const bE=K,kE=k,SE=k;function vE(t,e){return e?"other":t==0?"zero":t==1?"one":"other"}const wE=k;function EE(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-2),i=r&&n[0].slice(-3),o=r&&n[0].slice(-5),a=r&&n[0].slice(-6);return e?r&&t>=1&&t<=4||s>=1&&s<=4||s>=21&&s<=24||s>=41&&s<=44||s>=61&&s<=64||s>=81&&s<=84?"one":t==5||s==5?"many":"other":t==0?"zero":t==1?"one":s==2||s==22||s==42||s==62||s==82||r&&i==0&&(o>=1e3&&o<=2e4||o==4e4||o==6e4||o==8e4)||t!=0&&a==1e5?"two":s==3||s==23||s==43||s==63||s==83?"few":t!=1&&(s==1||s==21||s==41||s==61||s==81)?"many":"other"}const CE=k;function TE(t,e){var n=String(t).split("."),r=n[0];return e?"other":t==0?"zero":(r==0||r==1)&&t!=0?"one":"other"}const OE=k,ME=k,_E=K,NE=It;function AE(t,e){return e&&t==1?"one":"other"}function RE(t,e){var n=String(t).split("."),r=n[1]||"",s=Number(n[0])==t,i=s&&n[0].slice(-1),o=s&&n[0].slice(-2);return e?"other":i==1&&(o<11||o>19)?"one":i>=2&&i<=9&&(o<11||o>19)?"few":r!=0?"many":"other"}function IE(t,e){var n=String(t).split("."),r=n[1]||"",s=r.length,i=Number(n[0])==t,o=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return e?"other":i&&o==0||a>=11&&a<=19||s==2&&l>=11&&l<=19?"zero":o==1&&a!=11||s==2&&c==1&&l!=11||s!=2&&c==1?"one":"other"}const DE=k,PE=It,LE=k;function BE(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?o==1&&a!=11?"one":o==2&&a!=12?"two":(o==7||o==8)&&a!=17&&a!=18?"many":"other":i&&o==1&&a!=11||l==1&&c!=11?"one":"other"}const zE=k,$E=k;function FE(t,e){var n=String(t).split("."),r=!n[1],s=Number(n[0])==t,i=s&&n[0].slice(-2);return e?t==1?"one":"other":t==1&&r?"one":!r||t==0||i>=2&&i<=19?"few":"other"}function VE(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":"other":t==1?"one":"other"}function HE(t,e){return e&&t==1?"one":"other"}function UE(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-2);return e?"other":t==1?"one":t==0||s>=2&&s<=10?"few":s>=11&&s<=19?"many":"other"}const jE=K,WE=k,KE=hn,qE=k,JE=k;function GE(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?r&&t>=1&&t<=4?"one":"other":t==1?"one":"other"}const XE=$e,YE=k,ZE=k,QE=k,eC=K,tC=k,nC=It,rC=k,sC=k,iC=k;function oC(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1||t==5||r&&t>=7&&t<=9?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t==1?"one":"other"}const aC=k,lC=K,cC=It,uC=k;function dC(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=r.slice(-1),o=r.slice(-2);return e?"other":t==1&&s?"one":s&&i>=2&&i<=4&&(o<12||o>14)?"few":s&&r!=1&&(i==0||i==1)||s&&i>=5&&i<=9||s&&o>=12&&o<=14?"many":"other"}function hC(t,e){var n=String(t).split("."),r=n[1]||"",s=r.length,i=Number(n[0])==t,o=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return e?"other":i&&o==0||a>=11&&a<=19||s==2&&l>=11&&l<=19?"zero":o==1&&a!=11||s==2&&c==1&&l!=11||s!=2&&c==1?"one":"other"}const fC=k;function pC(t,e){var n=String(t).split("."),r=n[0];return e?"other":r==0||r==1?"one":"other"}const mC=$e,gC=k;function yC(t,e){var n=String(t).split("."),r=!n[1],s=Number(n[0])==t,i=s&&n[0].slice(-2);return e?t==1?"one":"other":t==1&&r?"one":!r||t==0||i>=2&&i<=19?"few":"other"}const xC=k,bC=K;function kC(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=r.slice(-1),o=r.slice(-2);return e?"other":s&&i==1&&o!=11?"one":s&&i>=2&&i<=4&&(o<12||o>14)?"few":s&&i==0||s&&i>=5&&i<=9||s&&o>=11&&o<=14?"many":"other"}const SC=k,vC=K,wC=k;function EC(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}function CC(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}const TC=k,OC=k,MC=hn,_C=k,NC=K,AC=K;function RC(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?"other":i&&o==1&&a!=11||l==1&&c!=11?"one":i&&o>=2&&o<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function IC(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?"other":t>=0&&t<=1?"one":r&&t>=2&&t<=10?"few":"other"}function DC(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"";return e?"other":t==0||t==1||r==0&&s==1?"one":"other"}function PC(t,e){var n=String(t).split("."),r=n[0],s=!n[1];return e?"other":t==1&&s?"one":r>=2&&r<=4&&s?"few":s?"other":"many"}function LC(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=r.slice(-2);return e?"other":s&&i==1?"one":s&&i==2?"two":s&&(i==3||i==4)||!s?"few":"other"}const BC=hn,zC=hn,$C=hn,FC=hn,VC=hn,HC=k,UC=k;function jC(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return e?t==1?"one":s==4&&i!=14?"many":"other":t==1?"one":"other"}function WC(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?"other":i&&o==1&&a!=11||l==1&&c!=11?"one":i&&o>=2&&o<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}const KC=k,qC=k,JC=k,GC=K;function XC(t,e){var n=String(t).split("."),r=!n[1],s=Number(n[0])==t,i=s&&n[0].slice(-1),o=s&&n[0].slice(-2);return e?(i==1||i==2)&&o!=11&&o!=12?"one":"other":t==1&&r?"one":"other"}const YC=$e,ZC=k,QC=k,eT=k,tT=k,nT=K,rT=It,sT=k;function iT(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1);return e?s==6||s==9||t==10?"few":"other":t==1?"one":"other"}function oT(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=s.slice(-1);return e?t==1?"one":"other":i&&(r==1||r==2||r==3)||i&&o!=4&&o!=6&&o!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const aT=k,lT=K,cT=k,uT=k;function dT(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?"other":t==0||t==1||r&&t>=11&&t<=99?"one":"other"}const hT=k;function fT(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=Number(n[0])==t,o=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return e?o==3&&a!=13?"few":"other":s&&l==1&&c!=11?"one":s&&l>=2&&l<=4&&(c<12||c>14)?"few":s&&l==0||s&&l>=5&&l<=9||s&&c>=11&&c<=14?"many":"other"}const pT=$e,mT=k,gT=k;function yT(t,e){return e&&t==1?"one":"other"}const xT=k,bT=k,kT=It,ST=k,vT=K,wT=k,ET=k,CT=$e,TT=K,OT=K,MT=K;function _T(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const NT=Object.freeze(Object.defineProperty({__proto__:null,_in:Pv,af:Lv,ak:Bv,am:zv,an:$v,ar:Fv,ars:Vv,as:Hv,asa:Uv,ast:jv,az:Wv,be:Kv,bem:qv,bez:Jv,bg:Gv,bho:Xv,bm:Yv,bn:Zv,bo:Qv,br:ew,brx:tw,bs:nw,ca:rw,ce:sw,ceb:iw,cgg:ow,chr:aw,ckb:lw,cs:cw,cy:uw,da:dw,de:hw,dsb:fw,dv:pw,dz:mw,ee:gw,el:yw,en:xw,eo:bw,es:kw,et:Sw,eu:vw,fa:ww,ff:Ew,fi:Cw,fil:Tw,fo:Ow,fr:Mw,fur:_w,fy:Nw,ga:Aw,gd:Rw,gl:Iw,gsw:Dw,gu:Pw,guw:Lw,gv:Bw,ha:zw,haw:$w,he:Fw,hi:Vw,hr:Hw,hsb:Uw,hu:jw,hy:Ww,ia:Kw,id:qw,ig:Jw,ii:Gw,io:Xw,is:Yw,it:Zw,iu:Qw,iw:eE,ja:tE,jbo:nE,jgo:rE,ji:sE,jmc:iE,jv:oE,jw:aE,ka:lE,kab:cE,kaj:uE,kcg:dE,kde:hE,kea:fE,kk:pE,kkj:mE,kl:gE,km:yE,kn:xE,ko:bE,ks:kE,ksb:SE,ksh:vE,ku:wE,kw:EE,ky:CE,lag:TE,lb:OE,lg:ME,lkt:_E,ln:NE,lo:AE,lt:RE,lv:IE,mas:DE,mg:PE,mgo:LE,mk:BE,ml:zE,mn:$E,mo:FE,mr:VE,ms:HE,mt:UE,my:jE,nah:WE,naq:KE,nb:qE,nd:JE,ne:GE,nl:XE,nn:YE,nnh:ZE,no:QE,nqo:eC,nr:tC,nso:nC,ny:rC,nyn:sC,om:iC,or:oC,os:aC,osa:lC,pa:cC,pap:uC,pl:dC,prg:hC,ps:fC,pt:pC,pt_PT:mC,rm:gC,ro:yC,rof:xC,root:bC,ru:kC,rwk:SC,sah:vC,saq:wC,sc:EC,scn:CC,sd:TC,sdh:OC,se:MC,seh:_C,ses:NC,sg:AC,sh:RC,shi:IC,si:DC,sk:PC,sl:LC,sma:BC,smi:zC,smj:$C,smn:FC,sms:VC,sn:HC,so:UC,sq:jC,sr:WC,ss:KC,ssy:qC,st:JC,su:GC,sv:XC,sw:YC,syr:ZC,ta:QC,te:eT,teo:tT,th:nT,ti:rT,tig:sT,tk:iT,tl:oT,tn:aT,to:lT,tr:cT,ts:uT,tzm:dT,ug:hT,uk:fT,ur:pT,uz:mT,ve:gT,vi:yT,vo:xT,vun:bT,wa:kT,wae:ST,wo:vT,xh:wT,xog:ET,yi:CT,yo:TT,yue:OT,zh:MT,zu:_T},Symbol.toStringTag,{value:"Module"}));var AT=Object.defineProperty,RT=Object.getOwnPropertyDescriptor,IT=Object.getOwnPropertyNames,DT=Object.prototype.hasOwnProperty,Jc=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of IT(e))!DT.call(t,s)&&s!==n&&AT(t,s,{get:()=>e[s],enumerable:!(r=RT(e,s))||r.enumerable});return t},PT=(t,e,n)=>(Jc(t,e,"default"),n&&Jc(n,e,"default")),LT=JSON.parse('{"extension.command.toggle-upper-case.label":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"extension.table.column_count":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"extension.table.row_count":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.toggle-columns.description":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"extension.command.toggle-columns.label":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"extension.command.set-text-direction.label":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"extension.command.set-text-direction.description":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"extension.command.toggle-heading.label":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"extension.command.toggle-callout.description":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"extension.command.toggle-callout.label":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"extension.command.toggle-code-block.description":"Add a code block","extension.command.add-annotation.label":"Add annotation","extension.command.toggle-blockquote.description":"Add blockquote formatting to the selected text","extension.command.toggle-bold.description":"Add bold formatting to the selected text","extension.command.toggle-code.description":"Add inline code formatting to the selected text","keyboard.shortcut.alt":"Alt","keyboard.shortcut.arrowDown":"Arrow Down","keyboard.shortcut.arrowLeft":"Arrow Left","keyboard.shortcut.arrowRight":"Arrow Right","keyboard.shortcut.arrowUp":"Arrow Up","keyboard.shortcut.backspace":"Backspace","ui.text-color.black":"Black","extension.command.toggle-blockquote.label":"Blockquote","ui.text-color.blue":"Blue","ui.text-color.blue.hue":["Blue ",["hue"]],"extension.command.toggle-bold.label":"Bold","extension.command.toggle-bullet-list.description":"Bulleted list","keyboard.shortcut.capsLock":"Caps Lock","extension.command.center-align.label":"Center align","extension.command.toggle-code.label":"Code","extension.command.toggle-code-block.label":"Codeblock","keyboard.shortcut.command":"Command","QcPNd6":"Image description","ogrUzJ":"Add a short description here.","yqdyzr":"Image","6/02F4":"Image source","X8H91v":"Image","zhQ7Zt":"Italic","ZL7E7l":"Underline","keyboard.shortcut.control":"Control","extension.command.convert-paragraph.description":"Convert current block into a paragraph block.","extension.command.convert-paragraph.label":"Convert Paragraph","extension.command.copy.label":"Copy","extension.command.copy.description":"Copy the selected text","extension.command.create-table.description":"Create a table with set number of rows and columns.","extension.command.create-table.label":"Create table","extension.command.cut.label":"Cut","extension.command.cut.description":"Cut the selected text","ui.text-color.cyan":"Cyan","ui.text-color.cyan.hue":["Cyan ",["hue"]],"extension.command.decrease-font-size.label":"Decrease","extension.command.decrease-indent.label":"Decrease indentation","extension.command.decrease-font-size.description":"Decrease the font size.","keyboard.shortcut.delete":"Delete","extension.command.insert-horizontal-rule.label":"Divider","keyboard.shortcut.end":"End","keyboard.shortcut.escape":"Enter","keyboard.shortcut.enter":"Enter","6PjrOF":"Add annotation","OTq5WC":"Center align","oeZ3ox":"Convert current block into a paragraph block.","m1khs+":"Convert Paragraph","w/1U+3":"Copy the selected text","kdodi0":"Copy","k0KR/u":"Create a table with set number of rows and columns.","zrwMyD":"Create table","D/nWxh":"Cut the selected text","jHPv5m":"Cut","5cNgRx":"Decrease the font size.","vyRNWx":"Decrease","Jgiol4":"Decrease indentation","1gJSHH":"Increase the font size","OQXJXz":"Increase","72TLhr":"Increase indentation","HFlfzJ":"Insert Emoji","RPq9fY":"Separate content with a diving horizontal line","OKQF+e":"Divider","zjYb9C":"Insert a new paragraph","4M4sXC":"Insert Paragraph","1Q+eVc":"Justify","ejWWtP":"Left align","wVqrpS":"Paste content into the editor","07v9aw":"Paste","zUYfou":"Redo the most recent action","9Nq9zr":"Redo","0uxaZe":"Remove annotation","iJWZAz":"Right align","g5WpPn":"Select all content within the editor","2+pZDT":"Select all","yChCR1":"Set text case","GMzAC/":"Set the font size for the selected text.","vzEyrv":"Font size","7VCkJ8":"Set the text color for the selected text.","qjWFaR":"Text color","LVWgFu":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"WXwRy1":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"G/o315":"Set the text highlight color for the selected text.","xtHg6d":"Text highlight","1p1W/p":"Add blockquote formatting to the selected text","6+rh6I":"Blockquote","0yB3LV":"Add bold formatting to the selected text","sFMo4Z":"Bold","SMKG/s":"Bulleted list","/BYCMi":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"V+3IBe":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"hbIo4L":"Add a code block","7GkMcx":"Codeblock","2r4JYl":"Add inline code formatting to the selected text","Up8Tpe":"Code","ATHSPS":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"7DC1VE":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"hnrBeo":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"NkZAcw":"Italicize the selected text","2fTW9e":"Italic","c759Ra":"Ordered list","uQwrZu":"Strikethrough the selected text","pT3qly":"Strikethrough","BHk+zu":"Subscript","18BVwM":"Superscript","tOIVCV":"Tasked list","4Janx3":"Underline the selected text","dCHt+D":"Underline","YYAprs":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"tczyZL":"Show hidden whitespace characters in your editor.","0qAX23":"Toggle Whitespace","ezMADU":"Undo the most recent action","N3P7EC":"Undo","2nj/+s":"Update annotation","dWD7u4":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"qXqgVT":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.set-font-size.label":"Font size","ui.text-color.grape":"Grape","ui.text-color.grape.hue":["Grape ",["hue"]],"ui.text-color.gray":"Gray","ui.text-color.gray.hue":["Gray ",["hue"]],"ui.text-color.green":"Green","ui.text-color.green.hue":["Green ",["hue"]],"keyboard.shortcut.home":"Home","extension.command.increase-font-size.label":"Increase","extension.command.increase-indent.label":"Increase indentation","extension.command.increase-font-size.description":"Increase the font size","ui.text-color.indigo":"Indigo","ui.text-color.indigo.hue":["Indigo ",["hue"]],"extension.command.insert-paragraph.description":"Insert a new paragraph","extension.command.insert-emoji.label":"Insert Emoji","extension.command.insert-paragraph.label":"Insert Paragraph","extension.command.toggle-italic.label":"Italic","extension.command.toggle-italic.description":"Italicize the selected text","extension.command.justify-align.label":"Justify","R7NlCw":"Alt","RbDiK5":"Arrow Down","Dgyd+E":"Arrow Left","8pdCk4":"Arrow Right","Gp/343":"Arrow Up","PFPV0A":"Backspace","0IRYvp":"Caps Lock","X7HX0D":"Command","zq0AdD":"Control","8SfToN":"Delete","Ys/uah":"End","3K5hww":"Enter","veQt1j":"Enter","ySv7i+":"Home","e6RUI1":"Page Down","EEJk31":"Page Up","7sbhAU":"Shift","Q4eplT":"Space","SUhVVC":"Tab","extension.command.left-align.label":"Left align","ui.text-color.lime":"Lime","ui.text-color.lime.hue":["Lime ",["hue"]],"react-components.mention-atom-component.zero-items":"No items available","ui.text-color.orange":"Orange","ui.text-color.orange.hue":["Orange ",["hue"]],"extension.command.toggle-ordered-list.label":"Ordered list","keyboard.shortcut.pageDown":"Page Down","keyboard.shortcut.pageUp":"Page Up","extension.command.paste.label":"Paste","extension.command.paste.description":"Paste content into the editor","ui.text-color.pink":"Pink","ui.text-color.pink.hue":["Pink ",["hue"]],"zvMfIA":"No items available","pEjhti":"Static Menu","ui.text-color.red":"Red","ui.text-color.red.hue":["Red ",["hue"]],"extension.command.redo.label":"Redo","extension.command.redo.description":"Redo the most recent action","extension.command.remove-annotation.label":"Remove annotation","extension.command.right-align.label":"Right align","extension.command.select-all.label":"Select all","extension.command.select-all.description":"Select all content within the editor","extension.command.insert-horizontal-rule.description":"Separate content with a diving horizontal line","extension.command.set-casing.label":"Set text case","extension.command.set-font-size.description":"Set the font size for the selected text.","extension.command.set-text-color.description":"Set the text color for the selected text.","extension.command.set-text-highlight.description":"Set the text highlight color for the selected text.","keyboard.shortcut.shift":"Shift","extension.command.toggle-whitespace.description":"Show hidden whitespace characters in your editor.","keyboard.shortcut.space":"Space","extension.command.toggle-strike.label":"Strikethrough","extension.command.toggle-strike.description":"Strikethrough the selected text","extension.command.toggle-subscript.label":"Subscript","extension.command.toggle-superscript.label":"Superscript","keyboard.shortcut.tab":"Tab","extension.command.toggle-task-list.description":"Tasked list","ui.text-color.teal":"Teal","ui.text-color.teal.hue":["Teal ",["hue"]],"extension.command.set-text-color.label":"Text color","extension.command.set-text-highlight.label":"Text highlight","extension.command.toggle-whitespace.label":"Toggle Whitespace","ui.text-color.transparent":"Transparent","slrB1c":"Black","6QML30":"Blue","xw+keN":["Blue ",["hue"]],"38RHqP":"Cyan","D89yPf":["Cyan ",["hue"]],"VjBLnd":"Grape","Rp40yv":["Grape ",["hue"]],"5Dm9D1":"Gray","HGjXjC":["Gray ",["hue"]],"b9fz+n":"Green","18jo3M":["Green ",["hue"]],"CFzqCV":"Indigo","aVlDku":["Indigo ",["hue"]],"04PfLc":"Lime","KRTK6Y":["Lime ",["hue"]],"pSnXFd":"Orange","ve/MJZ":["Orange ",["hue"]],"OvCgDa":"Pink","l7NqyT":["Pink ",["hue"]],"IT9k0j":"Red","AdyJ7/":["Red ",["hue"]],"3D2UWc":"Teal","Dcq0Y1":["Teal ",["hue"]],"bsi2ik":"Transparent","Tj3PRR":"Violet","xxMH5N":["Violet ",["hue"]],"Rum0ah":"White","4gaw/Q":"Yellow","hhauc3":["Yellow ",["hue"]],"extension.command.toggle-underline.label":"Underline","extension.command.toggle-underline.description":"Underline the selected text","extension.command.undo.label":"Undo","extension.command.undo.description":"Undo the most recent action","extension.command.update-annotation.label":"Update annotation","ui.text-color.violet":"Violet","ui.text-color.violet.hue":["Violet ",["hue"]],"ui.text-color.white":"White","ui.text-color.yellow":"Yellow","ui.text-color.yellow.hue":["Yellow ",["hue"]]}'),uf={};PT(uf,NT);Gi.loadLocaleData("en",{plurals:uf.en});Gi.load("en",LT);Gi.activate("en");var BT=Object.defineProperty,zT=Object.getOwnPropertyDescriptor,$T=(t,e,n,r)=>{for(var s=r>1?void 0:r?zT(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&BT(e,n,s),s},FT={...cn.defaultOptions,...gs.defaultOptions},VT=[...cn.staticKeys,...gs.staticKeys],ys=class extends te{get name(){return"react"}onSetOptions(t){const{pickChanged:e}=t;this.getExtension(cn).setOptions(e(["placeholder"]))}createExtensions(){const{emptyNodeClass:t,placeholder:e,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:s,defaultInlineNode:i,nodeViewComponents:o}=this.options;return[new cn({emptyNodeClass:t,placeholder:e,priority:X.Low}),new gs({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:s,defaultInlineNode:i,nodeViewComponents:o})]}};ys=$T([G({defaultOptions:FT,staticKeys:VT})],ys);var df={};Object.defineProperty(df,"__esModule",{value:!0});function HT(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length===2)return Xc(t[0],t[1])||null;var n=t.slice(1).reduce(function(r,s){return Xc(r,s)},t[0]);return n||null}var kr=df.default=HT,Gc=new WeakMap;function Xc(t,e){if(t&&e){var n=Gc.get(t)||new WeakMap;Gc.set(t,n);var r=n.get(e)||function(s){Yc(t,s),Yc(e,s)};return n.set(e,r),r}return t||e}function Yc(t,e){typeof t=="function"?t(e):t.current=e}var hf=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},wo=(t,e,n)=>(hf(t,e,"read from private field"),n?n.call(t):e.get(t)),UT=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},jT=(t,e,n,r)=>(hf(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function WT(){const[,t]=$.useState(M());return $.useCallback(()=>{t(M())},[])}var ff=$.createContext(null);function el(t){const e=$.useContext(ff),n=$.useRef(WT());R(e,{code:b.REACT_PROVIDER_CONTEXT});const{addHandler:r}=e;return $.useEffect(()=>{let s=t;if(s){if(Rn(s)){const{autoUpdate:i}=s;s=i?()=>n.current():void 0}if(ee(s))return r("updated",s)}},[r,t]),e}function KT(t=!0){return el({autoUpdate:t}).active}function qT(){return el().commands}var[JT,VO]=vv(({props:t})=>{const e=t.locale??"en",n=t.i18n??Gi,r=t.supportedLocales??[e],s=n._.bind(n);return{locale:e,i18n:n,supportedLocales:r,t:s}});function Zc(t,e={}){const{core:n,react:r,...s}=e;return tb(t)?t:eb.create(()=>[...Au(t),new ys(r),...uv(n)],s)}function GT(t,e={}){const n=$.useRef(t),r=$.useRef(e),[s,i]=$.useState(()=>Zc(t,e));return n.current=t,r.current=e,$.useEffect(()=>s.addHandler("destroy",()=>{i(()=>Zc(n.current,r.current))}),[s]),s}var XT=typeof kr=="object"&&kr.__esModule&&kr.default?kr.default:kr,qn,YT=class extends Gx{constructor(t){if(super(t),UT(this,qn,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=e=>this.internalGetRootProps(e,null),this.internalGetRootProps=(e,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:s,...i}=e??M();return{[r]:XT(s,this.onRef),key:this.uid,...i,children:n}},this.onRef=e=>{e&&(this.rootPropsConfig.count+=1,R(this.rootPropsConfig.count<=1,{code:b.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),jT(this,qn,e),this.onRefLoad())},this.manager.view){this.manager.view.setProps({state:this.manager.view.state,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0});return}this.manager.getExtension(cn).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(t){return super.update(t),this}createView(t){return new my(null,{state:t,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:t,...e}){const{triggerChange:n=!0,tr:r,transactions:s}=e;if(this.props.state){const{onChange:i}=this.props;R(i,{code:b.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),R(n,{code:b.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:t,tr:r,transactions:s});return}!r&&!s&&(t=t.apply(t.tr.setMeta(rl,{}))),this.view.updateState(t),n&&(s==null?void 0:s.length)!==0&&this.onChange({state:t,tr:r,transactions:s}),this.manager.onStateUpdate({previousState:this.previousState,state:t,tr:r,transactions:s})}updateControlledState(t,e){this.previousStateOverride=e,t=t.apply(t.tr.setMeta(rl,{})),this.view.updateState(t),this.manager.onStateUpdate({previousState:this.previousState,state:t}),this.previousStateOverride=void 0}addProsemirrorViewToDom(t,e){this.props.insertPosition==="start"?t.insertBefore(e,t.firstChild):t.append(e)}onRefLoad(){R(wo(this,qn),{code:b.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:t}=this.props;this.addProsemirrorViewToDom(wo(this,qn),this.view.dom),t&&this.focus(t),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&wo(this,qn)&&this.view.setProps({...this.view.props,editable:()=>this.props.editable??!0})}get frameworkOutput(){return{...this.baseOutput,getRootProps:this.getRootProps,portalContainer:this.manager.store.portalContainer}}resetRender(){this.rootPropsConfig.called=!1,this.rootPropsConfig.count=0}};qn=new WeakMap;var pf=typeof document<"u"?$.useLayoutEffect:$.useEffect;function ZT(t){const e=$.useRef();return pf(()=>{e.current=t}),e.current}function QT(t){const{manager:e,state:n}=t,{placeholder:r,editable:s}=t;$.useRef(!0).current&&!en(r)&&e.getExtension(ys).setOptions({placeholder:r}),$.useEffect(()=>{r!=null&&e.getExtension(ys).setOptions({placeholder:r})},[r,e]);const[o]=$.useState(()=>{if(n)return n;const l=e.createEmptyDoc(),[c,u]=pe(t.initialContent)?t.initialContent:[t.initialContent??l];return e.createState({content:c,selection:u})}),a=eO({initialEditorState:o,getProps:()=>t});return $.useEffect(()=>()=>{a.destroy()},[a]),$.useEffect(()=>{a.onUpdate()},[s,a]),tO(a),a.frameworkOutput}function eO(t){const e=$.useRef(t);e.current=t;const n=$.useMemo(()=>new YT(e.current),[]);return n.update(t),n}function tO(t){const{state:e}=t.props,n=$.useRef(!!e),r=ZT(e);pf(()=>{const s=e?n.current===!0:n.current===!1;R(s,{code:b.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!e||e===r)&&t.updateControlledState(e,r??void 0)},[e,r,t])}function nO(t={}){const{content:e,document:n,selection:r,extensions:s,...i}=t,o=GT(s??(()=>[]),i),[a,l]=$.useState(()=>o.createState({selection:r,content:e??o.createEmptyDoc()})),c=$.useCallback(({state:d})=>{l(d)},[]),u=$.useCallback(()=>o.output,[o]);return $.useMemo(()=>({state:a,setState:l,manager:o,onChange:c,getContext:u}),[u,o,c,a])}var oa=()=>Me.createElement("div",{className:p1.EDITOR_WRAPPER,...el().getRootProps()}),rO=t=>(t.hook(),null);function sO(t){const{children:e,autoRender:n,i18n:r,locale:s,supportedLocales:i,hooks:o=[],...a}=t,l=QT(a),c=gv(l.portalContainer),u=n==="start"||n===!0||!e&&en(n),d=n==="end";return Me.createElement(JT,{i18n:r,locale:s,supportedLocales:i},Me.createElement(ff.Provider,{value:l},Me.createElement(mv,{portals:c}),o.map((h,f)=>Me.createElement(rO,{hook:h,key:f})),u&&Me.createElement(oa,null),e,d&&Me.createElement(oa,null)))}const iO="_richTextToolbar_1gbkk_1",oO="_richTextToolbarContainer_1gbkk_5",Qc={richTextToolbar:iO,richTextToolbarContainer:oO};var Jn=(t=>(t.BOLD="bold",t.ITALIC="italic",t.CODE="code",t.UL="ul",t.OL="ol",t))(Jn||{});const aa=({disabled:t=!1,toolbarComponent:e=null})=>{const{focus:n,toggleBold:r,toggleBulletList:s,toggleCode:i,toggleItalic:o,toggleOrderedList:a}=qT(),l=KT(),c=[{icon:Jn.BOLD,onClick:r,active:l.bold()},{icon:Jn.ITALIC,onClick:o,active:l.italic()},{icon:Jn.CODE,onClick:i,active:l.code()},{icon:Jn.UL,onClick:s,active:l.bulletList()},{icon:Jn.OL,onClick:a,active:l.orderedList()}];return ae.jsxs("div",{className:Qc.richTextToolbarContainer,children:[ae.jsx("div",{className:Qc.richTextToolbar,children:c.map((u,d)=>ae.jsx(xu,{small:!0,round:!0,basic:!0,icon:u.icon,colored:xf.MUTED,onClick:()=>{u.onClick(),n()},active:u.active,disabled:t},d))}),e]})};try{aa.displayName="RichTextToolbar",aa.__docgenInfo={description:"",displayName:"RichTextToolbar",props:{disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},toolbarComponent:{defaultValue:{value:"null"},description:"",name:"toolbarComponent",required:!1,type:{name:"ReactNode"}}}}}catch{}const aO="_inputInTable_ta5ga_1",lO="_inputHover_ta5ga_13",cO="_inputFocus_ta5ga_18",uO="_inputError_ta5ga_25",dO="_inputWarning_ta5ga_26",hO="_inputDisabled_ta5ga_61",fO="_hideScrollbars_ta5ga_67",pO="_richTextInput_ta5ga_77",mO={inputInTable:aO,inputHover:lO,inputFocus:cO,inputError:uO,inputWarning:dO,inputDisabled:hO,hideScrollbars:fO,richTextInput:pO},xs=$.forwardRef(({placeholder:t,onChange:e,value:n,disabled:r,toolbarComponent:s},i)=>{const o=$.useContext(yf),a=r||o,{manager:l,state:c,setState:u,getContext:d}=nO({extensions:()=>[new Nn,new ps,new ds,new fs,new hr,new ms,new cn({placeholder:t})],content:n,selection:"start",stringHandler:"markdown"});$.useImperativeHandle(i,()=>d(),[d]);const h=({helpers:f,state:p})=>{const m=f.getMarkdown(p);e&&e(m),u(p)};return ae.jsx("div",{className:mO.richTextInput,children:ae.jsxs(sO,{manager:l,state:c,placeholder:t,onChange:h,editable:!a,children:[ae.jsx(aa,{disabled:a,toolbarComponent:s}),ae.jsx(oa,{})]})})});try{xs.displayName="RichTextInput",xs.__docgenInfo={description:"",displayName:"RichTextInput",props:{disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((markdown: string) => void)"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"string"}},toolbarComponent:{defaultValue:null,description:"",name:"toolbarComponent",required:!1,type:{name:"ReactNode"}}}}}catch{}const HO={title:"Forms/RichTextInput",component:xs,args:{}},Ms=t=>{const[e,n]=Me.useState(t.value);return ae.jsxs(ae.Fragment,{children:[ae.jsx(xs,{...t,value:e,onChange:n}),ae.jsx("pre",{children:ae.jsx("strong",{children:"Markdown output:"})}),ae.jsx("pre",{children:e})]})},Ds=Ms.bind({}),Wr=Ms.bind({});Wr.args={value:`Paragraph goes here lorem ipsum dolor.
178
+ `}}});function JS(t,e){return N(t,{gfm:!0,smartLists:!0,xhtml:!0,sanitizer:e})}function GS(t){R(typeof document,{code:b.EXTENSION,message:"Attempting to sanitize html within a non-browser environment. Please provide your own `sanitizeHtml` method to the `MarkdownExtension`."});const e=new DOMParser().parseFromString(`<!DOCTYPE html><html><body>${t}</body>`,"text/html");return e.normalize(),nf(e.body),e.body.innerHTML}function nf(t){if(!Uy(t)){if(!Ie(t)||/^(script|iframe|object|embed|svg)$/i.test(t.tagName))return t==null?void 0:t.remove();for(const{name:e}of t.attributes)/^(class|id|name|href|src|alt|align|valign)$/i.test(e)||t.attributes.removeNamedItem(e);for(const e of t.childNodes)nf(e)}}var hr=class extends te{get name(){return"markdown"}onCreate(){this.store.setStringHandler("markdown",this.markdownToProsemirrorNode.bind(this))}createPlugin(){return{props:{clipboardTextSerializer:this.options.copyAsMarkdown?e=>{const n=document.createElement("div"),r=qe.fromSchema(this.store.schema);return n.append(r.serializeFragment(e.content)),this.options.htmlToMarkdown(n.innerHTML)}:void 0}}}markdownToProsemirrorNode(t){return this.store.stringHandlers.html({...t,content:this.options.markdownToHtml(t.content,this.options.htmlSanitizer)})}insertMarkdown(t,e){return n=>{const{state:r}=n;let s=this.options.markdownToHtml(t,this.options.htmlSanitizer);s=!(e!=null&&e.alwaysWrapInBlock)&&s.startsWith("<p><")&&s.endsWith(`</p>
179
+ `)?s.slice(3,-5):`<div>${s}</div>`;const i=this.store.stringHandlers.html({content:s,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(i,{...e,replaceEmptyParentBlock:!0})(n)}}getMarkdown(t){return this.options.htmlToMarkdown(this.store.helpers.getHTML(t))}toggleBoldMarkdown(){return t=>!1}};qi([_()],hr.prototype,"insertMarkdown",1);qi([se()],hr.prototype,"getMarkdown",1);qi([_()],hr.prototype,"toggleBoldMarkdown",1);hr=qi([G({defaultOptions:{htmlToMarkdown:WS,markdownToHtml:JS,htmlSanitizer:GS,activeNodes:[j.Code],copyAsMarkdown:!1},staticKeys:["htmlToMarkdown","markdownToHtml","htmlSanitizer"]})],hr);var XS=Object.defineProperty,YS=Object.getOwnPropertyDescriptor,Ji=(t,e,n,r)=>{for(var s=r>1?void 0:r?YS(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&XS(e,n,s),s},ZS={icon:"paragraph",label:({t})=>t(ui.INSERT_LABEL),description:({t})=>t(ui.INSERT_DESCRIPTION)},QS={icon:"paragraph",label:({t})=>t(ui.CONVERT_LABEL),description:({t})=>t(ui.CONVERT_DESCRIPTION)},An=class extends Rt{get name(){return"paragraph"}createTags(){return[j.LastNodeCompatible,j.TextBlock,j.Block,j.FormattingNode]}createNodeSpec(t,e){return{content:"inline*",draggable:!1,...e,attrs:{...t.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...t.parse(n)})},...e.parseDOM??[]],toDOM:n=>["p",t.dom(n),0]}}convertParagraph(t={}){const{attrs:e,selection:n,preserveAttrs:r}=t;return this.store.commands.setBlockNodeType.original(this.type,e,n,r)}insertParagraph(t,e={}){const{selection:n,attrs:r}=e;return this.store.commands.insertNode.original(this.type,{content:t,selection:n,attrs:r})}shortcut(t){return this.convertParagraph()(t)}};Ji([_(QS)],An.prototype,"convertParagraph",1);Ji([_(ZS)],An.prototype,"insertParagraph",1);Ji([Ye({shortcut:w.Paragraph,command:"convertParagraph"})],An.prototype,"shortcut",1);An=Ji([G({defaultPriority:X.Medium})],An);var ev=Object.defineProperty,tv=Object.getOwnPropertyDescriptor,nv=(t,e,n,r)=>{for(var s=r>1?void 0:r?tv(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&ev(e,n,s),s},cn=class extends te{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(t,e)=>({...this.options,empty:Ra(e.doc,{ignoreAttributes:!0})}),apply:(t,e,n,r)=>rv({pluginState:e,tr:t,extension:this,state:r})},props:{decorations:t=>sv({state:t,extension:this})}}}onSetOptions(t){const{changes:e}=t;e.placeholder.changed&&this.store.phase>=Pe.EditorView&&this.store.updateAttributes()}};cn=nv([G({defaultOptions:{emptyNodeClass:w1.IS_EMPTY,placeholder:""}})],cn);function rv(t){const{pluginState:e,extension:n,tr:r,state:s}=t;return r.docChanged?{...n.options,empty:Ra(s.doc)}:e}function sv(t){const{extension:e,state:n}=t,{empty:r}=e.pluginKey.getState(n),{emptyNodeClass:s,placeholder:i}=e.options;if(!r)return null;const o=[];return n.doc.descendants((a,l)=>{const c=Q.node(l,l+a.nodeSize,{class:s,"data-placeholder":i});o.push(c)}),W.create(n.doc,o)}var iv=Object.defineProperty,ov=Object.getOwnPropertyDescriptor,av=(t,e,n,r)=>{for(var s=r>1?void 0:r?ov(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&iv(e,n,s),s},ra=class extends Rt{get name(){return"text"}createTags(){return[j.InlineNode]}createNodeSpec(){return{}}};ra=av([G({disableExtraAttributes:!0,defaultPriority:X.Medium})],ra);var lv={...cr.defaultOptions,...An.defaultOptions,...bt.defaultOptions,excludeExtensions:[]};function cv(t={}){t={...lv,...t};const{content:e,depth:n,getDispatch:r,getState:s,newGroupDelay:i,excludeExtensions:o}=t,a={};for(const c of o??[])a[c]=!0;const l=[];if(!a.history){const c=new bt({depth:n,getDispatch:r,getState:s,newGroupDelay:i});l.push(c)}return a.doc||l.push(new cr({content:e})),a.text||l.push(new ra),a.paragraph||l.push(new An),a.positioner||l.push(new us),a.gapCursor||l.push(new ea),a.events||l.push(new Si),l}var uv=Object.defineProperty,dv=Object.getOwnPropertyDescriptor,hv=(t,e,n,r)=>{for(var s=r>1?void 0:r?dv(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&uv(e,n,s),s},rf=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},O=(t,e,n)=>(rf(t,e,"read from private field"),n?n.call(t):e.get(t)),Ue=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Ve=(t,e,n,r)=>(rf(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Fr,fv=class{constructor(){this.portals=new Map,Ue(this,Fr,Hi()),this.on=t=>O(this,Fr).on("update",t),this.once=t=>{const e=O(this,Fr).on("update",n=>{e(),t(n)});return e}}update(){O(this,Fr).emit("update",this.portals)}render({Component:t,container:e}){const n=this.portals.get(e);this.portals.set(e,{Component:t,key:(n==null?void 0:n.key)??ni()}),this.update()}forceUpdate(){for(const[t,{Component:e}]of this.portals)this.portals.set(t,{Component:e,key:ni()})}remove(t){this.portals.delete(t),this.update()}};Fr=new WeakMap;var pv=t=>{const{portals:e}=t;return Me.createElement(Me.Fragment,null,e.map(([n,{Component:r,key:s}])=>bf.createPortal(Me.createElement(r,null),n,s)))};function mv(t){const[e,n]=$.useState(()=>Array.from(t.portals.entries()));return $.useEffect(()=>t.on(r=>{n(Array.from(r.entries()))}),[t]),$.useMemo(()=>e,[e])}var ne,Vr,gn,Hr,Ys,Ur,Kn,jr,Zs,Et,Oe,sa,sf=class{constructor({getPosition:t,node:e,portalContainer:n,view:r,ReactComponent:s,options:i}){Ue(this,ne,void 0),Ue(this,Vr,[]),Ue(this,gn,void 0),Ue(this,Hr,void 0),Ue(this,Ys,void 0),Ue(this,Ur,void 0),Ue(this,Kn,void 0),Ue(this,jr,!1),Ue(this,Zs,void 0),Ue(this,Et,void 0),Ue(this,Oe,void 0),Ue(this,sa,l=>{l&&(R(O(this,Et),{code:b.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${O(this,ne).type.name}' which doesn't support content.`}),l.append(O(this,Et)))}),this.Component=()=>{const l=O(this,Ys);return R(l,{code:b.REACT_NODE_VIEW,message:`The custom react node view provided for ${O(this,ne).type.name} doesn't have a valid ReactComponent`}),Me.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:O(this,gn),getPosition:O(this,Ur),node:O(this,ne),forwardRef:O(this,sa),decorations:O(this,Vr)})},this.updateAttributes=l=>{if(!O(this,gn).editable)return;const c=O(this,Ur).call(this);if(c==null)return;const u=O(this,gn).state.tr.setNodeMarkup(c,void 0,{...O(this,ne).attrs,...l});O(this,gn).dispatch(u)},R(ee(t),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),Ve(this,ne,e),Ve(this,gn,r),Ve(this,Hr,n),Ve(this,Ys,s),Ve(this,Ur,t),Ve(this,Kn,i),Ve(this,Oe,this.createDom());const{contentDOM:o,wrapper:a}=this.createContentDom()??{};Ve(this,Zs,o??void 0),Ve(this,Et,a),O(this,Et)&&O(this,Oe).append(O(this,Et)),this.setDomAttributes(O(this,ne),O(this,Oe)),this.Component.displayName=Cu(`${O(this,ne).type.name}NodeView`),this.renderComponent()}static create(t){const{portalContainer:e,ReactComponent:n,options:r}=t;return(s,i,o)=>new sf({options:r,node:s,view:i,getPosition:o,portalContainer:e,ReactComponent:n})}get selected(){return O(this,jr)}get contentDOM(){return O(this,Zs)}get dom(){return O(this,Oe)}renderComponent(){O(this,Hr).render({Component:this.Component,container:O(this,Oe)})}createDom(){const{defaultBlockNode:t,defaultInlineNode:e}=O(this,Kn),n=O(this,ne).isInline?document.createElement(e):document.createElement(t);return n.classList.add(`${ol(O(this,ne).type.name)}-node-view-wrapper`),n}createContentDom(){var t,e;if(O(this,ne).isLeaf)return;const n=(e=(t=O(this,ne).type.spec).toDOM)==null?void 0:e.call(t,O(this,ne));if(!n)return;const{contentDOM:r,dom:s}=qe.renderSpec(document,n);let i;if(Ie(s))return i=s,s===r&&(i=document.createElement("span"),i.classList.add(`${ol(O(this,ne).type.name)}-node-view-content-wrapper`),i.append(r)),Ie(r),{wrapper:i,contentDOM:r}}update(t,e){return _a({types:O(this,ne).type,node:t})?(O(this,ne)===t&&O(this,Vr)===e||(O(this,ne).sameMarkup(t)||this.setDomAttributes(t,O(this,Oe)),Ve(this,ne,t),Ve(this,Vr,e),this.renderComponent()),!0):!1}setDomAttributes(t,e){const{toDOM:n}=O(this,ne).type.spec;let r=t.attrs;if(n){const s=n(t);if(D(s)||gv(s))return;Rn(s[1])&&(r=s[1])}for(const[s,i]of he(r))e.setAttribute(s,i)}selectNode(){Ve(this,jr,!0),O(this,Oe)&&O(this,Oe).classList.add(nl),this.renderComponent()}deselectNode(){Ve(this,jr,!1),O(this,Oe)&&O(this,Oe).classList.remove(nl),this.renderComponent()}destroy(){O(this,Hr).remove(O(this,Oe))}ignoreMutation(t){return t.type==="selection"?!O(this,ne).type.spec.selectable:O(this,Et)?!O(this,Et).contains(t.target):!0}stopEvent(t){var e;if(!O(this,Oe))return!1;if(ee(O(this,Kn).stopEvent))return O(this,Kn).stopEvent({event:t});const n=t.target;if(!(O(this,Oe).contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s)return!0;const o=!!O(this,ne).type.spec.draggable,a=I.isSelectable(O(this,ne)),l=t.type==="copy",c=t.type==="paste",u=t.type==="cut",d=t.type==="mousedown",h=t.type.startsWith("drag");return!o&&a&&h&&t.preventDefault(),!(h||s||l||c||u||d&&a)}},Uc=sf;ne=new WeakMap;Vr=new WeakMap;gn=new WeakMap;Hr=new WeakMap;Ys=new WeakMap;Ur=new WeakMap;Kn=new WeakMap;jr=new WeakMap;Zs=new WeakMap;Et=new WeakMap;Oe=new WeakMap;sa=new WeakMap;function gv(t){return mi(t)||Rn(t)&&mi(t.dom)}var gs=class extends te{constructor(){super(...arguments),this.portalContainer=new fv}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const t=M(),e=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!Ts(r)||r.reactComponentEnvironment==="ssr"||(t[r.name]=Uc.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=he({...this.options.nodeViewComponents,...e});for(const[r,s]of n)t[r]=Uc.create({options:this.options,ReactComponent:s,portalContainer:this.portalContainer});return t}};gs=hv([G({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],gs);function yv(t){const e=$.createContext(null),n=xv(e);return[s=>{const i=t(s);return Me.createElement(e.Provider,{value:i},s.children)},n,e]}function xv(t){return(e,n)=>{const r=$.useContext(t),s=bv(r);if(!r)throw new Error("`useContextHook` must be placed inside the `Provider` returned by the `createContextState` method");if(!e)return r;if(typeof e!="function")throw new TypeError("invalid arguments passed to `useContextHook`. This hook must be called with zero arguments, a getter function or a path string.");const i=e(r);if(!s||!n)return i;const o=e(s);return n(o,i)?o:i}}function bv(t){const e=$.useRef();return kv(()=>{e.current=t}),e.current}var kv=typeof document<"u"?$.useLayoutEffect:$.useEffect;function Sv(t,e){return yv(n=>{const r=$.useRef(null),s=$.useRef(),i=e==null?void 0:e(n),[o,a]=$.useState(()=>t({get:jc(r),set:Wc(s),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return $.useEffect(()=>{l.length!==0&&a(c=>t({get:jc(r),set:Wc(s),previousContext:c,props:n,state:i}))},l),r.current=o,s.current=a,o})}function jc(t){return e=>{if(!t.current)throw new Error("`get` called outside of function scope. `get` can only be called within a function.");if(!e)return t.current;if(typeof e!="function")throw new TypeError("Invalid arguments passed to `useContextHook`. The hook must be called with zero arguments, a getter function or a path string.");return e(t.current)}}function Wc(t){return e=>{if(!t.current)throw new Error("`set` called outside of function scope. `set` can only be called within a function.");t.current(n=>({...n,...typeof e=="function"?e(n):e}))}}var of={},af={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.errorMessages=t.ErrorType=void 0;var e;(function(n){n.MalformedUnicode="MALFORMED_UNICODE",n.MalformedHexadecimal="MALFORMED_HEXADECIMAL",n.CodePointLimit="CODE_POINT_LIMIT",n.OctalDeprecation="OCTAL_DEPRECATION",n.EndOfString="END_OF_STRING"})(e=t.ErrorType||(t.ErrorType={})),t.errorMessages=new Map([[e.MalformedUnicode,"malformed Unicode character escape sequence"],[e.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[e.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[e.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[e.EndOfString,"malformed escape sequence at end of string"]])})(af);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.unraw=t.errorMessages=t.ErrorType=void 0;const e=af;Object.defineProperty(t,"ErrorType",{enumerable:!0,get:function(){return e.ErrorType}}),Object.defineProperty(t,"errorMessages",{enumerable:!0,get:function(){return e.errorMessages}});function n(f){return!f.match(/[^a-f0-9]/i)?parseInt(f,16):NaN}function r(f,p,m){const g=n(f);if(Number.isNaN(g)||m!==void 0&&m!==f.length)throw new SyntaxError(e.errorMessages.get(p));return g}function s(f){const p=r(f,e.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(p)}function i(f,p){const m=r(f,e.ErrorType.MalformedUnicode,4);if(p!==void 0){const g=r(p,e.ErrorType.MalformedUnicode,4);return String.fromCharCode(m,g)}return String.fromCharCode(m)}function o(f){return f.charAt(0)==="{"&&f.charAt(f.length-1)==="}"}function a(f){if(!o(f))throw new SyntaxError(e.errorMessages.get(e.ErrorType.MalformedUnicode));const p=f.slice(1,-1),m=r(p,e.ErrorType.MalformedUnicode);try{return String.fromCodePoint(m)}catch(g){throw g instanceof RangeError?new SyntaxError(e.errorMessages.get(e.ErrorType.CodePointLimit)):g}}function l(f,p=!1){if(p)throw new SyntaxError(e.errorMessages.get(e.ErrorType.OctalDeprecation));const m=parseInt(f,8);return String.fromCharCode(m)}const c=new Map([["b","\b"],["f","\f"],["n",`
180
+ `],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(f){return c.get(f)||f}const d=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function h(f,p=!1){return f.replace(d,function(m,g,y,E,L,q,J,F,oe){if(g!==void 0)return"\\";if(y!==void 0)return s(y);if(E!==void 0)return a(E);if(L!==void 0)return i(L,q);if(J!==void 0)return i(J);if(F==="0")return"\0";if(F!==void 0)return l(F,!p);if(oe!==void 0)return u(oe);throw new SyntaxError(e.errorMessages.get(e.ErrorType.EndOfString))})}t.unraw=h,t.default=h})(of);const vv=bs(of),_t=t=>typeof t=="string",wv=t=>typeof t=="function",Kc=new Map;function Qa(t){return[...Array.isArray(t)?t:[t],"en"]}function lf(t,e,n){const r=Qa(t);return Mi(()=>_i("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(_t(e)?new Date(e):e)}function ia(t,e,n){const r=Qa(t);return Mi(()=>_i("number",r,n),()=>new Intl.NumberFormat(r,n)).format(e)}function qc(t,e,n,{offset:r=0,...s}){const i=Qa(t),o=e?Mi(()=>_i("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):Mi(()=>_i("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return s[n]??s[o.select(n-r)]??s.other}function Mi(t,e){const n=t();let r=Kc.get(n);return r||(r=e(),Kc.set(n,r)),r}function _i(t,e,n){const r=e.join("-");return`${t}-${r}-${JSON.stringify(n)}`}const cf=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g,Ev=(t,e,n={})=>{e=e||t;const r=i=>_t(i)?n[i]||{style:i}:i,s=(i,o)=>{const a=Object.keys(n).length?r("number"):{},l=ia(e,i,a);return o.replace("#",l)};return{plural:(i,o)=>{const{offset:a=0}=o,l=qc(e,!1,i,o);return s(i-a,l)},selectordinal:(i,o)=>{const{offset:a=0}=o,l=qc(e,!0,i,o);return s(i-a,l)},select:(i,o)=>o[i]??o.other,number:(i,o)=>ia(e,i,r(o)),date:(i,o)=>lf(e,i,r(o)),undefined:i=>i}};function Cv(t,e,n){return(r,s={})=>{const i=Ev(e,n,s),o=l=>Array.isArray(l)?l.reduce((c,u)=>{if(_t(u))return c+u;const[d,h,f]=u;let p={};f!=null&&!_t(f)?Object.keys(f).forEach(g=>{p[g]=o(f[g])}):p=f;const m=i[h](r[d],p);return m==null?c:c+m},""):l,a=o(t);return _t(a)&&cf.test(a)?vv(a.trim()):_t(a)?a.trim():a}}var Tv=Object.defineProperty,Ov=(t,e,n)=>e in t?Tv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Mv=(t,e,n)=>(Ov(t,typeof e!="symbol"?e+"":e,n),n);class _v{constructor(){Mv(this,"_events",{})}on(e,n){return this._hasEvent(e)||(this._events[e]=[]),this._events[e].push(n),()=>this.removeListener(e,n)}removeListener(e,n){if(!this._hasEvent(e))return;const r=this._events[e].indexOf(n);~r&&this._events[e].splice(r,1)}emit(e,...n){this._hasEvent(e)&&this._events[e].map(r=>r.apply(this,n))}_hasEvent(e){return Array.isArray(this._events[e])}}var Nv=Object.defineProperty,Av=(t,e,n)=>e in t?Nv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$n=(t,e,n)=>(Av(t,typeof e!="symbol"?e+"":e,n),n);class Rv extends _v{constructor(e){super(),$n(this,"_locale"),$n(this,"_locales"),$n(this,"_localeData"),$n(this,"_messages"),$n(this,"_missing"),$n(this,"t",this._.bind(this)),this._messages={},this._localeData={},e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(e.locale!=null||e.locales!=null)&&this.activate(e.locale,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(e,n){this._localeData[e]==null?this._localeData[e]=n:Object.assign(this._localeData[e],n)}loadLocaleData(e,n){n!=null?this._loadLocaleData(e,n):Object.keys(e).forEach(r=>this._loadLocaleData(r,e[r])),this.emit("change")}_load(e,n){this._messages[e]==null?this._messages[e]=n:Object.assign(this._messages[e],n)}load(e,n){n!=null?this._load(e,n):Object.keys(e).forEach(r=>this._load(r,e[r])),this.emit("change")}loadAndActivate({locale:e,locales:n,messages:r}){this._locale=e,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(e,n){this._locale=e,this._locales=n,this.emit("change")}_(e,n={},{message:r,formats:s}={}){_t(e)||(n=e.values||n,r=e.message,e=e.id);const i=!this.messages[e],o=this._missing;if(o&&i)return wv(o)?o(this._locale,e):o;i&&this.emit("missing",{id:e,locale:this._locale});let a=this.messages[e]||r||e;return _t(a)&&cf.test(a)?JSON.parse(`"${a}"`):_t(a)?a:Cv(a,this._locale,this._locales)(n,s)}date(e,n){return lf(this._locales||this._locale,e,n)}number(e,n){return ia(this._locales||this._locale,e,n)}}function Iv(t={}){return new Rv(t)}const Gi=Iv();function k(t,e){return e?"other":t==1?"one":"other"}function It(t,e){return e?"other":t==0||t==1?"one":"other"}function $e(t,e){var n=String(t).split("."),r=!n[1];return e?"other":t==1&&r?"one":"other"}function K(t,e){return"other"}function hn(t,e){return e?"other":t==1?"one":t==2?"two":"other"}const Dv=K,Pv=k,Lv=It;function Bv(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const zv=k;function $v(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-2);return e?"other":t==0?"zero":t==1?"one":t==2?"two":s>=3&&s<=10?"few":s>=11&&s<=99?"many":"other"}function Fv(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-2);return e?"other":t==0?"zero":t==1?"one":t==2?"two":s>=3&&s<=10?"few":s>=11&&s<=99?"many":"other"}function Vv(t,e){return e?t==1||t==5||t==7||t==8||t==9||t==10?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const Hv=k,Uv=$e;function jv(t,e){var n=String(t).split("."),r=n[0],s=r.slice(-1),i=r.slice(-2),o=r.slice(-3);return e?s==1||s==2||s==5||s==7||s==8||i==20||i==50||i==70||i==80?"one":s==3||s==4||o==100||o==200||o==300||o==400||o==500||o==600||o==700||o==800||o==900?"few":r==0||s==6||i==40||i==60||i==90?"many":"other":t==1?"one":"other"}function Wv(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return e?(s==2||s==3)&&i!=12&&i!=13?"few":"other":s==1&&i!=11?"one":s>=2&&s<=4&&(i<12||i>14)?"few":r&&s==0||s>=5&&s<=9||i>=11&&i<=14?"many":"other"}const Kv=k,qv=k,Jv=k,Gv=It,Xv=K;function Yv(t,e){return e?t==1||t==5||t==7||t==8||t==9||t==10?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const Zv=K;function Qv(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1),i=r&&n[0].slice(-2),o=r&&n[0].slice(-6);return e?"other":s==1&&i!=11&&i!=71&&i!=91?"one":s==2&&i!=12&&i!=72&&i!=92?"two":(s==3||s==4||s==9)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":t!=0&&r&&o==0?"many":"other"}const ew=k;function tw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?"other":i&&o==1&&a!=11||l==1&&c!=11?"one":i&&o>=2&&o<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function nw(t,e){var n=String(t).split("."),r=!n[1];return e?t==1||t==3?"one":t==2?"two":t==4?"few":"other":t==1&&r?"one":"other"}const rw=k;function sw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=s.slice(-1);return e?"other":i&&(r==1||r==2||r==3)||i&&o!=4&&o!=6&&o!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const iw=k,ow=k,aw=k;function lw(t,e){var n=String(t).split("."),r=n[0],s=!n[1];return e?"other":t==1&&s?"one":r>=2&&r<=4&&s?"few":s?"other":"many"}function cw(t,e){return e?t==0||t==7||t==8||t==9?"zero":t==1?"one":t==2?"two":t==3||t==4?"few":t==5||t==6?"many":"other":t==0?"zero":t==1?"one":t==2?"two":t==3?"few":t==6?"many":"other"}function uw(t,e){var n=String(t).split("."),r=n[0],s=Number(n[0])==t;return e?"other":t==1||!s&&(r==0||r==1)?"one":"other"}const dw=$e;function hw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-2),a=s.slice(-2);return e?"other":i&&o==1||a==1?"one":i&&o==2||a==2?"two":i&&(o==3||o==4)||a==3||a==4?"few":"other"}const fw=k,pw=K,mw=k,gw=k;function yw(t,e){var n=String(t).split("."),r=!n[1],s=Number(n[0])==t,i=s&&n[0].slice(-1),o=s&&n[0].slice(-2);return e?i==1&&o!=11?"one":i==2&&o!=12?"two":i==3&&o!=13?"few":"other":t==1&&r?"one":"other"}const xw=k,bw=k,kw=$e,Sw=k;function vw(t,e){return e?"other":t>=0&&t<=1?"one":"other"}function ww(t,e){return e?"other":t>=0&&t<2?"one":"other"}const Ew=$e;function Cw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=s.slice(-1);return e?t==1?"one":"other":i&&(r==1||r==2||r==3)||i&&o!=4&&o!=6&&o!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Tw=k;function Ow(t,e){return e?t==1?"one":"other":t>=0&&t<2?"one":"other"}const Mw=k,_w=$e;function Nw(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1?"one":"other":t==1?"one":t==2?"two":r&&t>=3&&t<=6?"few":r&&t>=7&&t<=10?"many":"other"}function Aw(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1||t==11?"one":t==2||t==12?"two":t==3||t==13?"few":"other":t==1||t==11?"one":t==2||t==12?"two":r&&t>=3&&t<=10||r&&t>=13&&t<=19?"few":"other"}const Rw=$e,Iw=k;function Dw(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const Pw=It;function Lw(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=r.slice(-1),o=r.slice(-2);return e?"other":s&&i==1?"one":s&&i==2?"two":s&&(o==0||o==20||o==40||o==60||o==80)?"few":s?"other":"many"}const Bw=k,zw=k;function $w(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=Number(n[0])==t,o=i&&n[0].slice(-1);return e?"other":t==1&&s?"one":r==2&&s?"two":s&&(t<0||t>10)&&i&&o==0?"many":"other"}function Fw(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}function Vw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?"other":i&&o==1&&a!=11||l==1&&c!=11?"one":i&&o>=2&&o<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Hw(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-2),a=s.slice(-2);return e?"other":i&&o==1||a==1?"one":i&&o==2||a==2?"two":i&&(o==3||o==4)||a==3||a==4?"few":"other"}function Uw(t,e){return e?t==1||t==5?"one":"other":t==1?"one":"other"}function jw(t,e){return e?t==1?"one":"other":t>=0&&t<2?"one":"other"}const Ww=$e,Kw=K,qw=K,Jw=K,Gw=$e;function Xw(t,e){var n=String(t).split("."),r=n[0],s=Number(n[0])==t,i=r.slice(-1),o=r.slice(-2);return e?"other":s&&i==1&&o!=11||!s?"one":"other"}function Yw(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}const Zw=hn;function Qw(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=Number(n[0])==t,o=i&&n[0].slice(-1);return e?"other":t==1&&s?"one":r==2&&s?"two":s&&(t<0||t>10)&&i&&o==0?"many":"other"}const eE=K,tE=K,nE=k,rE=$e,sE=k,iE=K,oE=K;function aE(t,e){var n=String(t).split("."),r=n[0],s=r.slice(-2);return e?r==1?"one":r==0||s>=2&&s<=20||s==40||s==60||s==80?"many":"other":t==1?"one":"other"}function lE(t,e){return e?"other":t>=0&&t<2?"one":"other"}const cE=k,uE=k,dE=K,hE=K;function fE(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1);return e?s==6||s==9||r&&s==0&&t!=0?"many":"other":t==1?"one":"other"}const pE=k,mE=k,gE=K;function yE(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const xE=K,bE=k,kE=k;function SE(t,e){return e?"other":t==0?"zero":t==1?"one":"other"}const vE=k;function wE(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-2),i=r&&n[0].slice(-3),o=r&&n[0].slice(-5),a=r&&n[0].slice(-6);return e?r&&t>=1&&t<=4||s>=1&&s<=4||s>=21&&s<=24||s>=41&&s<=44||s>=61&&s<=64||s>=81&&s<=84?"one":t==5||s==5?"many":"other":t==0?"zero":t==1?"one":s==2||s==22||s==42||s==62||s==82||r&&i==0&&(o>=1e3&&o<=2e4||o==4e4||o==6e4||o==8e4)||t!=0&&a==1e5?"two":s==3||s==23||s==43||s==63||s==83?"few":t!=1&&(s==1||s==21||s==41||s==61||s==81)?"many":"other"}const EE=k;function CE(t,e){var n=String(t).split("."),r=n[0];return e?"other":t==0?"zero":(r==0||r==1)&&t!=0?"one":"other"}const TE=k,OE=k,ME=K,_E=It;function NE(t,e){return e&&t==1?"one":"other"}function AE(t,e){var n=String(t).split("."),r=n[1]||"",s=Number(n[0])==t,i=s&&n[0].slice(-1),o=s&&n[0].slice(-2);return e?"other":i==1&&(o<11||o>19)?"one":i>=2&&i<=9&&(o<11||o>19)?"few":r!=0?"many":"other"}function RE(t,e){var n=String(t).split("."),r=n[1]||"",s=r.length,i=Number(n[0])==t,o=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return e?"other":i&&o==0||a>=11&&a<=19||s==2&&l>=11&&l<=19?"zero":o==1&&a!=11||s==2&&c==1&&l!=11||s!=2&&c==1?"one":"other"}const IE=k,DE=It,PE=k;function LE(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?o==1&&a!=11?"one":o==2&&a!=12?"two":(o==7||o==8)&&a!=17&&a!=18?"many":"other":i&&o==1&&a!=11||l==1&&c!=11?"one":"other"}const BE=k,zE=k;function $E(t,e){var n=String(t).split("."),r=!n[1],s=Number(n[0])==t,i=s&&n[0].slice(-2);return e?t==1?"one":"other":t==1&&r?"one":!r||t==0||i>=2&&i<=19?"few":"other"}function FE(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":"other":t==1?"one":"other"}function VE(t,e){return e&&t==1?"one":"other"}function HE(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-2);return e?"other":t==1?"one":t==0||s>=2&&s<=10?"few":s>=11&&s<=19?"many":"other"}const UE=K,jE=k,WE=hn,KE=k,qE=k;function JE(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?r&&t>=1&&t<=4?"one":"other":t==1?"one":"other"}const GE=$e,XE=k,YE=k,ZE=k,QE=K,eC=k,tC=It,nC=k,rC=k,sC=k;function iC(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1||t==5||r&&t>=7&&t<=9?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t==1?"one":"other"}const oC=k,aC=K,lC=It,cC=k;function uC(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=r.slice(-1),o=r.slice(-2);return e?"other":t==1&&s?"one":s&&i>=2&&i<=4&&(o<12||o>14)?"few":s&&r!=1&&(i==0||i==1)||s&&i>=5&&i<=9||s&&o>=12&&o<=14?"many":"other"}function dC(t,e){var n=String(t).split("."),r=n[1]||"",s=r.length,i=Number(n[0])==t,o=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return e?"other":i&&o==0||a>=11&&a<=19||s==2&&l>=11&&l<=19?"zero":o==1&&a!=11||s==2&&c==1&&l!=11||s!=2&&c==1?"one":"other"}const hC=k;function fC(t,e){var n=String(t).split("."),r=n[0];return e?"other":r==0||r==1?"one":"other"}const pC=$e,mC=k;function gC(t,e){var n=String(t).split("."),r=!n[1],s=Number(n[0])==t,i=s&&n[0].slice(-2);return e?t==1?"one":"other":t==1&&r?"one":!r||t==0||i>=2&&i<=19?"few":"other"}const yC=k,xC=K;function bC(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=r.slice(-1),o=r.slice(-2);return e?"other":s&&i==1&&o!=11?"one":s&&i>=2&&i<=4&&(o<12||o>14)?"few":s&&i==0||s&&i>=5&&i<=9||s&&o>=11&&o<=14?"many":"other"}const kC=k,SC=K,vC=k;function wC(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}function EC(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}const CC=k,TC=k,OC=hn,MC=k,_C=K,NC=K;function AC(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?"other":i&&o==1&&a!=11||l==1&&c!=11?"one":i&&o>=2&&o<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function RC(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?"other":t>=0&&t<=1?"one":r&&t>=2&&t<=10?"few":"other"}function IC(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"";return e?"other":t==0||t==1||r==0&&s==1?"one":"other"}function DC(t,e){var n=String(t).split("."),r=n[0],s=!n[1];return e?"other":t==1&&s?"one":r>=2&&r<=4&&s?"few":s?"other":"many"}function PC(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=r.slice(-2);return e?"other":s&&i==1?"one":s&&i==2?"two":s&&(i==3||i==4)||!s?"few":"other"}const LC=hn,BC=hn,zC=hn,$C=hn,FC=hn,VC=k,HC=k;function UC(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return e?t==1?"one":s==4&&i!=14?"many":"other":t==1?"one":"other"}function jC(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=r.slice(-2),l=s.slice(-1),c=s.slice(-2);return e?"other":i&&o==1&&a!=11||l==1&&c!=11?"one":i&&o>=2&&o<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}const WC=k,KC=k,qC=k,JC=K;function GC(t,e){var n=String(t).split("."),r=!n[1],s=Number(n[0])==t,i=s&&n[0].slice(-1),o=s&&n[0].slice(-2);return e?(i==1||i==2)&&o!=11&&o!=12?"one":"other":t==1&&r?"one":"other"}const XC=$e,YC=k,ZC=k,QC=k,eT=k,tT=K,nT=It,rT=k;function sT(t,e){var n=String(t).split("."),r=Number(n[0])==t,s=r&&n[0].slice(-1);return e?s==6||s==9||t==10?"few":"other":t==1?"one":"other"}function iT(t,e){var n=String(t).split("."),r=n[0],s=n[1]||"",i=!n[1],o=r.slice(-1),a=s.slice(-1);return e?t==1?"one":"other":i&&(r==1||r==2||r==3)||i&&o!=4&&o!=6&&o!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const oT=k,aT=K,lT=k,cT=k;function uT(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?"other":t==0||t==1||r&&t>=11&&t<=99?"one":"other"}const dT=k;function hT(t,e){var n=String(t).split("."),r=n[0],s=!n[1],i=Number(n[0])==t,o=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return e?o==3&&a!=13?"few":"other":s&&l==1&&c!=11?"one":s&&l>=2&&l<=4&&(c<12||c>14)?"few":s&&l==0||s&&l>=5&&l<=9||s&&c>=11&&c<=14?"many":"other"}const fT=$e,pT=k,mT=k;function gT(t,e){return e&&t==1?"one":"other"}const yT=k,xT=k,bT=It,kT=k,ST=K,vT=k,wT=k,ET=$e,CT=K,TT=K,OT=K;function MT(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const _T=Object.freeze(Object.defineProperty({__proto__:null,_in:Dv,af:Pv,ak:Lv,am:Bv,an:zv,ar:$v,ars:Fv,as:Vv,asa:Hv,ast:Uv,az:jv,be:Wv,bem:Kv,bez:qv,bg:Jv,bho:Gv,bm:Xv,bn:Yv,bo:Zv,br:Qv,brx:ew,bs:tw,ca:nw,ce:rw,ceb:sw,cgg:iw,chr:ow,ckb:aw,cs:lw,cy:cw,da:uw,de:dw,dsb:hw,dv:fw,dz:pw,ee:mw,el:gw,en:yw,eo:xw,es:bw,et:kw,eu:Sw,fa:vw,ff:ww,fi:Ew,fil:Cw,fo:Tw,fr:Ow,fur:Mw,fy:_w,ga:Nw,gd:Aw,gl:Rw,gsw:Iw,gu:Dw,guw:Pw,gv:Lw,ha:Bw,haw:zw,he:$w,hi:Fw,hr:Vw,hsb:Hw,hu:Uw,hy:jw,ia:Ww,id:Kw,ig:qw,ii:Jw,io:Gw,is:Xw,it:Yw,iu:Zw,iw:Qw,ja:eE,jbo:tE,jgo:nE,ji:rE,jmc:sE,jv:iE,jw:oE,ka:aE,kab:lE,kaj:cE,kcg:uE,kde:dE,kea:hE,kk:fE,kkj:pE,kl:mE,km:gE,kn:yE,ko:xE,ks:bE,ksb:kE,ksh:SE,ku:vE,kw:wE,ky:EE,lag:CE,lb:TE,lg:OE,lkt:ME,ln:_E,lo:NE,lt:AE,lv:RE,mas:IE,mg:DE,mgo:PE,mk:LE,ml:BE,mn:zE,mo:$E,mr:FE,ms:VE,mt:HE,my:UE,nah:jE,naq:WE,nb:KE,nd:qE,ne:JE,nl:GE,nn:XE,nnh:YE,no:ZE,nqo:QE,nr:eC,nso:tC,ny:nC,nyn:rC,om:sC,or:iC,os:oC,osa:aC,pa:lC,pap:cC,pl:uC,prg:dC,ps:hC,pt:fC,pt_PT:pC,rm:mC,ro:gC,rof:yC,root:xC,ru:bC,rwk:kC,sah:SC,saq:vC,sc:wC,scn:EC,sd:CC,sdh:TC,se:OC,seh:MC,ses:_C,sg:NC,sh:AC,shi:RC,si:IC,sk:DC,sl:PC,sma:LC,smi:BC,smj:zC,smn:$C,sms:FC,sn:VC,so:HC,sq:UC,sr:jC,ss:WC,ssy:KC,st:qC,su:JC,sv:GC,sw:XC,syr:YC,ta:ZC,te:QC,teo:eT,th:tT,ti:nT,tig:rT,tk:sT,tl:iT,tn:oT,to:aT,tr:lT,ts:cT,tzm:uT,ug:dT,uk:hT,ur:fT,uz:pT,ve:mT,vi:gT,vo:yT,vun:xT,wa:bT,wae:kT,wo:ST,xh:vT,xog:wT,yi:ET,yo:CT,yue:TT,zh:OT,zu:MT},Symbol.toStringTag,{value:"Module"}));var NT=Object.defineProperty,AT=Object.getOwnPropertyDescriptor,RT=Object.getOwnPropertyNames,IT=Object.prototype.hasOwnProperty,Jc=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of RT(e))!IT.call(t,s)&&s!==n&&NT(t,s,{get:()=>e[s],enumerable:!(r=AT(e,s))||r.enumerable});return t},DT=(t,e,n)=>(Jc(t,e,"default"),n&&Jc(n,e,"default")),PT=JSON.parse('{"extension.command.toggle-upper-case.label":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"extension.table.column_count":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"extension.table.row_count":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.toggle-columns.description":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"extension.command.toggle-columns.label":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"extension.command.set-text-direction.label":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"extension.command.set-text-direction.description":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"extension.command.toggle-heading.label":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"extension.command.toggle-callout.description":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"extension.command.toggle-callout.label":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"extension.command.toggle-code-block.description":"Add a code block","extension.command.add-annotation.label":"Add annotation","extension.command.toggle-blockquote.description":"Add blockquote formatting to the selected text","extension.command.toggle-bold.description":"Add bold formatting to the selected text","extension.command.toggle-code.description":"Add inline code formatting to the selected text","keyboard.shortcut.alt":"Alt","keyboard.shortcut.arrowDown":"Arrow Down","keyboard.shortcut.arrowLeft":"Arrow Left","keyboard.shortcut.arrowRight":"Arrow Right","keyboard.shortcut.arrowUp":"Arrow Up","keyboard.shortcut.backspace":"Backspace","ui.text-color.black":"Black","extension.command.toggle-blockquote.label":"Blockquote","ui.text-color.blue":"Blue","ui.text-color.blue.hue":["Blue ",["hue"]],"extension.command.toggle-bold.label":"Bold","extension.command.toggle-bullet-list.description":"Bulleted list","keyboard.shortcut.capsLock":"Caps Lock","extension.command.center-align.label":"Center align","extension.command.toggle-code.label":"Code","extension.command.toggle-code-block.label":"Codeblock","keyboard.shortcut.command":"Command","QcPNd6":"Image description","ogrUzJ":"Add a short description here.","yqdyzr":"Image","6/02F4":"Image source","X8H91v":"Image","zhQ7Zt":"Italic","ZL7E7l":"Underline","keyboard.shortcut.control":"Control","extension.command.convert-paragraph.description":"Convert current block into a paragraph block.","extension.command.convert-paragraph.label":"Convert Paragraph","extension.command.copy.label":"Copy","extension.command.copy.description":"Copy the selected text","extension.command.create-table.description":"Create a table with set number of rows and columns.","extension.command.create-table.label":"Create table","extension.command.cut.label":"Cut","extension.command.cut.description":"Cut the selected text","ui.text-color.cyan":"Cyan","ui.text-color.cyan.hue":["Cyan ",["hue"]],"extension.command.decrease-font-size.label":"Decrease","extension.command.decrease-indent.label":"Decrease indentation","extension.command.decrease-font-size.description":"Decrease the font size.","keyboard.shortcut.delete":"Delete","extension.command.insert-horizontal-rule.label":"Divider","keyboard.shortcut.end":"End","keyboard.shortcut.escape":"Enter","keyboard.shortcut.enter":"Enter","6PjrOF":"Add annotation","OTq5WC":"Center align","oeZ3ox":"Convert current block into a paragraph block.","m1khs+":"Convert Paragraph","w/1U+3":"Copy the selected text","kdodi0":"Copy","k0KR/u":"Create a table with set number of rows and columns.","zrwMyD":"Create table","D/nWxh":"Cut the selected text","jHPv5m":"Cut","5cNgRx":"Decrease the font size.","vyRNWx":"Decrease","Jgiol4":"Decrease indentation","1gJSHH":"Increase the font size","OQXJXz":"Increase","72TLhr":"Increase indentation","HFlfzJ":"Insert Emoji","RPq9fY":"Separate content with a diving horizontal line","OKQF+e":"Divider","zjYb9C":"Insert a new paragraph","4M4sXC":"Insert Paragraph","1Q+eVc":"Justify","ejWWtP":"Left align","wVqrpS":"Paste content into the editor","07v9aw":"Paste","zUYfou":"Redo the most recent action","9Nq9zr":"Redo","0uxaZe":"Remove annotation","iJWZAz":"Right align","g5WpPn":"Select all content within the editor","2+pZDT":"Select all","yChCR1":"Set text case","GMzAC/":"Set the font size for the selected text.","vzEyrv":"Font size","7VCkJ8":"Set the text color for the selected text.","qjWFaR":"Text color","LVWgFu":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"WXwRy1":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"G/o315":"Set the text highlight color for the selected text.","xtHg6d":"Text highlight","1p1W/p":"Add blockquote formatting to the selected text","6+rh6I":"Blockquote","0yB3LV":"Add bold formatting to the selected text","sFMo4Z":"Bold","SMKG/s":"Bulleted list","/BYCMi":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"V+3IBe":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"hbIo4L":"Add a code block","7GkMcx":"Codeblock","2r4JYl":"Add inline code formatting to the selected text","Up8Tpe":"Code","ATHSPS":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"7DC1VE":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"hnrBeo":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"NkZAcw":"Italicize the selected text","2fTW9e":"Italic","c759Ra":"Ordered list","uQwrZu":"Strikethrough the selected text","pT3qly":"Strikethrough","BHk+zu":"Subscript","18BVwM":"Superscript","tOIVCV":"Tasked list","4Janx3":"Underline the selected text","dCHt+D":"Underline","YYAprs":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"tczyZL":"Show hidden whitespace characters in your editor.","0qAX23":"Toggle Whitespace","ezMADU":"Undo the most recent action","N3P7EC":"Undo","2nj/+s":"Update annotation","dWD7u4":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"qXqgVT":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.set-font-size.label":"Font size","ui.text-color.grape":"Grape","ui.text-color.grape.hue":["Grape ",["hue"]],"ui.text-color.gray":"Gray","ui.text-color.gray.hue":["Gray ",["hue"]],"ui.text-color.green":"Green","ui.text-color.green.hue":["Green ",["hue"]],"keyboard.shortcut.home":"Home","extension.command.increase-font-size.label":"Increase","extension.command.increase-indent.label":"Increase indentation","extension.command.increase-font-size.description":"Increase the font size","ui.text-color.indigo":"Indigo","ui.text-color.indigo.hue":["Indigo ",["hue"]],"extension.command.insert-paragraph.description":"Insert a new paragraph","extension.command.insert-emoji.label":"Insert Emoji","extension.command.insert-paragraph.label":"Insert Paragraph","extension.command.toggle-italic.label":"Italic","extension.command.toggle-italic.description":"Italicize the selected text","extension.command.justify-align.label":"Justify","R7NlCw":"Alt","RbDiK5":"Arrow Down","Dgyd+E":"Arrow Left","8pdCk4":"Arrow Right","Gp/343":"Arrow Up","PFPV0A":"Backspace","0IRYvp":"Caps Lock","X7HX0D":"Command","zq0AdD":"Control","8SfToN":"Delete","Ys/uah":"End","3K5hww":"Enter","veQt1j":"Enter","ySv7i+":"Home","e6RUI1":"Page Down","EEJk31":"Page Up","7sbhAU":"Shift","Q4eplT":"Space","SUhVVC":"Tab","extension.command.left-align.label":"Left align","ui.text-color.lime":"Lime","ui.text-color.lime.hue":["Lime ",["hue"]],"react-components.mention-atom-component.zero-items":"No items available","ui.text-color.orange":"Orange","ui.text-color.orange.hue":["Orange ",["hue"]],"extension.command.toggle-ordered-list.label":"Ordered list","keyboard.shortcut.pageDown":"Page Down","keyboard.shortcut.pageUp":"Page Up","extension.command.paste.label":"Paste","extension.command.paste.description":"Paste content into the editor","ui.text-color.pink":"Pink","ui.text-color.pink.hue":["Pink ",["hue"]],"zvMfIA":"No items available","pEjhti":"Static Menu","ui.text-color.red":"Red","ui.text-color.red.hue":["Red ",["hue"]],"extension.command.redo.label":"Redo","extension.command.redo.description":"Redo the most recent action","extension.command.remove-annotation.label":"Remove annotation","extension.command.right-align.label":"Right align","extension.command.select-all.label":"Select all","extension.command.select-all.description":"Select all content within the editor","extension.command.insert-horizontal-rule.description":"Separate content with a diving horizontal line","extension.command.set-casing.label":"Set text case","extension.command.set-font-size.description":"Set the font size for the selected text.","extension.command.set-text-color.description":"Set the text color for the selected text.","extension.command.set-text-highlight.description":"Set the text highlight color for the selected text.","keyboard.shortcut.shift":"Shift","extension.command.toggle-whitespace.description":"Show hidden whitespace characters in your editor.","keyboard.shortcut.space":"Space","extension.command.toggle-strike.label":"Strikethrough","extension.command.toggle-strike.description":"Strikethrough the selected text","extension.command.toggle-subscript.label":"Subscript","extension.command.toggle-superscript.label":"Superscript","keyboard.shortcut.tab":"Tab","extension.command.toggle-task-list.description":"Tasked list","ui.text-color.teal":"Teal","ui.text-color.teal.hue":["Teal ",["hue"]],"extension.command.set-text-color.label":"Text color","extension.command.set-text-highlight.label":"Text highlight","extension.command.toggle-whitespace.label":"Toggle Whitespace","ui.text-color.transparent":"Transparent","slrB1c":"Black","6QML30":"Blue","xw+keN":["Blue ",["hue"]],"38RHqP":"Cyan","D89yPf":["Cyan ",["hue"]],"VjBLnd":"Grape","Rp40yv":["Grape ",["hue"]],"5Dm9D1":"Gray","HGjXjC":["Gray ",["hue"]],"b9fz+n":"Green","18jo3M":["Green ",["hue"]],"CFzqCV":"Indigo","aVlDku":["Indigo ",["hue"]],"04PfLc":"Lime","KRTK6Y":["Lime ",["hue"]],"pSnXFd":"Orange","ve/MJZ":["Orange ",["hue"]],"OvCgDa":"Pink","l7NqyT":["Pink ",["hue"]],"IT9k0j":"Red","AdyJ7/":["Red ",["hue"]],"3D2UWc":"Teal","Dcq0Y1":["Teal ",["hue"]],"bsi2ik":"Transparent","Tj3PRR":"Violet","xxMH5N":["Violet ",["hue"]],"Rum0ah":"White","4gaw/Q":"Yellow","hhauc3":["Yellow ",["hue"]],"extension.command.toggle-underline.label":"Underline","extension.command.toggle-underline.description":"Underline the selected text","extension.command.undo.label":"Undo","extension.command.undo.description":"Undo the most recent action","extension.command.update-annotation.label":"Update annotation","ui.text-color.violet":"Violet","ui.text-color.violet.hue":["Violet ",["hue"]],"ui.text-color.white":"White","ui.text-color.yellow":"Yellow","ui.text-color.yellow.hue":["Yellow ",["hue"]]}'),uf={};DT(uf,_T);Gi.loadLocaleData("en",{plurals:uf.en});Gi.load("en",PT);Gi.activate("en");var LT=Object.defineProperty,BT=Object.getOwnPropertyDescriptor,zT=(t,e,n,r)=>{for(var s=r>1?void 0:r?BT(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&LT(e,n,s),s},$T={...cn.defaultOptions,...gs.defaultOptions},FT=[...cn.staticKeys,...gs.staticKeys],ys=class extends te{get name(){return"react"}onSetOptions(t){const{pickChanged:e}=t;this.getExtension(cn).setOptions(e(["placeholder"]))}createExtensions(){const{emptyNodeClass:t,placeholder:e,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:s,defaultInlineNode:i,nodeViewComponents:o}=this.options;return[new cn({emptyNodeClass:t,placeholder:e,priority:X.Low}),new gs({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:s,defaultInlineNode:i,nodeViewComponents:o})]}};ys=zT([G({defaultOptions:$T,staticKeys:FT})],ys);var df={};Object.defineProperty(df,"__esModule",{value:!0});function VT(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length===2)return Xc(t[0],t[1])||null;var n=t.slice(1).reduce(function(r,s){return Xc(r,s)},t[0]);return n||null}var kr=df.default=VT,Gc=new WeakMap;function Xc(t,e){if(t&&e){var n=Gc.get(t)||new WeakMap;Gc.set(t,n);var r=n.get(e)||function(s){Yc(t,s),Yc(e,s)};return n.set(e,r),r}return t||e}function Yc(t,e){typeof t=="function"?t(e):t.current=e}var hf=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},wo=(t,e,n)=>(hf(t,e,"read from private field"),n?n.call(t):e.get(t)),HT=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},UT=(t,e,n,r)=>(hf(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function jT(){const[,t]=$.useState(M());return $.useCallback(()=>{t(M())},[])}var ff=$.createContext(null);function el(t){const e=$.useContext(ff),n=$.useRef(jT());R(e,{code:b.REACT_PROVIDER_CONTEXT});const{addHandler:r}=e;return $.useEffect(()=>{let s=t;if(s){if(Rn(s)){const{autoUpdate:i}=s;s=i?()=>n.current():void 0}if(ee(s))return r("updated",s)}},[r,t]),e}function WT(t=!0){return el({autoUpdate:t}).active}function KT(){return el().commands}var[qT,VO]=Sv(({props:t})=>{const e=t.locale??"en",n=t.i18n??Gi,r=t.supportedLocales??[e],s=n._.bind(n);return{locale:e,i18n:n,supportedLocales:r,t:s}});function Zc(t,e={}){const{core:n,react:r,...s}=e;return eb(t)?t:Qx.create(()=>[...Au(t),new ys(r),...cv(n)],s)}function JT(t,e={}){const n=$.useRef(t),r=$.useRef(e),[s,i]=$.useState(()=>Zc(t,e));return n.current=t,r.current=e,$.useEffect(()=>s.addHandler("destroy",()=>{i(()=>Zc(n.current,r.current))}),[s]),s}var GT=typeof kr=="object"&&kr.__esModule&&kr.default?kr.default:kr,qn,XT=class extends Jx{constructor(t){if(super(t),HT(this,qn,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=e=>this.internalGetRootProps(e,null),this.internalGetRootProps=(e,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:s,...i}=e??M();return{[r]:GT(s,this.onRef),key:this.uid,...i,children:n}},this.onRef=e=>{e&&(this.rootPropsConfig.count+=1,R(this.rootPropsConfig.count<=1,{code:b.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),UT(this,qn,e),this.onRefLoad())},this.manager.view){this.manager.view.setProps({state:this.manager.view.state,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0});return}this.manager.getExtension(cn).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(t){return super.update(t),this}createView(t){return new py(null,{state:t,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:t,...e}){const{triggerChange:n=!0,tr:r,transactions:s}=e;if(this.props.state){const{onChange:i}=this.props;R(i,{code:b.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),R(n,{code:b.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:t,tr:r,transactions:s});return}!r&&!s&&(t=t.apply(t.tr.setMeta(rl,{}))),this.view.updateState(t),n&&(s==null?void 0:s.length)!==0&&this.onChange({state:t,tr:r,transactions:s}),this.manager.onStateUpdate({previousState:this.previousState,state:t,tr:r,transactions:s})}updateControlledState(t,e){this.previousStateOverride=e,t=t.apply(t.tr.setMeta(rl,{})),this.view.updateState(t),this.manager.onStateUpdate({previousState:this.previousState,state:t}),this.previousStateOverride=void 0}addProsemirrorViewToDom(t,e){this.props.insertPosition==="start"?t.insertBefore(e,t.firstChild):t.append(e)}onRefLoad(){R(wo(this,qn),{code:b.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:t}=this.props;this.addProsemirrorViewToDom(wo(this,qn),this.view.dom),t&&this.focus(t),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&wo(this,qn)&&this.view.setProps({...this.view.props,editable:()=>this.props.editable??!0})}get frameworkOutput(){return{...this.baseOutput,getRootProps:this.getRootProps,portalContainer:this.manager.store.portalContainer}}resetRender(){this.rootPropsConfig.called=!1,this.rootPropsConfig.count=0}};qn=new WeakMap;var pf=typeof document<"u"?$.useLayoutEffect:$.useEffect;function YT(t){const e=$.useRef();return pf(()=>{e.current=t}),e.current}function ZT(t){const{manager:e,state:n}=t,{placeholder:r,editable:s}=t;$.useRef(!0).current&&!en(r)&&e.getExtension(ys).setOptions({placeholder:r}),$.useEffect(()=>{r!=null&&e.getExtension(ys).setOptions({placeholder:r})},[r,e]);const[o]=$.useState(()=>{if(n)return n;const l=e.createEmptyDoc(),[c,u]=pe(t.initialContent)?t.initialContent:[t.initialContent??l];return e.createState({content:c,selection:u})}),a=QT({initialEditorState:o,getProps:()=>t});return $.useEffect(()=>()=>{a.destroy()},[a]),$.useEffect(()=>{a.onUpdate()},[s,a]),eO(a),a.frameworkOutput}function QT(t){const e=$.useRef(t);e.current=t;const n=$.useMemo(()=>new XT(e.current),[]);return n.update(t),n}function eO(t){const{state:e}=t.props,n=$.useRef(!!e),r=YT(e);pf(()=>{const s=e?n.current===!0:n.current===!1;R(s,{code:b.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!e||e===r)&&t.updateControlledState(e,r??void 0)},[e,r,t])}function tO(t={}){const{content:e,document:n,selection:r,extensions:s,...i}=t,o=JT(s??(()=>[]),i),[a,l]=$.useState(()=>o.createState({selection:r,content:e??o.createEmptyDoc()})),c=$.useCallback(({state:d})=>{l(d)},[]),u=$.useCallback(()=>o.output,[o]);return $.useMemo(()=>({state:a,setState:l,manager:o,onChange:c,getContext:u}),[u,o,c,a])}var oa=()=>Me.createElement("div",{className:f1.EDITOR_WRAPPER,...el().getRootProps()}),nO=t=>(t.hook(),null);function rO(t){const{children:e,autoRender:n,i18n:r,locale:s,supportedLocales:i,hooks:o=[],...a}=t,l=ZT(a),c=mv(l.portalContainer),u=n==="start"||n===!0||!e&&en(n),d=n==="end";return Me.createElement(qT,{i18n:r,locale:s,supportedLocales:i},Me.createElement(ff.Provider,{value:l},Me.createElement(pv,{portals:c}),o.map((h,f)=>Me.createElement(nO,{hook:h,key:f})),u&&Me.createElement(oa,null),e,d&&Me.createElement(oa,null)))}const sO="_richTextToolbar_1gbkk_1",iO="_richTextToolbarContainer_1gbkk_5",Qc={richTextToolbar:sO,richTextToolbarContainer:iO};var Jn=(t=>(t.BOLD="bold",t.ITALIC="italic",t.CODE="code",t.UL="ul",t.OL="ol",t))(Jn||{});const aa=({disabled:t=!1,toolbarComponent:e=null})=>{const{focus:n,toggleBold:r,toggleBulletList:s,toggleCode:i,toggleItalic:o,toggleOrderedList:a}=KT(),l=WT(),c=[{icon:Jn.BOLD,onClick:r,active:l.bold()},{icon:Jn.ITALIC,onClick:o,active:l.italic()},{icon:Jn.CODE,onClick:i,active:l.code()},{icon:Jn.UL,onClick:s,active:l.bulletList()},{icon:Jn.OL,onClick:a,active:l.orderedList()}];return ae.jsxs("div",{className:Qc.richTextToolbarContainer,children:[ae.jsx("div",{className:Qc.richTextToolbar,children:c.map((u,d)=>ae.jsx(xu,{small:!0,round:!0,basic:!0,icon:u.icon,colored:xf.MUTED,onClick:()=>{u.onClick(),n()},active:u.active,disabled:t},d))}),e]})};try{aa.displayName="RichTextToolbar",aa.__docgenInfo={description:"",displayName:"RichTextToolbar",props:{disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},toolbarComponent:{defaultValue:{value:"null"},description:"",name:"toolbarComponent",required:!1,type:{name:"ReactNode"}}}}}catch{}const oO="_inputInTable_ta5ga_1",aO="_inputHover_ta5ga_13",lO="_inputFocus_ta5ga_18",cO="_inputError_ta5ga_25",uO="_inputWarning_ta5ga_26",dO="_inputDisabled_ta5ga_61",hO="_hideScrollbars_ta5ga_67",fO="_richTextInput_ta5ga_77",pO={inputInTable:oO,inputHover:aO,inputFocus:lO,inputError:cO,inputWarning:uO,inputDisabled:dO,hideScrollbars:hO,richTextInput:fO},xs=$.forwardRef(({placeholder:t,onChange:e,value:n,disabled:r,toolbarComponent:s},i)=>{const o=$.useContext(yf),a=r||o,{manager:l,state:c,setState:u,getContext:d}=tO({extensions:()=>[new Nn,new ps,new ds,new fs,new hr,new ms,new cn({placeholder:t})],content:n,selection:"start",stringHandler:"markdown"});$.useImperativeHandle(i,()=>d(),[d]);const h=({helpers:f,state:p})=>{const m=f.getMarkdown(p);e&&e(m),u(p)};return ae.jsx("div",{className:pO.richTextInput,children:ae.jsxs(rO,{manager:l,state:c,placeholder:t,onChange:h,editable:!a,children:[ae.jsx(aa,{disabled:a,toolbarComponent:s}),ae.jsx(oa,{})]})})});try{xs.displayName="RichTextInput",xs.__docgenInfo={description:"",displayName:"RichTextInput",props:{disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((markdown: string) => void)"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"string"}},toolbarComponent:{defaultValue:null,description:"",name:"toolbarComponent",required:!1,type:{name:"ReactNode"}}}}}catch{}const HO={title:"Forms/RichTextInput",component:xs,args:{}},Ms=t=>{const[e,n]=Me.useState(t.value);return ae.jsxs(ae.Fragment,{children:[ae.jsx(xs,{...t,value:e,onChange:n}),ae.jsx("pre",{children:ae.jsx("strong",{children:"Markdown output:"})}),ae.jsx("pre",{children:e})]})},Ds=Ms.bind({}),Wr=Ms.bind({});Wr.args={value:`Paragraph goes here lorem ipsum dolor.
181
181
  1. Item (*italic*)
182
182
  2. Item (**bold**)
183
183
  3. Item (\`code\`)
184
184
  * Item
185
- * Item`};const Kr=Ms.bind({});Kr.args={placeholder:"Enter message..."};const qr=Ms.bind({});qr.args={disabled:!0};const Ps=()=>{const[t,e]=Me.useState("starting value"),n=Me.useRef(null),r=s=>{e(""),s.current.clearContent()};return ae.jsxs(ae.Fragment,{children:[ae.jsx(xu,{label:"Clear input!",colored:"red",onClick:()=>r(n)}),ae.jsx(xs,{value:t,onChange:e,ref:n}),ae.jsx("pre",{children:ae.jsx("strong",{children:"Markdown output:"})}),ae.jsx("pre",{children:t})]})},gO=ae.jsx(kf,{options:[{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Koalas",value:"leaves"},{label:"Wombats",value:"bark"}],width:"auto",value:"termites",small:!0}),Jr=Ms.bind({});Jr.args={toolbarComponent:gO};var eu,tu,nu;Ds.parameters={...Ds.parameters,docs:{...(eu=Ds.parameters)==null?void 0:eu.docs,source:{originalSource:`args => {
185
+ * Item`};const Kr=Ms.bind({});Kr.args={placeholder:"Enter message..."};const qr=Ms.bind({});qr.args={disabled:!0};const Ps=()=>{const[t,e]=Me.useState("starting value"),n=Me.useRef(null),r=s=>{e(""),s.current.clearContent()};return ae.jsxs(ae.Fragment,{children:[ae.jsx(xu,{label:"Clear input!",colored:"red",onClick:()=>r(n)}),ae.jsx(xs,{value:t,onChange:e,ref:n}),ae.jsx("pre",{children:ae.jsx("strong",{children:"Markdown output:"})}),ae.jsx("pre",{children:t})]})},mO=ae.jsx(kf,{options:[{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Koalas",value:"leaves"},{label:"Wombats",value:"bark"}],width:"auto",value:"termites",small:!0}),Jr=Ms.bind({});Jr.args={toolbarComponent:mO};var eu,tu,nu;Ds.parameters={...Ds.parameters,docs:{...(eu=Ds.parameters)==null?void 0:eu.docs,source:{originalSource:`args => {
186
186
  const [value, setValue] = React.useState(args.value);
187
187
  return <>
188
188
  <RichTextInput