@modern-admin/web 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/standalone/assets/{action-component-host-BrEZDHZt.js → action-component-host-P6HcuKj3.js} +2 -2
  2. package/dist/standalone/assets/action-component-host-P6HcuKj3.js.br +0 -0
  3. package/dist/standalone/assets/action-component-host-P6HcuKj3.js.gz +0 -0
  4. package/dist/standalone/assets/{action-component-host-BrEZDHZt.js.map → action-component-host-P6HcuKj3.js.map} +1 -1
  5. package/dist/standalone/assets/{action-page-Bx7kzeK7.js → action-page-kyqtK3oq.js} +2 -2
  6. package/dist/standalone/assets/action-page-kyqtK3oq.js.br +0 -0
  7. package/dist/standalone/assets/action-page-kyqtK3oq.js.gz +0 -0
  8. package/dist/standalone/assets/{action-page-Bx7kzeK7.js.map → action-page-kyqtK3oq.js.map} +1 -1
  9. package/dist/standalone/assets/{ai-assistant-widget-BbIXVrSu.js → ai-assistant-widget-DGanix6u.js} +2 -2
  10. package/dist/standalone/assets/ai-assistant-widget-DGanix6u.js.br +0 -0
  11. package/dist/standalone/assets/ai-assistant-widget-DGanix6u.js.gz +0 -0
  12. package/dist/standalone/assets/{ai-assistant-widget-BbIXVrSu.js.map → ai-assistant-widget-DGanix6u.js.map} +1 -1
  13. package/dist/standalone/assets/{audit-log-page-BoZh23oQ.js → audit-log-page-DozriTiA.js} +2 -2
  14. package/dist/standalone/assets/audit-log-page-DozriTiA.js.br +0 -0
  15. package/dist/standalone/assets/audit-log-page-DozriTiA.js.gz +0 -0
  16. package/dist/standalone/assets/{audit-log-page-BoZh23oQ.js.map → audit-log-page-DozriTiA.js.map} +1 -1
  17. package/dist/standalone/assets/{badge-6nyM5Jft.js → badge-lb2Nqx1b.js} +2 -2
  18. package/dist/standalone/assets/{badge-6nyM5Jft.js.map → badge-lb2Nqx1b.js.map} +1 -1
  19. package/dist/standalone/assets/{calendar-nvD_z7KQ.js → calendar-crtd4PEn.js} +2 -2
  20. package/dist/standalone/assets/calendar-crtd4PEn.js.br +0 -0
  21. package/dist/standalone/assets/calendar-crtd4PEn.js.gz +0 -0
  22. package/dist/standalone/assets/{calendar-nvD_z7KQ.js.map → calendar-crtd4PEn.js.map} +1 -1
  23. package/dist/standalone/assets/{card-4cS4uWCP.js → card-Dh44j2Nb.js} +2 -2
  24. package/dist/standalone/assets/card-Dh44j2Nb.js.br +0 -0
  25. package/dist/standalone/assets/card-Dh44j2Nb.js.gz +0 -0
  26. package/dist/standalone/assets/{card-4cS4uWCP.js.map → card-Dh44j2Nb.js.map} +1 -1
  27. package/dist/standalone/assets/chart-widget-B819aHsE.js +2 -0
  28. package/dist/standalone/assets/chart-widget-B819aHsE.js.br +0 -0
  29. package/dist/standalone/assets/chart-widget-B819aHsE.js.gz +0 -0
  30. package/dist/standalone/assets/chart-widget-B819aHsE.js.map +1 -0
  31. package/dist/standalone/assets/{command-Sb0xL-se.js → command-xJ-6Grpv.js} +2 -2
  32. package/dist/standalone/assets/command-xJ-6Grpv.js.br +0 -0
  33. package/dist/standalone/assets/command-xJ-6Grpv.js.gz +0 -0
  34. package/dist/standalone/assets/command-xJ-6Grpv.js.map +1 -0
  35. package/dist/standalone/assets/{date-picker-C4HcgidQ.js → date-picker-D0dWQEox.js} +2 -2
  36. package/dist/standalone/assets/date-picker-D0dWQEox.js.br +0 -0
  37. package/dist/standalone/assets/date-picker-D0dWQEox.js.gz +0 -0
  38. package/dist/standalone/assets/{date-picker-C4HcgidQ.js.map → date-picker-D0dWQEox.js.map} +1 -1
  39. package/dist/standalone/assets/{dist-BSbFjTlr.js → dist-CWGgVQiS.js} +2 -2
  40. package/dist/standalone/assets/dist-CWGgVQiS.js.br +0 -0
  41. package/dist/standalone/assets/dist-CWGgVQiS.js.gz +0 -0
  42. package/dist/standalone/assets/{dist-BSbFjTlr.js.map → dist-CWGgVQiS.js.map} +1 -1
  43. package/dist/standalone/assets/{dist-Dpg8xy_r.js → dist-UsTgBPww.js} +2 -2
  44. package/dist/standalone/assets/dist-UsTgBPww.js.br +0 -0
  45. package/dist/standalone/assets/dist-UsTgBPww.js.gz +0 -0
  46. package/dist/standalone/assets/{dist-Dpg8xy_r.js.map → dist-UsTgBPww.js.map} +1 -1
  47. package/dist/standalone/assets/dist-qlnAsTo_.js +2 -0
  48. package/dist/standalone/assets/dist-qlnAsTo_.js.br +0 -0
  49. package/dist/standalone/assets/dist-qlnAsTo_.js.gz +0 -0
  50. package/dist/standalone/assets/{dist-BcL2U6dT.js.map → dist-qlnAsTo_.js.map} +1 -1
  51. package/dist/standalone/assets/{edit-page-CW7-FAPC.js → edit-page-CFPwq1_5.js} +2 -2
  52. package/dist/standalone/assets/edit-page-CFPwq1_5.js.br +0 -0
  53. package/dist/standalone/assets/edit-page-CFPwq1_5.js.gz +0 -0
  54. package/dist/standalone/assets/{edit-page-CW7-FAPC.js.map → edit-page-CFPwq1_5.js.map} +1 -1
  55. package/dist/standalone/assets/empty-D9sUunOr.js +2 -0
  56. package/dist/standalone/assets/empty-D9sUunOr.js.br +0 -0
  57. package/dist/standalone/assets/empty-D9sUunOr.js.gz +0 -0
  58. package/dist/standalone/assets/{empty-Cposcczv.js.map → empty-D9sUunOr.js.map} +1 -1
  59. package/dist/standalone/assets/{global-search-dialog-DLv_nIvM.js → global-search-dialog-AfQmJSE7.js} +2 -2
  60. package/dist/standalone/assets/global-search-dialog-AfQmJSE7.js.br +0 -0
  61. package/dist/standalone/assets/global-search-dialog-AfQmJSE7.js.gz +0 -0
  62. package/dist/standalone/assets/{global-search-dialog-DLv_nIvM.js.map → global-search-dialog-AfQmJSE7.js.map} +1 -1
  63. package/dist/standalone/assets/{heavy-fields-BiCEgD2L.js → heavy-fields-_zVIBnm1.js} +4 -4
  64. package/dist/standalone/assets/heavy-fields-_zVIBnm1.js.br +0 -0
  65. package/dist/standalone/assets/heavy-fields-_zVIBnm1.js.gz +0 -0
  66. package/dist/standalone/assets/{heavy-fields-BiCEgD2L.js.map → heavy-fields-_zVIBnm1.js.map} +1 -1
  67. package/dist/standalone/assets/{home-page-BSz1wGk0.js → home-page-BdTrAXqk.js} +3 -3
  68. package/dist/standalone/assets/home-page-BdTrAXqk.js.br +0 -0
  69. package/dist/standalone/assets/home-page-BdTrAXqk.js.gz +0 -0
  70. package/dist/standalone/assets/{home-page-BSz1wGk0.js.map → home-page-BdTrAXqk.js.map} +1 -1
  71. package/dist/standalone/assets/{icon-registry-BQU4fIc4.js → icon-registry-CcMm2Zh3.js} +2 -2
  72. package/dist/standalone/assets/icon-registry-CcMm2Zh3.js.br +0 -0
  73. package/dist/standalone/assets/icon-registry-CcMm2Zh3.js.gz +0 -0
  74. package/dist/standalone/assets/{icon-registry-BQU4fIc4.js.map → icon-registry-CcMm2Zh3.js.map} +1 -1
  75. package/dist/standalone/assets/index-DHZwffoP.css +2 -0
  76. package/dist/standalone/assets/index-DHZwffoP.css.br +0 -0
  77. package/dist/standalone/assets/{index-95cwJ2RY.css.gz → index-DHZwffoP.css.gz} +0 -0
  78. package/dist/standalone/assets/index-uYpCUVT4.js +15 -0
  79. package/dist/standalone/assets/index-uYpCUVT4.js.br +0 -0
  80. package/dist/standalone/assets/index-uYpCUVT4.js.gz +0 -0
  81. package/dist/standalone/assets/index-uYpCUVT4.js.map +1 -0
  82. package/dist/standalone/assets/json-editor-yfO4TUB_.js +2 -0
  83. package/dist/standalone/assets/json-editor-yfO4TUB_.js.br +0 -0
  84. package/dist/standalone/assets/json-editor-yfO4TUB_.js.gz +0 -0
  85. package/dist/standalone/assets/{json-editor-CAIgxYb3.js.map → json-editor-yfO4TUB_.js.map} +1 -1
  86. package/dist/standalone/assets/{property-renderer-B8Md-EqW.js → property-renderer-CDKsa2KQ.js} +4 -4
  87. package/dist/standalone/assets/property-renderer-CDKsa2KQ.js.br +0 -0
  88. package/dist/standalone/assets/property-renderer-CDKsa2KQ.js.gz +0 -0
  89. package/dist/standalone/assets/property-renderer-CDKsa2KQ.js.map +1 -0
  90. package/dist/standalone/assets/reference-DWJEoGIf.js +2 -0
  91. package/dist/standalone/assets/reference-DWJEoGIf.js.br +0 -0
  92. package/dist/standalone/assets/reference-DWJEoGIf.js.gz +0 -0
  93. package/dist/standalone/assets/reference-DWJEoGIf.js.map +1 -0
  94. package/dist/standalone/assets/{revisions-button-0WtL6bsZ.js → revisions-button-DR0oW2wX.js} +2 -2
  95. package/dist/standalone/assets/revisions-button-DR0oW2wX.js.br +0 -0
  96. package/dist/standalone/assets/revisions-button-DR0oW2wX.js.gz +0 -0
  97. package/dist/standalone/assets/{revisions-button-0WtL6bsZ.js.map → revisions-button-DR0oW2wX.js.map} +1 -1
  98. package/dist/standalone/assets/{richtext-render-DnVcQ34I.js → richtext-render-VFCKGulc.js} +2 -2
  99. package/dist/standalone/assets/richtext-render-VFCKGulc.js.br +0 -0
  100. package/dist/standalone/assets/richtext-render-VFCKGulc.js.gz +0 -0
  101. package/dist/standalone/assets/{richtext-render-DnVcQ34I.js.map → richtext-render-VFCKGulc.js.map} +1 -1
  102. package/dist/standalone/assets/{router-wFvtgo77.js → router-BcZgB5cZ.js} +12 -12
  103. package/dist/standalone/assets/router-BcZgB5cZ.js.br +0 -0
  104. package/dist/standalone/assets/router-BcZgB5cZ.js.gz +0 -0
  105. package/dist/standalone/assets/router-BcZgB5cZ.js.map +1 -0
  106. package/dist/standalone/assets/select-BiV9bunJ.js +2 -0
  107. package/dist/standalone/assets/select-BiV9bunJ.js.br +0 -0
  108. package/dist/standalone/assets/select-BiV9bunJ.js.gz +0 -0
  109. package/dist/standalone/assets/{select-CR4acjX0.js.map → select-BiV9bunJ.js.map} +1 -1
  110. package/dist/standalone/assets/{settings-page-DtguXLAP.js → settings-page-DSWp2N6T.js} +2 -2
  111. package/dist/standalone/assets/settings-page-DSWp2N6T.js.br +0 -0
  112. package/dist/standalone/assets/settings-page-DSWp2N6T.js.gz +0 -0
  113. package/dist/standalone/assets/{settings-page-DtguXLAP.js.map → settings-page-DSWp2N6T.js.map} +1 -1
  114. package/dist/standalone/assets/{show-page-Dnox2NwO.js → show-page-CGzUAZoO.js} +2 -2
  115. package/dist/standalone/assets/show-page-CGzUAZoO.js.br +0 -0
  116. package/dist/standalone/assets/show-page-CGzUAZoO.js.gz +0 -0
  117. package/dist/standalone/assets/{show-page-Dnox2NwO.js.map → show-page-CGzUAZoO.js.map} +1 -1
  118. package/dist/standalone/assets/tabs-smdw70rV.js +2 -0
  119. package/dist/standalone/assets/tabs-smdw70rV.js.br +0 -0
  120. package/dist/standalone/assets/tabs-smdw70rV.js.gz +0 -0
  121. package/dist/standalone/assets/{tabs-DUS8e6dR.js.map → tabs-smdw70rV.js.map} +1 -1
  122. package/dist/standalone/assets/{textarea-CX_0QVSz.js → textarea-DBVf3GGt.js} +2 -2
  123. package/dist/standalone/assets/{textarea-CX_0QVSz.js.map → textarea-DBVf3GGt.js.map} +1 -1
  124. package/dist/standalone/assets/useQueries-Ba2PuYhZ.js +2 -0
  125. package/dist/standalone/assets/useQueries-Ba2PuYhZ.js.br +0 -0
  126. package/dist/standalone/assets/useQueries-Ba2PuYhZ.js.gz +0 -0
  127. package/dist/standalone/assets/useQueries-Ba2PuYhZ.js.map +1 -0
  128. package/dist/standalone/assets/{user-directory-9COoW6AO.js → user-directory-Df5X8VOe.js} +2 -2
  129. package/dist/standalone/assets/user-directory-Df5X8VOe.js.br +0 -0
  130. package/dist/standalone/assets/user-directory-Df5X8VOe.js.gz +0 -0
  131. package/dist/standalone/assets/{user-directory-9COoW6AO.js.map → user-directory-Df5X8VOe.js.map} +1 -1
  132. package/dist/standalone/assets/{value-format-Cgau0meh.js → value-format-BUeGtfH4.js} +16 -16
  133. package/dist/standalone/assets/value-format-BUeGtfH4.js.br +0 -0
  134. package/dist/standalone/assets/value-format-BUeGtfH4.js.gz +0 -0
  135. package/dist/standalone/assets/{value-format-Cgau0meh.js.map → value-format-BUeGtfH4.js.map} +1 -1
  136. package/dist/standalone/assets/with-selector-id7qGzTH.js +2 -0
  137. package/dist/standalone/assets/with-selector-id7qGzTH.js.br +0 -0
  138. package/dist/standalone/assets/with-selector-id7qGzTH.js.gz +0 -0
  139. package/dist/standalone/assets/with-selector-id7qGzTH.js.map +1 -0
  140. package/dist/standalone/assets/{wizard-create-page-v2-Aw8Oj.js → wizard-create-page-B8IcszRF.js} +2 -2
  141. package/dist/standalone/assets/wizard-create-page-B8IcszRF.js.br +0 -0
  142. package/dist/standalone/assets/wizard-create-page-B8IcszRF.js.gz +0 -0
  143. package/dist/standalone/assets/{wizard-create-page-v2-Aw8Oj.js.map → wizard-create-page-B8IcszRF.js.map} +1 -1
  144. package/dist/standalone/assets/{zod-BrelKLfy.js → zod-mi61gVha.js} +2 -2
  145. package/dist/standalone/assets/zod-mi61gVha.js.br +0 -0
  146. package/dist/standalone/assets/zod-mi61gVha.js.gz +0 -0
  147. package/dist/standalone/assets/{zod-BrelKLfy.js.map → zod-mi61gVha.js.map} +1 -1
  148. package/dist/standalone/index.html +10 -10
  149. package/dist/standalone/index.html.br +0 -0
  150. package/dist/standalone/index.html.gz +0 -0
  151. package/package.json +4 -4
  152. package/dist/standalone/assets/action-component-host-BrEZDHZt.js.br +0 -0
  153. package/dist/standalone/assets/action-component-host-BrEZDHZt.js.gz +0 -0
  154. package/dist/standalone/assets/action-page-Bx7kzeK7.js.br +0 -0
  155. package/dist/standalone/assets/action-page-Bx7kzeK7.js.gz +0 -0
  156. package/dist/standalone/assets/ai-assistant-widget-BbIXVrSu.js.br +0 -0
  157. package/dist/standalone/assets/ai-assistant-widget-BbIXVrSu.js.gz +0 -0
  158. package/dist/standalone/assets/audit-log-page-BoZh23oQ.js.br +0 -0
  159. package/dist/standalone/assets/audit-log-page-BoZh23oQ.js.gz +0 -0
  160. package/dist/standalone/assets/calendar-nvD_z7KQ.js.br +0 -0
  161. package/dist/standalone/assets/calendar-nvD_z7KQ.js.gz +0 -0
  162. package/dist/standalone/assets/card-4cS4uWCP.js.br +0 -0
  163. package/dist/standalone/assets/card-4cS4uWCP.js.gz +0 -0
  164. package/dist/standalone/assets/chart-widget-YeCL7jdB.js +0 -2
  165. package/dist/standalone/assets/chart-widget-YeCL7jdB.js.br +0 -0
  166. package/dist/standalone/assets/chart-widget-YeCL7jdB.js.gz +0 -0
  167. package/dist/standalone/assets/chart-widget-YeCL7jdB.js.map +0 -1
  168. package/dist/standalone/assets/command-Sb0xL-se.js.br +0 -0
  169. package/dist/standalone/assets/command-Sb0xL-se.js.gz +0 -0
  170. package/dist/standalone/assets/command-Sb0xL-se.js.map +0 -1
  171. package/dist/standalone/assets/date-picker-C4HcgidQ.js.br +0 -0
  172. package/dist/standalone/assets/date-picker-C4HcgidQ.js.gz +0 -0
  173. package/dist/standalone/assets/dist-BSbFjTlr.js.br +0 -0
  174. package/dist/standalone/assets/dist-BSbFjTlr.js.gz +0 -0
  175. package/dist/standalone/assets/dist-BcL2U6dT.js +0 -2
  176. package/dist/standalone/assets/dist-BcL2U6dT.js.br +0 -0
  177. package/dist/standalone/assets/dist-BcL2U6dT.js.gz +0 -0
  178. package/dist/standalone/assets/dist-Dpg8xy_r.js.br +0 -0
  179. package/dist/standalone/assets/dist-Dpg8xy_r.js.gz +0 -0
  180. package/dist/standalone/assets/edit-page-CW7-FAPC.js.br +0 -0
  181. package/dist/standalone/assets/edit-page-CW7-FAPC.js.gz +0 -0
  182. package/dist/standalone/assets/empty-Cposcczv.js +0 -2
  183. package/dist/standalone/assets/empty-Cposcczv.js.br +0 -0
  184. package/dist/standalone/assets/empty-Cposcczv.js.gz +0 -0
  185. package/dist/standalone/assets/global-search-dialog-DLv_nIvM.js.br +0 -0
  186. package/dist/standalone/assets/global-search-dialog-DLv_nIvM.js.gz +0 -0
  187. package/dist/standalone/assets/heavy-fields-BiCEgD2L.js.br +0 -0
  188. package/dist/standalone/assets/heavy-fields-BiCEgD2L.js.gz +0 -0
  189. package/dist/standalone/assets/home-page-BSz1wGk0.js.br +0 -0
  190. package/dist/standalone/assets/home-page-BSz1wGk0.js.gz +0 -0
  191. package/dist/standalone/assets/icon-registry-BQU4fIc4.js.br +0 -0
  192. package/dist/standalone/assets/icon-registry-BQU4fIc4.js.gz +0 -0
  193. package/dist/standalone/assets/index-95cwJ2RY.css +0 -2
  194. package/dist/standalone/assets/index-95cwJ2RY.css.br +0 -0
  195. package/dist/standalone/assets/index-BL8keDxQ.js +0 -15
  196. package/dist/standalone/assets/index-BL8keDxQ.js.br +0 -0
  197. package/dist/standalone/assets/index-BL8keDxQ.js.gz +0 -0
  198. package/dist/standalone/assets/index-BL8keDxQ.js.map +0 -1
  199. package/dist/standalone/assets/json-editor-CAIgxYb3.js +0 -2
  200. package/dist/standalone/assets/json-editor-CAIgxYb3.js.br +0 -0
  201. package/dist/standalone/assets/json-editor-CAIgxYb3.js.gz +0 -0
  202. package/dist/standalone/assets/property-renderer-B8Md-EqW.js.br +0 -0
  203. package/dist/standalone/assets/property-renderer-B8Md-EqW.js.gz +0 -0
  204. package/dist/standalone/assets/property-renderer-B8Md-EqW.js.map +0 -1
  205. package/dist/standalone/assets/reference-WPaf6IdD.js +0 -2
  206. package/dist/standalone/assets/reference-WPaf6IdD.js.br +0 -0
  207. package/dist/standalone/assets/reference-WPaf6IdD.js.gz +0 -0
  208. package/dist/standalone/assets/reference-WPaf6IdD.js.map +0 -1
  209. package/dist/standalone/assets/revisions-button-0WtL6bsZ.js.br +0 -0
  210. package/dist/standalone/assets/revisions-button-0WtL6bsZ.js.gz +0 -0
  211. package/dist/standalone/assets/richtext-render-DnVcQ34I.js.br +0 -0
  212. package/dist/standalone/assets/richtext-render-DnVcQ34I.js.gz +0 -0
  213. package/dist/standalone/assets/router-wFvtgo77.js.br +0 -0
  214. package/dist/standalone/assets/router-wFvtgo77.js.gz +0 -0
  215. package/dist/standalone/assets/router-wFvtgo77.js.map +0 -1
  216. package/dist/standalone/assets/select-CR4acjX0.js +0 -2
  217. package/dist/standalone/assets/select-CR4acjX0.js.br +0 -0
  218. package/dist/standalone/assets/select-CR4acjX0.js.gz +0 -0
  219. package/dist/standalone/assets/settings-page-DtguXLAP.js.br +0 -0
  220. package/dist/standalone/assets/settings-page-DtguXLAP.js.gz +0 -0
  221. package/dist/standalone/assets/show-page-Dnox2NwO.js.br +0 -0
  222. package/dist/standalone/assets/show-page-Dnox2NwO.js.gz +0 -0
  223. package/dist/standalone/assets/tabs-DUS8e6dR.js +0 -2
  224. package/dist/standalone/assets/tabs-DUS8e6dR.js.br +0 -0
  225. package/dist/standalone/assets/tabs-DUS8e6dR.js.gz +0 -0
  226. package/dist/standalone/assets/useQueries-BCUhWYX4.js +0 -2
  227. package/dist/standalone/assets/useQueries-BCUhWYX4.js.br +0 -0
  228. package/dist/standalone/assets/useQueries-BCUhWYX4.js.gz +0 -0
  229. package/dist/standalone/assets/useQueries-BCUhWYX4.js.map +0 -1
  230. package/dist/standalone/assets/user-directory-9COoW6AO.js.br +0 -0
  231. package/dist/standalone/assets/user-directory-9COoW6AO.js.gz +0 -0
  232. package/dist/standalone/assets/value-format-Cgau0meh.js.br +0 -0
  233. package/dist/standalone/assets/value-format-Cgau0meh.js.gz +0 -0
  234. package/dist/standalone/assets/with-selector-NDLhu4dT.js +0 -2
  235. package/dist/standalone/assets/with-selector-NDLhu4dT.js.br +0 -0
  236. package/dist/standalone/assets/with-selector-NDLhu4dT.js.gz +0 -0
  237. package/dist/standalone/assets/with-selector-NDLhu4dT.js.map +0 -1
  238. package/dist/standalone/assets/wizard-create-page-v2-Aw8Oj.js.br +0 -0
  239. package/dist/standalone/assets/wizard-create-page-v2-Aw8Oj.js.gz +0 -0
  240. package/dist/standalone/assets/zod-BrelKLfy.js.br +0 -0
  241. package/dist/standalone/assets/zod-BrelKLfy.js.gz +0 -0
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,r}from"./createLucideIcon-CUopU_LC.js";import{C as i,S as a,n as o,s,t as c}from"./with-selector-NDLhu4dT.js";import{a as l,c as u,d,f,h as p,i as m,l as h,m as g,n as _,o as v,p as y,r as b,s as ee,t as te,u as x}from"./undo-2-DlSB-5DM.js";import{n as ne,r as re,t as ie}from"./minimize-2-Bx2cH_WS.js";import{s as ae}from"./dist-Dpg8xy_r.js";import{t as oe}from"./textarea-CX_0QVSz.js";import{W as se,b as ce,ft as le,x as ue,y as de}from"./index-BL8keDxQ.js";function S(e){this.content=e}S.prototype={constructor:S,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new S(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new S(n)},addToStart:function(e,t){return new S([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new S(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new S(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=S.from(e),e.size?new S(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=S.from(e),e.size?new S(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=S.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},S.from=function(e){if(e instanceof S)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new S(t)};function fe(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&he(e.charCodeAt(r-1))&&me(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=fe(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function pe(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&he(e.charCodeAt(i-1))&&me(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=pe(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function me(e){return e>=56320&&e<57344}function he(e){return e>=55296&&e<56320}var C=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return fe(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return pe(this,e,t,n)}findIndex(e){if(e==0)return ge(0,e);if(e==this.size)return ge(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ge(t+1,i):ge(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};C.empty=new C([],0);var w={index:0,offset:0};function ge(e,t){return w.index=e,w.offset=t,w}function _e(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!_e(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!_e(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var T=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&_e(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};T.none=[];var ve=class extends Error{},E=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=be(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(ye(this.content,t+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(C.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};E.empty=new E(C.empty,0,0);function ye(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(ye(a.content,t-i-1,n-i-1)))}function be(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=be(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function xe(e,t,n){if(n.openStart>e.depth)throw new ve(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ve(`Inconsistent open depths`);return Se(e,t,n,0)}function Se(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Se(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return De(a,ke(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return De(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Ae(n,e);return De(a,Oe(e,i,o,t,r))}}function Ce(e,t){if(!t.type.compatibleContent(e.type))throw new ve(`Cannot join `+t.type.name+` onto `+e.type.name)}function we(e,t,n){let r=e.node(n);return Ce(r,t.node(n)),r}function Te(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ee(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Te(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Te(i.child(e),r);t&&t.depth==n&&t.textOffset&&Te(t.nodeBefore,r)}function De(e,t){if(!e.type.validContent(t))throw new ve(`Invalid content for node `+e.type.name);return e.copy(t)}function Oe(e,t,n,r,i){let a=e.depth>i&&we(e,t,i+1),o=r.depth>i&&we(n,r,i+1),s=[];return Ee(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ce(a,o),Te(De(a,Oe(e,t,n,r,i+1)),s)):(a&&Te(De(a,ke(e,t,i+1)),s),Ee(t,n,i,s),o&&Te(De(o,ke(n,r,i+1)),s)),Ee(r,null,i,s),new C(s)}function ke(e,t,n){let r=[];return Ee(null,e,n,r),e.depth>n&&Te(De(we(e,t,n+1),ke(e,t,n+1)),r),Ee(t,null,n,r),new C(r)}function Ae(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(C.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var je=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.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 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 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,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return T.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Fe(this,e,n);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 t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Pe.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Pe.set(t,r=new Me);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Ne,i}},Me=class{constructor(){this.elts=[],this.i=0}},Ne=12,Pe=new WeakMap,Fe=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},Ie=Object.create(null),Le=class e{constructor(e,t,n,r=T.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||C.empty}get children(){return this.content.content}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,t,n,r=0){this.content.nodesBetween(e,t,n,r,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,t,n,r){return this.content.textBetween(e,t,n,r)}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,t,n){return this.type==e&&_e(this.attrs,t||e.defaultAttrs||Ie)&&T.sameSet(this.marks,n||T.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return E.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new E(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return xe(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return je.resolveCached(this,e)}resolveNoCache(e){return je.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),ze(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=C.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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),this.type.checkAttrs(this.attrs);let e=T.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!T.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t 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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=C.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Le.prototype.text=void 0;var Re=class e extends Le{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ze(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function ze(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Be=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Ve(t,n);if(r.next==null)return e.empty;let i=He(r);r.next&&r.err(`Unexpected trailing text`);let a=Qe(Ye(i));return $e(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return C.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
1
+ import{a as e,i as t,n,r}from"./createLucideIcon-CUopU_LC.js";import{D as i,E as a,d as o,n as s,t as c}from"./with-selector-id7qGzTH.js";import{a as l,c as u,d,f,h as p,i as m,l as h,m as g,n as _,o as v,p as y,r as b,s as ee,t as te,u as x}from"./undo-2-DlSB-5DM.js";import{n as ne,r as re,t as ie}from"./minimize-2-Bx2cH_WS.js";import{s as ae}from"./dist-UsTgBPww.js";import{t as oe}from"./textarea-DBVf3GGt.js";import{W as se,b as ce,ft as le,x as ue,y as de}from"./index-uYpCUVT4.js";function S(e){this.content=e}S.prototype={constructor:S,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new S(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new S(n)},addToStart:function(e,t){return new S([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new S(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new S(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=S.from(e),e.size?new S(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=S.from(e),e.size?new S(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=S.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},S.from=function(e){if(e instanceof S)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new S(t)};function fe(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&he(e.charCodeAt(r-1))&&me(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=fe(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function pe(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&he(e.charCodeAt(i-1))&&me(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=pe(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function me(e){return e>=56320&&e<57344}function he(e){return e>=55296&&e<56320}var C=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return fe(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return pe(this,e,t,n)}findIndex(e){if(e==0)return ge(0,e);if(e==this.size)return ge(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ge(t+1,i):ge(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};C.empty=new C([],0);var w={index:0,offset:0};function ge(e,t){return w.index=e,w.offset=t,w}function _e(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!_e(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!_e(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var T=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&_e(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};T.none=[];var ve=class extends Error{},E=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=be(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(ye(this.content,t+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(C.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};E.empty=new E(C.empty,0,0);function ye(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(ye(a.content,t-i-1,n-i-1)))}function be(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=be(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function xe(e,t,n){if(n.openStart>e.depth)throw new ve(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ve(`Inconsistent open depths`);return Se(e,t,n,0)}function Se(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Se(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return De(a,ke(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return De(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Ae(n,e);return De(a,Oe(e,i,o,t,r))}}function Ce(e,t){if(!t.type.compatibleContent(e.type))throw new ve(`Cannot join `+t.type.name+` onto `+e.type.name)}function we(e,t,n){let r=e.node(n);return Ce(r,t.node(n)),r}function Te(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ee(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Te(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Te(i.child(e),r);t&&t.depth==n&&t.textOffset&&Te(t.nodeBefore,r)}function De(e,t){if(!e.type.validContent(t))throw new ve(`Invalid content for node `+e.type.name);return e.copy(t)}function Oe(e,t,n,r,i){let a=e.depth>i&&we(e,t,i+1),o=r.depth>i&&we(n,r,i+1),s=[];return Ee(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ce(a,o),Te(De(a,Oe(e,t,n,r,i+1)),s)):(a&&Te(De(a,ke(e,t,i+1)),s),Ee(t,n,i,s),o&&Te(De(o,ke(n,r,i+1)),s)),Ee(r,null,i,s),new C(s)}function ke(e,t,n){let r=[];return Ee(null,e,n,r),e.depth>n&&Te(De(we(e,t,n+1),ke(e,t,n+1)),r),Ee(t,null,n,r),new C(r)}function Ae(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(C.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var je=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.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 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 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,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return T.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Fe(this,e,n);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 t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Pe.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Pe.set(t,r=new Me);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Ne,i}},Me=class{constructor(){this.elts=[],this.i=0}},Ne=12,Pe=new WeakMap,Fe=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},Ie=Object.create(null),Le=class e{constructor(e,t,n,r=T.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||C.empty}get children(){return this.content.content}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,t,n,r=0){this.content.nodesBetween(e,t,n,r,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,t,n,r){return this.content.textBetween(e,t,n,r)}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,t,n){return this.type==e&&_e(this.attrs,t||e.defaultAttrs||Ie)&&T.sameSet(this.marks,n||T.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return E.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new E(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return xe(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return je.resolveCached(this,e)}resolveNoCache(e){return je.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),ze(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=C.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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),this.type.checkAttrs(this.attrs);let e=T.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!T.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t 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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=C.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Le.prototype.text=void 0;var Re=class e extends Le{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ze(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function ze(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Be=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Ve(t,n);if(r.next==null)return e.empty;let i=He(r);r.next&&r.err(`Unexpected trailing text`);let a=Qe(Ye(i));return $e(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return C.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
2
2
  `)}};Be.empty=new Be(!0);var Ve=class{constructor(e,t){this.string=e,this.nodeTypes=t,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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function He(e){let t=[];do t.push(Ue(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Ue(e){let t=[];do t.push(We(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function We(e){let t=Je(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Ke(e,t);else break;return t}function Ge(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Ke(e,t){let n=Ge(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Ge(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function qe(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Je(e){if(e.eat(`(`)){let t=He(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=qe(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Ye(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Xe(e,t){return t-e}function Ze(e,t){let n=[];return r(t),n.sort(Xe);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Qe(e){let t=Object.create(null);return n(Ze(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Ze(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Be(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Xe);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function $e(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function et(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function tt(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function nt(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function rt(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new ot(e,r,t[r]);return n}var it=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=rt(e,n.attrs),this.defaultAttrs=et(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Be.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}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:tt(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Le(this,this.computeAttrs(e),C.from(t),T.setFrom(n))}createChecked(e=null,t,n){return t=C.from(t),this.checkContent(t),new Le(this,this.computeAttrs(e),t,T.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=C.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(C.empty,!0);return i?new Le(this,e,t.append(i),T.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){nt(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:T.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function at(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var ot=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?at(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},st=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=rt(e,r.attrs),this.excluded=null;let i=et(this.attrs);this.instance=i?new T(this,i):null}create(e=null){return!e&&this.instance?this.instance:new T(this,tt(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){nt(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},ct=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=S.from(e.nodes),t.marks=S.from(e.marks||{}),this.nodes=it.compile(this.spec.nodes,this),this.marks=st.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Be.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?lt(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:lt(this,n.split(` `))}this.nodeFromJSON=e=>Le.fromJSON(this,e),this.markFromJSON=e=>T.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof it))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Re(n,n.defaultAttrs,e,T.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function lt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function ut(e){return e.tag!=null}function dt(e){return e.style!=null}var ft=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ut(e))this.tags.push(e);else if(dt(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new xt(this,t,!1);return n.addAll(e,T.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new xt(this,t,!0);return n.addAll(e,T.none,t.from,t.to),E.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Ct(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=wt(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=wt(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},pt={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},mt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ht={ol:!0,ul:!0},gt=1,_t=2,vt=4;function yt(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?gt:0)|(t===`full`?_t:0)}var bt=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=T.none,this.match=i||(a&vt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(C.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&gt)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=C.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(C.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!pt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},xt=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=yt(null,t.preserveWhitespace,0)|(n?vt:0);i=r?new bt(r.type,r.attrs,T.none,!0,t.topMatch||r.type.contentMatch,a):n?new bt(null,null,T.none,!0,null,a):new bt(e.schema.topNodeType,null,T.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&_t?`full`:this.localPreserveWS||(r.options&gt)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
3
3
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;ht.hasOwnProperty(a)&&this.parser.normalizeLists&&St(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:mt.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(pt.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=T.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Tt(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=yt(e,i,a.options);a.options&vt&&a.content.length==0&&(o|=vt);let s=T.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Tt(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new bt(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=gt);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function St(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&ht.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Ct(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function wt(e){let t={};for(let n in e)t[n]=e[n];return t}function Tt(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Et=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Ot(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Ot(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Mt(Ot(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Mt(Ot(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Mt(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Dt(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Dt(e.marks)}};function Dt(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ot(e){return e.document||window.document}var kt=new WeakMap;function At(e){let t=kt.get(e);return t===void 0&&kt.set(e,t=jt(e)),t}function jt(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Mt(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=At(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Mt(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Nt=65535,Pt=2**16;function Ft(e,t){return e+t*Pt}function It(e){return e&Nt}function Lt(e){return(e-(e&Nt))/Pt}var Rt=1,zt=2,Bt=4,Vt=8,Ht=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Vt)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Bt)>0}},Ut=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=It(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+Lt(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:Ft(o/3,e-s),f=e==s?zt:e==u?Rt:Bt;return(t<0?e!=s:e!=u)&&(f|=Vt),new Ht(a,f,d)}r+=l-c}return n?e+r:new Ht(e+r,0,null)}touches(e,t){let n=0,r=It(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Ut.empty=new Ut([]);var Wt=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new Ht(e,r,null)}},Gt=Object.create(null),D=class{getMap(){return Ut.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Gt[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Gt)throw RangeError(`Duplicate use of step JSON ID `+e);return Gt[e]=t,t.prototype.jsonID=e,t}},Kt=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof ve)return e.fail(t.message);throw t}}};function qt(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(qt(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return C.fromArray(r)}var Jt=class e extends D{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new E(qt(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return Kt.fromReplace(e,this.from,this.to,i)}invert(){return new Yt(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};D.jsonID(`addMark`,Jt);var Yt=class e extends D{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new E(qt(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Kt.fromReplace(e,this.from,this.to,n)}invert(){return new Jt(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};D.jsonID(`removeMark`,Yt);var Xt=class e extends D{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Kt.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Kt.fromReplace(e,this.pos,this.pos+1,new E(C.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Zt(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};D.jsonID(`addNodeMark`,Xt);var Zt=class e extends D{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Kt.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Kt.fromReplace(e,this.pos,this.pos+1,new E(C.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Xt(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};D.jsonID(`removeNodeMark`,Zt);var Qt=class e extends D{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&en(e,this.from,this.to)?Kt.fail(`Structure replace would overwrite content`):Kt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ut([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?E.empty:new E(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?E.empty:new E(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,E.fromJSON(t,n.slice),!!n.structure)}};Qt.MAP_BIAS=1,D.jsonID(`replace`,Qt);var $t=class e extends D{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(en(e,this.from,this.gapFrom)||en(e,this.gapTo,this.to)))return Kt.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Kt.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Kt.fromReplace(e,this.from,this.to,n):Kt.fail(`Content does not fit in gap`)}getMap(){return new Ut([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,E.fromJSON(t,n.slice),n.insert,!!n.structure)}};D.jsonID(`replaceAround`,$t);function en(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function tn(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Yt(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Jt(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function nn(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof st){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Yt(t.from,t.to,t.style)))}function rn(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Qt(s,l,E.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Yt(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new E(C.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Qt(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(C.empty,!0);e.replace(s,s,new E(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function an(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function on(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!an(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function sn(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=C.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=C.from(r.node(e).copy(u)),d++):c--;let f=C.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=C.from(i.node(e).copy(f)),p++):l++;e.step(new $t(c,l,o,s,new E(u.append(f),d,p),u.size-d,!0))}function cn(e,t,n=null,r=e){let i=un(e,t),a=i&&dn(r,t);return a?i.map(ln).concat({type:t,attrs:n}).concat(a.map(ln)):null}function ln(e){return{type:e,attrs:null}}function un(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function dn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function fn(e,t,n){let r=C.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=C.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new $t(i,a,i,a,new E(r,0,0),n.length,!0))}function pn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&gn(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&hn(e,t,n,a),rn(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new $t(c,l,c+1,l-1,new E(C.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&mn(e,t,n,a),!1}})}function mn(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function hn(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
@@ -101,7 +101,7 @@ img.ProseMirror-separator {
101
101
  display: block;
102
102
  }`,mf=class extends Cd{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Ju,createMappablePosition:Yu},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=gl(t,this.options.autofocus);this.editorState=ur.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=Td(pf,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=du(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){let e=[...this.options.enableCoreExtensions?[af,ef.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),tf,sf,cf,uf.configure({value:this.options.coreExtensionOptions?.tabindex?.value}),rf,lf,nf,df.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new Qd(e,this)}createCommandManager(){this.commandManager=new Uc({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=tu(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=tu(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new vc(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return Au(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return Bu(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return uu(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
103
103
 
104
- `,textSerializers:n={}}=e||{};return Du(this.state.doc,{blockSeparator:t,textSerializers:{...Ou(this.schema),...n}})}get isEmpty(){return Gu(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new ff(t,this,!1,n)}get $doc(){return this.$pos(0)}};function hf(e){return new Bd({find:e.find,handler:({state:t,range:n,match:r})=>{let i=R(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Pu(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function gf(e){return new Bd({find:e.find,handler:({state:t,range:n,match:r})=>{let i=R(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function _f(e){return new Bd({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=R(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function vf(e){return new Bd({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=R(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&cn(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&bn(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var V=class e extends Wd{constructor(){super(...arguments),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function yf(e){return new Kd({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=R(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Pu(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:bf,getOwnPropertySymbols:xf}=Object,{hasOwnProperty:Sf}=Object.prototype;function Cf(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function wf(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Tf(e){return e?.[Symbol.toStringTag]}function Ef(e){return bf(e).concat(xf(e))}var Df=Object.hasOwn||((e,t)=>Sf.call(e,t));function Of(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var kf=`__v`,Af=`__o`,jf=`_owner`,{getOwnPropertyDescriptor:Mf,keys:Nf}=Object;function Pf(e,t){return e.byteLength===t.byteLength&&qf(new Uint8Array(e),new Uint8Array(t))}function Ff(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function If(e,t){return e.byteLength===t.byteLength&&qf(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Lf(e,t){return Of(e.getTime(),t.getTime())}function Rf(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function zf(e,t){return e===t}function Bf(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Vf=Of;function Hf(e,t,n){let r=Nf(e),i=r.length;if(Nf(t).length!==i)return!1;for(;i-->0;)if(!Yf(e,t,n,r[i]))return!1;return!0}function Uf(e,t,n){let r=Ef(e),i=r.length;if(Ef(t).length!==i)return!1;let a,o,s;for(;i-->0;)if(a=r[i],!Yf(e,t,n,a)||(o=Mf(e,a),s=Mf(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Wf(e,t){return Of(e.valueOf(),t.valueOf())}function Gf(e,t){return e.source===t.source&&e.flags===t.flags}function Kf(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function qf(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-->0;)if(e[n]!==t[n])return!1;return!0}function Jf(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Yf(e,t,n,r){return(r===jf||r===Af||r===kf)&&(e.$$typeof||t.$$typeof)?!0:Df(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Xf=`[object ArrayBuffer]`,Zf=`[object Arguments]`,Qf=`[object Boolean]`,$f=`[object DataView]`,ep=`[object Date]`,tp=`[object Error]`,np=`[object Map]`,rp=`[object Number]`,ip=`[object Object]`,ap=`[object RegExp]`,op=`[object Set]`,sp=`[object String]`,cp={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},lp=`[object URL]`,up=Object.prototype.toString;function dp({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`&&a(h,g,_);let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=up.call(h);if(b===ep)return r(h,g,_);if(b===ap)return u(h,g,_);if(b===np)return o(h,g,_);if(b===op)return d(h,g,_);if(b===ip)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===lp)return p(h,g,_);if(b===tp)return i(h,g,_);if(b===Zf)return c(h,g,_);if(cp[b])return f(h,g,_);if(b===Xf)return e(h,g,_);if(b===$f)return n(h,g,_);if(b===Qf||b===rp||b===sp)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Tf(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function fp({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Pf,areArraysEqual:n?Uf:Ff,areDataViewsEqual:If,areDatesEqual:Lf,areErrorsEqual:Rf,areFunctionsEqual:zf,areMapsEqual:n?Cf(Bf,Uf):Bf,areNumbersEqual:Vf,areObjectsEqual:n?Uf:Hf,arePrimitiveWrappersEqual:Wf,areRegExpsEqual:Gf,areSetsEqual:n?Cf(Kf,Uf):Kf,areTypedArraysEqual:n?Cf(qf,Uf):qf,areUrlsEqual:Jf,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=wf(r.areArraysEqual),t=wf(r.areMapsEqual),n=wf(r.areObjectsEqual),i=wf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function pp(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function mp({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var hp=gp();gp({strict:!0}),gp({circular:!0}),gp({circular:!0,strict:!0}),gp({createInternalComparator:()=>Of}),gp({strict:!0,createInternalComparator:()=>Of}),gp({circular:!0,createInternalComparator:()=>Of}),gp({circular:!0,createInternalComparator:()=>Of,strict:!0});function gp(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=dp(fp(e));return mp({circular:t,comparator:a,createState:r,equals:n?n(a):pp(a),strict:i})}var H=e(n(),1),_p=e(i(),1),vp=o(),U=a(),yp=c(),bp=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},xp=({contentComponent:e})=>{let t=(0,vp.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,U.jsx)(U.Fragment,{children:Object.values(t)})};function Sp(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:_p.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var Cp=class extends H.Component{constructor(e){super(e),this.editorContentRef=H.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Sp(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{ref:bp(t,this.editorContentRef),...n}),e?.contentComponent&&(0,U.jsx)(xp,{contentComponent:e.contentComponent})]})}},wp=(0,H.forwardRef)((e,t)=>{let n=H.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return H.createElement(Cp,{key:n,innerRef:t,...e})}),Tp=H.memo(wp),Ep=typeof window<`u`?H.useLayoutEffect:H.useEffect,Dp=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function Op(e){let[t]=(0,H.useState)(()=>new Dp(e.editor)),n=(0,yp.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??hp);return Ep(()=>t.watch(e.editor),[e.editor,t]),(0,H.useDebugValue)(n),n}var kp=typeof window>`u`,Ap=kp||!!(typeof window<`u`&&window.next),jp=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return(kp||Ap&&e===void 0)&&(t=!1),t?this.createEditor():null}createEditor(){return new mf({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>e===t.extensions?.[n]):e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Mp(e={},t=[]){let n=(0,H.useRef)(e);n.current=e;let[r]=(0,H.useState)(()=>new jp(n)),i=(0,vp.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,H.useDebugValue)(i),(0,H.useEffect)(r.onRender(t)),Op({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Np=(0,H.createContext)({editor:null});Np.Consumer;var Pp=(0,H.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Fp=()=>(0,H.useContext)(Pp);H.forwardRef((e,t)=>{let{onDragStart:n}=Fp();return(0,U.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),H.createContext({markViewContentRef:()=>{}});var Ip=(0,H.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});Ip.displayName=`TiptapContext`;var Lp=()=>(0,H.useContext)(Ip);function Rp({children:e,...t}){let n=`editor`in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,H.useMemo)(()=>({editor:n}),[n]),i=(0,H.useMemo)(()=>({editor:n}),[n]);return(0,U.jsx)(Np.Provider,{value:i,children:(0,U.jsx)(Ip.Provider,{value:r,children:e})})}Rp.displayName=`Tiptap`;function zp({...e}){let{editor:t}=Lp();return(0,U.jsx)(Tp,{editor:t,...e})}zp.displayName=`Tiptap.Content`,Object.assign(Rp,{Content:zp});var Bp=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]};function Vp(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Wp(e.charCodeAt(r-1))&&Up(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Vp(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Hp(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Wp(e.charCodeAt(i-1))&&Up(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Hp(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Up(e){return e>=56320&&e<57344}function Wp(e){return e>=55296&&e<56320}var Gp=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Vp(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Hp(this,e,t,n)}findIndex(e){if(e==0)return qp(0,e);if(e==this.size)return qp(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?qp(t+1,i):qp(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};Gp.empty=new Gp([],0);var Kp={index:0,offset:0};function qp(e,t){return Kp.index=e,Kp.offset=t,Kp}function Jp(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Jp(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Jp(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Yp=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Jp(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Yp.none=[];var Xp=class extends Error{},W=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Qp(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Zp(this.content,t+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(Gp.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};W.empty=new W(Gp.empty,0,0);function Zp(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Zp(a.content,t-i-1,n-i-1)))}function Qp(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Qp(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function $p(e,t,n){if(n.openStart>e.depth)throw new Xp(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Xp(`Inconsistent open depths`);return em(e,t,n,0)}function em(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=em(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return am(a,sm(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return am(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=cm(n,e);return am(a,om(e,i,o,t,r))}}function tm(e,t){if(!t.type.compatibleContent(e.type))throw new Xp(`Cannot join `+t.type.name+` onto `+e.type.name)}function nm(e,t,n){let r=e.node(n);return tm(r,t.node(n)),r}function rm(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function im(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(rm(e.nodeAfter,r),a++));for(let e=a;e<o;e++)rm(i.child(e),r);t&&t.depth==n&&t.textOffset&&rm(t.nodeBefore,r)}function am(e,t){if(!e.type.validContent(t))throw new Xp(`Invalid content for node `+e.type.name);return e.copy(t)}function om(e,t,n,r,i){let a=e.depth>i&&nm(e,t,i+1),o=r.depth>i&&nm(n,r,i+1),s=[];return im(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(tm(a,o),rm(am(a,om(e,t,n,r,i+1)),s)):(a&&rm(am(a,sm(e,t,i+1)),s),im(t,n,i,s),o&&rm(am(o,sm(n,r,i+1)),s)),im(r,null,i,s),new Gp(s)}function sm(e,t,n){let r=[];return im(null,e,n,r),e.depth>n&&rm(am(nm(e,t,n+1),sm(e,t,n+1)),r),im(t,null,n,r),new Gp(r)}function cm(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Gp.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var lm=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.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 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 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,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Yp.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new pm(this,e,n);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 t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=fm.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else fm.set(t,r=new um);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%dm,i}},um=class{constructor(){this.elts=[],this.i=0}},dm=12,fm=new WeakMap,pm=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},mm=Object.create(null),hm=class e{constructor(e,t,n,r=Yp.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Gp.empty}get children(){return this.content.content}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,t,n,r=0){this.content.nodesBetween(e,t,n,r,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,t,n,r){return this.content.textBetween(e,t,n,r)}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,t,n){return this.type==e&&Jp(this.attrs,t||e.defaultAttrs||mm)&&Yp.sameSet(this.marks,n||Yp.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return W.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new W(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return $p(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return lm.resolveCached(this,e)}resolveNoCache(e){return lm.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),gm(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=Gp.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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),this.type.checkAttrs(this.attrs);let e=Yp.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Yp.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t 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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=Gp.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};hm.prototype.text=void 0;function gm(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var _m=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new vm(t,n);if(r.next==null)return e.empty;let i=ym(r);r.next&&r.err(`Unexpected trailing text`);let a=km(Em(i));return Am(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return Gp.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
104
+ `,textSerializers:n={}}=e||{};return Du(this.state.doc,{blockSeparator:t,textSerializers:{...Ou(this.schema),...n}})}get isEmpty(){return Gu(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new ff(t,this,!1,n)}get $doc(){return this.$pos(0)}};function hf(e){return new Bd({find:e.find,handler:({state:t,range:n,match:r})=>{let i=R(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Pu(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function gf(e){return new Bd({find:e.find,handler:({state:t,range:n,match:r})=>{let i=R(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function _f(e){return new Bd({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=R(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function vf(e){return new Bd({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=R(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&cn(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&bn(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var V=class e extends Wd{constructor(){super(...arguments),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function yf(e){return new Kd({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=R(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Pu(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:bf,getOwnPropertySymbols:xf}=Object,{hasOwnProperty:Sf}=Object.prototype;function Cf(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function wf(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Tf(e){return e?.[Symbol.toStringTag]}function Ef(e){return bf(e).concat(xf(e))}var Df=Object.hasOwn||((e,t)=>Sf.call(e,t));function Of(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var kf=`__v`,Af=`__o`,jf=`_owner`,{getOwnPropertyDescriptor:Mf,keys:Nf}=Object;function Pf(e,t){return e.byteLength===t.byteLength&&qf(new Uint8Array(e),new Uint8Array(t))}function Ff(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function If(e,t){return e.byteLength===t.byteLength&&qf(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Lf(e,t){return Of(e.getTime(),t.getTime())}function Rf(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function zf(e,t){return e===t}function Bf(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Vf=Of;function Hf(e,t,n){let r=Nf(e),i=r.length;if(Nf(t).length!==i)return!1;for(;i-->0;)if(!Yf(e,t,n,r[i]))return!1;return!0}function Uf(e,t,n){let r=Ef(e),i=r.length;if(Ef(t).length!==i)return!1;let a,o,s;for(;i-->0;)if(a=r[i],!Yf(e,t,n,a)||(o=Mf(e,a),s=Mf(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Wf(e,t){return Of(e.valueOf(),t.valueOf())}function Gf(e,t){return e.source===t.source&&e.flags===t.flags}function Kf(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function qf(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-->0;)if(e[n]!==t[n])return!1;return!0}function Jf(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Yf(e,t,n,r){return(r===jf||r===Af||r===kf)&&(e.$$typeof||t.$$typeof)?!0:Df(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Xf=`[object ArrayBuffer]`,Zf=`[object Arguments]`,Qf=`[object Boolean]`,$f=`[object DataView]`,ep=`[object Date]`,tp=`[object Error]`,np=`[object Map]`,rp=`[object Number]`,ip=`[object Object]`,ap=`[object RegExp]`,op=`[object Set]`,sp=`[object String]`,cp={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},lp=`[object URL]`,up=Object.prototype.toString;function dp({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`&&a(h,g,_);let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=up.call(h);if(b===ep)return r(h,g,_);if(b===ap)return u(h,g,_);if(b===np)return o(h,g,_);if(b===op)return d(h,g,_);if(b===ip)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===lp)return p(h,g,_);if(b===tp)return i(h,g,_);if(b===Zf)return c(h,g,_);if(cp[b])return f(h,g,_);if(b===Xf)return e(h,g,_);if(b===$f)return n(h,g,_);if(b===Qf||b===rp||b===sp)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Tf(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function fp({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Pf,areArraysEqual:n?Uf:Ff,areDataViewsEqual:If,areDatesEqual:Lf,areErrorsEqual:Rf,areFunctionsEqual:zf,areMapsEqual:n?Cf(Bf,Uf):Bf,areNumbersEqual:Vf,areObjectsEqual:n?Uf:Hf,arePrimitiveWrappersEqual:Wf,areRegExpsEqual:Gf,areSetsEqual:n?Cf(Kf,Uf):Kf,areTypedArraysEqual:n?Cf(qf,Uf):qf,areUrlsEqual:Jf,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=wf(r.areArraysEqual),t=wf(r.areMapsEqual),n=wf(r.areObjectsEqual),i=wf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function pp(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function mp({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var hp=gp();gp({strict:!0}),gp({circular:!0}),gp({circular:!0,strict:!0}),gp({createInternalComparator:()=>Of}),gp({strict:!0,createInternalComparator:()=>Of}),gp({circular:!0,createInternalComparator:()=>Of}),gp({circular:!0,createInternalComparator:()=>Of,strict:!0});function gp(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=dp(fp(e));return mp({circular:t,comparator:a,createState:r,equals:n?n(a):pp(a),strict:i})}var H=e(n(),1),_p=e(i(),1),vp=s(),U=a(),yp=c(),bp=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},xp=({contentComponent:e})=>{let t=(0,vp.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,U.jsx)(U.Fragment,{children:Object.values(t)})};function Sp(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:_p.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var Cp=class extends H.Component{constructor(e){super(e),this.editorContentRef=H.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Sp(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{ref:bp(t,this.editorContentRef),...n}),e?.contentComponent&&(0,U.jsx)(xp,{contentComponent:e.contentComponent})]})}},wp=(0,H.forwardRef)((e,t)=>{let n=H.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return H.createElement(Cp,{key:n,innerRef:t,...e})}),Tp=H.memo(wp),Ep=typeof window<`u`?H.useLayoutEffect:H.useEffect,Dp=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function Op(e){let[t]=(0,H.useState)(()=>new Dp(e.editor)),n=(0,yp.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??hp);return Ep(()=>t.watch(e.editor),[e.editor,t]),(0,H.useDebugValue)(n),n}var kp=typeof window>`u`,Ap=kp||!!(typeof window<`u`&&window.next),jp=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return(kp||Ap&&e===void 0)&&(t=!1),t?this.createEditor():null}createEditor(){return new mf({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>e===t.extensions?.[n]):e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Mp(e={},t=[]){let n=(0,H.useRef)(e);n.current=e;let[r]=(0,H.useState)(()=>new jp(n)),i=(0,vp.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,H.useDebugValue)(i),(0,H.useEffect)(r.onRender(t)),Op({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Np=(0,H.createContext)({editor:null});Np.Consumer;var Pp=(0,H.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Fp=()=>(0,H.useContext)(Pp);H.forwardRef((e,t)=>{let{onDragStart:n}=Fp();return(0,U.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),H.createContext({markViewContentRef:()=>{}});var Ip=(0,H.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});Ip.displayName=`TiptapContext`;var Lp=()=>(0,H.useContext)(Ip);function Rp({children:e,...t}){let n=`editor`in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,H.useMemo)(()=>({editor:n}),[n]),i=(0,H.useMemo)(()=>({editor:n}),[n]);return(0,U.jsx)(Np.Provider,{value:i,children:(0,U.jsx)(Ip.Provider,{value:r,children:e})})}Rp.displayName=`Tiptap`;function zp({...e}){let{editor:t}=Lp();return(0,U.jsx)(Tp,{editor:t,...e})}zp.displayName=`Tiptap.Content`,Object.assign(Rp,{Content:zp});var Bp=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]};function Vp(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Wp(e.charCodeAt(r-1))&&Up(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Vp(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Hp(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Wp(e.charCodeAt(i-1))&&Up(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Hp(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Up(e){return e>=56320&&e<57344}function Wp(e){return e>=55296&&e<56320}var Gp=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Vp(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Hp(this,e,t,n)}findIndex(e){if(e==0)return qp(0,e);if(e==this.size)return qp(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?qp(t+1,i):qp(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};Gp.empty=new Gp([],0);var Kp={index:0,offset:0};function qp(e,t){return Kp.index=e,Kp.offset=t,Kp}function Jp(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Jp(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Jp(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Yp=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Jp(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Yp.none=[];var Xp=class extends Error{},W=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Qp(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Zp(this.content,t+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(Gp.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};W.empty=new W(Gp.empty,0,0);function Zp(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Zp(a.content,t-i-1,n-i-1)))}function Qp(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Qp(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function $p(e,t,n){if(n.openStart>e.depth)throw new Xp(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Xp(`Inconsistent open depths`);return em(e,t,n,0)}function em(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=em(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return am(a,sm(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return am(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=cm(n,e);return am(a,om(e,i,o,t,r))}}function tm(e,t){if(!t.type.compatibleContent(e.type))throw new Xp(`Cannot join `+t.type.name+` onto `+e.type.name)}function nm(e,t,n){let r=e.node(n);return tm(r,t.node(n)),r}function rm(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function im(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(rm(e.nodeAfter,r),a++));for(let e=a;e<o;e++)rm(i.child(e),r);t&&t.depth==n&&t.textOffset&&rm(t.nodeBefore,r)}function am(e,t){if(!e.type.validContent(t))throw new Xp(`Invalid content for node `+e.type.name);return e.copy(t)}function om(e,t,n,r,i){let a=e.depth>i&&nm(e,t,i+1),o=r.depth>i&&nm(n,r,i+1),s=[];return im(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(tm(a,o),rm(am(a,om(e,t,n,r,i+1)),s)):(a&&rm(am(a,sm(e,t,i+1)),s),im(t,n,i,s),o&&rm(am(o,sm(n,r,i+1)),s)),im(r,null,i,s),new Gp(s)}function sm(e,t,n){let r=[];return im(null,e,n,r),e.depth>n&&rm(am(nm(e,t,n+1),sm(e,t,n+1)),r),im(t,null,n,r),new Gp(r)}function cm(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Gp.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var lm=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.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 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 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,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Yp.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new pm(this,e,n);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 t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=fm.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else fm.set(t,r=new um);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%dm,i}},um=class{constructor(){this.elts=[],this.i=0}},dm=12,fm=new WeakMap,pm=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},mm=Object.create(null),hm=class e{constructor(e,t,n,r=Yp.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Gp.empty}get children(){return this.content.content}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,t,n,r=0){this.content.nodesBetween(e,t,n,r,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,t,n,r){return this.content.textBetween(e,t,n,r)}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,t,n){return this.type==e&&Jp(this.attrs,t||e.defaultAttrs||mm)&&Yp.sameSet(this.marks,n||Yp.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return W.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new W(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return $p(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return lm.resolveCached(this,e)}resolveNoCache(e){return lm.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),gm(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=Gp.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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),this.type.checkAttrs(this.attrs);let e=Yp.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Yp.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t 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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=Gp.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};hm.prototype.text=void 0;function gm(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var _m=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new vm(t,n);if(r.next==null)return e.empty;let i=ym(r);r.next&&r.err(`Unexpected trailing text`);let a=km(Em(i));return Am(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return Gp.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
105
105
  `)}};_m.empty=new _m(!0);var vm=class{constructor(e,t){this.string=e,this.nodeTypes=t,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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function ym(e){let t=[];do t.push(bm(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function bm(e){let t=[];do t.push(xm(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function xm(e){let t=Tm(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Cm(e,t);else break;return t}function Sm(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Cm(e,t){let n=Sm(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Sm(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function wm(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Tm(e){if(e.eat(`(`)){let t=ym(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=wm(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Em(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Dm(e,t){return t-e}function Om(e,t){let n=[];return r(t),n.sort(Dm);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function km(e){let t=Object.create(null);return n(Om(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Om(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new _m(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Dm);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Am(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var jm=65535,Mm=2**16;function Nm(e,t){return e+t*Mm}function Pm(e){return e&jm}function Fm(e){return(e-(e&jm))/Mm}var Im=1,Lm=2,Rm=4,zm=8,Bm=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&zm)>0}get deletedBefore(){return(this.delInfo&(Im|Rm))>0}get deletedAfter(){return(this.delInfo&(Lm|Rm))>0}get deletedAcross(){return(this.delInfo&Rm)>0}},Vm=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=Pm(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+Fm(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:Nm(o/3,e-s),f=e==s?Lm:e==u?Im:Rm;return(t<0?e!=s:e!=u)&&(f|=zm),new Bm(a,f,d)}r+=l-c}return n?e+r:new Bm(e+r,0,null)}touches(e,t){let n=0,r=Pm(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Vm.empty=new Vm([]);var Hm=Object.create(null),Um=class{getMap(){return Vm.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Hm[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Hm)throw RangeError(`Duplicate use of step JSON ID `+e);return Hm[e]=t,t.prototype.jsonID=e,t}},Wm=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Xp)return e.fail(t.message);throw t}}};function Gm(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Gm(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return Gp.fromArray(r)}var Km=class e extends Um{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new W(Gm(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return Wm.fromReplace(e,this.from,this.to,i)}invert(){return new qm(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Um.jsonID(`addMark`,Km);var qm=class e extends Um{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new W(Gm(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Wm.fromReplace(e,this.from,this.to,n)}invert(){return new Km(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Um.jsonID(`removeMark`,qm);var Jm=class e extends Um{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Wm.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Wm.fromReplace(e,this.pos,this.pos+1,new W(Gp.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Ym(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Um.jsonID(`addNodeMark`,Jm);var Ym=class e extends Um{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Wm.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Wm.fromReplace(e,this.pos,this.pos+1,new W(Gp.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Jm(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Um.jsonID(`removeNodeMark`,Ym);var Xm=class e extends Um{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Qm(e,this.from,this.to)?Wm.fail(`Structure replace would overwrite content`):Wm.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Vm([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,W.fromJSON(t,n.slice),!!n.structure)}};Xm.MAP_BIAS=1,Um.jsonID(`replace`,Xm);var Zm=class e extends Um{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Qm(e,this.from,this.gapFrom)||Qm(e,this.gapTo,this.to)))return Wm.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Wm.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Wm.fromReplace(e,this.from,this.to,n):Wm.fail(`Content does not fit in gap`)}getMap(){return new Vm([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,W.fromJSON(t,n.slice),n.insert,!!n.structure)}};Um.jsonID(`replaceAround`,Zm);function Qm(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}var $m=class e extends Um{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return Wm.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return Wm.fromReplace(e,this.pos,this.pos+1,new W(Gp.from(r),0,+!t.isLeaf))}getMap(){return Vm.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};Um.jsonID(`attr`,$m);var eh=class e extends Um{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return Wm.ok(n)}getMap(){return Vm.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};Um.jsonID(`docAttr`,eh);var th=class extends Error{};th=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},th.prototype=Object.create(Error.prototype),th.prototype.constructor=th,th.prototype.name=`TransformError`;var nh=Object.create(null),G=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new rh(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=W.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?W.empty:t),o==0&&ph(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),ph(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new oh(e):fh(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?fh(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):fh(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new uh(e.node(0))}static atStart(e){return fh(e,e,0,0,1)||new uh(e)}static atEnd(e){return fh(e,e,e.content.size,e.childCount,-1)||new uh(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=nh[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in nh)throw RangeError(`Duplicate use of selection JSON ID `+e);return nh[e]=t,t.prototype.jsonID=e,t}getBookmark(){return oh.between(this.$anchor,this.$head).getBookmark()}};G.prototype.visible=!0;var rh=class{constructor(e,t){this.$from=e,this.$to=t}},ih=!1;function ah(e){!ih&&!e.parent.inlineContent&&(ih=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var oh=class e extends G{constructor(e,t=e){ah(e),ah(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return G.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=W.empty){if(super.replace(e,t),t==W.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new sh(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=G.findFrom(n,r,!0)||G.findFrom(n,-r,!0);if(e)n=e.$head;else return G.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(G.findFrom(t,-r,!0)||G.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};G.jsonID(`text`,oh);var sh=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return oh.between(e.resolve(this.anchor),e.resolve(this.head))}},ch=class e extends G{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?G.near(a):new e(a)}content(){return new W(Gp.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new lh(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};ch.prototype.visible=!1,G.jsonID(`node`,ch);var lh=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new sh(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&ch.isSelectable(n)?new ch(t):G.near(t)}},uh=class e extends G{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=W.empty){if(t==W.empty){e.delete(0,e.doc.content.size);let t=G.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return dh}};G.jsonID(`all`,uh);var dh={map(){return this},resolve(e){return new uh(e)}};function fh(e,t,n,r,i,a=!1){if(t.inlineContent)return oh.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=fh(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&ch.isSelectable(r))return ch.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function ph(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Xm||i instanceof Zm))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(G.near(e.doc.resolve(o),n))}function mh(e,t){return!t||!e?e:e.bind(t)}var hh=class{constructor(e,t,n){this.name=e,this.init=mh(t.init,n),this.apply=mh(t.apply,n)}};new hh(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new hh(`selection`,{init(e,t){return e.selection||G.atStart(t.doc)},apply(e){return e.selection}}),new hh(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new hh(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});var gh=(e,t)=>{let{state:n,view:r}=e,{selection:i}=n;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0)return!1;let o=a.depth-1,s=a.node(o),c=a.index(o);if(c===0)return!1;if(s.type===t)return e.commands.lift(t.name);let l=s.child(c-1);if(l.type!==t||!l.lastChild?.isTextblock)return!1;let u=a.before(),d=u-1-1,{tr:f}=n;return f.delete(u,a.after()).insert(d,a.parent.content),f.setSelection(oh.create(f.doc,d)),r.dispatch(f.scrollIntoView()),!0},_h=/^\s*>\s$/,vh=V.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return Bp(`blockquote`,{...z(this.options.HTMLAttributes,e),children:Bp(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
106
106
  `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
107
107
  `))}),n.join(`
@@ -177,5 +177,5 @@ ${t.innerHTML}
177
177
  `),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){e.set({langPrefix:this.options.languageClassPrefix??`language-`})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,`</code></pre>`)}}}}}}),uT=V.create({name:`hardBreak`}).extend({addStorage(){return{markdown:{serialize(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(e.inTable?iT.storage.markdown.serialize.call(this,e,t,n):`\\
178
178
  `);return}},parse:{}}}}}),dT=V.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:Iw.nodes.heading,parse:{}}}}}),fT=V.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:Iw.nodes.horizontal_rule,parse:{}}}}}),pT=V.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:Iw.nodes.image,parse:{}}}}}),mT=V.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:Iw.nodes.list_item,parse:{}}}}}),hT=V.create({name:`orderedList`});function gT(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var _T=hT.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=gT(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),vT=V.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:Iw.nodes.paragraph,parse:{}}}}});function yT(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var bT=V.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!ST(t)){iT.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function xT(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function ST(e){let t=yT(e),n=t[0],r=t.slice(1);return!(yT(n).some(e=>e.type.name!==`tableHeader`||xT(e)||e.childCount>1)||r.some(e=>yT(e).some(e=>e.type.name===`tableHeader`||xT(e)||e.childCount>1)))}var CT=[sT,cT,lT,uT,dT,fT,iT,pT,mT,_T,vT,bT,V.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),V.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:cT.storage.markdown.serialize,parse:{setup(e){e.use(Bw.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),V.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(tT(t.text))},parse:{}}}}}),Gd.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:Iw.marks.strong,parse:{}}}}}),Gd.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:Iw.marks.code,parse:{}}}}}),Qw,Gd.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:Iw.marks.em,parse:{}}}}}),Gd.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:Iw.marks.link,parse:{}}}}}),Gd.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function wT(e){let t=e.storage?.markdown,n=CT.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var TT=class{constructor(e){Uw(this,`editor`,null),this.editor=e}serialize(e){let t=new Zw(this.nodes,this.marks,{hardBreakNodeName:uT.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(iT)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(Qw)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=wT(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=wT(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},ET=class{constructor(e,t){Uw(this,`editor`,null),Uw(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(ww({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=wT(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=eT(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=wT(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&nT(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}rT(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
179
179
  `?t:t[t.length-1]===`
180
- `?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},DT=B.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new j({key:new M(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return ft.fromSchema(this.editor.schema).parseSlice(eT(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),OT=B.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=$d.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new ET(this.editor,this.options),serializer:new TT(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[Ww.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),DT.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}});function kT(e){return e!==`source`}function AT(e){return e}function jT(e,t){return e===`split`&&!t?`wysiwyg`:e}function MT(e,t){return t===`markdown`?e.storage.markdown?.getMarkdown?.()??``:e.getHTML()}function NT(e,t,n,r){return n||r!==void 0&&t===r?!1:e!==t}var PT={1:f,2:d,3:x},FT=`prose prose-sm max-w-none min-h-[160px] p-3 text-foreground focus:outline-none prose-headings:scroll-mt-20 prose-headings:text-foreground prose-p:text-foreground prose-strong:text-foreground prose-li:text-foreground prose-code:text-foreground prose-pre:text-foreground prose-pre:bg-muted prose-blockquote:text-muted-foreground prose-blockquote:border-border prose-a:text-foreground dark:prose-invert`;function IT({active:e,disabled:t,onClick:n,title:r,children:i}){return(0,U.jsxs)(de,{children:[(0,U.jsx)(ue,{asChild:!0,children:(0,U.jsx)(ae,{type:`button`,variant:e?`secondary`:`ghost`,size:`icon`,className:`size-8`,"aria-pressed":e,"aria-label":r,disabled:t,onMouseDown:e=>{e.preventDefault()},onClick:n,children:i})}),(0,U.jsx)(ce,{children:r})]})}function LT({value:e,onChange:t,format:n=`html`,placeholder:r,disabled:i,defaultMode:a=`wysiwyg`,className:o,onBlur:c,ariaLabelledBy:d,labels:f}){let x={bold:f?.bold??`Bold`,italic:f?.italic??`Italic`,strikethrough:f?.strikethrough??`Strikethrough`,inlineCode:f?.inlineCode??`Inline code`,heading:f?.heading??`Heading {level}`,bulletList:f?.bulletList??`Bullet list`,numberedList:f?.numberedList??`Numbered list`,blockquote:f?.blockquote??`Blockquote`,horizontalRule:f?.horizontalRule??`Horizontal rule`,insertLink:f?.insertLink??`Insert link`,undo:f?.undo??`Undo`,redo:f?.redo??`Redo`,source:f?.source??`Source ({format})`,splitView:f?.splitView??`Split view`,visualEditor:f?.visualEditor??`Visual editor`,fullscreen:f?.fullscreen??`Fullscreen`,exitFullscreen:f?.exitFullscreen??`Exit fullscreen`,urlPrompt:f?.urlPrompt??`URL`},[ae,ce]=H.useState(a),[ue,de]=H.useState(!1),S=jT(ae,ue),[fe,pe]=H.useState(n);H.useEffect(()=>{pe(n)},[n]);let me=H.useRef(fe);H.useEffect(()=>{me.current=fe},[fe]);let he=H.useRef(!1),C=H.useRef(e),w=Mp({extensions:H.useMemo(()=>[vb.configure({heading:{levels:[1,2,3]}}),OT.configure({html:!0,transformPastedText:!0})],[]),content:e,editable:!i,editorProps:{attributes:{class:s(FT),"aria-labelledby":d??``}},onUpdate:({editor:e})=>{let n=MT(e,me.current);C.current=n,t(n)},onBlur:()=>c?.(),immediatelyRender:!1},[i,d]);H.useEffect(()=>{if(!w||!kT(S)){he.current=!1;return}NT(MT(w,fe),e,he.current,C.current)&&(w.commands.setContent(e,{emitUpdate:!1}),C.current=e),he.current=!1},[w,e,fe,S]);let ge=H.useCallback(e=>{if(e!==fe&&(he.current=!0,pe(e),w)){let n=MT(w,e);C.current=n,t(n)}},[fe,w,t]),_e=H.useCallback(t=>{t!==`source`&&w&&(w.commands.setContent(e,{emitUpdate:!1}),C.current=e),ce(t)},[w,e]),T=H.useCallback(()=>{de(e=>!e)},[]);H.useEffect(()=>{if(!ue||typeof window>`u`)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),de(!1))},t=document.body.style.overflow;return document.body.style.overflow=`hidden`,window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e),document.body.style.overflow=t}},[ue]);let ve=H.useCallback(()=>{if(!w)return;let e=w.getAttributes(`link`)?.href??``,t=typeof window<`u`?window.prompt(x.urlPrompt,e):null;if(t==null)return;if(t===``){w.chain().focus().extendMarkRange(`link`).unsetMark(`link`).run();return}let n=w.chain().focus().extendMarkRange(`link`);typeof n.setLink==`function`&&n.setLink({href:t}).run()},[w,x.urlPrompt]);return w?(0,U.jsxs)(`div`,{className:s(`rounded-md border border-input bg-background shadow-sm`,i&&`opacity-50`,ue&&`fixed inset-0 z-50 flex flex-col rounded-none border-0 shadow-none`,o),children:[(0,U.jsxs)(`div`,{className:s(`flex flex-wrap items-center gap-0.5 border-b border-border p-1`,ue&&`shrink-0 bg-background`),children:[(0,U.jsx)(IT,{title:x.bold,active:w.isActive(`bold`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleBold().run(),children:(0,U.jsx)(p,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.italic,active:w.isActive(`italic`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleItalic().run(),children:(0,U.jsx)(h,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.strikethrough,active:w.isActive(`strike`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleStrike().run(),children:(0,U.jsx)(_,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.inlineCode,active:w.isActive(`code`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleCode().run(),children:(0,U.jsx)(re,{className:`size-4`})}),(0,U.jsx)(se,{orientation:`vertical`,className:`mx-0.5 h-6`}),[1,2,3].map(e=>{let t=PT[e];return(0,U.jsx)(IT,{title:x.heading.replace(`{level}`,String(e)),active:w.isActive(`heading`,{level:e}),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleHeading({level:e}).run(),children:(0,U.jsx)(t,{className:`size-4`})},e)}),(0,U.jsx)(se,{orientation:`vertical`,className:`mx-0.5 h-6`}),(0,U.jsx)(IT,{title:x.bulletList,active:w.isActive(`bulletList`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleBulletList().run(),children:(0,U.jsx)(v,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.numberedList,active:w.isActive(`orderedList`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleOrderedList().run(),children:(0,U.jsx)(ee,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.blockquote,active:w.isActive(`blockquote`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleBlockquote().run(),children:(0,U.jsx)(m,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.horizontalRule,disabled:S===`source`||i,onClick:()=>w.chain().focus().setHorizontalRule().run(),children:(0,U.jsx)(l,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.insertLink,active:w.isActive(`link`),disabled:S===`source`||i,onClick:ve,children:(0,U.jsx)(u,{className:`size-4`})}),(0,U.jsx)(se,{orientation:`vertical`,className:`mx-0.5 h-6`}),(0,U.jsx)(IT,{title:x.undo,disabled:S===`source`||!w.can().undo()||i,onClick:()=>w.chain().focus().undo().run(),children:(0,U.jsx)(te,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.redo,disabled:S===`source`||!w.can().redo()||i,onClick:()=>w.chain().focus().redo().run(),children:(0,U.jsx)(b,{className:`size-4`})}),(0,U.jsx)(`div`,{className:`ml-auto`}),(0,U.jsx)(`div`,{className:`flex h-8 items-center overflow-hidden rounded-md border border-input`,children:[`html`,`markdown`].map(e=>(0,U.jsx)(`button`,{type:`button`,"aria-pressed":fe===e,disabled:i,onMouseDown:e=>e.preventDefault(),onClick:()=>ge(e),className:s(`h-full cursor-pointer px-2 text-xs font-medium uppercase transition-colors`,fe===e?`bg-secondary text-secondary-foreground`:`bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,i&&`pointer-events-none opacity-50`),children:e===`html`?`HTML`:`MD`},e))}),(0,U.jsx)(se,{orientation:`vertical`,className:`mx-0.5 h-6`}),(0,U.jsx)(IT,{title:x.source.replace(`{format}`,fe),active:S===`source`,disabled:i,onClick:()=>_e(`source`),children:(0,U.jsx)(g,{className:`size-4`})}),AT(ue)&&(0,U.jsx)(IT,{title:x.splitView,active:S===`split`,disabled:i,onClick:()=>_e(`split`),children:(0,U.jsx)(y,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.visualEditor,active:S===`wysiwyg`,disabled:i,onClick:()=>_e(`wysiwyg`),children:(0,U.jsx)(le,{className:`size-4`})}),(0,U.jsx)(IT,{title:ue?x.exitFullscreen:x.fullscreen,active:ue,onClick:T,children:ue?(0,U.jsx)(ie,{className:`size-4`}):(0,U.jsx)(ne,{className:`size-4`})})]}),S===`source`?(0,U.jsx)(oe,{value:e,onChange:e=>t(e.target.value),onBlur:()=>c?.(),placeholder:r,disabled:i,spellCheck:!1,className:s(`w-full rounded-none border-0 font-mono text-xs shadow-none focus-visible:ring-0`,ue?`min-h-0 flex-1 resize-none`:`min-h-[160px] resize-y`)}):S===`split`?(0,U.jsxs)(`div`,{className:s(`flex w-full`,ue?`min-h-0 flex-1`:`min-h-[160px]`),children:[(0,U.jsx)(oe,{value:e,onChange:e=>t(e.target.value),onBlur:()=>c?.(),placeholder:r,disabled:i,spellCheck:!1,className:s(`w-1/2 rounded-none border-0 font-mono text-xs shadow-none focus-visible:ring-0`,ue?`min-h-0 resize-none`:`min-h-[160px] resize-none`)}),(0,U.jsx)(`div`,{"aria-hidden":!0,className:`w-px shrink-0 self-stretch bg-border`}),(0,U.jsx)(Tp,{editor:w,className:s(`w-1/2 overflow-auto`,i&&`pointer-events-none`,ue&&`min-h-0 [&_.ProseMirror]:min-h-full`)})]}):(0,U.jsx)(Tp,{editor:w,className:s(i&&`pointer-events-none`,ue&&`min-h-0 flex-1 overflow-auto [&_.ProseMirror]:min-h-full`)})]}):(0,U.jsx)(`div`,{className:s(`rounded-md border border-input bg-background text-sm text-muted-foreground`,o),children:(0,U.jsx)(`div`,{className:`p-3`,children:r??``})})}export{LT as RichtextEditor};
181
- //# sourceMappingURL=heavy-fields-BiCEgD2L.js.map
180
+ `?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},DT=B.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new j({key:new M(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return ft.fromSchema(this.editor.schema).parseSlice(eT(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),OT=B.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=$d.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new ET(this.editor,this.options),serializer:new TT(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[Ww.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),DT.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}});function kT(e){return e!==`source`}function AT(e){return e}function jT(e,t){return e===`split`&&!t?`wysiwyg`:e}function MT(e,t){return t===`markdown`?e.storage.markdown?.getMarkdown?.()??``:e.getHTML()}function NT(e,t,n,r){return n||r!==void 0&&t===r?!1:e!==t}var PT={1:f,2:d,3:x},FT=`prose prose-sm max-w-none min-h-[160px] p-3 text-foreground focus:outline-none prose-headings:scroll-mt-20 prose-headings:text-foreground prose-p:text-foreground prose-strong:text-foreground prose-li:text-foreground prose-code:text-foreground prose-pre:text-foreground prose-pre:bg-muted prose-blockquote:text-muted-foreground prose-blockquote:border-border prose-a:text-foreground dark:prose-invert`;function IT({active:e,disabled:t,onClick:n,title:r,children:i}){return(0,U.jsxs)(de,{children:[(0,U.jsx)(ue,{asChild:!0,children:(0,U.jsx)(ae,{type:`button`,variant:e?`secondary`:`ghost`,size:`icon`,className:`size-8`,"aria-pressed":e,"aria-label":r,disabled:t,onMouseDown:e=>{e.preventDefault()},onClick:n,children:i})}),(0,U.jsx)(ce,{children:r})]})}function LT({value:e,onChange:t,format:n=`html`,placeholder:r,disabled:i,defaultMode:a=`wysiwyg`,className:s,onBlur:c,ariaLabelledBy:d,labels:f}){let x={bold:f?.bold??`Bold`,italic:f?.italic??`Italic`,strikethrough:f?.strikethrough??`Strikethrough`,inlineCode:f?.inlineCode??`Inline code`,heading:f?.heading??`Heading {level}`,bulletList:f?.bulletList??`Bullet list`,numberedList:f?.numberedList??`Numbered list`,blockquote:f?.blockquote??`Blockquote`,horizontalRule:f?.horizontalRule??`Horizontal rule`,insertLink:f?.insertLink??`Insert link`,undo:f?.undo??`Undo`,redo:f?.redo??`Redo`,source:f?.source??`Source ({format})`,splitView:f?.splitView??`Split view`,visualEditor:f?.visualEditor??`Visual editor`,fullscreen:f?.fullscreen??`Fullscreen`,exitFullscreen:f?.exitFullscreen??`Exit fullscreen`,urlPrompt:f?.urlPrompt??`URL`},[ae,ce]=H.useState(a),[ue,de]=H.useState(!1),S=jT(ae,ue),[fe,pe]=H.useState(n);H.useEffect(()=>{pe(n)},[n]);let me=H.useRef(fe);H.useEffect(()=>{me.current=fe},[fe]);let he=H.useRef(!1),C=H.useRef(e),w=Mp({extensions:H.useMemo(()=>[vb.configure({heading:{levels:[1,2,3]}}),OT.configure({html:!0,transformPastedText:!0})],[]),content:e,editable:!i,editorProps:{attributes:{class:o(FT),"aria-labelledby":d??``}},onUpdate:({editor:e})=>{let n=MT(e,me.current);C.current=n,t(n)},onBlur:()=>c?.(),immediatelyRender:!1},[i,d]);H.useEffect(()=>{if(!w||!kT(S)){he.current=!1;return}NT(MT(w,fe),e,he.current,C.current)&&(w.commands.setContent(e,{emitUpdate:!1}),C.current=e),he.current=!1},[w,e,fe,S]);let ge=H.useCallback(e=>{if(e!==fe&&(he.current=!0,pe(e),w)){let n=MT(w,e);C.current=n,t(n)}},[fe,w,t]),_e=H.useCallback(t=>{t!==`source`&&w&&(w.commands.setContent(e,{emitUpdate:!1}),C.current=e),ce(t)},[w,e]),T=H.useCallback(()=>{de(e=>!e)},[]);H.useEffect(()=>{if(!ue||typeof window>`u`)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),de(!1))},t=document.body.style.overflow;return document.body.style.overflow=`hidden`,window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e),document.body.style.overflow=t}},[ue]);let ve=H.useCallback(()=>{if(!w)return;let e=w.getAttributes(`link`)?.href??``,t=typeof window<`u`?window.prompt(x.urlPrompt,e):null;if(t==null)return;if(t===``){w.chain().focus().extendMarkRange(`link`).unsetMark(`link`).run();return}let n=w.chain().focus().extendMarkRange(`link`);typeof n.setLink==`function`&&n.setLink({href:t}).run()},[w,x.urlPrompt]);return w?(0,U.jsxs)(`div`,{className:o(`rounded-md border border-input bg-background shadow-sm`,i&&`opacity-50`,ue&&`fixed inset-0 z-50 flex flex-col rounded-none border-0 shadow-none`,s),children:[(0,U.jsxs)(`div`,{className:o(`flex flex-wrap items-center gap-0.5 border-b border-border p-1`,ue&&`shrink-0 bg-background`),children:[(0,U.jsx)(IT,{title:x.bold,active:w.isActive(`bold`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleBold().run(),children:(0,U.jsx)(p,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.italic,active:w.isActive(`italic`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleItalic().run(),children:(0,U.jsx)(h,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.strikethrough,active:w.isActive(`strike`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleStrike().run(),children:(0,U.jsx)(_,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.inlineCode,active:w.isActive(`code`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleCode().run(),children:(0,U.jsx)(re,{className:`size-4`})}),(0,U.jsx)(se,{orientation:`vertical`,className:`mx-0.5 h-6`}),[1,2,3].map(e=>{let t=PT[e];return(0,U.jsx)(IT,{title:x.heading.replace(`{level}`,String(e)),active:w.isActive(`heading`,{level:e}),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleHeading({level:e}).run(),children:(0,U.jsx)(t,{className:`size-4`})},e)}),(0,U.jsx)(se,{orientation:`vertical`,className:`mx-0.5 h-6`}),(0,U.jsx)(IT,{title:x.bulletList,active:w.isActive(`bulletList`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleBulletList().run(),children:(0,U.jsx)(v,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.numberedList,active:w.isActive(`orderedList`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleOrderedList().run(),children:(0,U.jsx)(ee,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.blockquote,active:w.isActive(`blockquote`),disabled:S===`source`||i,onClick:()=>w.chain().focus().toggleBlockquote().run(),children:(0,U.jsx)(m,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.horizontalRule,disabled:S===`source`||i,onClick:()=>w.chain().focus().setHorizontalRule().run(),children:(0,U.jsx)(l,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.insertLink,active:w.isActive(`link`),disabled:S===`source`||i,onClick:ve,children:(0,U.jsx)(u,{className:`size-4`})}),(0,U.jsx)(se,{orientation:`vertical`,className:`mx-0.5 h-6`}),(0,U.jsx)(IT,{title:x.undo,disabled:S===`source`||!w.can().undo()||i,onClick:()=>w.chain().focus().undo().run(),children:(0,U.jsx)(te,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.redo,disabled:S===`source`||!w.can().redo()||i,onClick:()=>w.chain().focus().redo().run(),children:(0,U.jsx)(b,{className:`size-4`})}),(0,U.jsx)(`div`,{className:`ml-auto`}),(0,U.jsx)(`div`,{className:`flex h-8 items-center overflow-hidden rounded-md border border-input`,children:[`html`,`markdown`].map(e=>(0,U.jsx)(`button`,{type:`button`,"aria-pressed":fe===e,disabled:i,onMouseDown:e=>e.preventDefault(),onClick:()=>ge(e),className:o(`h-full cursor-pointer px-2 text-xs font-medium uppercase transition-colors`,fe===e?`bg-secondary text-secondary-foreground`:`bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,i&&`pointer-events-none opacity-50`),children:e===`html`?`HTML`:`MD`},e))}),(0,U.jsx)(se,{orientation:`vertical`,className:`mx-0.5 h-6`}),(0,U.jsx)(IT,{title:x.source.replace(`{format}`,fe),active:S===`source`,disabled:i,onClick:()=>_e(`source`),children:(0,U.jsx)(g,{className:`size-4`})}),AT(ue)&&(0,U.jsx)(IT,{title:x.splitView,active:S===`split`,disabled:i,onClick:()=>_e(`split`),children:(0,U.jsx)(y,{className:`size-4`})}),(0,U.jsx)(IT,{title:x.visualEditor,active:S===`wysiwyg`,disabled:i,onClick:()=>_e(`wysiwyg`),children:(0,U.jsx)(le,{className:`size-4`})}),(0,U.jsx)(IT,{title:ue?x.exitFullscreen:x.fullscreen,active:ue,onClick:T,children:ue?(0,U.jsx)(ie,{className:`size-4`}):(0,U.jsx)(ne,{className:`size-4`})})]}),S===`source`?(0,U.jsx)(oe,{value:e,onChange:e=>t(e.target.value),onBlur:()=>c?.(),placeholder:r,disabled:i,spellCheck:!1,className:o(`w-full rounded-none border-0 font-mono text-xs shadow-none focus-visible:ring-0`,ue?`min-h-0 flex-1 resize-none`:`min-h-[160px] resize-y`)}):S===`split`?(0,U.jsxs)(`div`,{className:o(`flex w-full`,ue?`min-h-0 flex-1`:`min-h-[160px]`),children:[(0,U.jsx)(oe,{value:e,onChange:e=>t(e.target.value),onBlur:()=>c?.(),placeholder:r,disabled:i,spellCheck:!1,className:o(`w-1/2 rounded-none border-0 font-mono text-xs shadow-none focus-visible:ring-0`,ue?`min-h-0 resize-none`:`min-h-[160px] resize-none`)}),(0,U.jsx)(`div`,{"aria-hidden":!0,className:`w-px shrink-0 self-stretch bg-border`}),(0,U.jsx)(Tp,{editor:w,className:o(`w-1/2 overflow-auto`,i&&`pointer-events-none`,ue&&`min-h-0 [&_.ProseMirror]:min-h-full`)})]}):(0,U.jsx)(Tp,{editor:w,className:o(i&&`pointer-events-none`,ue&&`min-h-0 flex-1 overflow-auto [&_.ProseMirror]:min-h-full`)})]}):(0,U.jsx)(`div`,{className:o(`rounded-md border border-input bg-background text-sm text-muted-foreground`,s),children:(0,U.jsx)(`div`,{className:`p-3`,children:r??``})})}export{LT as RichtextEditor};
181
+ //# sourceMappingURL=heavy-fields-_zVIBnm1.js.map