@monkeyplus/flow 6.0.71 → 6.0.73

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 (679) hide show
  1. package/cms/dist/assets/{AuthForm-CUz2Ro2K.js → AuthForm-CUehdajc.js} +1 -1
  2. package/cms/dist/assets/{Button-BooObqdP.js → Button-CJFt6aWV.js} +1 -1
  3. package/cms/dist/assets/{Checkbox-0BQNCW0C.js → Checkbox-CiT3TC-l.js} +1 -1
  4. package/cms/dist/assets/Cms-DqtPWmX1.js +1 -0
  5. package/cms/dist/assets/Cms-PiPg-OLZ.js +1 -0
  6. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-CsIHoao4.js +1 -0
  7. package/cms/dist/assets/{Collection-2zX7JMzg.js → Collection-B0yBaat0.js} +1 -1
  8. package/cms/dist/assets/{Collection-B6UKWcVr.js → Collection-Dj6k6x8j.js} +1 -1
  9. package/cms/dist/assets/{Collection.vue_vue_type_script_setup_true_lang-B3k0qHAD.js → Collection.vue_vue_type_script_setup_true_lang-CmmeuErE.js} +1 -1
  10. package/cms/dist/assets/{DropdownMenu--dD4Ugau.js → DropdownMenu-1W9OTJzF.js} +1 -1
  11. package/cms/dist/assets/{Entry-1IJuAw5Y.js → Entry-CSYSJ5Wt.js} +1 -1
  12. package/cms/dist/assets/{Entry-BI3kB5-Q.js → Entry-C_ZkxXDA.js} +1 -1
  13. package/cms/dist/assets/{Entry-DP12G9TL.js → Entry-D3LNKXXC.js} +1 -1
  14. package/cms/dist/assets/{Entry-B8C1-lrW.js → Entry-tazvvBZh.js} +1 -1
  15. package/cms/dist/assets/{Entry.vue_vue_type_script_setup_true_lang-D9j22MUI.js → Entry.vue_vue_type_script_setup_true_lang-BVKICGyd.js} +1 -1
  16. package/cms/dist/assets/{Entry.vue_vue_type_script_setup_true_lang-D4Rf_iMF.js → Entry.vue_vue_type_script_setup_true_lang-DDBfLrbH.js} +1 -1
  17. package/cms/dist/assets/{Fields-Bs08qbF8.js → Fields-BfqGBRs4.js} +1 -1
  18. package/cms/dist/assets/{FormField-BsHbSeUb.js → FormField-DIjxFfLF.js} +1 -1
  19. package/cms/dist/assets/{Input-1aJl-rMT.js → Input-CLDQkwDa.js} +1 -1
  20. package/cms/dist/assets/{Main-AD34pgxi.js → Main-FMjhkZj3.js} +1 -1
  21. package/cms/dist/assets/{Media-Cf02VWO_.js → Media-COlNEi1y.js} +1 -1
  22. package/cms/dist/assets/{Modal-B1hrRCZQ.js → Modal-O9CIs-3B.js} +1 -1
  23. package/cms/dist/assets/{Page-BJcPcEQf.js → Page-DeAEdkDQ.js} +1 -1
  24. package/cms/dist/assets/{PageSideForm-BBcs44uN.js → PageSideForm-CluM3brD.js} +1 -1
  25. package/cms/dist/assets/{PageSideForm-BAxhdPZ-.js → PageSideForm-DpRODbLj.js} +1 -1
  26. package/cms/dist/assets/{Pages-B7gwznnM.js → Pages-CKIYiwdV.js} +1 -1
  27. package/cms/dist/assets/{Pages-C2vTwp5r.js → Pages-DVv2oaiW.js} +1 -1
  28. package/cms/dist/assets/{Preview-CLlVxYta.js → Preview-DaDy9RDU.js} +1 -1
  29. package/cms/dist/assets/{RovingFocusGroup-CKdkkmIx.js → RovingFocusGroup-BpHLnIl_.js} +1 -1
  30. package/cms/dist/assets/{RovingFocusItem-BIF6UQck.js → RovingFocusItem-BojDylTD.js} +1 -1
  31. package/cms/dist/assets/{SelectMenu-DJ3Azsc3.js → SelectMenu-QGBS9wng.js} +1 -1
  32. package/cms/dist/assets/{Settings-1SuXNZp_.js → Settings-D0Gc3GFb.js} +1 -1
  33. package/cms/dist/assets/{Sidebar-4-OD3LdY.js → Sidebar-cgpE32ZR.js} +1 -1
  34. package/cms/dist/assets/{TooltipProvider-B0Lr7v95.js → TooltipProvider-BOCPyYmq.js} +1 -1
  35. package/cms/dist/assets/app-DzhwxuSa.js +1 -0
  36. package/cms/dist/assets/app-TCQdnaAj.js +1 -0
  37. package/cms/dist/assets/{app.vue_vue_type_script_setup_true_lang-BjyQxRp4.js → app.vue_vue_type_script_setup_true_lang-MLvgIJ7s.js} +1 -1
  38. package/cms/dist/assets/{auth-B_N_3VL1.js → auth-BaqYHpYy.js} +1 -1
  39. package/cms/dist/assets/{cms-Cst7aRN_.js → cms-DpSWbx8q.js} +1 -1
  40. package/cms/dist/assets/{dist-CWcmukvQ.js → dist-C3iDqjqL.js} +1 -1
  41. package/cms/dist/assets/{index.spa-CAX3mO8L.js → index.spa-Cki2bcBD.js} +2 -2
  42. package/cms/dist/assets/{index.vue_vue_type_script_setup_true_lang-BFaM_kkZ.js → index.vue_vue_type_script_setup_true_lang-Ciy2EL47.js} +1 -1
  43. package/cms/dist/assets/{not-found-B9MreZ8D.js → not-found-BVa7U45L.js} +1 -1
  44. package/cms/dist/assets/{not-found-BFG4v60e.js → not-found-Dntb3qJk.js} +1 -1
  45. package/cms/dist/assets/pages-D8F3YSda.js +1 -0
  46. package/cms/dist/assets/pages-_7zR5EOs.js +1 -0
  47. package/cms/dist/assets/{preview-CnzUuKun.js → preview-BUAsDBLA.js} +1 -1
  48. package/cms/dist/assets/{useCmsBreadcrumb-BFAWkzps.js → useCmsBreadcrumb-MrfY3SxT.js} +1 -1
  49. package/cms/dist/assets/{useOverlay-42WuI5Jo.js → useOverlay-KmVhW6qi.js} +1 -1
  50. package/cms/dist/assets/{usePortal-CYr2cwo1.js → usePortal-CNf5dTxg.js} +1 -1
  51. package/cms/dist/assets/{useToast-BKulfPxW.js → useToast-D1WgOp-C.js} +1 -1
  52. package/cms/dist/assets/{utils-8_KcOvWq.js → utils-Bv2dEnJu.js} +1 -1
  53. package/cms/dist/index.spa.html +1 -1
  54. package/modules/cms/server/api/admin.mjs +1 -1
  55. package/package.json +1 -1
  56. package/src/public/nitro.mjs +21 -0
  57. package/src/runtime/config.d.ts +3 -0
  58. package/src/runtime/config.mjs +1 -0
  59. package/cms/dist/assets/AuthForm-B0gVFwzm.js +0 -1
  60. package/cms/dist/assets/AuthForm-BZQgPFs-.js +0 -1
  61. package/cms/dist/assets/AuthForm-BabeUsJj.js +0 -1
  62. package/cms/dist/assets/AuthForm-C5B4Wuqs.js +0 -1
  63. package/cms/dist/assets/AuthForm-CKBya5x8.js +0 -1
  64. package/cms/dist/assets/AuthForm-D9zqy79A.js +0 -1
  65. package/cms/dist/assets/AuthForm-Dc9LzSL8.js +0 -1
  66. package/cms/dist/assets/Button-B1_ChBC0.js +0 -3
  67. package/cms/dist/assets/Button-B7wM3Rqf.js +0 -3
  68. package/cms/dist/assets/Button-BYGO05Rp.js +0 -3
  69. package/cms/dist/assets/Button-BqeUw3Nb.js +0 -1
  70. package/cms/dist/assets/Button-BuENm9tV.js +0 -1
  71. package/cms/dist/assets/Button-BxK__vWW.js +0 -3
  72. package/cms/dist/assets/Button-C7jpkO_1.js +0 -1
  73. package/cms/dist/assets/Button-DbVI-83L.js +0 -1
  74. package/cms/dist/assets/Button-DeE4C5qv.js +0 -3
  75. package/cms/dist/assets/Button-Dt2TMimy.js +0 -3
  76. package/cms/dist/assets/Button-IK_nqXss.js +0 -1
  77. package/cms/dist/assets/Button-xknultRn.js +0 -3
  78. package/cms/dist/assets/Checkbox-6GWVsal3.js +0 -1
  79. package/cms/dist/assets/Checkbox-BfHdwIk0.js +0 -1
  80. package/cms/dist/assets/Checkbox-BgCy8mnr.js +0 -1
  81. package/cms/dist/assets/Checkbox-CHILGIjL.js +0 -1
  82. package/cms/dist/assets/Checkbox-CXfABHs8.js +0 -1
  83. package/cms/dist/assets/Checkbox-DdhxCdRA.js +0 -1
  84. package/cms/dist/assets/Checkbox-ZAz-DF2K.js +0 -1
  85. package/cms/dist/assets/Cms--iKNGffI.js +0 -1
  86. package/cms/dist/assets/Cms-1tdwZGMl.js +0 -1
  87. package/cms/dist/assets/Cms-B0vq5n6u.js +0 -1
  88. package/cms/dist/assets/Cms-B1lwE06I.js +0 -1
  89. package/cms/dist/assets/Cms-B75wC8Kv.js +0 -1
  90. package/cms/dist/assets/Cms-BL-bMCXY.js +0 -1
  91. package/cms/dist/assets/Cms-BOZdkHUL.js +0 -1
  92. package/cms/dist/assets/Cms-BURjTcCW.js +0 -1
  93. package/cms/dist/assets/Cms-BY92oHNU.js +0 -1
  94. package/cms/dist/assets/Cms-BZq3sh5J.js +0 -1
  95. package/cms/dist/assets/Cms-BhWTOaHI.js +0 -1
  96. package/cms/dist/assets/Cms-C44-U5eI.js +0 -1
  97. package/cms/dist/assets/Cms-C6Sdowsy.js +0 -1
  98. package/cms/dist/assets/Cms-CSB8-qqP.js +0 -1
  99. package/cms/dist/assets/Cms-DPkKSuvX.js +0 -1
  100. package/cms/dist/assets/Cms-DeWl1IIT.js +0 -1
  101. package/cms/dist/assets/Cms-DpP3trxj.js +0 -1
  102. package/cms/dist/assets/Cms-Dy96x5P5.js +0 -1
  103. package/cms/dist/assets/Cms-QMkk8gFC.js +0 -1
  104. package/cms/dist/assets/Cms-_gffpBZ4.js +0 -1
  105. package/cms/dist/assets/Cms-j1ozEk-V.js +0 -1
  106. package/cms/dist/assets/Cms-kNbTLyZM.js +0 -1
  107. package/cms/dist/assets/Cms-m0iyo84T.js +0 -1
  108. package/cms/dist/assets/Cms-mW1_iLgz.js +0 -1
  109. package/cms/dist/assets/Cms-rJ0hDHXI.js +0 -1
  110. package/cms/dist/assets/Cms-zT5DLnHq.js +0 -1
  111. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-1wCWAxUK.js +0 -1
  112. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-BLjYlaya.js +0 -1
  113. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-BPYuKYBe.js +0 -1
  114. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-BVrwFxvx.js +0 -1
  115. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-C52YbJMv.js +0 -1
  116. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-CHrxgxa5.js +0 -1
  117. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-CKMwat1g.js +0 -1
  118. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-Cg0BoaZJ.js +0 -1
  119. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-D2wHS2oL.js +0 -1
  120. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-DBjRdz5I.js +0 -1
  121. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-DFXqlBL9.js +0 -1
  122. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-DQFlpNrC.js +0 -1
  123. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-DibRYDhk.js +0 -1
  124. package/cms/dist/assets/Collection-BF1Z2tsZ.js +0 -1
  125. package/cms/dist/assets/Collection-BGimILv3.js +0 -1
  126. package/cms/dist/assets/Collection-BHA5hC99.js +0 -1
  127. package/cms/dist/assets/Collection-BO8LTH-q.js +0 -1
  128. package/cms/dist/assets/Collection-BjwVqOUm.js +0 -1
  129. package/cms/dist/assets/Collection-C4GUXzuD.js +0 -1
  130. package/cms/dist/assets/Collection-C4Vi8Wv-.js +0 -1
  131. package/cms/dist/assets/Collection-CC4xVuVM.js +0 -1
  132. package/cms/dist/assets/Collection-CSN_sBN7.js +0 -1
  133. package/cms/dist/assets/Collection-CaS_UqAL.js +0 -1
  134. package/cms/dist/assets/Collection-CeT7sqBS.js +0 -1
  135. package/cms/dist/assets/Collection-CkmskhNr.js +0 -1
  136. package/cms/dist/assets/Collection-DAyaNqb6.js +0 -1
  137. package/cms/dist/assets/Collection-DBPlWW4z.js +0 -1
  138. package/cms/dist/assets/Collection-DB_Ot4_U.js +0 -1
  139. package/cms/dist/assets/Collection-DSM03FoR.js +0 -1
  140. package/cms/dist/assets/Collection-D_YQL3jb.js +0 -1
  141. package/cms/dist/assets/Collection-DiRyNm6p.js +0 -1
  142. package/cms/dist/assets/Collection-Dl7bG39O.js +0 -1
  143. package/cms/dist/assets/Collection-Dn1_GXdv.js +0 -1
  144. package/cms/dist/assets/Collection-Du6OUNJe.js +0 -1
  145. package/cms/dist/assets/Collection-Dw0Ot4y0.js +0 -1
  146. package/cms/dist/assets/Collection-EqBWDgnq.js +0 -1
  147. package/cms/dist/assets/Collection-NjoZfmbJ.js +0 -1
  148. package/cms/dist/assets/Collection-S5xaewWu.js +0 -1
  149. package/cms/dist/assets/Collection-VJAZO0Rz.js +0 -1
  150. package/cms/dist/assets/Collection-kcf4fNUl.js +0 -1
  151. package/cms/dist/assets/Collection-oMH_nwxS.js +0 -1
  152. package/cms/dist/assets/Collection-sfaJ9fwa.js +0 -1
  153. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-B4H713EC.js +0 -4
  154. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-B9eWzacX.js +0 -4
  155. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-BIh3O9qs.js +0 -4
  156. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-BdSq_QTY.js +0 -4
  157. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-CH8PUbU4.js +0 -4
  158. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-CLuwC8Uj.js +0 -4
  159. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-DBh9sOKn.js +0 -4
  160. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-DOZLJ7ZA.js +0 -4
  161. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-DfIsWO53.js +0 -4
  162. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-jFzOAzL2.js +0 -4
  163. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-jRigvXc0.js +0 -4
  164. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-oDSxxqxJ.js +0 -4
  165. package/cms/dist/assets/DropdownMenu-BDXAXFWu.js +0 -1
  166. package/cms/dist/assets/DropdownMenu-BZptii48.js +0 -1
  167. package/cms/dist/assets/DropdownMenu-C9Pf1B2E.js +0 -1
  168. package/cms/dist/assets/DropdownMenu-CFzQxXeB.js +0 -1
  169. package/cms/dist/assets/DropdownMenu-CVUbPEtY.js +0 -1
  170. package/cms/dist/assets/DropdownMenu-D5x3rHhs.js +0 -1
  171. package/cms/dist/assets/DropdownMenu-DXnYOOY0.js +0 -1
  172. package/cms/dist/assets/DropdownMenu-DYqsMHlZ.js +0 -1
  173. package/cms/dist/assets/DropdownMenu-Dip_7-16.js +0 -1
  174. package/cms/dist/assets/DropdownMenu-J5qridfW.js +0 -1
  175. package/cms/dist/assets/DropdownMenu-R4khQe6l.js +0 -1
  176. package/cms/dist/assets/DropdownMenu-pXjjYDJf.js +0 -1
  177. package/cms/dist/assets/EditorDragHandle-BEBDlO3N.js +0 -210
  178. package/cms/dist/assets/EditorDragHandle-B_izFj4P.js +0 -210
  179. package/cms/dist/assets/EditorDragHandle-C6gCTajf.js +0 -210
  180. package/cms/dist/assets/EditorDragHandle-CpVlSiXR.js +0 -210
  181. package/cms/dist/assets/EditorDragHandle-DjhDrza4.js +0 -210
  182. package/cms/dist/assets/Entry-B0mNJ8em.js +0 -1
  183. package/cms/dist/assets/Entry-B9xgn-k-.js +0 -1
  184. package/cms/dist/assets/Entry-BEJ_bRWi.js +0 -1
  185. package/cms/dist/assets/Entry-BHRGVv4D.js +0 -1
  186. package/cms/dist/assets/Entry-BNPs_gct.js +0 -1
  187. package/cms/dist/assets/Entry-BVEcmHD0.js +0 -1
  188. package/cms/dist/assets/Entry-BcR1pGiC.js +0 -1
  189. package/cms/dist/assets/Entry-Bg_tMviD.js +0 -1
  190. package/cms/dist/assets/Entry-BlAicVCg.js +0 -1
  191. package/cms/dist/assets/Entry-BnO4ovDl.js +0 -1
  192. package/cms/dist/assets/Entry-BpYBI271.js +0 -1
  193. package/cms/dist/assets/Entry-ByUw2yF4.js +0 -1
  194. package/cms/dist/assets/Entry-C0oNgptm.js +0 -1
  195. package/cms/dist/assets/Entry-CEqZl74M.js +0 -1
  196. package/cms/dist/assets/Entry-CQafvISG.js +0 -1
  197. package/cms/dist/assets/Entry-CUQUSn88.js +0 -1
  198. package/cms/dist/assets/Entry-CaJRktT6.js +0 -1
  199. package/cms/dist/assets/Entry-Cb4Q7R6n.js +0 -1
  200. package/cms/dist/assets/Entry-CjCaRK3h.js +0 -1
  201. package/cms/dist/assets/Entry-CuCvR6bo.js +0 -1
  202. package/cms/dist/assets/Entry-CvIwD9sR.js +0 -1
  203. package/cms/dist/assets/Entry-D1FEE6Xe.js +0 -1
  204. package/cms/dist/assets/Entry-DBJmQU5s.js +0 -1
  205. package/cms/dist/assets/Entry-DIjoQMCn.js +0 -1
  206. package/cms/dist/assets/Entry-DK9arl_r.js +0 -1
  207. package/cms/dist/assets/Entry-DModL0da.js +0 -1
  208. package/cms/dist/assets/Entry-DNH3uGxY.js +0 -1
  209. package/cms/dist/assets/Entry-DOQqrBlw.js +0 -1
  210. package/cms/dist/assets/Entry-DQ8zv87B.js +0 -1
  211. package/cms/dist/assets/Entry-DVUy5pDQ.js +0 -1
  212. package/cms/dist/assets/Entry-DVk6konk.js +0 -1
  213. package/cms/dist/assets/Entry-DiaxpV9P.js +0 -1
  214. package/cms/dist/assets/Entry-Dl9NYEbP.js +0 -1
  215. package/cms/dist/assets/Entry-DnIfmeOq.js +0 -1
  216. package/cms/dist/assets/Entry-Dx-Gentu.js +0 -1
  217. package/cms/dist/assets/Entry-RCHRt0FB.js +0 -1
  218. package/cms/dist/assets/Entry-_XOmFO6J.js +0 -1
  219. package/cms/dist/assets/Entry-eCmCiJIP.js +0 -1
  220. package/cms/dist/assets/Entry-futdQUpk.js +0 -1
  221. package/cms/dist/assets/Entry-gMoAyQfe.js +0 -1
  222. package/cms/dist/assets/Entry-jb5GRi4m.js +0 -1
  223. package/cms/dist/assets/Entry-k0kK5D3F.js +0 -1
  224. package/cms/dist/assets/Entry-le3iFxM-.js +0 -1
  225. package/cms/dist/assets/Entry-nJUE8QzM.js +0 -1
  226. package/cms/dist/assets/Entry-rYZqzJqw.js +0 -1
  227. package/cms/dist/assets/Entry-utFCLZ-0.js +0 -1
  228. package/cms/dist/assets/Entry-v0qtNgqY.js +0 -1
  229. package/cms/dist/assets/Entry-zdD-YBgr.js +0 -1
  230. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-BN7ZZ0wt.js +0 -1
  231. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-Boktp-MQ.js +0 -1
  232. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-CGsCqUcC.js +0 -1
  233. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-CROY0b_N.js +0 -1
  234. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-CrVPEIAh.js +0 -1
  235. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-Cv4GzN8Q.js +0 -1
  236. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-D7fm8yWT.js +0 -1
  237. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DHCJViy-.js +0 -1
  238. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DLQRvVMy.js +0 -1
  239. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DLk9XG-C.js +0 -1
  240. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DQpUwjD1.js +0 -1
  241. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DcNJ430Y.js +0 -1
  242. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DoYHYD_Y.js +0 -1
  243. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DpfvQY8b.js +0 -1
  244. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DsBsM3DC.js +0 -1
  245. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DuuScFZd.js +0 -1
  246. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DvZK3fuW.js +0 -1
  247. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DwJSBAHJ.js +0 -1
  248. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DzE52E7U.js +0 -1
  249. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-Lpiwz51b.js +0 -1
  250. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-Op1A2IkQ.js +0 -1
  251. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-WXvEHYE1.js +0 -1
  252. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-iyex1bkH.js +0 -1
  253. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-yZb441-Z.js +0 -1
  254. package/cms/dist/assets/Fields-0js47OkJ.js +0 -1
  255. package/cms/dist/assets/Fields-1zzijKwy.css +0 -1
  256. package/cms/dist/assets/Fields-25hjY31I.js +0 -210
  257. package/cms/dist/assets/Fields-B-HNL-y0.js +0 -210
  258. package/cms/dist/assets/Fields-BLqjNMhd.js +0 -210
  259. package/cms/dist/assets/Fields-BMGmtjoc.js +0 -210
  260. package/cms/dist/assets/Fields-Bc9Spqip.js +0 -1
  261. package/cms/dist/assets/Fields-C62J8YEn.css +0 -1
  262. package/cms/dist/assets/Fields-DEXEicIk.js +0 -210
  263. package/cms/dist/assets/Fields-DG6uyVyw.js +0 -1
  264. package/cms/dist/assets/Fields-DOkmjQ0S.js +0 -210
  265. package/cms/dist/assets/Fields-DmUUqqBx.js +0 -1
  266. package/cms/dist/assets/Fields-MTFgNXjQ.js +0 -210
  267. package/cms/dist/assets/Fields-dzjCI4Jy.js +0 -1
  268. package/cms/dist/assets/FormField-C2PqQKhW.js +0 -1
  269. package/cms/dist/assets/FormField-CJ18tD1k.js +0 -1
  270. package/cms/dist/assets/FormField-CajfYqNM.js +0 -1
  271. package/cms/dist/assets/FormField-DfXv3tMz.js +0 -1
  272. package/cms/dist/assets/FormField-Djjq39lS.js +0 -1
  273. package/cms/dist/assets/FormField-PKfHR15T.js +0 -1
  274. package/cms/dist/assets/FormField-j7eHJ9wN.js +0 -1
  275. package/cms/dist/assets/Input-BCncVJ7t.js +0 -1
  276. package/cms/dist/assets/Input-BxnrWZ6G.js +0 -1
  277. package/cms/dist/assets/Input-CW8qQ740.js +0 -1
  278. package/cms/dist/assets/Input-CgvtCyC6.js +0 -1
  279. package/cms/dist/assets/Input-CpnoPwk2.js +0 -1
  280. package/cms/dist/assets/Input-DCQ1Ty7z.js +0 -1
  281. package/cms/dist/assets/Input-_D8WzaFu.js +0 -1
  282. package/cms/dist/assets/Main-2m4YDuQc.js +0 -1
  283. package/cms/dist/assets/Main-BbS-oL-i.js +0 -1
  284. package/cms/dist/assets/Main-CYylNMKm.js +0 -1
  285. package/cms/dist/assets/Main-CanIVr6y.js +0 -1
  286. package/cms/dist/assets/Main-ChzI-DcQ.js +0 -1
  287. package/cms/dist/assets/Main-Cus0bSFl.js +0 -1
  288. package/cms/dist/assets/Main-CwSgD6bv.js +0 -1
  289. package/cms/dist/assets/Main-DZFIaCGo.js +0 -1
  290. package/cms/dist/assets/Main-I4OsPHC_.js +0 -1
  291. package/cms/dist/assets/Main-VFLhsy9f.js +0 -1
  292. package/cms/dist/assets/Main-VjkQD6CR.js +0 -1
  293. package/cms/dist/assets/Main-Xea2Go7n.js +0 -1
  294. package/cms/dist/assets/Media-12I_cgO9.js +0 -64
  295. package/cms/dist/assets/Media-BNWQk3sM.js +0 -64
  296. package/cms/dist/assets/Media-BiUrdhiy.js +0 -64
  297. package/cms/dist/assets/Media-BqOLIuh6.js +0 -64
  298. package/cms/dist/assets/Media-CYa_Y3O_.js +0 -64
  299. package/cms/dist/assets/Media-CbyzN3h1.js +0 -64
  300. package/cms/dist/assets/Media-D5oaDJXb.js +0 -64
  301. package/cms/dist/assets/Media-D9qcmiia.js +0 -64
  302. package/cms/dist/assets/Media-DL3EbJa4.js +0 -64
  303. package/cms/dist/assets/Media-Di_95zwT.js +0 -64
  304. package/cms/dist/assets/Media-ZT1nHQgy.js +0 -64
  305. package/cms/dist/assets/Media-zNQ89zmA.js +0 -64
  306. package/cms/dist/assets/Modal-B2F2q5Uu.js +0 -1
  307. package/cms/dist/assets/Modal-B2ck9rmv.js +0 -1
  308. package/cms/dist/assets/Modal-B6UQRpam.js +0 -1
  309. package/cms/dist/assets/Modal-BBUZcn1n.js +0 -1
  310. package/cms/dist/assets/Modal-BBj1nhhs.js +0 -1
  311. package/cms/dist/assets/Modal-BKv66bnD.js +0 -1
  312. package/cms/dist/assets/Modal-CL4NZ42V.js +0 -1
  313. package/cms/dist/assets/Modal-CMnUfF3F.js +0 -1
  314. package/cms/dist/assets/Modal-CYbXD9PV.js +0 -1
  315. package/cms/dist/assets/Modal-DzMlh1K9.js +0 -1
  316. package/cms/dist/assets/Modal-I7xswxkx.js +0 -1
  317. package/cms/dist/assets/Modal-RZEkBosd.js +0 -1
  318. package/cms/dist/assets/Page-9dw9Ft-l.js +0 -1
  319. package/cms/dist/assets/Page-B-cgW7LN.js +0 -1
  320. package/cms/dist/assets/Page-BW7HZaBD.js +0 -1
  321. package/cms/dist/assets/Page-Bg6ZJkCi.js +0 -1
  322. package/cms/dist/assets/Page-BlWH1sgw.js +0 -1
  323. package/cms/dist/assets/Page-C2SS3gyg.js +0 -1
  324. package/cms/dist/assets/Page-CWAvatN5.js +0 -1
  325. package/cms/dist/assets/Page-CwzXDrgx.js +0 -1
  326. package/cms/dist/assets/Page-D-WWIe14.js +0 -1
  327. package/cms/dist/assets/Page-DRPSlFKP.js +0 -1
  328. package/cms/dist/assets/Page-DTNX7n0w.js +0 -1
  329. package/cms/dist/assets/Page-PimiY6D-.js +0 -1
  330. package/cms/dist/assets/PageSideForm-BWtKHaei.js +0 -1
  331. package/cms/dist/assets/PageSideForm-BZD26RtU.js +0 -1
  332. package/cms/dist/assets/PageSideForm-BiTP0Rcj.js +0 -1
  333. package/cms/dist/assets/PageSideForm-CEDt6M5O.js +0 -1
  334. package/cms/dist/assets/PageSideForm-CJvudHte.js +0 -1
  335. package/cms/dist/assets/PageSideForm-CP1KmxAr.js +0 -1
  336. package/cms/dist/assets/PageSideForm-CTwTTlhF.js +0 -1
  337. package/cms/dist/assets/PageSideForm-CUxYBTAM.js +0 -1
  338. package/cms/dist/assets/PageSideForm-CY-iNJZC.js +0 -1
  339. package/cms/dist/assets/PageSideForm-CeOa15DZ.js +0 -1
  340. package/cms/dist/assets/PageSideForm-ChYuCLVH.js +0 -1
  341. package/cms/dist/assets/PageSideForm-CiCXSFVe.js +0 -1
  342. package/cms/dist/assets/PageSideForm-Cpij0izw.js +0 -1
  343. package/cms/dist/assets/PageSideForm-D6j0vgNb.js +0 -1
  344. package/cms/dist/assets/PageSideForm-DSEEZbjC.js +0 -1
  345. package/cms/dist/assets/PageSideForm-DcywA2Ze.js +0 -1
  346. package/cms/dist/assets/PageSideForm-Dielp2uC.js +0 -1
  347. package/cms/dist/assets/PageSideForm-DjrBwGyS.js +0 -1
  348. package/cms/dist/assets/PageSideForm-P8nKOUCx.js +0 -1
  349. package/cms/dist/assets/PageSideForm-cd0fKxav.js +0 -1
  350. package/cms/dist/assets/PageSideForm-faK_4Gs5.js +0 -1
  351. package/cms/dist/assets/PageSideForm-seQVr_ia.js +0 -1
  352. package/cms/dist/assets/PageSideForm-tCtNfiS6.js +0 -1
  353. package/cms/dist/assets/PageSideForm-v14TdYOR.js +0 -1
  354. package/cms/dist/assets/Pages-5dwPc5tT.js +0 -1
  355. package/cms/dist/assets/Pages-B9RI0ALH.js +0 -1
  356. package/cms/dist/assets/Pages-BJ756ZqY.js +0 -1
  357. package/cms/dist/assets/Pages-BQ95j-9A.js +0 -1
  358. package/cms/dist/assets/Pages-Bav-LEXJ.js +0 -1
  359. package/cms/dist/assets/Pages-BdJ5GzoS.js +0 -1
  360. package/cms/dist/assets/Pages-CJarUOul.js +0 -1
  361. package/cms/dist/assets/Pages-CP9O9mPs.js +0 -1
  362. package/cms/dist/assets/Pages-CPhAtUB5.js +0 -1
  363. package/cms/dist/assets/Pages-CZb9e8d-.js +0 -1
  364. package/cms/dist/assets/Pages-CgtLUrd1.js +0 -1
  365. package/cms/dist/assets/Pages-Ci78caHB.js +0 -1
  366. package/cms/dist/assets/Pages-Colx-y_M.js +0 -1
  367. package/cms/dist/assets/Pages-CrzdQcv2.js +0 -1
  368. package/cms/dist/assets/Pages-D1XFG4yO.js +0 -1
  369. package/cms/dist/assets/Pages-D5fPcH44.js +0 -1
  370. package/cms/dist/assets/Pages-DBBe71Nk.js +0 -1
  371. package/cms/dist/assets/Pages-DK3LUgQV.js +0 -1
  372. package/cms/dist/assets/Pages-DLbUF5SZ.js +0 -1
  373. package/cms/dist/assets/Pages-DUYe82TY.js +0 -1
  374. package/cms/dist/assets/Pages-FdHFDljA.js +0 -1
  375. package/cms/dist/assets/Pages-WiUCWL-t.js +0 -1
  376. package/cms/dist/assets/Pages-xAtEr5In.js +0 -1
  377. package/cms/dist/assets/Pages-zhSg3JzN.js +0 -1
  378. package/cms/dist/assets/Presence-BKPT4wLH.js +0 -3
  379. package/cms/dist/assets/Presence-BSNqXaUm.js +0 -3
  380. package/cms/dist/assets/Presence-Bs9zR2--.js +0 -3
  381. package/cms/dist/assets/Presence-DXmvDu-B.js +0 -3
  382. package/cms/dist/assets/Presence-DtH-HN2c.js +0 -3
  383. package/cms/dist/assets/Preview-890exrfz.js +0 -1
  384. package/cms/dist/assets/Preview-BKee89iX.js +0 -1
  385. package/cms/dist/assets/Preview-BRMGur-R.js +0 -1
  386. package/cms/dist/assets/Preview-CIdaPCpk.js +0 -1
  387. package/cms/dist/assets/Preview-Cu6fqQzO.js +0 -1
  388. package/cms/dist/assets/Preview-CyTD_Z7s.js +0 -1
  389. package/cms/dist/assets/Preview-D8g5RNyg.js +0 -1
  390. package/cms/dist/assets/Preview-DTsccCmU.js +0 -1
  391. package/cms/dist/assets/Preview-DV3zHCWR.js +0 -1
  392. package/cms/dist/assets/Preview-D_1BmrHf.js +0 -1
  393. package/cms/dist/assets/Preview-Dv-wfrr0.js +0 -1
  394. package/cms/dist/assets/Preview-DyW6gcwI.js +0 -1
  395. package/cms/dist/assets/RovingFocusGroup-B6l0MDaU.js +0 -1
  396. package/cms/dist/assets/RovingFocusGroup-BZUm8WuX.js +0 -1
  397. package/cms/dist/assets/RovingFocusGroup-C3WFJJ-d.js +0 -1
  398. package/cms/dist/assets/RovingFocusGroup-C4FqbJJj.js +0 -1
  399. package/cms/dist/assets/RovingFocusGroup-CHQeCrb2.js +0 -1
  400. package/cms/dist/assets/RovingFocusGroup-CmRC1gsO.js +0 -1
  401. package/cms/dist/assets/RovingFocusGroup-CnDWyi3J.js +0 -1
  402. package/cms/dist/assets/RovingFocusGroup-Cnf6WfXS.js +0 -1
  403. package/cms/dist/assets/RovingFocusGroup-CwJU75IP.js +0 -1
  404. package/cms/dist/assets/RovingFocusGroup-DCgUDa7P.js +0 -1
  405. package/cms/dist/assets/RovingFocusGroup-DTopjd0p.js +0 -1
  406. package/cms/dist/assets/RovingFocusGroup-Zc2iLojI.js +0 -1
  407. package/cms/dist/assets/RovingFocusItem-BTBMx4cV.js +0 -1
  408. package/cms/dist/assets/RovingFocusItem-BmY0KanC.js +0 -1
  409. package/cms/dist/assets/RovingFocusItem-Bsu9B5OP.js +0 -1
  410. package/cms/dist/assets/RovingFocusItem-BvqkGTBJ.js +0 -1
  411. package/cms/dist/assets/RovingFocusItem-C9PcBZCt.js +0 -1
  412. package/cms/dist/assets/RovingFocusItem-CGZ2Yzb4.js +0 -1
  413. package/cms/dist/assets/RovingFocusItem-DAszosPo.js +0 -1
  414. package/cms/dist/assets/RovingFocusItem-DFbidCjz.js +0 -1
  415. package/cms/dist/assets/RovingFocusItem-DtCElDTw.js +0 -1
  416. package/cms/dist/assets/RovingFocusItem-DyM0He8R.js +0 -1
  417. package/cms/dist/assets/RovingFocusItem-VyijGu8z.js +0 -1
  418. package/cms/dist/assets/RovingFocusItem-XP2WbDfI.js +0 -1
  419. package/cms/dist/assets/SelectMenu-CXEWx3Bv.js +0 -1
  420. package/cms/dist/assets/SelectMenu-Dp_5PCRf.js +0 -1
  421. package/cms/dist/assets/Settings-1mrkoW_N.js +0 -1
  422. package/cms/dist/assets/Settings-6BY8hMNJ.js +0 -1
  423. package/cms/dist/assets/Settings-BGC-mGIn.js +0 -1
  424. package/cms/dist/assets/Settings-BbndYUqK.js +0 -1
  425. package/cms/dist/assets/Settings-BygzRFRi.js +0 -1
  426. package/cms/dist/assets/Settings-BzHrNd55.js +0 -1
  427. package/cms/dist/assets/Settings-C80VipXv.js +0 -1
  428. package/cms/dist/assets/Settings-CfO0WRUz.js +0 -1
  429. package/cms/dist/assets/Settings-CyVv4mff.js +0 -1
  430. package/cms/dist/assets/Settings-DPJigHSQ.js +0 -1
  431. package/cms/dist/assets/Settings-DaP_-c8D.js +0 -1
  432. package/cms/dist/assets/Settings-Dbt8lsoR.js +0 -1
  433. package/cms/dist/assets/Sidebar-7tc1rH-m.js +0 -1
  434. package/cms/dist/assets/Sidebar-BiLe4lXc.js +0 -1
  435. package/cms/dist/assets/Sidebar-BpOtz-Un.js +0 -1
  436. package/cms/dist/assets/Sidebar-BzPY1U-c.js +0 -1
  437. package/cms/dist/assets/Sidebar-CHe70jCj.js +0 -1
  438. package/cms/dist/assets/Sidebar-CgAdYIHE.js +0 -1
  439. package/cms/dist/assets/Sidebar-ClfXqKv4.js +0 -1
  440. package/cms/dist/assets/Sidebar-Cm6vpmjm.js +0 -1
  441. package/cms/dist/assets/Sidebar-CsdSwAef.js +0 -1
  442. package/cms/dist/assets/Sidebar-DvHF5_VA.js +0 -1
  443. package/cms/dist/assets/Sidebar-RRp6XCg_.js +0 -1
  444. package/cms/dist/assets/Sidebar-tV2e58xY.js +0 -1
  445. package/cms/dist/assets/TooltipProvider-BAxFxzu5.js +0 -1
  446. package/cms/dist/assets/TooltipProvider-BIKJORur.js +0 -1
  447. package/cms/dist/assets/TooltipProvider-C8zLfLF8.js +0 -1
  448. package/cms/dist/assets/TooltipProvider-DFTumMxo.js +0 -1
  449. package/cms/dist/assets/TooltipProvider-DGX3rBdo.js +0 -1
  450. package/cms/dist/assets/TooltipProvider-DJG_8YvR.js +0 -1
  451. package/cms/dist/assets/TooltipProvider-DUr3-aHH.js +0 -1
  452. package/cms/dist/assets/TooltipProvider-LaS50ijC.js +0 -1
  453. package/cms/dist/assets/TooltipProvider-MSci9uam.js +0 -1
  454. package/cms/dist/assets/TooltipProvider-T49u14GZ.js +0 -1
  455. package/cms/dist/assets/TooltipProvider-uX-pZahh.js +0 -1
  456. package/cms/dist/assets/TooltipProvider-zcbl2F13.js +0 -1
  457. package/cms/dist/assets/app-B10egs3x.js +0 -1
  458. package/cms/dist/assets/app-B2viUSxj.js +0 -1
  459. package/cms/dist/assets/app-B5Htwhk2.js +0 -1
  460. package/cms/dist/assets/app-B93Soo8I.js +0 -1
  461. package/cms/dist/assets/app-BAcuKYuM.js +0 -1
  462. package/cms/dist/assets/app-BIkD1OOa.js +0 -1
  463. package/cms/dist/assets/app-BcvPS_w3.js +0 -1
  464. package/cms/dist/assets/app-BmQS_z0s.js +0 -1
  465. package/cms/dist/assets/app-CI0J2Xsm.js +0 -1
  466. package/cms/dist/assets/app-CIAYE716.js +0 -1
  467. package/cms/dist/assets/app-CJN6wB4C.js +0 -1
  468. package/cms/dist/assets/app-CRSMXllS.js +0 -1
  469. package/cms/dist/assets/app-CjFg7ttC.js +0 -1
  470. package/cms/dist/assets/app-CzQYtlMM.js +0 -1
  471. package/cms/dist/assets/app-D3yRpajb.js +0 -1
  472. package/cms/dist/assets/app-DBVODLiC.js +0 -1
  473. package/cms/dist/assets/app-DBac-q-m.css +0 -2
  474. package/cms/dist/assets/app-DFMmXmuL.js +0 -1
  475. package/cms/dist/assets/app-D_lICTji.js +0 -1
  476. package/cms/dist/assets/app-DeC2b1eE.js +0 -1
  477. package/cms/dist/assets/app-Dp9KKPI1.js +0 -1
  478. package/cms/dist/assets/app-Drc_DlIW.js +0 -1
  479. package/cms/dist/assets/app-DyuvC6pP.js +0 -1
  480. package/cms/dist/assets/app-DzK4b1Um.js +0 -1
  481. package/cms/dist/assets/app-DzXy24xQ.js +0 -1
  482. package/cms/dist/assets/app-h_Nd9pHO.js +0 -1
  483. package/cms/dist/assets/app-kpzwsL8F.js +0 -1
  484. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-3a9NPBSx.js +0 -13
  485. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-B4i6MXLF.js +0 -13
  486. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-BXAw_NlS.js +0 -13
  487. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-Bp9fDXA6.js +0 -13
  488. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-BzcsrEfr.js +0 -13
  489. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-CR_0uVCm.js +0 -13
  490. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-C_rBiHLc.js +0 -13
  491. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-CtvHTqQW.js +0 -13
  492. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-D45dSEGm.js +0 -13
  493. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-D_C1SULA.js +0 -13
  494. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-a-0WngBC.js +0 -13
  495. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-l7N-XJiL.js +0 -13
  496. package/cms/dist/assets/auth-Bs1Qquj1.js +0 -3
  497. package/cms/dist/assets/auth-CKYSul2o.js +0 -3
  498. package/cms/dist/assets/auth-Cx6gId2J.js +0 -3
  499. package/cms/dist/assets/auth-DCLgP-Ce.js +0 -3
  500. package/cms/dist/assets/auth-DmU168ck.js +0 -3
  501. package/cms/dist/assets/auth-FT7uJhu6.js +0 -3
  502. package/cms/dist/assets/auth-Yc5CUKsd.js +0 -3
  503. package/cms/dist/assets/cms-8j-DDv_x.js +0 -1
  504. package/cms/dist/assets/cms-BTRDNlqn.js +0 -1
  505. package/cms/dist/assets/cms-BfAB9urh.js +0 -1
  506. package/cms/dist/assets/cms-CQEZJZTL.js +0 -1
  507. package/cms/dist/assets/cms-CToRsZjR.js +0 -1
  508. package/cms/dist/assets/cms-CdsJXxvV.js +0 -1
  509. package/cms/dist/assets/cms-CfkR4UZ2.js +0 -1
  510. package/cms/dist/assets/cms-CtNvP11D.js +0 -1
  511. package/cms/dist/assets/cms-D2eW8dB-.js +0 -1
  512. package/cms/dist/assets/cms-EdEv3eUj.js +0 -1
  513. package/cms/dist/assets/cms-I1jZzyqp.js +0 -1
  514. package/cms/dist/assets/cms-iTMgUJHR.js +0 -1
  515. package/cms/dist/assets/dist-6Ip2czgv.js +0 -1
  516. package/cms/dist/assets/dist-BFNHGD4x.js +0 -1
  517. package/cms/dist/assets/dist-BsgV7NzT.js +0 -1
  518. package/cms/dist/assets/dist-CPOot3FO.js +0 -1
  519. package/cms/dist/assets/dist-CRhqvTV6.js +0 -1
  520. package/cms/dist/assets/dist-Ca3w8o4H.js +0 -1
  521. package/cms/dist/assets/dist-CuqvsgQ3.js +0 -1
  522. package/cms/dist/assets/dist-D3OXVhrG.js +0 -1
  523. package/cms/dist/assets/dist-DASomEJF.js +0 -1
  524. package/cms/dist/assets/dist-DoUWPhS3.js +0 -1
  525. package/cms/dist/assets/dist-XCaUKs5e.js +0 -1
  526. package/cms/dist/assets/dist-gC8hGhMx.js +0 -1
  527. package/cms/dist/assets/index-1Es5a0_Z.js +0 -18
  528. package/cms/dist/assets/index-5F4j9J7h.js +0 -18
  529. package/cms/dist/assets/index-B1m0-iPT.js +0 -18
  530. package/cms/dist/assets/index-BIKzIEd2.js +0 -18
  531. package/cms/dist/assets/index-CGiGNJrV.js +0 -18
  532. package/cms/dist/assets/index-yfLwsAFs.css +0 -1
  533. package/cms/dist/assets/index.spa-2Efw5l3r.js +0 -18
  534. package/cms/dist/assets/index.spa-6RkbZIv_.js +0 -18
  535. package/cms/dist/assets/index.spa-BIyNTWZm.js +0 -18
  536. package/cms/dist/assets/index.spa-BjPilebp.js +0 -18
  537. package/cms/dist/assets/index.spa-Bttzn5Vp.js +0 -18
  538. package/cms/dist/assets/index.spa-DeNX-30H.js +0 -18
  539. package/cms/dist/assets/index.spa-_gVd6eNI.js +0 -18
  540. package/cms/dist/assets/index.vue_vue_type_script_setup_true_lang-BSYIcYZQ.js +0 -1
  541. package/cms/dist/assets/index.vue_vue_type_script_setup_true_lang-BXMi-bSl.js +0 -1
  542. package/cms/dist/assets/index.vue_vue_type_script_setup_true_lang-BeZ-mbmU.js +0 -1
  543. package/cms/dist/assets/index.vue_vue_type_script_setup_true_lang-Bi7MfGmM.js +0 -1
  544. package/cms/dist/assets/index.vue_vue_type_script_setup_true_lang-mq8D_l8z.js +0 -1
  545. package/cms/dist/assets/index.vue_vue_type_script_setup_true_lang-qTmtl6C-.js +0 -1
  546. package/cms/dist/assets/index.vue_vue_type_script_setup_true_lang-t8KrWaGh.js +0 -1
  547. package/cms/dist/assets/index.vue_vue_type_style_index_0_scoped_2e5c9142_lang-Br0OYO2z.js +0 -1
  548. package/cms/dist/assets/index.vue_vue_type_style_index_0_scoped_2e5c9142_lang-CfB8rLPy.js +0 -1
  549. package/cms/dist/assets/index.vue_vue_type_style_index_0_scoped_2e5c9142_lang-DVAz2LCd.js +0 -1
  550. package/cms/dist/assets/index.vue_vue_type_style_index_0_scoped_2e5c9142_lang-DrRFNheg.js +0 -1
  551. package/cms/dist/assets/index.vue_vue_type_style_index_0_scoped_2e5c9142_lang-Gt-XIE2j.js +0 -1
  552. package/cms/dist/assets/not-found-AcykWV_8.js +0 -1
  553. package/cms/dist/assets/not-found-B8Yomlc0.js +0 -1
  554. package/cms/dist/assets/not-found-BAymWgsq.js +0 -1
  555. package/cms/dist/assets/not-found-BIA1QJqt.js +0 -1
  556. package/cms/dist/assets/not-found-BNkQHSSS.js +0 -1
  557. package/cms/dist/assets/not-found-BRSXFHoi.js +0 -1
  558. package/cms/dist/assets/not-found-CNgVofle.js +0 -1
  559. package/cms/dist/assets/not-found-CVi1OEfO.js +0 -1
  560. package/cms/dist/assets/not-found-CaM3Tdnq.js +0 -1
  561. package/cms/dist/assets/not-found-CkQU1joq.js +0 -1
  562. package/cms/dist/assets/not-found-CnRpS-Xw.js +0 -1
  563. package/cms/dist/assets/not-found-CpHTh9w-.js +0 -1
  564. package/cms/dist/assets/not-found-CrH6SUE3.js +0 -1
  565. package/cms/dist/assets/not-found-DBnVH99v.js +0 -1
  566. package/cms/dist/assets/not-found-DKsTsHpk.js +0 -1
  567. package/cms/dist/assets/not-found-DclK62tc.js +0 -1
  568. package/cms/dist/assets/not-found-Dg8hWn_Y.js +0 -1
  569. package/cms/dist/assets/not-found-LTnPRO4I.js +0 -1
  570. package/cms/dist/assets/not-found-NCvOG8Ji.js +0 -1
  571. package/cms/dist/assets/not-found-R1DbpD2t.js +0 -1
  572. package/cms/dist/assets/not-found-WLF5CeXa.js +0 -1
  573. package/cms/dist/assets/not-found-_NQUGdlF.js +0 -1
  574. package/cms/dist/assets/not-found-oUQ-YRf2.js +0 -1
  575. package/cms/dist/assets/not-found-z4zyiO6n.js +0 -1
  576. package/cms/dist/assets/pages-B6dE90Nv.js +0 -1
  577. package/cms/dist/assets/pages-Ba8dBSLp.js +0 -1
  578. package/cms/dist/assets/pages-Bf6Guhc-.js +0 -1
  579. package/cms/dist/assets/pages-BpcJBgCg.js +0 -1
  580. package/cms/dist/assets/pages-C-4syvp1.js +0 -1
  581. package/cms/dist/assets/pages-C0C1lfVA.js +0 -1
  582. package/cms/dist/assets/pages-CAAcPdeh.js +0 -1
  583. package/cms/dist/assets/pages-CIfmxUmU.js +0 -1
  584. package/cms/dist/assets/pages-CNWF70v8.js +0 -1
  585. package/cms/dist/assets/pages-CUP33On-.js +0 -1
  586. package/cms/dist/assets/pages-Cg7Q0Yyn.js +0 -1
  587. package/cms/dist/assets/pages-ChIeD0uF.js +0 -1
  588. package/cms/dist/assets/pages-ClAr5CuA.js +0 -1
  589. package/cms/dist/assets/pages-CpDp_TZq.js +0 -1
  590. package/cms/dist/assets/pages-CrTaK6K8.js +0 -1
  591. package/cms/dist/assets/pages-D-Q-HQWM.js +0 -1
  592. package/cms/dist/assets/pages-D9dx56WI.js +0 -1
  593. package/cms/dist/assets/pages-DLGXw_J5.js +0 -1
  594. package/cms/dist/assets/pages-DXnfB_q7.js +0 -1
  595. package/cms/dist/assets/pages-DhCx_5RP.js +0 -1
  596. package/cms/dist/assets/pages-Dy8Hg1rv.js +0 -1
  597. package/cms/dist/assets/pages-bs5FTVq5.js +0 -1
  598. package/cms/dist/assets/pages-htdeHdBq.js +0 -1
  599. package/cms/dist/assets/pages-kaHLKSrN.js +0 -1
  600. package/cms/dist/assets/pages-lK6dAbD3.js +0 -1
  601. package/cms/dist/assets/pages-u5O_jEla.js +0 -1
  602. package/cms/dist/assets/preview-3uocSFPM.js +0 -1
  603. package/cms/dist/assets/preview-AeQAlQoM.js +0 -1
  604. package/cms/dist/assets/preview-BMvUjSWh.js +0 -1
  605. package/cms/dist/assets/preview-BvocrpFU.js +0 -1
  606. package/cms/dist/assets/preview-CMFesftP.js +0 -1
  607. package/cms/dist/assets/preview-CMbNM4LD.js +0 -1
  608. package/cms/dist/assets/preview-Cy1wpCyU.js +0 -1
  609. package/cms/dist/assets/preview-D1CIVM6p.js +0 -1
  610. package/cms/dist/assets/preview-EralP1Qk.js +0 -1
  611. package/cms/dist/assets/preview-nIoKpnJh.js +0 -1
  612. package/cms/dist/assets/preview-pXGAEnhu.js +0 -1
  613. package/cms/dist/assets/preview-qROwgtUj.js +0 -1
  614. package/cms/dist/assets/useCmsBreadcrumb-BGzdrscS.js +0 -1
  615. package/cms/dist/assets/useCmsBreadcrumb-Bc9eFrA5.js +0 -1
  616. package/cms/dist/assets/useCmsBreadcrumb-BdmAc1uz.js +0 -1
  617. package/cms/dist/assets/useCmsBreadcrumb-BgJkzt9z.js +0 -1
  618. package/cms/dist/assets/useCmsBreadcrumb-CFid0hqD.js +0 -1
  619. package/cms/dist/assets/useCmsBreadcrumb-CIdcDem-.js +0 -1
  620. package/cms/dist/assets/useCmsBreadcrumb-CPmEZGzI.js +0 -1
  621. package/cms/dist/assets/useCmsBreadcrumb-Cfp9FigG.js +0 -1
  622. package/cms/dist/assets/useCmsBreadcrumb-Cvg0a25f.js +0 -1
  623. package/cms/dist/assets/useCmsBreadcrumb-D4EbyJo3.js +0 -1
  624. package/cms/dist/assets/useCmsBreadcrumb-DJeAZIVz.js +0 -1
  625. package/cms/dist/assets/useCmsBreadcrumb-wP2vZ3mm.js +0 -1
  626. package/cms/dist/assets/useOverlay-B-mEZODJ.js +0 -1
  627. package/cms/dist/assets/useOverlay-B6q-19vP.js +0 -1
  628. package/cms/dist/assets/useOverlay-BON7Ngo_.js +0 -1
  629. package/cms/dist/assets/useOverlay-BRFWvY65.js +0 -1
  630. package/cms/dist/assets/useOverlay-C_F4RtBU.js +0 -1
  631. package/cms/dist/assets/useOverlay-CbUqVtbX.js +0 -1
  632. package/cms/dist/assets/useOverlay-Cg5WBtfm.js +0 -1
  633. package/cms/dist/assets/useOverlay-CkF2srkx.js +0 -1
  634. package/cms/dist/assets/useOverlay-DE40aGNR.js +0 -1
  635. package/cms/dist/assets/useOverlay-DluMVhaY.js +0 -1
  636. package/cms/dist/assets/useOverlay-Dx6wB9LJ.js +0 -1
  637. package/cms/dist/assets/useOverlay-TWCA-Ihv.js +0 -1
  638. package/cms/dist/assets/usePortal-BkuxWRnT.js +0 -1
  639. package/cms/dist/assets/usePortal-C04XvxfO.js +0 -1
  640. package/cms/dist/assets/usePortal-C6Od580j.js +0 -1
  641. package/cms/dist/assets/usePortal-CA_5oW33.js +0 -1
  642. package/cms/dist/assets/usePortal-CDrvJCjs.js +0 -1
  643. package/cms/dist/assets/usePortal-CaXS5wOp.js +0 -1
  644. package/cms/dist/assets/usePortal-Cxfopw3d.js +0 -1
  645. package/cms/dist/assets/usePortal-DS804J8g.js +0 -1
  646. package/cms/dist/assets/usePortal-DdvF7QHu.js +0 -1
  647. package/cms/dist/assets/usePortal-DgYTFxOG.js +0 -1
  648. package/cms/dist/assets/usePortal-Dn8xF7v8.js +0 -1
  649. package/cms/dist/assets/usePortal-DpqbePOa.js +0 -1
  650. package/cms/dist/assets/useToast-BsiDs1CI.js +0 -1
  651. package/cms/dist/assets/useToast-CDyjwefJ.js +0 -1
  652. package/cms/dist/assets/useToast-CPztuntH.js +0 -1
  653. package/cms/dist/assets/useToast-CUjGiYO5.js +0 -1
  654. package/cms/dist/assets/useToast-Cp1RFXcq.js +0 -1
  655. package/cms/dist/assets/useToast-CtH2d1a7.js +0 -1
  656. package/cms/dist/assets/useToast-DYME0f6B.js +0 -1
  657. package/cms/dist/assets/useToast-T1ue7roH.js +0 -1
  658. package/cms/dist/assets/useToast-c4ALC6wi.js +0 -1
  659. package/cms/dist/assets/useToast-j7mDX-r5.js +0 -1
  660. package/cms/dist/assets/useToast-nX69BgSK.js +0 -1
  661. package/cms/dist/assets/useToast-pRwfHIN7.js +0 -1
  662. package/cms/dist/assets/utils-BnjEOPf5.js +0 -1
  663. package/cms/dist/assets/utils-CISuHCdC.js +0 -1
  664. package/cms/dist/assets/utils-CWz9wPsd.js +0 -1
  665. package/cms/dist/assets/utils-Co2K3gR2.js +0 -1
  666. package/cms/dist/assets/utils-CoRDsqN-.js +0 -1
  667. package/cms/dist/assets/utils-Cx7OEZFn.js +0 -1
  668. package/cms/dist/assets/utils-DKAXGedG.js +0 -1
  669. package/cms/dist/assets/utils-DRYNV2kf.js +0 -1
  670. package/cms/dist/assets/utils-DYZhBWAz.js +0 -1
  671. package/cms/dist/assets/utils-DbQImDcT.js +0 -1
  672. package/cms/dist/assets/utils-DsgHgvSL.js +0 -1
  673. package/cms/dist/assets/utils-U0A7AqAJ.js +0 -1
  674. package/cms/dist/assets/virtualizer-6erXO0S6.js +0 -1
  675. package/cms/dist/assets/virtualizer-BcnC_KFL.js +0 -1
  676. package/cms/dist/assets/virtualizer-Dza0K04W.js +0 -1
  677. package/cms/dist/assets/virtualizer-IKP0IcQd.js +0 -1
  678. package/cms/dist/assets/virtualizer-ZIBv4Ghl.js +0 -1
  679. package/cms/dist/index.html +0 -12
@@ -1,210 +0,0 @@
1
- import{$t as e,A as t,An as n,At as r,Ct as i,Dt as a,E as o,En as s,Et as c,Ft as l,Gt as u,Ht as d,I as f,It as p,Jt as m,Lt as h,M as g,Mt as _,Nn as v,Nt as y,On as b,Ot as x,Pt as S,Q as C,Rt as w,Sn as ee,V as te,Vt as T,Wt as E,Xt as ne,Yt as re,Zt as D,_ as ie,_n as ae,en as oe,fn as se,g as ce,hn as le,in as ue,jn as de,kt as O,mn as fe,mt as pe,on as me,ot as he,p as ge,sn as _e,st as ve,tn as ye,un as k,v as be,vn as xe,wn as Se,xt as Ce,yn as A,yt as we}from"./index-5F4j9J7h.js";import{D as Te,E as Ee,S as De,_ as Oe,b as ke,c as Ae,d as je,f as Me,g as Ne,h as Pe,m as Fe,n as Ie,p as Le,r as Re,s as ze,t as Be,u as Ve,v as He,x as Ue,y as We}from"./DropdownMenu-BZptii48.js";import{C as Ge,E as Ke,S as qe,b as Je,k as Ye,m as Xe,t as Ze,v as Qe,w as $e,x as et}from"./Button-IK_nqXss.js";import{n as tt,t as nt}from"./Presence-BKPT4wLH.js";import{f as rt,i as it,n as at,r as ot}from"./usePortal-CaXS5wOp.js";import{n as st,t as ct}from"./cms-CtNvP11D.js";import{n as lt,t as ut}from"./Modal-CMnUfF3F.js";import{i as dt,t as ft}from"./Media-BqOLIuh6.js";import{n as pt}from"./TooltipProvider-uX-pZahh.js";import{t as mt}from"./useOverlay-CbUqVtbX.js";import{t as ht}from"./logger-DSeL-og4.js";var gt=S({__name:`BaseSeparator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=[`horizontal`,`vertical`];function r(e){return n.includes(e)}let i=c(()=>r(t.orientation)?t.orientation:`horizontal`),a=c(()=>i.value===`vertical`?t.orientation:void 0),o=c(()=>t.decorative?{role:`none`}:{"aria-orientation":a.value,role:`separator`});return(e,t)=>(m(),x(b($e),T({as:e.as,"as-child":e.asChild,"data-orientation":i.value},o.value),{default:k(()=>[D(e.$slots,`default`)]),_:3},16,[`as`,`as-child`,`data-orientation`]))}}),_t=S({__name:`Separator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e;return(e,n)=>(m(),x(gt,de(p(t)),{default:k(()=>[D(e.$slots,`default`)]),_:3},16))}}),vt=S({__name:`TooltipArrow`,props:{width:{type:Number,required:!1,default:10},height:{type:Number,required:!1,default:5},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`svg`}},setup(e){let t=e;return tt(),(e,n)=>(m(),x(b(Ve),de(p(t)),{default:k(()=>[D(e.$slots,`default`)]),_:3},16))}}),yt=`tooltip.open`,[bt,xt]=Ye(`TooltipRoot`),St=S({__name:`TooltipRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},delayDuration:{type:Number,required:!1,default:void 0},disableHoverableContent:{type:Boolean,required:!1,default:void 0},disableClosingTrigger:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1,default:void 0},ignoreNonKeyboardFocus:{type:Boolean,required:!1,default:void 0}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=t;tt();let i=pt(),a=c(()=>n.disableHoverableContent??i.disableHoverableContent.value),o=c(()=>n.disableClosingTrigger??i.disableClosingTrigger.value),s=c(()=>n.disabled??i.disabled.value),l=c(()=>n.delayDuration??i.delayDuration.value),u=c(()=>n.ignoreNonKeyboardFocus??i.ignoreNonKeyboardFocus.value),d=C(n,`open`,r,{defaultValue:n.defaultOpen,passive:n.open===void 0});me(d,e=>{i.onClose&&(e?(i.onOpen(),document.dispatchEvent(new CustomEvent(yt))):i.onClose())});let f=A(!1),p=A(),h=c(()=>d.value?f.value?`delayed-open`:`instant-open`:`closed`),{start:g,stop:_}=pe(()=>{f.value=!0,d.value=!0},l,{immediate:!1});function v(){_(),f.value=!1,d.value=!0}function y(){_(),d.value=!1}function S(){g()}return xt({contentId:``,open:d,stateAttribute:h,trigger:p,onTriggerChange(e){p.value=e},onTriggerEnter(){i.isOpenDelayed.value?S():v()},onTriggerLeave(){a.value?y():_()},onOpen:v,onClose:y,disableHoverableContent:a,disableClosingTrigger:o,disabled:s,ignoreNonKeyboardFocus:u}),(e,t)=>(m(),x(b(De),null,{default:k(()=>[D(e.$slots,`default`,{open:b(d)})]),_:3}))}}),Ct=S({__name:`TooltipContentImpl`,props:{ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1,default:void 0},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1,default:void 0},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1,default:void 0},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=bt(),a=pt(),{forwardRef:s,currentElement:l}=tt(),d=c(()=>n.ariaLabel||l.value?.textContent),f=c(()=>{let{ariaLabel:e,...t}=n;return o(t,a.content.value??{},{side:`top`,sideOffset:0,align:`center`,avoidCollisions:!0,collisionBoundary:[],collisionPadding:0,arrowPadding:0,sticky:`partial`,hideWhenDetached:!1})});return u(()=>{te(window,`scroll`,e=>{e.target?.contains(i.trigger.value)&&i.onClose()},{capture:!0}),te(window,yt,i.onClose)}),(e,t)=>(m(),x(b(rt),{"as-child":``,"disable-outside-pointer-events":!1,onEscapeKeyDown:t[0]||=e=>r(`escapeKeyDown`,e),onPointerDownOutside:t[1]||=e=>{b(i).disableClosingTrigger.value&&b(i).trigger.value?.contains(e.target)&&e.preventDefault(),r(`pointerDownOutside`,e)},onFocusOutside:t[2]||=Ce(()=>{},[`prevent`]),onDismiss:t[3]||=e=>b(i).onClose()},{default:k(()=>[y(b(je),T({ref:b(s),"data-state":b(i).stateAttribute.value},{...e.$attrs,...f.value},{style:{"--reka-tooltip-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-tooltip-content-available-width":`var(--reka-popper-available-width)`,"--reka-tooltip-content-available-height":`var(--reka-popper-available-height)`,"--reka-tooltip-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-tooltip-trigger-height":`var(--reka-popper-anchor-height)`}}),{default:k(()=>[D(e.$slots,`default`),y(b(ot),{id:b(i).contentId,role:`tooltip`},{default:k(()=>[_(v(d.value),1)]),_:1},8,[`id`])]),_:3},16,[`data-state`])]),_:3}))}}),wt=S({__name:`TooltipContentHoverable`,props:{ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},setup(e){let t=Ke(e),{forwardRef:n,currentElement:r}=tt(),{trigger:i,onClose:a}=bt(),o=pt(),{isPointerInTransit:s,onPointerExit:c}=Ee(i,r);return o.isPointerInTransitRef=s,c(()=>{a()}),(e,r)=>(m(),x(Ct,T({ref:b(n)},b(t)),{default:k(()=>[D(e.$slots,`default`)]),_:3},16))}}),Tt=S({__name:`TooltipContent`,props:{forceMount:{type:Boolean,required:!1},ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(t,{emit:n}){let r=t,i=n,a=bt(),o=Te(r,i),{forwardRef:s}=tt();return(t,n)=>(m(),x(b(nt),{present:t.forceMount||b(a).open.value},{default:k(()=>[(m(),x(e(b(a).disableHoverableContent.value?Ct:wt),T({ref:b(s)},b(o)),{default:k(()=>[D(t.$slots,`default`)]),_:3},16))]),_:3},8,[`present`]))}}),Et=S({__name:`TooltipPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let t=e;return(e,n)=>(m(),x(b(it),de(p(t)),{default:k(()=>[D(e.$slots,`default`)]),_:3},16))}}),Dt=S({__name:`TooltipTrigger`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=bt(),r=pt();n.contentId||=st(void 0,`reka-tooltip-content`);let{forwardRef:i,currentElement:a}=tt(),o=A(!1),s=A(!1),l=c(()=>n.disabled.value?{}:{click:v,focus:g,pointermove:p,pointerleave:h,pointerdown:f,blur:_});u(()=>{n.onTriggerChange(a.value)});function d(){setTimeout(()=>{o.value=!1},1)}function f(){n.open&&!n.disableClosingTrigger.value&&n.onClose(),o.value=!0,document.addEventListener(`pointerup`,d,{once:!0})}function p(e){e.pointerType!==`touch`&&!s.value&&!r.isPointerInTransitRef.value&&(n.onTriggerEnter(),s.value=!0)}function h(){n.onTriggerLeave(),s.value=!1}function g(e){o.value||n.ignoreNonKeyboardFocus.value&&!e.target.matches?.(`:focus-visible`)||n.onOpen()}function _(){n.onClose()}function v(){n.disableClosingTrigger.value||n.onClose()}return(e,r)=>(m(),x(b(Ue),{"as-child":``,reference:e.reference},{default:k(()=>[y(b($e),T({ref:b(i),"aria-describedby":b(n).open.value?b(n).contentId:void 0,"data-state":b(n).stateAttribute.value,as:e.as,"as-child":t.asChild,"data-grace-area-trigger":``},oe(l.value)),{default:k(()=>[D(e.$slots,`default`)]),_:3},16,[`aria-describedby`,`data-state`,`as`,`as-child`])]),_:3},8,[`reference`]))}}),Ot={slots:{root:`flex items-center align-center text-center`,border:``,container:`font-medium text-default flex`,icon:`shrink-0 size-5`,avatar:`shrink-0`,avatarSize:`2xs`,label:`text-sm`},variants:{color:{primary:{border:`border-primary`},secondary:{border:`border-secondary`},success:{border:`border-success`},info:{border:`border-info`},warning:{border:`border-warning`},error:{border:`border-error`},neutral:{border:`border-default`}},orientation:{horizontal:{root:`w-full flex-row`,border:`w-full`,container:`whitespace-nowrap`},vertical:{root:`h-full flex-col`,border:`h-full`,container:``}},size:{xs:``,sm:``,md:``,lg:``,xl:``},position:{start:``,center:``,end:``},type:{solid:{border:`border-solid`},dashed:{border:`border-dashed`},dotted:{border:`border-dotted`}}},compoundVariants:[{orientation:`horizontal`,position:`start`,class:{container:`me-3`}},{orientation:`horizontal`,position:`center`,class:{container:`mx-3`}},{orientation:`horizontal`,position:`end`,class:{container:`ms-3`}},{orientation:`vertical`,position:`start`,class:{container:`mb-2`}},{orientation:`vertical`,position:`center`,class:{container:`my-2`}},{orientation:`vertical`,position:`end`,class:{container:`mt-2`}},{orientation:`horizontal`,size:`xs`,class:{border:`border-t`}},{orientation:`horizontal`,size:`sm`,class:{border:`border-t-[2px]`}},{orientation:`horizontal`,size:`md`,class:{border:`border-t-[3px]`}},{orientation:`horizontal`,size:`lg`,class:{border:`border-t-[4px]`}},{orientation:`horizontal`,size:`xl`,class:{border:`border-t-[5px]`}},{orientation:`vertical`,size:`xs`,class:{border:`border-s`}},{orientation:`vertical`,size:`sm`,class:{border:`border-s-[2px]`}},{orientation:`vertical`,size:`md`,class:{border:`border-s-[3px]`}},{orientation:`vertical`,size:`lg`,class:{border:`border-s-[4px]`}},{orientation:`vertical`,size:`xl`,class:{border:`border-s-[5px]`}}],defaultVariants:{color:`neutral`,size:`xs`,type:`solid`}},kt={__name:`Separator`,props:{as:{type:null,required:!1},label:{type:String,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},color:{type:null,required:!1},size:{type:null,required:!1},type:{type:null,required:!1},orientation:{type:null,required:!1,default:`horizontal`},position:{type:null,required:!1,default:`center`},class:{type:null,required:!1},ui:{type:null,required:!1},decorative:{type:Boolean,required:!1}},setup(e){let o=e,s=ue(),l=Ge(`separator`,o),u=t(),d=qe(ve(l,`as`,`decorative`,`orientation`)),[f,p]=g(),h=c(()=>!!(l.label||l.icon||l.avatar||s.default)),_=c(()=>et({extend:et(Ot),...u.ui?.separator||{}})({color:l.color,orientation:l.orientation,size:l.size,position:l.position,type:l.type}));return(e,t)=>(m(),r(i,null,[y(b(f),null,{default:k(()=>[a(`div`,{"data-slot":`container`,class:n(_.value.container({class:b(l).ui?.container}))},[D(e.$slots,`default`,{ui:_.value},()=>[b(l).label?(m(),r(`span`,{key:0,"data-slot":`label`,class:n(_.value.label({class:b(l).ui?.label}))},v(b(l).label),3)):b(l).icon?(m(),x(Je,{key:1,name:b(l).icon,"data-slot":`icon`,class:n(_.value.icon({class:b(l).ui?.icon}))},null,8,[`name`,`class`])):b(l).avatar?(m(),x(Qe,T({key:2,size:b(l).ui?.avatarSize||_.value.avatarSize()},b(l).avatar,{"data-slot":`avatar`,class:_.value.avatar({class:b(l).ui?.avatar})}),null,16,[`size`,`class`])):O(``,!0)])],2)]),_:3}),y(b(_t),T(b(d),{"data-slot":`root`,class:_.value.root({class:[b(l).ui?.root,b(l).class]})}),{default:k(()=>[h.value&&b(l).position===`start`?(m(),x(b(p),{key:0})):O(``,!0),a(`div`,{"data-slot":`border`,class:n(_.value.border({class:b(l).ui?.border}))},null,2),h.value&&b(l).position===`center`?(m(),r(i,{key:1},[y(b(p)),a(`div`,{"data-slot":`border`,class:n(_.value.border({class:b(l).ui?.border}))},null,2)],64)):O(``,!0),h.value&&b(l).position===`end`?(m(),x(b(p),{key:2})):O(``,!0)]),_:1},16,[`class`])],64))}};function At(e){return typeof e==`function`}function jt(e){return e==null}var Mt=e=>e!==null&&!!e&&typeof e==`object`&&!Array.isArray(e);function Nt(e){return Number(e)>=0}function Pt(e){let t=parseFloat(e);return isNaN(t)?e:t}function Ft(e){return typeof e==`object`&&!!e}function It(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}function Lt(e){if(!Ft(e)||It(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Rt(e,t){return Object.keys(t).forEach(n=>{if(Lt(t[n])&&Lt(e[n])){e[n]||(e[n]={}),Rt(e[n],t[n]);return}e[n]=t[n]}),e}function zt(e){let t=e.split(`.`);if(!t.length)return``;let n=String(t[0]);for(let e=1;e<t.length;e++){if(Nt(t[e])){n+=`[${t[e]}]`;continue}n+=`.${t[e]}`}return n}var Bt={};function Vt(e){return Bt[e]}function Ht(e,t,n){typeof n.value==`object`&&(n.value=j(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t===`__proto__`?Object.defineProperty(e,t,n):e[t]=n.value}function j(e){if(typeof e!=`object`)return e;var t=0,n,r,i,a=Object.prototype.toString.call(e);if(a===`[object Object]`?i=Object.create(e.__proto__||null):a===`[object Array]`?i=Array(e.length):a===`[object Set]`?(i=new Set,e.forEach(function(e){i.add(j(e))})):a===`[object Map]`?(i=new Map,e.forEach(function(e,t){i.set(j(t),j(e))})):a===`[object Date]`?i=new Date(+e):a===`[object RegExp]`?i=new RegExp(e.source,e.flags):a===`[object DataView]`?i=new e.constructor(j(e.buffer)):a===`[object ArrayBuffer]`?i=e.slice(0):a.slice(-6)===`Array]`&&(i=new e.constructor(e)),i){for(r=Object.getOwnPropertySymbols(e);t<r.length;t++)Ht(i,r[t],Object.getOwnPropertyDescriptor(e,r[t]));for(t=0,r=Object.getOwnPropertyNames(e);t<r.length;t++)Object.hasOwnProperty.call(i,n=r[t])&&i[n]===e[n]||Ht(i,n,Object.getOwnPropertyDescriptor(e,n))}return i||e}var Ut=Symbol(`vee-validate-form`),Wt=Symbol(`vee-validate-form-context`),Gt=Symbol(`vee-validate-field-instance`),Kt=Symbol(`Default empty value`),qt=typeof window<`u`;function Jt(e){return At(e)&&!!e.__locatorRef}function Yt(e){return!!e&&At(e.parse)&&e.__type===`VVTypedSchema`}function Xt(e){return!!e&&At(e.validate)}function Zt(e){return e===`checkbox`||e===`radio`}function Qt(e){return Mt(e)||Array.isArray(e)}function $t(e){return Array.isArray(e)?e.length===0:Mt(e)&&Object.keys(e).length===0}function en(e){return/^\[.+\]$/i.test(e)}function tn(e){return nn(e)&&e.multiple}function nn(e){return e.tagName===`SELECT`}function rn(e,t){let n=![!1,null,void 0,0].includes(t.multiple)&&!Number.isNaN(t.multiple);return e===`select`&&`multiple`in t&&n}function an(e,t){return!rn(e,t)&&t.type!==`file`&&!Zt(t.type)}function on(e){return sn(e)&&e.target&&`submit`in e.target}function sn(e){return e?!!(typeof Event<`u`&&At(Event)&&e instanceof Event||e&&e.srcElement):!1}function cn(e,t){return t in e&&e[t]!==Kt}function ln(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!ln(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(r of e.entries())if(!t.has(r[0]))return!1;for(r of e.entries())if(!ln(r[1],t.get(r[0])))return!1;return!0}if(dn(e)&&dn(t))return!(e.size!==t.size||e.name!==t.name||e.lastModified!==t.lastModified||e.type!==t.type);if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(r of e.entries())if(!t.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(e=un(e),t=un(t),i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){var a=i[r];if(!ln(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function un(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}function dn(e){return qt?e instanceof File:!1}function fn(e){return en(e)?e.replace(/\[|\]/gi,``):e}function pn(e,t,n){return e?en(t)?e[fn(t)]:(t||``).split(/\.|\[(\d+)\]/).filter(Boolean).reduce((e,t)=>Qt(e)&&t in e?e[t]:n,e):n}function mn(e,t,n){if(en(t)){e[fn(t)]=n;return}let r=t.split(/\.|\[(\d+)\]/).filter(Boolean),i=e;for(let e=0;e<r.length;e++){if(e===r.length-1){i[r[e]]=n;return}(!(r[e]in i)||jt(i[r[e]]))&&(i[r[e]]=Nt(r[e+1])?[]:{}),i=i[r[e]]}}function hn(e,t){if(Array.isArray(e)&&Nt(t)){e.splice(Number(t),1);return}Mt(e)&&delete e[t]}function gn(e,t){if(en(t)){delete e[fn(t)];return}let n=t.split(/\.|\[(\d+)\]/).filter(Boolean),r=e;for(let e=0;e<n.length;e++){if(e===n.length-1){hn(r,n[e]);break}if(!(n[e]in r)||jt(r[n[e]]))break;r=r[n[e]]}let i=n.map((t,r)=>pn(e,n.slice(0,r).join(`.`)));for(let t=i.length-1;t>=0;t--)if($t(i[t])){if(t===0){hn(e,n[0]);continue}hn(i[t-1],n[t-1])}}function _n(e){return Object.keys(e)}function vn(e,t=void 0){return l()?.provides[e]||w(e,t)}function yn(e,t,n){if(Array.isArray(e)){let n=[...e],r=n.findIndex(e=>ln(e,t));return r>=0?n.splice(r,1):n.push(t),n}return ln(e,t)?n:t}function bn(e,t=0){let n=null,r=[];return function(...i){return n&&clearTimeout(n),n=setTimeout(()=>{let t=e(...i);r.forEach(e=>e(t)),r=[]},t),new Promise(e=>r.push(e))}}function xn(e,t){return Mt(t)&&t.number?Pt(e):e}function Sn(e,t){let n;return async function(...r){let i=e(...r);n=i;let a=await i;return i===n?(n=void 0,t(a,r)):a}}function Cn({get:e,set:t}){let n=A(j(e()));return me(e,e=>{ln(e,n.value)||(n.value=j(e))},{deep:!0}),me(n,n=>{ln(n,e())||t(j(n))},{deep:!0}),n}function wn(e){return Array.isArray(e)?e:e?[e]:[]}function Tn(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function En(e){let t=null,n=[];return function(...r){let i=d(()=>{if(t!==i)return;let a=e(...r);n.forEach(e=>e(a)),n=[],t=null});return t=i,new Promise(e=>n.push(e))}}function Dn(e,t,n){return t.slots.default?typeof e==`string`||!e?t.slots.default(n()):{default:()=>{var e;return(e=t.slots).default?.call(e,n())}}:t.slots.default}function On(e){if(kn(e))return e._value}function kn(e){return`_value`in e}function An(e){return e.type===`number`||e.type===`range`?Number.isNaN(e.valueAsNumber)?e.value:e.valueAsNumber:e.value}function jn(e){if(!sn(e))return e;let t=e.target;if(Zt(t.type)&&kn(t))return On(t);if(t.type===`file`&&t.files){let e=Array.from(t.files);return t.multiple?e:e[0]}if(tn(t))return Array.from(t.options).filter(e=>e.selected&&!e.disabled).map(On);if(nn(t)){let e=Array.from(t.options).find(e=>e.selected);return e?On(e):t.value}return An(t)}function Mn(e){let t={};return Object.defineProperty(t,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),e?Mt(e)&&e._$$isNormalized?e:Mt(e)?Object.keys(e).reduce((t,n)=>{let r=Nn(e[n]);return e[n]!==!1&&(t[n]=Pn(r)),t},t):typeof e==`string`?e.split(`|`).reduce((e,t)=>{let n=Fn(t);return n.name&&(e[n.name]=Pn(n.params)),e},t):t:t}function Nn(e){return e===!0?[]:Array.isArray(e)||Mt(e)?e:[e]}function Pn(e){let t=e=>typeof e==`string`&&e[0]===`@`?In(e.slice(1)):e;return Array.isArray(e)?e.map(t):e instanceof RegExp?[e]:Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{})}var Fn=e=>{let t=[],n=e.split(`:`)[0];return e.includes(`:`)&&(t=e.split(`:`).slice(1).join(`:`).split(`,`)),{name:n,params:t}};function In(e){let t=t=>pn(t,e)??t[e];return t.__locatorRef=e,t}function Ln(e){return Array.isArray(e)?e.filter(Jt):_n(e).filter(t=>Jt(e[t])).map(t=>e[t])}var Rn=Object.assign({},{generateMessage:({field:e})=>`${e} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0}),zn=()=>Rn;async function Bn(e,t,n={}){let r=n?.bails,i=await Vn({name:n?.name||`{field}`,rules:t,label:n?.label,bails:r??!0,formData:n?.values||{}},e);return Object.assign(Object.assign({},i),{valid:!i.errors.length})}async function Vn(e,t){let n=e.rules;if(Yt(n)||Xt(n))return Wn(t,Object.assign(Object.assign({},e),{rules:n}));if(At(n)||Array.isArray(n)){let r={field:e.label||e.name,name:e.name,label:e.label,form:e.formData,value:t},i=Array.isArray(n)?n:[n],a=i.length,o=[];for(let n=0;n<a;n++){let a=i[n],s=await a(t,r);if(!(typeof s!=`string`&&!Array.isArray(s)&&s)){if(Array.isArray(s))o.push(...s);else{let e=typeof s==`string`?s:Kn(r);o.push(e)}if(e.bails)return{errors:o}}}return{errors:o}}let r=Object.assign(Object.assign({},e),{rules:Mn(n)}),i=[],a=Object.keys(r.rules),o=a.length;for(let n=0;n<o;n++){let o=a[n],s=await Gn(r,t,{name:o,params:r.rules[o]});if(s.error&&(i.push(s.error),e.bails))return{errors:i}}return{errors:i}}function Hn(e){return!!e&&e.name===`ValidationError`}function Un(e){return{__type:`VVTypedSchema`,async parse(t,n){try{return{output:await e.validate(t,{abortEarly:!1,context:n?.formData||{}}),errors:[]}}catch(e){if(!Hn(e))throw e;if(!e.inner?.length&&e.errors.length)return{errors:[{path:e.path,errors:e.errors}]};let t=e.inner.reduce((e,t)=>{let n=t.path||``;return e[n]||(e[n]={errors:[],path:n}),e[n].errors.push(...t.errors),e},{});return{errors:Object.values(t)}}}}}async function Wn(e,t){let n=await(Yt(t.rules)?t.rules:Un(t.rules)).parse(e,{formData:t.formData}),r=[];for(let e of n.errors)e.errors.length&&r.push(...e.errors);return{value:n.value,errors:r}}async function Gn(e,t,n){let r=Vt(n.name);if(!r)throw Error(`No such validator '${n.name}' exists.`);let i=qn(n.params,e.formData),a={field:e.label||e.name,name:e.name,label:e.label,value:t,form:e.formData,rule:Object.assign(Object.assign({},n),{params:i})},o=await r(t,i,a);return typeof o==`string`?{error:o}:{error:o?void 0:Kn(a)}}function Kn(e){let t=zn().generateMessage;return t?t(e):`Field is invalid`}function qn(e,t){let n=e=>Jt(e)?e(t):e;return Array.isArray(e)?e.map(n):Object.keys(e).reduce((t,r)=>(t[r]=n(e[r]),t),{})}async function Jn(e,t){let n=await(Yt(e)?e:Un(e)).parse(j(t),{formData:j(t)}),r={},i={};for(let e of n.errors){let t=e.errors,n=(e.path||``).replace(/\["(\d+)"\]/g,(e,t)=>`[${t}]`);r[n]={valid:!t.length,errors:t},t.length&&(i[n]=t[0])}return{valid:!n.errors.length,results:r,errors:i,values:n.value,source:`schema`}}async function Yn(e,t,n){let r=_n(e).map(async r=>{let i=n?.names?.[r],a=await Bn(pn(t,r),e[r],{name:i?.name||r,label:i?.label,values:t,bails:n?.bailsMap?.[r]??!0});return Object.assign(Object.assign({},a),{path:r})}),i=!0,a=await Promise.all(r),o={},s={};for(let e of a)o[e.path]={valid:e.valid,errors:e.errors},e.valid||(i=!1,s[e.path]=e.errors[0]);return{valid:i,results:o,errors:s,source:`schema`}}var Xn=0;function Zn(e,t){let{value:n,initialValue:r,setInitialValue:i}=Qn(e,t.modelValue,t.form);if(!t.form){let{errors:a,setErrors:o}=tr(),s=Xn>=2**53-1?0:++Xn,c=er(n,r,a,t.schema);function l(e){`value`in e&&(n.value=e.value),`errors`in e&&o(e.errors),`touched`in e&&(c.touched=e.touched??c.touched),`initialValue`in e&&i(e.initialValue)}return{id:s,path:e,value:n,initialValue:r,meta:c,flags:{pendingUnmount:{[s]:!1},pendingReset:!1},errors:a,setState:l}}let a=t.form.createPathState(e,{bails:t.bails,label:t.label,type:t.type,validate:t.validate,schema:t.schema}),o=c(()=>a.errors);function s(r){var a,o;`value`in r&&(n.value=r.value),`errors`in r&&((a=t.form)==null||a.setFieldError(b(e),r.errors)),`touched`in r&&((o=t.form)==null||o.setFieldTouched(b(e),r.touched??!1)),`initialValue`in r&&i(r.initialValue)}return{id:Array.isArray(a.id)?a.id[a.id.length-1]:a.id,path:e,value:n,errors:o,meta:a,initialValue:r,flags:a.__flags,setState:s}}function Qn(e,t,n){let r=A(b(t));function i(){return n?pn(n.initialValues.value,b(e),b(r)):b(r)}function a(t){if(!n){r.value=t;return}n.setFieldInitialValue(b(e),t,!0)}let o=c(i);if(!n)return{value:A(i()),initialValue:o,setInitialValue:a};let s=$n(t,n,o,e);return n.stageInitialValue(b(e),s,!0),{value:c({get(){return pn(n.values,b(e))},set(t){n.setFieldValue(b(e),t,!1)}}),initialValue:o,setInitialValue:a}}function $n(e,t,n,r){return fe(e)?b(e):e===void 0?pn(t.values,b(r),b(n)):e}function er(e,t,n,r){let i=ae({touched:!1,pending:!1,valid:!0,required:c(()=>{var e;return((e=s(r))?.describe)?.call(e).required??!1}),validated:!!b(n).length,initialValue:c(()=>b(t)),dirty:c(()=>!ln(b(e),b(t)))});return me(n,e=>{i.valid=!e.length},{immediate:!0,flush:`sync`}),i}function tr(){let e=A([]);return{errors:e,setErrors:t=>{e.value=wn(t)}}}function nr(e,t,n){return Zt(n?.type)?ar(e,t,n):rr(e,t,n)}function rr(e,t,n){let{initialValue:r,validateOnMount:i,bails:a,type:o,checkedValue:d,label:f,validateOnValueUpdate:p,uncheckedValue:m,controlled:h,keepValueOnUnmount:g,syncVModel:_,form:v}=ir(n),y=h?vn(Ut):void 0,x=v||y,S=c(()=>zt(s(e))),C=c(()=>{if(s(x?.schema))return;let e=b(t);return Xt(e)||Yt(e)||At(e)||Array.isArray(e)?e:Mn(e)}),w=!At(C.value)&&Yt(s(t)),{id:ee,value:te,initialValue:T,meta:ne,setState:D,errors:ie,flags:ae}=Zn(S,{modelValue:r,form:x,bails:a,label:f,type:o,validate:C.value?de:void 0,schema:w?t:void 0}),oe=c(()=>ie.value[0]);_&&or({value:te,prop:_,handleChange:O,shouldValidate:()=>p&&!ae.pendingReset});let se=(e,t=!1)=>{ne.touched=!0,t&&le()};async function ce(e){if(x?.validateSchema){let{results:t}=await x.validateSchema(e);return t[s(S)]??{valid:!0,errors:[]}}return C.value?Bn(te.value,C.value,{name:s(S),label:s(f),values:x?.values??{},bails:a}):{valid:!0,errors:[]}}let le=Sn(async()=>(ne.pending=!0,ne.validated=!0,ce(`validated-only`)),e=>ae.pendingUnmount[ye.id]?e:(D({errors:e.errors}),ne.pending=!1,ne.valid=e.valid,e)),ue=Sn(async()=>ce(`silent`),e=>(ne.valid=e.valid,e));function de(e){return e?.mode===`silent`?ue():le()}function O(e,t=!0){_e(jn(e),t)}u(()=>{if(i)return le();(!x||!x.validateSchema)&&ue()});function pe(e){ne.touched=e}function he(e){let t=e&&`value`in e?e.value:T.value;D({value:j(t),initialValue:j(t),touched:e?.touched??!1,errors:e?.errors||[]}),ne.pending=!1,ne.validated=!1,ue()}let ge=l();function _e(e,t=!0){te.value=ge&&_?xn(e,ge.props.modelModifiers):e,(t?le:ue)()}function ve(e){D({errors:Array.isArray(e)?e:[e]})}let ye={id:ee,name:S,label:f,value:c({get(){return te.value},set(e){_e(e,p)}}),meta:ne,errors:ie,errorMessage:oe,type:o,checkedValue:d,uncheckedValue:m,bails:a,keepValueOnUnmount:g,resetField:he,handleReset:()=>he(),validate:de,handleChange:O,handleBlur:se,setState:D,setTouched:pe,setErrors:ve,setValue:_e};return re(Gt,ye),fe(t)&&typeof b(t)!=`function`&&me(t,(e,t)=>{ln(e,t)||(ne.validated?le():ue())},{deep:!0}),x?(me(c(()=>{let e=C.value;return!e||At(e)||Xt(e)||Yt(e)||Array.isArray(e)?{}:Object.keys(e).reduce((t,n)=>{let r=Ln(e[n]).map(e=>e.__locatorRef).reduce((e,t)=>{let n=pn(x.values,t)||x.values[t];return n!==void 0&&(e[t]=n),e},{});return Object.assign(t,r),t},{})}),(e,t)=>{Object.keys(e).length&&(ln(e,t)||(ne.validated?le():ue()))}),E(()=>{let e=s(ye.keepValueOnUnmount)??s(x.keepValuesOnUnmount),t=s(S);if(e||!x||ae.pendingUnmount[ye.id]){x?.removePathState(t,ee);return}ae.pendingUnmount[ye.id]=!0;let n=x.getPathState(t);if(Array.isArray(n?.id)&&n?.multiple?n?.id.includes(ye.id):n?.id===ye.id){if(n?.multiple&&Array.isArray(n.value)){let e=n.value.findIndex(e=>ln(e,s(ye.checkedValue)));if(e>-1){let r=[...n.value];r.splice(e,1),x.setFieldValue(t,r)}Array.isArray(n.id)&&n.id.splice(n.id.indexOf(ye.id),1)}else x.unsetPathValue(s(S));x.removePathState(t,ee)}}),ye):ye}function ir(e){let t=()=>({initialValue:void 0,validateOnMount:!1,bails:!0,label:void 0,validateOnValueUpdate:!0,keepValueOnUnmount:void 0,syncVModel:!1,controlled:!0}),n=!!e?.syncVModel,r=typeof e?.syncVModel==`string`?e.syncVModel:e?.modelPropName||`modelValue`,i=n&&!(`initialValue`in(e||{}))?sr(l(),r):e?.initialValue;if(!e)return Object.assign(Object.assign({},t()),{initialValue:i});let a=`valueProp`in e?e.valueProp:e.checkedValue,o=`standalone`in e?!e.standalone:e.controlled,s=e?.modelPropName||e?.syncVModel||!1;return Object.assign(Object.assign(Object.assign({},t()),e||{}),{initialValue:i,controlled:o??!0,checkedValue:a,syncVModel:s})}function ar(e,t,n){let r=n?.standalone?void 0:vn(Ut),i=n?.checkedValue,a=n?.uncheckedValue;function o(t){let o=t.handleChange,l=c(()=>{let e=s(t.value),n=s(i);return Array.isArray(e)?e.findIndex(e=>ln(e,n))>=0:ln(n,e)});function u(c,u=!0){if(l.value===c?.target?.checked){u&&t.validate();return}let d=s(e),f=r?.getPathState(d),p=jn(c),m=s(i)??p;r&&f?.multiple&&f.type===`checkbox`?m=yn(pn(r.values,d)||[],m,void 0):n?.type===`checkbox`&&(m=yn(s(t.value),m,s(a))),o(m,u)}return Object.assign(Object.assign({},t),{checked:l,checkedValue:i,uncheckedValue:a,handleChange:u})}return o(rr(e,t,n))}function or({prop:e,value:t,handleChange:n,shouldValidate:r}){let i=l();if(!i||!e)return;let a=typeof e==`string`?e:`modelValue`,o=`update:${a}`;a in i.props&&(me(t,e=>{ln(e,sr(i,a))||i.emit(o,e)}),me(()=>sr(i,a),e=>{if(e===Kt&&t.value===void 0)return;let i=e===Kt?void 0:e;ln(i,t.value)||n(i,r())}))}function sr(e,t){if(e)return e.props[t]}S({name:`Field`,inheritAttrs:!1,props:{as:{type:[String,Object],default:void 0},name:{type:String,required:!0},rules:{type:[Object,String,Function],default:void 0},validateOnMount:{type:Boolean,default:!1},validateOnBlur:{type:Boolean,default:void 0},validateOnChange:{type:Boolean,default:void 0},validateOnInput:{type:Boolean,default:void 0},validateOnModelUpdate:{type:Boolean,default:void 0},bails:{type:Boolean,default:()=>zn().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:Kt},modelModifiers:{type:null,default:()=>({})},"onUpdate:modelValue":{type:null,default:void 0},standalone:{type:Boolean,default:!1},keepValue:{type:Boolean,default:void 0}},setup(t,n){let r=Se(t,`rules`),i=Se(t,`name`),a=Se(t,`label`),o=Se(t,`uncheckedValue`),s=Se(t,`keepValue`),{errors:l,value:u,errorMessage:d,validate:f,handleChange:p,handleBlur:m,setTouched:g,resetField:_,handleReset:v,meta:y,checked:b,setErrors:x,setValue:S}=nr(i,r,{validateOnMount:t.validateOnMount,bails:t.bails,standalone:t.standalone,type:n.attrs.type,initialValue:ur(t,n),checkedValue:n.attrs.value,uncheckedValue:o,label:a,validateOnValueUpdate:t.validateOnModelUpdate,keepValueOnUnmount:s,syncVModel:!0}),C=function(e,t=!0){p(e,t)},w=c(()=>{let{validateOnInput:e,validateOnChange:r,validateOnBlur:i,validateOnModelUpdate:a}=lr(t);function o(e){m(e,i),At(n.attrs.onBlur)&&n.attrs.onBlur(e)}function s(t){C(t,e),At(n.attrs.onInput)&&n.attrs.onInput(t)}function c(e){C(e,r),At(n.attrs.onChange)&&n.attrs.onChange(e)}let l={name:t.name,onBlur:o,onInput:s,onChange:c};return l[`onUpdate:modelValue`]=e=>C(e,a),l}),ee=c(()=>{let e=Object.assign({},w.value);return Zt(n.attrs.type)&&b&&(e.checked=b.value),an(cr(t,n),n.attrs)&&(e.value=u.value),e}),te=c(()=>Object.assign(Object.assign({},w.value),{modelValue:u.value}));function T(){return{field:ee.value,componentField:te.value,value:u.value,meta:y,errors:l.value,errorMessage:d.value,validate:f,resetField:_,handleChange:C,handleInput:e=>C(e,!1),handleReset:v,handleBlur:w.value.onBlur,setTouched:g,setErrors:x,setValue:S}}return n.expose({value:u,meta:y,errors:l,errorMessage:d,setErrors:x,setTouched:g,setValue:S,reset:_,validate:f,handleChange:p}),()=>{let r=e(cr(t,n)),i=Dn(r,n,T);return r?h(r,Object.assign(Object.assign({},n.attrs),ee.value),i):i}}});function cr(e,t){let n=e.as||``;return!e.as&&!t.slots.default&&(n=`input`),n}function lr(e){let{validateOnInput:t,validateOnChange:n,validateOnBlur:r,validateOnModelUpdate:i}=zn();return{validateOnInput:e.validateOnInput??t,validateOnChange:e.validateOnChange??n,validateOnBlur:e.validateOnBlur??r,validateOnModelUpdate:e.validateOnModelUpdate??i}}function ur(e,t){return Zt(t.attrs.type)?cn(e,`modelValue`)?e.modelValue:void 0:cn(e,`modelValue`)?e.modelValue:t.attrs.value}var dr=0,fr=[`bails`,`fieldsCount`,`id`,`multiple`,`type`,`validate`];function pr(e){let t=e?.initialValues||{},n=Object.assign({},s(t)),r=b(e?.validationSchema);return r&&Yt(r)&&At(r.cast)?j(r.cast(n)||{}):j(n)}function mr(e){let t=dr++,n=e?.name||`Form`,r=0,i=A(!1),a=A(!1),o=A(0),l=[],f=ae(pr(e)),p=A([]),m=A({}),h=A({}),g=En(()=>{h.value=p.value.reduce((e,t)=>(e[zt(s(t.path))]=t,e),{})});function _(e,t){let n=O(e);if(!n){typeof e==`string`&&(m.value[zt(e)]=wn(t));return}if(typeof e==`string`){let t=zt(e);m.value[t]&&delete m.value[t]}n.errors=wn(t),n.valid=!n.errors.length}function v(e){_n(e).forEach(t=>{_(t,e[t])})}e?.initialErrors&&v(e.initialErrors);let y=c(()=>{let e=p.value.reduce((e,t)=>(t.errors.length&&(e[s(t.path)]=t.errors),e),{});return Object.assign(Object.assign({},m.value),e)}),x=c(()=>_n(y.value).reduce((e,t)=>{let n=y.value[t];return n?.length&&(e[t]=n[0]),e},{})),S=c(()=>p.value.reduce((e,t)=>(e[s(t.path)]={name:s(t.path)||``,label:t.label||``},e),{})),C=c(()=>p.value.reduce((e,t)=>(e[s(t.path)]=t.bails??!0,e),{})),w=Object.assign({},e?.initialErrors||{}),te=e?.keepValuesOnUnmount??!1,{initialValues:T,originalInitialValues:E,setInitialValues:ne}=gr(p,f,e),D=hr(p,f,E,x),ie=c(()=>p.value.reduce((e,t)=>{let n=pn(f,s(t.path));return mn(e,s(t.path),n),e},{})),oe=e?.validationSchema;function se(e,t){let n=c(()=>pn(T.value,s(e))),i=h.value[s(e)],a=t?.type===`checkbox`||t?.type===`radio`;if(i&&a){i.multiple=!0;let e=r++;return Array.isArray(i.id)?i.id.push(e):i.id=[i.id,e],i.fieldsCount++,i.__flags.pendingUnmount[e]=!1,i}let o=c(()=>pn(f,s(e))),l=s(e),u=he.findIndex(e=>e===l);u!==-1&&he.splice(u,1);let m=c(()=>{let n=s(oe);if(Yt(n))return n.describe?.call(n,s(e)).required??!1;let r=s(t?.schema);return Yt(r)?r.describe?.call(r).required??!1:!1}),_=r++,v=ae({id:_,path:e,touched:!1,pending:!1,valid:!0,validated:!!w[l]?.length,required:m,initialValue:n,errors:ee([]),bails:t?.bails??!1,label:t?.label,type:t?.type||`default`,value:o,multiple:!1,__flags:{pendingUnmount:{[_]:!1},pendingReset:!1},fieldsCount:1,validate:t?.validate,dirty:c(()=>!ln(b(o),b(n)))});return p.value.push(v),h.value[l]=v,g(),x.value[l]&&!w[l]&&d(()=>{Fe(l,{mode:`silent`})}),fe(e)&&me(e,e=>{g();let t=j(o.value);h.value[e]=v,d(()=>{mn(f,e,t)})}),v}let ce=bn(ze,5),le=bn(ze,5),ue=Sn(async e=>await(e===`silent`?ce():le()),(e,[t])=>{let n=_n(Se.errorBag.value),r=[...new Set([..._n(e.results),...p.value.map(e=>e.path),...n])].sort().reduce((n,r)=>{let i=r,a=O(i)||pe(i),o=e.results[i]?.errors||[],c=s(a?.path)||i,l=_r({errors:o,valid:!o.length},n.results[c]);return n.results[c]=l,l.valid||(n.errors[c]=l.errors[0]),a&&m.value[c]&&delete m.value[c],a?(a.valid=l.valid,t===`silent`||t===`validated-only`&&!a.validated||_(a,l.errors),n):(_(c,o),n)},{valid:e.valid,results:{},errors:{},source:e.source});return e.values&&(r.values=e.values,r.source=e.source),_n(r.results).forEach(e=>{let n=O(e);n&&t!==`silent`&&(t===`validated-only`&&!n.validated||_(n,r.results[e]?.errors))}),r});function de(e){p.value.forEach(e)}function O(e){let t=typeof e==`string`?zt(e):e;return typeof t==`string`?h.value[t]:t}function pe(e){return p.value.filter(t=>e.startsWith(s(t.path))).reduce((e,t)=>e?t.path.length>e.path.length?t:e:t,void 0)}let he=[],ge;function _e(e){return he.push(e),ge||=d(()=>{[...he].sort().reverse().forEach(e=>{gn(f,e)}),he=[],ge=null}),ge}function ve(e){return function(t,n){return function(r){return r instanceof Event&&(r.preventDefault(),r.stopPropagation()),de(e=>e.touched=!0),i.value=!0,o.value++,Pe().then(i=>{let a=j(f);if(i.valid&&typeof t==`function`){let n=j(ie.value),o=e?n:a;return i.values&&(o=i.source===`schema`?i.values:Object.assign({},o,i.values)),t(o,{evt:r,controlledValues:n,setErrors:v,setFieldError:_,setTouched:je,setFieldTouched:De,setValues:Te,setFieldValue:Ce,resetForm:Ne,resetField:Me})}!i.valid&&typeof n==`function`&&n({values:a,evt:r,errors:i.errors,results:i.results})}).then(e=>(i.value=!1,e),e=>{throw i.value=!1,e})}}}let ye=ve(!1);ye.withControlled=ve(!0);function k(e,t){let n=p.value.findIndex(n=>n.path===e&&(Array.isArray(n.id)?n.id.includes(t):n.id===t)),r=p.value[n];if(!(n===-1||!r)){if(d(()=>{Fe(e,{mode:`silent`,warn:!1})}),r.multiple&&r.fieldsCount&&r.fieldsCount--,Array.isArray(r.id)){let e=r.id.indexOf(t);e>=0&&r.id.splice(e,1),delete r.__flags.pendingUnmount[t]}(!r.multiple||r.fieldsCount<=0)&&(p.value.splice(n,1),Ie(e),g(),delete h.value[e])}}function be(e){_n(h.value).forEach(t=>{t.startsWith(e)&&delete h.value[t]}),p.value=p.value.filter(t=>!t.path.startsWith(e)),d(()=>{g()})}let Se={name:n,formId:t,values:f,controlledValues:ie,errorBag:y,errors:x,schema:oe,submitCount:o,meta:D,isSubmitting:i,isValidating:a,fieldArrays:l,keepValuesOnUnmount:te,validateSchema:b(oe)?ue:void 0,validate:Pe,setFieldError:_,validateField:Fe,setFieldValue:Ce,setValues:Te,setErrors:v,setFieldTouched:De,setTouched:je,resetForm:Ne,resetField:Me,handleSubmit:ye,useFieldModel:He,defineInputBinds:Ue,defineComponentBinds:We,defineField:Ve,stageInitialValue:Le,unsetInitialValue:Ie,setFieldInitialValue:Re,createPathState:se,getPathState:O,unsetPathValue:_e,removePathState:k,initialValues:T,getAllPathStates:()=>p.value,destroyPath:be,isFieldTouched:Oe,isFieldDirty:ke,isFieldValid:Ae};function Ce(e,t,n=!0){let r=j(t),i=typeof e==`string`?e:e.path;O(i)||se(i),mn(f,i,r),n&&Fe(i)}function we(e,t=!0){_n(f).forEach(e=>{delete f[e]}),_n(e).forEach(t=>{Ce(t,e[t],!1)}),t&&Pe()}function Te(e,t=!0){Rt(f,e),l.forEach(e=>e&&e.reset()),t&&Pe()}function Ee(e,t){let n=O(s(e))||se(e);return c({get(){return n.value},set(n){Ce(s(e),n,s(t)??!1)}})}function De(e,t){let n=O(e);n&&(n.touched=t)}function Oe(e){let t=O(e);return t?t.touched:p.value.filter(t=>t.path.startsWith(e)).some(e=>e.touched)}function ke(e){let t=O(e);return t?t.dirty:p.value.filter(t=>t.path.startsWith(e)).some(e=>e.dirty)}function Ae(e){let t=O(e);return t?t.valid:p.value.filter(t=>t.path.startsWith(e)).every(e=>e.valid)}function je(e){if(typeof e==`boolean`){de(t=>{t.touched=e});return}_n(e).forEach(t=>{De(t,!!e[t])})}function Me(e,t){let n=t&&`value`in t?t.value:pn(T.value,e),r=O(e);r&&(r.__flags.pendingReset=!0),Re(e,j(n),!0),Ce(e,n,!1),De(e,t?.touched??!1),_(e,t?.errors||[]),d(()=>{r&&(r.__flags.pendingReset=!1)})}function Ne(e,t){let n=j(e?.values?e.values:E.value);n=t?.force?n:Rt(E.value,n),n=Yt(oe)&&At(oe.cast)?oe.cast(n):n,ne(n,{force:t?.force}),de(t=>{t.__flags.pendingReset=!0,t.validated=!1,t.touched=e?.touched?.[s(t.path)]||!1,Ce(s(t.path),pn(n,s(t.path)),!1),_(s(t.path),void 0)}),t?.force?we(n,!1):Te(n,!1),v(e?.errors||{}),o.value=e?.submitCount||0,d(()=>{Pe({mode:`silent`}),de(e=>{e.__flags.pendingReset=!1})})}async function Pe(e){let t=e?.mode||`force`;if(t===`force`&&de(e=>e.validated=!0),Se.validateSchema)return Se.validateSchema(t);a.value=!0;let n=await Promise.all(p.value.map(t=>t.validate?t.validate(e).then(e=>({key:s(t.path),valid:e.valid,errors:e.errors,value:e.value})):Promise.resolve({key:s(t.path),valid:!0,errors:[],value:void 0})));a.value=!1;let r={},i={},o={};for(let e of n)r[e.key]={valid:e.valid,errors:e.errors},e.value&&mn(o,e.key,e.value),e.errors.length&&(i[e.key]=e.errors[0]);return{valid:n.every(e=>e.valid),results:r,errors:i,values:o,source:`fields`}}async function Fe(e,t){let n=O(e);if(n&&t?.mode!==`silent`&&(n.validated=!0),oe){let{results:n}=await ue(t?.mode||`validated-only`);return n[e]||{errors:[],valid:!0}}return n?.validate?n.validate(t):(!n&&t?.warn,Promise.resolve({errors:[],valid:!0}))}function Ie(e){gn(T.value,e)}function Le(t,n,r=!1){Re(t,n),mn(f,t,n),r&&!e?.initialValues&&mn(E.value,t,j(n))}function Re(e,t,n=!1){mn(T.value,e,j(t)),n&&mn(E.value,e,j(t))}async function ze(){let e=b(oe);if(!e)return{valid:!0,results:{},errors:{},source:`none`};a.value=!0;let t=Xt(e)||Yt(e)?await Jn(e,f):await Yn(e,f,{names:S.value,bailsMap:C.value});return a.value=!1,t}let Be=ye((e,{evt:t})=>{on(t)&&t.target.submit()});u(()=>{if(e?.initialErrors&&v(e.initialErrors),e?.initialTouched&&je(e.initialTouched),e?.validateOnMount){Pe();return}Se.validateSchema&&Se.validateSchema(`silent`)}),fe(oe)&&me(oe,()=>{var e;(e=Se.validateSchema)==null||e.call(Se,`validated-only`)}),re(Ut,Se);function Ve(e,t){let n=At(t)?void 0:t?.label,r=O(s(e))||se(e,{label:n}),i=()=>At(t)?t(Tn(r,fr)):t||{};function a(){r.touched=!0,(i().validateOnBlur??zn().validateOnBlur)&&Fe(s(r.path))}function o(){(i().validateOnInput??zn().validateOnInput)&&d(()=>{Fe(s(r.path))})}function l(){(i().validateOnChange??zn().validateOnChange)&&d(()=>{Fe(s(r.path))})}let u=c(()=>{let e={onChange:l,onInput:o,onBlur:a};return At(t)?Object.assign(Object.assign({},e),t(Tn(r,fr)).props||{}):t?.props?Object.assign(Object.assign({},e),t.props(Tn(r,fr))):e});return[Ee(e,()=>i().validateOnModelUpdate??zn()?.validateOnModelUpdate??!0),u]}function He(e){return Array.isArray(e)?e.map(e=>Ee(e,!0)):Ee(e)}function Ue(e,t){let[n,r]=Ve(e,t);function i(){r.value.onBlur()}function a(t){let n=jn(t);Ce(s(e),n,!1),r.value.onInput()}function o(t){let n=jn(t);Ce(s(e),n,!1),r.value.onChange()}return c(()=>Object.assign(Object.assign({},r.value),{onBlur:i,onInput:a,onChange:o,value:n.value}))}function We(e,t){let[n,r]=Ve(e,t),i=O(s(e));function a(e){n.value=e}return c(()=>{let e=At(t)?t(Tn(i,fr)):t||{};return Object.assign({[e.model||`modelValue`]:n.value,[`onUpdate:${e.model||`modelValue`}`]:a},r.value)})}let Ge=Object.assign(Object.assign({},Se),{values:xe(f),handleReset:()=>Ne(),submitForm:Be});return re(Wt,Ge),Ge}function hr(e,t,n,r){let i={touched:`some`,pending:`some`,valid:`every`},a=c(()=>!ln(t,b(n)));function o(){let t=e.value;return _n(i).reduce((e,n)=>(e[n]=t[i[n]](e=>e[n]),e),{})}let s=ae(o());return _e(()=>{let e=o();s.touched=e.touched,s.valid=e.valid,s.pending=e.pending}),c(()=>Object.assign(Object.assign({initialValues:b(n)},s),{valid:s.valid&&!_n(r.value).length,dirty:a.value}))}function gr(e,t,n){let r=pr(n),i=A(r),a=A(j(r));function o(n,r){r?.force?(i.value=j(n),a.value=j(n)):(i.value=Rt(j(i.value)||{},j(n)),a.value=Rt(j(a.value)||{},j(n))),r?.updateFields&&e.value.forEach(e=>{if(e.touched)return;let n=pn(i.value,s(e.path));mn(t,s(e.path),j(n))})}return{initialValues:i,originalInitialValues:a,setInitialValues:o}}function _r(e,t){return t?{valid:e.valid&&t.valid,errors:[...e.errors,...t.errors]}:e}S({name:`Form`,inheritAttrs:!1,props:{as:{type:null,default:`form`},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0},keepValues:{type:Boolean,default:!1},name:{type:String,default:`Form`}},setup(t,n){let r=Se(t,`validationSchema`),i=Se(t,`keepValues`),{errors:a,errorBag:o,values:s,meta:c,isSubmitting:l,isValidating:u,submitCount:d,controlledValues:f,validate:p,validateField:m,handleReset:g,resetForm:_,handleSubmit:v,setErrors:y,setFieldError:b,setFieldValue:x,setValues:S,setFieldTouched:C,setTouched:w,resetField:ee}=mr({validationSchema:r.value?r:void 0,initialValues:t.initialValues,initialErrors:t.initialErrors,initialTouched:t.initialTouched,validateOnMount:t.validateOnMount,keepValuesOnUnmount:i,name:t.name}),te=v((e,{evt:t})=>{on(t)&&t.target.submit()},t.onInvalidSubmit),T=t.onSubmit?v(t.onSubmit,t.onInvalidSubmit):te;function E(e){sn(e)&&e.preventDefault(),g(),typeof n.attrs.onReset==`function`&&n.attrs.onReset()}function ne(e,n){return v(typeof e==`function`&&!n?e:n,t.onInvalidSubmit)(e)}function re(){return j(s)}function D(){return j(c.value)}function ie(){return j(a.value)}function ae(){return{meta:c.value,errors:a.value,errorBag:o.value,values:s,isSubmitting:l.value,isValidating:u.value,submitCount:d.value,controlledValues:f.value,validate:p,validateField:m,handleSubmit:ne,handleReset:g,submitForm:te,setErrors:y,setFieldError:b,setFieldValue:x,setValues:S,setFieldTouched:C,setTouched:w,resetForm:_,resetField:ee,getValues:re,getMeta:D,getErrors:ie}}return n.expose({setFieldError:b,setErrors:y,setFieldValue:x,setValues:S,setFieldTouched:C,setTouched:w,resetForm:_,validate:p,validateField:m,resetField:ee,getValues:re,getMeta:D,getErrors:ie,values:s,meta:c,errors:a}),function(){let r=t.as===`form`?t.as:t.as?e(t.as):null,i=Dn(r,n,ae);return r?h(r,Object.assign(Object.assign(Object.assign({},r===`form`?{novalidate:!0}:{}),n.attrs),{onSubmit:T,onReset:E}),i):i}}});function vr(e){let t=vn(Ut,void 0),n=A([]),r=()=>{},i={fields:n,remove:r,push:r,swap:r,insert:r,update:r,replace:r,prepend:r,move:r};if(!t||!b(e))return i;let a=t.fieldArrays.find(t=>b(t.path)===b(e));if(a)return a;let o=0;function c(){return pn(t?.values,s(e),[])||[]}function l(){let e=c();Array.isArray(e)&&(n.value=e.map((e,t)=>d(e,t,n.value)),u())}l();function u(){let e=n.value.length;for(let t=0;t<e;t++){let r=n.value[t];r.isFirst=t===0,r.isLast=t===e-1}}function d(r,i,a){if(a&&!jt(i)&&a[i])return a[i];let c=o++;return{key:c,value:Cn({get(){let i=pn(t?.values,s(e),[])||[],a=n.value.findIndex(e=>e.key===c);return a===-1?r:i[a]},set(e){let t=n.value.findIndex(e=>e.key===c);t!==-1&&v(t,e)}}),isFirst:!1,isLast:!1}}function f(){u(),t?.validate({mode:`silent`})}function p(r){let i=s(e),a=pn(t?.values,i);if(!a||!Array.isArray(a))return;let o=[...a];o.splice(r,1);let c=i+`[${r}]`;t.destroyPath(c),t.unsetInitialValue(c),mn(t.values,i,o),n.value.splice(r,1),f()}function m(r){let i=j(r),a=s(e),o=pn(t?.values,a),c=jt(o)?[]:o;if(!Array.isArray(c))return;let l=[...c];l.push(i),t.stageInitialValue(a+`[${l.length-1}]`,i),mn(t.values,a,l),n.value.push(d(i)),f()}function h(r,i){let a=s(e),o=pn(t?.values,a);if(!Array.isArray(o)||!(r in o)||!(i in o))return;let c=[...o],l=[...n.value],d=c[r];c[r]=c[i],c[i]=d;let f=l[r];l[r]=l[i],l[i]=f,mn(t.values,a,c),n.value=l,u()}function g(r,i){let a=j(i),o=s(e),c=pn(t?.values,o);if(!Array.isArray(c)||c.length<r)return;let l=[...c],u=[...n.value];l.splice(r,0,a),u.splice(r,0,d(a)),mn(t.values,o,l),n.value=u,f()}function _(n){let r=s(e);t.stageInitialValue(r,n),mn(t.values,r,n),l(),f()}function v(n,r){let i=s(e),a=pn(t?.values,i);!Array.isArray(a)||a.length-1<n||(mn(t.values,`${i}[${n}]`,r),t?.validate({mode:`validated-only`}))}function y(r){let i=j(r),a=s(e),o=pn(t?.values,a),c=jt(o)?[]:o;if(!Array.isArray(c))return;let l=[i,...c];mn(t.values,a,l),t.stageInitialValue(a+`[0]`,i),n.value.unshift(d(i)),f()}function x(r,i){let a=s(e),o=pn(t?.values,a),c=jt(o)?[]:[...o];if(!Array.isArray(o)||!(r in o)||!(i in o))return;let l=[...n.value],u=l[r];l.splice(r,1),l.splice(i,0,u);let d=c[r];c.splice(r,1),c.splice(i,0,d),mn(t.values,a,c),n.value=l,f()}let S={fields:n,remove:p,push:m,swap:h,insert:g,update:v,replace:_,prepend:y,move:x};return t.fieldArrays.push(Object.assign({path:e,reset:l},S)),E(()=>{let n=t.fieldArrays.findIndex(t=>s(t.path)===s(e));n>=0&&t.fieldArrays.splice(n,1)}),me(c,e=>{ln(e,n.value.map(e=>e.value))||l()}),S}S({name:`FieldArray`,inheritAttrs:!1,props:{name:{type:String,required:!0}},setup(e,t){let{push:n,remove:r,swap:i,insert:a,replace:o,update:s,prepend:c,move:l,fields:u}=vr(()=>e.name);function d(){return{fields:u.value,push:n,remove:r,swap:i,insert:a,update:s,replace:o,prepend:c,move:l}}return t.expose({push:n,remove:r,swap:i,insert:a,update:s,replace:o,prepend:c,move:l}),()=>Dn(void 0,t,d)}}),S({name:`ErrorMessage`,props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(t,n){let r=w(Ut,void 0),i=c(()=>r?.errors.value[t.name]);function a(){return{message:i.value}}return()=>{if(!i.value)return;let r=t.as?e(t.as):t.as,o=Dn(r,n,a),s=Object.assign({role:`alert`},n.attrs);return!r&&(Array.isArray(o)||!o)&&o?.length?o:(Array.isArray(o)||!o)&&!o?.length?h(r||`span`,s,i.value):h(r,s,o)}}});function yr(){let e=vn(Ut);return c(()=>e?.values||{})}var br={class:`mx-2 bg-white px-4 pb-4 pt-3 rounded-lg`},xr={class:`flex items-center gap-2 mb-2`},Sr={class:`font-medium text-sm text-gray-900 pl-1`},Cr=S({__name:`FieldBox`,props:{label:{},icon:{}},setup(e){return(t,n)=>{let i=Je;return m(),r(`div`,br,[a(`div`,xr,[y(i,{name:e.icon,size:`24`},null,8,[`name`]),a(`span`,Sr,v(e.label),1)]),D(t.$slots,`default`)])}}}),wr={slots:{content:`bg-default shadow-lg rounded-md ring ring-default data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-popover-content-transform-origin) focus:outline-none pointer-events-auto`,arrow:`fill-bg stroke-default`}},Tr={__name:`Popover`,props:{mode:{type:null,required:!1,default:`click`},content:{type:Object,required:!1},arrow:{type:[Boolean,Object],required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},reference:{type:null,required:!1},dismissible:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:null,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1},modal:{type:Boolean,required:!1},openDelay:{type:Number,required:!1,default:0},closeDelay:{type:Number,required:!1,default:0}},emits:[`close:prevent`,`update:open`],setup(e,{emit:r}){let i=e,a=r,s=ue(),l=Ge(`popover`,i),u=t(),d=qe(l.mode===`hover`?ve(l,`defaultOpen`,`open`,`openDelay`,`closeDelay`):ve(l,`defaultOpen`,`open`,`modal`),a),f=at(Se(()=>l.portal)),h=Se(()=>o(l.content,{side:`bottom`,sideOffset:8,collisionPadding:8})),g=c(()=>l.dismissible?{pointerDownOutside:lt}:[`interactOutside`,`escapeKeyDown`].reduce((e,t)=>(e[t]=e=>{e.preventDefault(),a(`close:prevent`)},e),{})),_=Se(()=>o(l.arrow,{rounded:!0})),v=c(()=>et({extend:et(wr),...u.ui?.popover||{}})({side:h.value.side})),S=c(()=>l.mode===`hover`?ze:Ae);return(e,t)=>(m(),x(b(S).Root,de(p(b(d))),{default:k(({open:t,close:r})=>[s.default||b(l).reference?(m(),x(b(S).Trigger,{key:0,"as-child":``,reference:b(l).reference,class:n(b(l).class)},{default:k(()=>[D(e.$slots,`default`,{open:t})]),_:2},1032,[`reference`,`class`])):O(``,!0),`Anchor`in S.value&&s.anchor?(m(),x(b(S).Anchor,{key:1,"as-child":``},{default:k(()=>[D(e.$slots,`anchor`,de(p(r?{close:r}:{})))]),_:2},1024)):O(``,!0),y(b(S).Portal,de(p(b(f))),{default:k(()=>[y(b(Xe),null,{default:k(()=>[y(b(S).Content,T(h.value,{"data-slot":`content`,class:v.value.content({class:[!s.default&&b(l).class,b(l).ui?.content]})},oe(g.value)),{default:k(()=>[D(e.$slots,`content`,de(p(r?{close:r}:{}))),b(l).arrow?(m(),x(b(S).Arrow,T({key:0},_.value,{"data-slot":`arrow`,class:v.value.arrow({class:b(l).ui?.arrow})}),null,16,[`class`])):O(``,!0)]),_:2},1040,[`class`])]),_:2},1024)]),_:2},1040)]),_:3},16))}},Er=S({__name:`MediaSelector`,props:{onlyImage:{type:Boolean},folder:{}},emits:[`close`],setup(e,{emit:t}){let n=t;return(t,r)=>{let i=ut;return m(),x(i,{ui:{content:`max-w-screen-lg`}},{content:k(()=>[y(ft,{"only-image":e.onlyImage,"is-modal":``,folder:e.folder,onClose:r[0]||=e=>n(`close`,``),onSelect:r[1]||=e=>n(`close`,e)},null,8,[`only-image`,`folder`])]),_:1})}}}),Dr={class:`aspect-square checkerboard`},Or=[`src`],kr={key:0},Ar=S({__name:`Image`,props:{field:{},name:{},modelValue:{}},setup(e){ht.debug(`image`,e.name,e.field.mediaFolder);let{value:t}=nr(e.name,void 0,{syncVModel:!0}),n=mt(),i=ct(),o=dt(),s=A(``),c=n.create(Er);function l(){return typeof t.value==`object`?t.value.src||``:t.value}function u(e){typeof t.value==`object`?t.value.src=e:t.value=e}let{executeImmediate:d}=f(async e=>{let t=e||l();if(!t)return;let n=i.getMediaFolder(t),r=await o.getMediaAsBlob(n);s.value=URL.createObjectURL(r)},null);async function p(){let t=await c.open({onlyImage:!0,folder:e.field.mediaFolder}).result;t&&(ht.debug(`result`,t),u(t),d(t))}return(n,i)=>{let o=Re,c=Cr;return m(),x(c,{label:e.field.label,icon:`i-lucide-image`},{default:k(()=>[a(`div`,{class:`aspect-square bg-gray-50 border-3 border-dashed border-transparent rounded hover:border-gray-400`,onClick:i[0]||=e=>p()},[a(`div`,Dr,[b(s)?(m(),r(`img`,{key:0,src:b(s),alt:``,class:`object-contain w-full h-full`},null,8,Or)):O(``,!0)])]),typeof b(t)==`object`?(m(),r(`div`,kr,[y(o,{modelValue:b(t).alt,"onUpdate:modelValue":i[1]||=e=>b(t).alt=e,placeholder:`Alt`},null,8,[`modelValue`]),y(o,{modelValue:b(t).title,"onUpdate:modelValue":i[2]||=e=>b(t).title=e,placeholder:`Title`},null,8,[`modelValue`]),y(o,{modelValue:b(t).rename,"onUpdate:modelValue":i[3]||=e=>b(t).rename=e,placeholder:`Rename`},null,8,[`modelValue`])])):O(``,!0)]),_:1},8,[`label`])}}});function jr(e){this.content=e}jr.prototype={constructor:jr,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 jr(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 jr(n)},addToStart:function(e,t){return new jr([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new jr(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 jr(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=jr.from(e),e.size?new jr(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=jr.from(e),e.size?new jr(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=jr.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}},jr.from=function(e){if(e instanceof jr)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new jr(t)};function Mr(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){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Mr(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Nr(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=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Nr(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var M=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 Mr(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Nr(this,e,t,n)}findIndex(e){if(e==0)return Fr(0,e);if(e==this.size)return Fr(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?Fr(t+1,i):Fr(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 new e(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)`:``))}};M.empty=new M([],0);var Pr={index:0,offset:0};function Fr(e,t){return Pr.index=e,Pr.offset=t,Pr}function Ir(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(!Ir(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Ir(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var N=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&&Ir(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}};N.none=[];var Lr=class extends Error{},P=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=zr(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Rr(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(M.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)}};P.empty=new P(M.empty,0,0);function Rr(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(Rr(a.content,t-i-1,n-i-1)))}function zr(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=zr(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function Br(e,t,n){if(n.openStart>e.depth)throw new Lr(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Lr(`Inconsistent open depths`);return Vr(e,t,n,0)}function Vr(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=Vr(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Kr(a,Jr(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Kr(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Yr(n,e);return Kr(a,qr(e,i,o,t,r))}}function Hr(e,t){if(!t.type.compatibleContent(e.type))throw new Lr(`Cannot join `+t.type.name+` onto `+e.type.name)}function Ur(e,t,n){let r=e.node(n);return Hr(r,t.node(n)),r}function Wr(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 Gr(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&&(Wr(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Wr(i.child(e),r);t&&t.depth==n&&t.textOffset&&Wr(t.nodeBefore,r)}function Kr(e,t){return e.type.checkContent(t),e.copy(t)}function qr(e,t,n,r,i){let a=e.depth>i&&Ur(e,t,i+1),o=r.depth>i&&Ur(n,r,i+1),s=[];return Gr(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Hr(a,o),Wr(Kr(a,qr(e,t,n,r,i+1)),s)):(a&&Wr(Kr(a,Jr(e,t,i+1)),s),Gr(t,n,i,s),o&&Wr(Kr(o,Jr(n,r,i+1)),s)),Gr(r,null,i,s),new M(s)}function Jr(e,t,n){let r=[];return Gr(null,e,n,r),e.depth>n&&Wr(Kr(Ur(e,t,n+1),Jr(e,t,n+1)),r),Gr(t,null,n,r),new M(r)}function Yr(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(M.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Xr=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 N.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 ei(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=$r.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 $r.set(t,r=new Zr);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Qr,i}},Zr=class{constructor(){this.elts=[],this.i=0}},Qr=12,$r=new WeakMap,ei=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)}},ti=Object.create(null),ni=class e{constructor(e,t,n,r=N.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||M.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&&Ir(this.attrs,t||e.defaultAttrs||ti)&&N.sameSet(this.marks,n||N.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 P.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new P(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Br(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 Xr.resolveCached(this,e)}resolveNoCache(e){return Xr.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()+`)`),ii(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=M.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=N.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(!N.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=M.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};ni.prototype.text=void 0;var ri=class e extends ni{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):ii(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 ii(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var ai=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new oi(t,n);if(r.next==null)return e.empty;let i=si(r);r.next&&r.err(`Unexpected trailing text`);let a=_i(mi(i));return vi(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 M.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
- `)}};ai.empty=new ai(!0);var oi=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 si(e){let t=[];do t.push(ci(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function ci(e){let t=[];do t.push(li(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function li(e){let t=pi(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=di(e,t);else break;return t}function ui(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function di(e,t){let n=ui(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:ui(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function fi(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 pi(e){if(e.eat(`(`)){let t=si(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=fi(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 mi(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 hi(e,t){return t-e}function gi(e,t){let n=[];return r(t),n.sort(hi);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 _i(e){let t=Object.create(null);return n(gi(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]);gi(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ai(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(hi);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function vi(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 yi(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 bi(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 xi(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Si(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Ti(e,r,t[r]);return n}var Ci=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=Si(e,n.attrs),this.defaultAttrs=yi(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==ai.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:bi(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new ni(this,this.computeAttrs(e),M.from(t),N.setFrom(n))}createChecked(e=null,t,n){return t=M.from(t),this.checkContent(t),new ni(this,this.computeAttrs(e),t,N.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=M.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(M.empty,!0);return i?new ni(this,e,t.append(i),N.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){xi(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:N.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 wi(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 Ti=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?wi(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Ei=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Si(e,r.attrs),this.excluded=null;let i=yi(this.attrs);this.instance=i?new N(this,i):null}create(e=null){return!e&&this.instance?this.instance:new N(this,bi(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){xi(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Di=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=jr.from(e.nodes),t.marks=jr.from(e.marks||{}),this.nodes=Ci.compile(this.spec.nodes,this),this.marks=Ei.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]=ai.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?Oi(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==``?[]:Oi(this,n.split(` `))}this.nodeFromJSON=e=>ni.fromJSON(this,e),this.markFromJSON=e=>N.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 Ci))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 ri(n,n.defaultAttrs,e,N.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 Oi(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 ki(e){return e.tag!=null}function Ai(e){return e.style!=null}var ji=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ki(e))this.tags.push(e);else if(Ai(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 Bi(this,t,!1);return n.addAll(e,N.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Bi(this,t,!0);return n.addAll(e,N.none,t.from,t.to),P.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(Hi(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=Ui(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=Ui(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)))}},Mi={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},Ni={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Pi={ol:!0,ul:!0},Fi=1,Ii=2,Li=4;function Ri(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Fi:0)|(t===`full`?Ii:0)}var zi=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=N.none,this.match=i||(a&Li?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(M.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&Fi)){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=M.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(M.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&&!Mi.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Bi=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=Ri(null,t.preserveWhitespace,0)|(n?Li:0);i=r?new zi(r.type,r.attrs,N.none,!0,t.topMatch||r.type.contentMatch,a):n?new zi(null,null,N.none,!0,null,a):new zi(e.schema.topNodeType,null,N.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&Ii?`full`:this.localPreserveWS||(r.options&Fi)>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
- `);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;Pi.hasOwnProperty(a)&&this.parser.normalizeLists&&Vi(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Ni.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(Mi.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
- `),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=N.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Wi(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=Ri(e,i,a.options);a.options&Li&&a.content.length==0&&(o|=Li);let s=N.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Wi(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new zi(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|=Fi);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 Vi(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Pi.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Hi(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Ui(e){let t={};for(let n in e)t[n]=e[n];return t}function Wi(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 Gi=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=qi(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){let{dom:n,contentDOM:r}=Zi(qi(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&&Zi(qi(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Zi(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=Ki(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Ki(e.marks)}};function Ki(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function qi(e){return e.document||window.document}var Ji=new WeakMap;function Yi(e){let t=Ji.get(e);return t===void 0&&Ji.set(e,t=Xi(e)),t}function Xi(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 Zi(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Yi(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{let{dom:t,contentDOM:i}=Zi(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Qi=65535,$i=2**16;function ea(e,t){return e+t*$i}function ta(e){return e&Qi}function na(e){return(e-(e&Qi))/$i}var ra=1,ia=2,aa=4,oa=8,sa=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&oa)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&aa)>0}},ca=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=ta(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+na(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:ea(o/3,e-s),f=e==s?ia:e==u?ra:aa;return(t<0?e!=s:e!=u)&&(f|=oa),new sa(a,f,d)}r+=l-c}return n?e+r:new sa(e+r,0,null)}touches(e,t){let n=0,r=ta(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])}};ca.empty=new ca([]);var la=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 sa(e,r,null)}},ua=Object.create(null),da=class{getMap(){return ca.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=ua[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ua)throw RangeError(`Duplicate use of step JSON ID `+e);return ua[e]=t,t.prototype.jsonID=e,t}},fa=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 Lr)return e.fail(t.message);throw t}}};function pa(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(pa(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return M.fromArray(r)}var ma=class e extends da{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 P(pa(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 fa.fromReplace(e,this.from,this.to,i)}invert(){return new ha(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))}};da.jsonID(`addMark`,ma);var ha=class e extends da{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 P(pa(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return fa.fromReplace(e,this.from,this.to,n)}invert(){return new ma(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))}};da.jsonID(`removeMark`,ha);var ga=class e extends da{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return fa.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return fa.fromReplace(e,this.pos,this.pos+1,new P(M.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 _a(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))}};da.jsonID(`addNodeMark`,ga);var _a=class e extends da{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return fa.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return fa.fromReplace(e,this.pos,this.pos+1,new P(M.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ga(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))}};da.jsonID(`removeNodeMark`,_a);var va=class e extends da{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ba(e,this.from,this.to)?fa.fail(`Structure replace would overwrite content`):fa.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ca([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?P.empty:new P(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?P.empty:new P(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,P.fromJSON(t,n.slice),!!n.structure)}};va.MAP_BIAS=1,da.jsonID(`replace`,va);var ya=class e extends da{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&&(ba(e,this.from,this.gapFrom)||ba(e,this.gapTo,this.to)))return fa.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return fa.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?fa.fromReplace(e,this.from,this.to,n):fa.fail(`Content does not fit in gap`)}getMap(){return new ca([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,P.fromJSON(t,n.slice),n.insert,!!n.structure)}};da.jsonID(`replaceAround`,ya);function ba(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 xa(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 ha(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new ma(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Sa(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 Ei){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 ha(t.from,t.to,t.style)))}function Ca(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 va(s,l,P.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new ha(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 P(M.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new va(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(M.empty,!0);e.replace(s,s,new P(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function wa(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Ta(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||!wa(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Ea(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=M.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=M.from(r.node(e).copy(u)),d++):c--;let f=M.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=M.from(i.node(e).copy(f)),p++):l++;e.step(new ya(c,l,o,s,new P(u.append(f),d,p),u.size-d,!0))}function Da(e,t,n=null,r=e){let i=ka(e,t),a=i&&Aa(r,t);return a?i.map(Oa).concat({type:t,attrs:n}).concat(a.map(Oa)):null}function Oa(e){return{type:e,attrs:null}}function ka(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 Aa(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 ja(e,t,n){let r=M.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=M.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new ya(i,a,i,a,new P(r,0,0),n.length,!0))}function Ma(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)&&Fa(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&&Pa(e,t,n,a),Ca(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 ya(c,l,c+1,l-1,new P(M.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Na(e,t,n,a),!1}})}function Na(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 Pa(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(`
5
- `))}})}function Fa(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Ia(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new ya(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new P(M.from(o),0,0),1,!0))}function La(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function Ra(e,t,n=1,r){let i=e.doc.resolve(t),a=M.empty,o=M.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=M.from(i.node(e).copy(a));let t=r&&r[s];o=M.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new va(t,t,new P(a.append(o),n,n),!0))}function za(e,t){let n=e.resolve(t),r=n.index();return Va(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Ba(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Va(e,t){return!!(e&&t&&!e.isLeaf&&Ba(e,t))}function Ha(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Va(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Ua(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);Pa(e,r.node(),r.before(),s)}o.inlineContent&&Ca(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new va(l,c.map(t+n,-1),P.empty,!0)),r===!0){let t=e.doc.resolve(l);Na(e,t.node(),t.before(),e.steps.length)}return e}function Wa(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Ga(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Ka(e,t,n=t,r=P.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return qa(i,a,r)?new va(t,n,r):new Ja(i,a,r).fit()}function qa(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var Ja=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=M.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=M.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new P(i,a,o);return e>-1?new ya(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new va(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Za(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(M.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Za(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new P(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Za(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new P(Ya(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new P(Ya(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(Qa(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=Xa(this.placed,t,M.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?P.empty:new P(Ya(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new P(Ya(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!$a(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=$a(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=$a(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Xa(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Xa(this.placed,this.depth,M.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(M.empty,!0);e.childCount&&(this.placed=Xa(this.placed,this.frontier.length,e))}};function Ya(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Ya(e.firstChild.content,t-1,n)))}function Xa(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Xa(e.lastChild.content,t-1,n)))}function Za(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Qa(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Qa(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(M.empty,!0)))),e.copy(r)}function $a(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!eo(n,a.content,o)?s:null}function eo(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function to(e){return e.spec.defining||e.spec.definingForContent}function no(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(qa(i,a,r))return e.step(new va(t,n,r));let o=oo(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=to(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new P(ro(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function ro(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(ro(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(M.empty,!0))}return e}function io(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Wa(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new P(M.from(r),0,0))}function ao(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=oo(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function oo(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var so=class e extends da{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 fa.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 fa.fromReplace(e,this.pos,this.pos+1,new P(M.from(r),0,+!t.isLeaf))}getMap(){return ca.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)}};da.jsonID(`attr`,so);var co=class e extends da{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 fa.ok(n)}getMap(){return ca.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)}};da.jsonID(`docAttr`,co);var lo=class extends Error{};lo=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},lo.prototype=Object.create(Error.prototype),lo.prototype.constructor=lo,lo.prototype.name=`TransformError`;var uo=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new la}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new lo(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=P.empty){let r=Ka(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new P(M.from(n),0,0))}delete(e,t){return this.replace(e,t,P.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return no(this,e,t,n),this}replaceRangeWith(e,t,n){return io(this,e,t,n),this}deleteRange(e,t){return ao(this,e,t),this}lift(e,t){return Ea(this,e,t),this}join(e,t=1){return Ua(this,e,t),this}wrap(e,t){return ja(this,e,t),this}setBlockType(e,t=e,n,r=null){return Ma(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return Ia(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new so(e,t,n)),this}setDocAttribute(e,t){return this.step(new co(e,t)),this}addNodeMark(e,t){return this.step(new ga(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof N)t.isInSet(n.marks)&&this.step(new _a(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new _a(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return Ra(this,e,t,n),this}addMark(e,t,n){return xa(this,e,t,n),this}removeMark(e,t,n){return Sa(this,e,t,n),this}clearIncompatible(e,t,n){return Ca(this,e,t,n),this}},fo=Object.create(null),F=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new po(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=P.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?P.empty:t),o==0&&xo(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),xo(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new I(e):bo(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?bo(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):bo(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 vo(e.node(0))}static atStart(e){return bo(e,e,0,0,1)||new vo(e)}static atEnd(e){return bo(e,e,e.content.size,e.childCount,-1)||new vo(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=fo[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in fo)throw RangeError(`Duplicate use of selection JSON ID `+e);return fo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return I.between(this.$anchor,this.$head).getBookmark()}};F.prototype.visible=!0;var po=class{constructor(e,t){this.$from=e,this.$to=t}},mo=!1;function ho(e){!mo&&!e.parent.inlineContent&&(mo=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var I=class e extends F{constructor(e,t=e){ho(e),ho(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 F.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=P.empty){if(super.replace(e,t),t==P.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 go(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=F.findFrom(n,r,!0)||F.findFrom(n,-r,!0);if(e)n=e.$head;else return F.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(F.findFrom(t,-r,!0)||F.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};F.jsonID(`text`,I);var go=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 I.between(e.resolve(this.anchor),e.resolve(this.head))}},L=class e extends F{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?F.near(a):new e(a)}content(){return new P(M.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 _o(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}};L.prototype.visible=!1,F.jsonID(`node`,L);var _o=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new go(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&L.isSelectable(n)?new L(t):F.near(t)}},vo=class e extends F{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=P.empty){if(t==P.empty){e.delete(0,e.doc.content.size);let t=F.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 yo}};F.jsonID(`all`,vo);var yo={map(){return this},resolve(e){return new vo(e)}};function bo(e,t,n,r,i,a=!1){if(t.inlineContent)return I.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=bo(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&L.isSelectable(r))return L.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function xo(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof va||i instanceof ya))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(F.near(e.doc.resolve(o),n))}var So=1,Co=2,wo=4,To=class extends uo{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|So)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&So)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Co,this}ensureMarks(e){return N.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Co)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||N.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(F.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wo,this}get scrolledIntoView(){return(this.updated&wo)>0}};function Eo(e,t){return!t||!e?e:e.bind(t)}var Do=class{constructor(e,t,n){this.name=e,this.init=Eo(t.init,n),this.apply=Eo(t.apply,n)}},Oo=[new Do(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Do(`selection`,{init(e,t){return e.selection||F.atStart(t.doc)},apply(e){return e.selection}}),new Do(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Do(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],ko=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Oo.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Do(e.key,e.spec.state,e))})}},Ao=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new To(this)}static create(t){let n=new ko(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new ko(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new ko(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=ni.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=F.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function jo(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=jo(i,t,{})),n[r]=i}return n}var R=class{constructor(e){this.spec=e,this.props={},e.props&&jo(e.props,this,this.props),this.key=e.key?e.key.key:No(`plugin`)}getState(e){return e[this.key]}},Mo=Object.create(null);function No(e){return e in Mo?e+`$`+ ++Mo[e]:(Mo[e]=0,e+`$`)}var z=class{constructor(e=`key`){this.key=No(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},Po=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Fo(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var Io=(e,t,n)=>{let r=Fo(e,n);if(!r)return!1;let i=Ho(r);if(!i){let n=r.blockRange(),i=n&&Ta(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(ss(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Bo(a,`end`)||L.isSelectable(a)))for(let n=r.depth;;n--){let o=Ka(e.doc,r.before(n),r.after(n),P.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(Bo(a,`end`)?F.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):L.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Lo=(e,t,n)=>{let r=Fo(e,n);if(!r)return!1;let i=Ho(r);return i?zo(e,i,t):!1},Ro=(e,t,n)=>{let r=Uo(e,n);if(!r)return!1;let i=Ko(r);return i?zo(e,i,t):!1};function zo(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Ka(e.doc,i,o,P.empty);if(!s||s.from!=i||s instanceof va&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(I.create(t.doc,i)),n(t.scrollIntoView())}return!0}function Bo(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Vo=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Ho(r)}let o=a&&a.nodeBefore;return!o||!L.isSelectable(o)?!1:(t&&t(e.tr.setSelection(L.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Ho(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Uo(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var Wo=(e,t,n)=>{let r=Uo(e,n);if(!r)return!1;let i=Ko(r);if(!i)return!1;let a=i.nodeAfter;if(ss(e,i,t,1))return!0;if(r.parent.content.size==0&&(Bo(a,`start`)||L.isSelectable(a))){let n=Ka(e.doc,r.before(),r.after(),P.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Bo(a,`start`)?F.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):L.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Go=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Ko(r)}let o=a&&a.nodeAfter;return!o||!L.isSelectable(o)?!1:(t&&t(e.tr.setSelection(L.create(e.doc,a.pos)).scrollIntoView()),!0)};function Ko(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var qo=(e,t)=>{let n=e.selection,r=n instanceof L,i;if(r){if(n.node.isTextblock||!za(e.doc,n.from))return!1;i=n.from}else if(i=Ha(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(L.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},Jo=(e,t)=>{let n=e.selection,r;if(n instanceof L){if(n.node.isTextblock||!za(e.doc,n.to))return!1;r=n.to}else if(r=Ha(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},Yo=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Ta(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},Xo=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
6
- `).scrollIntoView()),!0)};function Zo(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var Qo=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=Zo(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(F.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},$o=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof vo||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=Zo(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(I.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},es=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(La(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ta(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function ts(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof L&&t.selection.node.isBlock)return!r.parentOffset||!La(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=Zo(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof I||t.selection instanceof vo)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=La(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,La(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var ns=ts(),rs=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(L.create(e.doc,i))),!0)},is=(e,t)=>(t&&t(e.tr.setSelection(new vo(e.doc))),!0);function as(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||za(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function ss(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&as(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=M.empty;for(let e=o.length-1;e>=0;e--)s=M.from(o[e].create(null,s));s=M.from(i.copy(s));let c=e.tr.step(new ya(t.pos-1,r,t.pos,r,new P(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&za(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:F.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ta(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&Bo(a,`start`,!0)&&Bo(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=M.empty;for(let e=o.length-1;e>=0;e--)r=M.from(o[e].copy(r));n(e.tr.step(new ya(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new P(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function cs(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(I.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var ls=cs(-1),us=cs(1);function ds(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&Da(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function fs(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function ps(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var ms=ps(Po,Io,Vo),hs=ps(Po,Wo,Go),gs={Enter:ps(Xo,$o,es,ns),"Mod-Enter":Qo,Backspace:ms,"Mod-Backspace":ms,"Shift-Backspace":ms,Delete:hs,"Mod-Delete":hs,"Mod-a":is},_s={"Ctrl-h":gs.Backspace,"Alt-Backspace":gs[`Mod-Backspace`],"Ctrl-d":gs.Delete,"Ctrl-Alt-Backspace":gs[`Mod-Delete`],"Alt-Delete":gs[`Mod-Delete`],"Alt-d":gs[`Mod-Delete`],"Ctrl-a":ls,"Ctrl-e":us};for(let e in gs)_s[e]=gs[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function vs(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return ys(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function ys(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new ei(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new ei(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=Da(a,n,r,t);return s?(e&&bs(e,t,s,i,n),!0):!1}function bs(e,t,n,r,i){let a=M.empty;for(let e=n.length-1;e>=0;e--)a=M.from(n[e].type.create(n[e].attrs,a));e.step(new ya(t.start-(r?2:0),t.end,t.start,t.end,new P(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&La(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function xs(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?Ss(t,n,e,a):Cs(t,n,a):!0:!1}}function Ss(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new ya(a-1,o,a,o,new P(M.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ei(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=Ta(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return za(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function Cs(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?M.empty:M.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new ya(d-+!!s,f+ +!!c,d+1,f-1,new P((s?M.empty:M.from(i.copy(M.empty))).append(c?M.empty:M.from(i.copy(M.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function ws(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=M.from(r?e.create():null),o=new P(M.from(e.create(null,M.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new ya(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var Ts=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Es=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Ds=null,Os=function(e,t,n){let r=Ds||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},ks=function(){Ds=null},As=function(e,t,n,r){return n&&(Ms(e,t,n,r,-1)||Ms(e,t,n,r,1))},js=/^(img|br|input|textarea|hr)$/i;function Ms(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Ns(e))){let n=e.parentNode;if(!n||n.nodeType!=1||Ls(e)||js.test(e.nodeName)||e.contentEditable==`false`)return!1;t=Ts(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?Ns(e):0}else return!1}}function Ns(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Ps(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Ns(e)}else if(e.parentNode&&!Ls(e))t=Ts(e),e=e.parentNode;else return null}}function Fs(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Ls(e))t=Ts(e)+1,e=e.parentNode;else return null}}function Is(e,t,n){for(let r=t==0,i=t==Ns(e);r||i;){if(e==n)return!0;let t=Ts(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Ns(e)}}function Ls(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Rs=function(e){return e.focusNode&&As(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function zs(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function Bs(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Vs(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Ns(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Ns(r.startContainer),r.startOffset)}}}var Hs=typeof navigator<`u`?navigator:null,Us=typeof document<`u`?document:null,Ws=Hs&&Hs.userAgent||``,Gs=/Edge\/(\d+)/.exec(Ws),Ks=/MSIE \d/.exec(Ws),qs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ws),Js=!!(Ks||qs||Gs),Ys=Ks?document.documentMode:qs?+qs[1]:Gs?+Gs[1]:0,Xs=!Js&&/gecko\/(\d+)/i.test(Ws);Xs&&+(/Firefox\/(\d+)/.exec(Ws)||[0,0])[1];var Zs=!Js&&/Chrome\/(\d+)/.exec(Ws),Qs=!!Zs,$s=Zs?+Zs[1]:0,ec=!Js&&!!Hs&&/Apple Computer/.test(Hs.vendor),tc=ec&&(/Mobile\/\w+/.test(Ws)||!!Hs&&Hs.maxTouchPoints>2),nc=tc||(Hs?/Mac/.test(Hs.platform):!1),rc=Hs?/Win/.test(Hs.platform):!1,ic=/Android \d/.test(Ws),ac=!!Us&&`webkitFontSmoothing`in Us.documentElement.style,oc=ac?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function sc(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function cc(e,t){return typeof e==`number`?e:e[t]}function lc(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function uc(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Es(o);continue}let e=o,n=e==a.body,s=n?sc(a):lc(e),c=0,l=0;if(t.top<s.top+cc(r,`top`)?l=-(s.top-t.top+cc(i,`top`)):t.bottom>s.bottom-cc(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+cc(i,`top`)-s.top:t.bottom-s.bottom+cc(i,`bottom`)),t.left<s.left+cc(r,`left`)?c=-(s.left-t.left+cc(i,`left`)):t.right>s.right-cc(r,`right`)&&(c=t.right-s.right+cc(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:Es(o)}}function dc(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:fc(e.dom)}}function fc(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Es(r));return t}function pc({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;mc(n,r==0?0:r-t)}function mc(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var hc=null;function gc(e){if(e.setActive)return e.setActive();if(hc)return e.focus(hc);let t=fc(e);e.focus(hc==null?{get preventScroll(){return hc={preventScroll:!0},!0}}:void 0),hc||(hc=!1,mc(t,0))}function _c(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=Os(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?vc(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:_c(n,i)}function vc(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Ec(r,1);if(n.top!=n.bottom&&yc(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function yc(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function bc(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function xc(e,t,n){let{node:r,offset:i}=_c(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Sc(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Cc(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(yc(t,i))return Cc(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function wc(e,t){let n=e.dom.ownerDocument,r,i=0,a=Vs(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!yc(t,n)||(o=Cc(e.dom,t,n),!o))return null}if(ec)for(let e=o;r&&e;e=Es(e))e.draggable&&(r=void 0);if(o=bc(o,t),r){if(Xs&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;ac&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=Sc(e,r,i,t))}s??=xc(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Tc(e){return e.top<e.bottom||e.left<e.right}function Ec(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Tc(e))return e}return Array.prototype.find.call(n,Tc)||e.getBoundingClientRect()}var Dc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Oc(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=ac||Xs;if(r.nodeType==3)if(o&&(Dc.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Ec(Os(r,i,i),n);if(Xs&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Ec(Os(r,i-1,i-1),-1);if(t.top==e.top){let n=Ec(Os(r,i,i+1),-1);if(n.top!=e.top)return kc(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,kc(Ec(Os(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Ns(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return Ac(e.getBoundingClientRect(),!1)}if(a==null&&i<Ns(r)){let e=r.childNodes[i];if(e.nodeType==1)return Ac(e.getBoundingClientRect(),!0)}return Ac(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Ns(r))){let e=r.childNodes[i-1],t=e.nodeType==3?Os(e,Ns(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return kc(Ec(t,1),!1)}if(a==null&&i<Ns(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?Os(e,0,+!o):e.nodeType==1?e:null:null;if(t)return kc(Ec(t,-1),!0)}return kc(Ec(r.nodeType==3?Os(r):r,-n),n>=0)}function kc(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Ac(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function jc(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Mc(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return jc(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Oc(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=Os(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Nc=/[\u0590-\u08ac]/;function Pc(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Nc.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:jc(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Fc=null,Ic=null,Lc=!1;function Rc(e,t,n){return Fc==t&&Ic==n?Lc:(Fc=t,Ic=n,Lc=n==`up`||n==`down`?Mc(e,t,n):Pc(e,t,n))}var zc=0,Bc=1,Vc=2,Hc=3,Uc=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=zc,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>Ts(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof Xc){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Wc&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Ts(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Ts(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Ts(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Ts(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((Xs||ec)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
7
- `),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:Ts(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(Xs&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&ec)&&As(o.node,o.offset,l.anchorNode,l.anchorOffset)&&As(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&Xs)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Vc:Bc,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Hc:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Vc:Hc}n=a}this.dirty=Vc}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Vc:Bc;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Wc=class extends Uc{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==zc&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Gc=class extends Uc{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Kc=class e extends Uc{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Gi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Hc||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Hc&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=zc){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=zc}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=pl(a,n,o,r)),t>0&&(a=pl(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},qc=class e extends Uc{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Gi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=il(u,r,n),l?c=new Zc(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new Yc(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>M.empty)}return e}matchesNode(e,t,n){return this.dirty==zc&&e.eq(this.node)&&al(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new sl(this,a&&a.node,e);ul(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?N.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Vc)&&(a&&this.protectLocalComposition(e,a),Qc(this.contentDOM,this.children,e),tc&&dl(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof I)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=fl(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new Gc(this,i,t,r);e.input.compositionNodes.push(a),this.children=pl(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Hc||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=zc}updateOuterDeco(e){if(al(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=nl(this.dom,this.nodeDOM,tl(this.outerDeco,this.node,t),tl(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function Jc(e,t,n,r,i){il(r,t,e);let a=new qc(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var Yc=class e extends qc{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Hc||this.dirty!=zc&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=zc||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=zc,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Hc)}get domAtom(){return!1}isText(e){return this.node.text==e}},Xc=class extends Uc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==zc&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},Zc=class extends qc{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==Hc)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function Qc(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=ol(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Kc){let t=r?r.previousSibling:e.lastChild;Qc(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=ol(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var $c=function(e){e&&(this.nodeName=e)};$c.prototype=Object.create(null);var el=[new $c];function tl(e,t,n){if(e.length==0)return el;let r=n?el[0]:new $c,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new $c(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new $c(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function nl(e,t,n,r){if(n==el&&r==el)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=el[0],i=t)}rl(i,o||el[0],a)}return i}function rl(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function il(e,t,n){return nl(e,e,el,tl(t,n,e.nodeType!=1))}function al(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function ol(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var sl=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=cl(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=zc,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Kc.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Hc&&a.dom==a.contentDOM&&(a.dirty=Vc),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof qc){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Hc&&al(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Vc,u.updateChildren(r,a+1),u.dirty=zc),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!al(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=qc.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=qc.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Wc(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Kc;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Yc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ec||Qs)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new Xc(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function cl(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Kc)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function ll(e,t){return e.type.side-t.type.side}function ul(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(ll);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function dl(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function fl(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function pl(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function ml(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Rs(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&L.isSelectable(e)&&i.parent&&!(e.isInline&&Is(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new L(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=Tl(e,u,s,n)}return l}function hl(e){return e.editable?e.hasFocus():Dl(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function gl(e,t=!1){let n=e.state.selection;if(Cl(e,n),hl(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Qs){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&As(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)Sl(e);else{let{anchor:r,head:i}=n,a,o;_l&&!(n instanceof I)&&(n.$from.parent.inlineContent||(a=vl(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=vl(e,n.to))),e.docView.setSelection(r,i,e,t),_l&&(a&&bl(a),o&&bl(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&xl(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var _l=ec||Qs&&$s<63;function vl(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(ec&&i&&i.contentEditable==`false`)return yl(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return yl(i);if(a)return yl(a)}}function yl(e){return e.contentEditable=`true`,ec&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function bl(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function xl(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!hl(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Sl(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,Ts(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Js&&Ys<=11&&(n.disabled=!0,n.disabled=!1)}function Cl(e,t){if(t instanceof L){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(wl(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else wl(e)}function wl(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function Tl(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||I.between(t,n,r)}function El(e){return e.editable&&!e.hasFocus()?!1:Dl(e)}function Dl(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Ol(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return As(t.node,t.offset,n.anchorNode,n.anchorOffset)}function kl(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&F.findFrom(a,t)}function Al(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function jl(e,t,n){let r=e.state.selection;if(r instanceof I){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return Al(e,new I(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=kl(e.state,t);return n&&n instanceof L?Al(e,n):!1}else if(!(nc&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?L.isSelectable(i)?Al(e,new L(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):ac?Al(e,new I(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof L&&r.node.isInline)return Al(e,new I(t>0?r.$to:r.$from));else{let n=kl(e.state,t);return n?Al(e,n):!1}}function Ml(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Nl(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function Pl(e,t){return t<0?Fl(e):Il(e)}function Fl(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(Xs&&n.nodeType==1&&r<Ml(n)&&Nl(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(Nl(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(Ll(n))break;else{let t=n.previousSibling;for(;t&&Nl(t,-1);)i=n.parentNode,a=Ts(t),t=t.previousSibling;if(t)n=t,r=Ml(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?Bl(e,n,r):i&&Bl(e,i,a)}function Il(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=Ml(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(Nl(e,1))a=n,o=++r;else break}else if(Ll(n))break;else{let t=n.nextSibling;for(;t&&Nl(t,1);)a=t.parentNode,o=Ts(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=Ml(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&Bl(e,a,o)}function Ll(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Rl(e,t){for(;e&&t==e.childNodes.length&&!Ls(e);)t=Ts(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function zl(e,t){for(;e&&!t&&!Ls(e);)t=Ts(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function Bl(e,t,n){if(t.nodeType!=3){let e,r;(r=Rl(t,n))?(t=r,n=0):(e=zl(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Rs(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&gl(e)},50)}function Vl(e,t){let n=e.state.doc.resolve(t);if(!(Qs||rc)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function Hl(e,t,n){let r=e.state.selection;if(r instanceof I&&!r.empty||n.indexOf(`s`)>-1||nc&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=kl(e.state,t);if(n&&n instanceof L)return Al(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof vo?F.near(n,t):F.findFrom(n,t);return o?Al(e,o):!1}return!1}function Ul(e,t){if(!(e.state.selection instanceof I))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function Wl(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Gl(e){if(!ec||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;Wl(e,n,`true`),setTimeout(()=>Wl(e,n,`false`),20)}return!1}function Kl(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function ql(e,t){let n=t.keyCode,r=Kl(t);if(n==8||nc&&n==72&&r==`c`)return Ul(e,-1)||Pl(e,-1);if(n==46&&!t.shiftKey||nc&&n==68&&r==`c`)return Ul(e,1)||Pl(e,1);if(n==13||n==27)return!0;if(n==37||nc&&n==66&&r==`c`){let t=n==37?Vl(e,e.state.selection.from)==`ltr`?-1:1:-1;return jl(e,t,r)||Pl(e,t)}else if(n==39||nc&&n==70&&r==`c`){let t=n==39?Vl(e,e.state.selection.from)==`ltr`?1:-1:1;return jl(e,t,r)||Pl(e,t)}else if(n==38||nc&&n==80&&r==`c`)return Hl(e,-1,r)||Pl(e,-1);else if(n==40||nc&&n==78&&r==`c`)return Gl(e)||Hl(e,1,r)||Pl(e,1);else if(r==(nc?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function Jl(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Gi.fromSchema(e.state.schema),s=au(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=ru[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
8
-
9
- `),slice:t}}function Yl(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new P(M.from(e.state.schema.text(t.replace(/\r\n?/g,`
10
- `))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Gi.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=cu(n),ac&&lu(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||ji.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!Xl.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=uu(nu(s,+u[1],+u[2]),u[4]);else if(s=P.maxOpen(Zl(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=nu(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var Xl=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Zl(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&$l(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=eu(a[a.length-1],i.length));let n=Ql(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return M.from(a)}return e}function Ql(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,M.from(e));return e}function $l(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=$l(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(M.from(Ql(n,e,i+1))))}}function eu(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,eu(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(M.empty,!0);return e.copy(n.append(r))}function tu(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=tu(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(M.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function nu(e,t,n){return t<e.openStart&&(e=new P(tu(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new P(tu(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var ru={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},iu=null;function au(){return iu||=document.implementation.createHTMLDocument(`title`)}var ou=null;function su(e){let t=window.trustedTypes;return t?(ou||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),ou.createHTML(e)):e}function cu(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=au().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&ru[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=su(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function lu(e){let t=e.querySelectorAll(Qs?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function uu(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=M.from(t.create(r[e+1],i)),a++,o++}return new P(i,a,o)}var du={},fu={},pu={touchstart:!0,touchmove:!0},mu=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function hu(e){for(let t in du){let n=du[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{bu(e,t)&&!yu(e,t)&&(e.editable||!(t.type in fu))&&n(e,t)},pu[t]?{passive:!0}:void 0)}ec&&e.dom.addEventListener(`input`,()=>null),vu(e)}function gu(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function _u(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function vu(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>yu(e,t))})}function yu(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function bu(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function xu(e,t){!yu(e,t)&&du[t.type]&&(e.editable||!(t.type in fu))&&du[t.type](e,t)}fu.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Fu(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ic&&Qs&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),tc&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,zs(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||ql(e,n)?n.preventDefault():gu(e,`key`)},fu.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},fu.keypress=(e,t)=>{let n=t;if(Fu(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||nc&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof I)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function Su(e){return{left:e.clientX,top:e.clientY}}function Cu(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function wu(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function Tu(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function Eu(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&L.isSelectable(r)?(Tu(e,new L(n),`pointer`),!0):!1}function Du(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof L&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(L.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(Tu(e,L.create(e.state.doc,i),`pointer`),!0)}function Ou(e,t,n,r,i){return wu(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Du(e,n):Eu(e,n))}function ku(e,t,n,r){return wu(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function Au(e,t,n,r){return wu(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||ju(e,n,r)}function ju(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(Tu(e,I.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)Tu(e,I.create(r,a+1,a+1+n.content.size),`pointer`);else if(L.isSelectable(n))Tu(e,L.create(r,a),`pointer`);else continue;return!0}}function Mu(e){return Hu(e)}var Nu=nc?`metaKey`:`ctrlKey`;du.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Mu(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Cu(n,e.input.lastClick)&&!n[Nu]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=e.posAtCoords(Su(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Pu(e,o,n,!!r)):(a==`doubleClick`?ku:Au)(e,o.pos,o.inside,n)?n.preventDefault():gu(e,`pointer`))};var Pu=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Nu],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof L&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Xs&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this)),gu(e,`pointer`)}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>gl(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Su(e))),this.updateAllowDefault(e),this.allowDefault||!t?gu(this.view,`pointer`):Ou(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ec&&this.mightDrag&&!this.mightDrag.node.isAtom||Qs&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Tu(this.view,F.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):gu(this.view,`pointer`)}move(e){this.updateAllowDefault(e),gu(this.view,`pointer`),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};du.touchstart=e=>{e.input.lastTouch=Date.now(),Mu(e),gu(e,`pointer`)},du.touchmove=e=>{e.input.lastTouch=Date.now(),gu(e,`pointer`)},du.contextmenu=e=>Mu(e);function Fu(e,t){return e.composing?!0:ec&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Iu=ic?5e3:-1;fu.compositionstart=fu.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof I&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||Qs&&rc&&Lu(e)))e.markCursor=e.state.storedMarks||n.marks(),Hu(e,!0),e.markCursor=null;else if(Hu(e,!t.selection.empty),Xs&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}Ru(e,Iu)};function Lu(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}fu.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Ru(e,20))};function Ru(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Hu(e),t))}function zu(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Vu());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Bu(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Ps(t.focusNode,t.focusOffset),r=Fs(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function Vu(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function Hu(e,t=!1){if(!(ic&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),zu(e),t||e.docView&&e.docView.dirty){let n=ml(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Uu(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var Wu=Js&&Ys<15||tc&&oc<604;du.copy=fu.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Wu?null:n.clipboardData,{dom:o,text:s}=Jl(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):Uu(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function Gu(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Ku(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?qu(e,r.value,null,i,t):qu(e,r.textContent,r.innerHTML,i,t)},50)}function qu(e,t,n,r,i){let a=Yl(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||P.empty)))return!0;if(!a)return!1;let o=Gu(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Ju(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}fu.paste=(e,t)=>{let n=t;if(e.composing&&!ic)return;let r=Wu?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&qu(e,Ju(r),r.getData(`text/html`),i,n)?n.preventDefault():Ku(e,n)};var Yu=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},Xu=nc?`altKey`:`ctrlKey`;function Zu(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[Xu]:!n}du.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(Su(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof L?i.to-1:i.to))){if(r&&r.mightDrag)o=L.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=L.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=Jl(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!Qs||$s>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Wu?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Wu||n.dataTransfer.setData(`text/plain`,c),e.dragging=new Yu(l,Zu(e,n),o)},du.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},fu.dragover=fu.dragenter=(e,t)=>t.preventDefault(),fu.drop=(e,t)=>{try{Qu(e,t,e.dragging)}finally{e.dragging=null}};function Qu(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Su(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=Yl(e,Ju(t.dataTransfer),Wu?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&Zu(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||P.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Ga(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&L.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new L(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(Tl(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}du.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&gl(e)},20))},du.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},du.beforeinput=(e,t)=>{if(Qs&&ic&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,zs(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in fu)du[e]=fu[e];function $u(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var ed=class e{constructor(e,t){this.toDOM=e,this.spec=t||ad,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new rd(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&$u(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},td=class e{constructor(e,t){this.attrs=e,this.spec=t||ad}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new rd(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&$u(this.attrs,t.attrs)&&$u(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},nd=class e{constructor(e,t){this.attrs=e,this.spec=t||ad}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new rd(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&$u(this.attrs,t.attrs)&&$u(this.spec,t.spec)}destroy(){}},rd=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new ed(n,r))}static inline(t,n,r,i){return new e(t,n,new td(r,i))}static node(t,n,r,i){return new e(t,n,new nd(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof td}get widget(){return this.type instanceof ed}},id=[],ad={},od=class e{constructor(e,t){this.local=e.length?e:id,this.children=t.length?t:id}static create(e,t){return t.length?md(t,e,0,ad):sd}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==sd||e.maps.length==0?this:this.mapInner(e,t,0,0,n||ad)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?ld(this.children,o||[],t,n,r,i,a):o?new e(o.sort(hd),id):sd}add(t,n){return n.length?this==sd?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=fd(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,md(s,e,o+1,ad)),a+=3}});let o=ud(a?pd(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(hd):this.local,i||this.children)}remove(e){return e.length==0||this==sd?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==sd?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):sd}forChild(t,n){if(this==sd)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof td){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(hd),id);return r?new cd([t,r]):t}return r||sd}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return gd(this.localsInner(e))}localsInner(e){if(this==sd)return id;if(e.inlineContent||!this.local.some(td.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof td||t.push(this.local[e]);return t}forEachSet(e){e(this)}};od.empty=new od([],[]),od.removeOverlap=gd;var sd=od.empty,cd=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,ad));return e.from(r)}forChild(t,n){if(n.isLeaf)return od.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=sd&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?gd(n?t:t.sort(hd)):id}static from(t){switch(t.length){case 0:return sd;case 1:return t[0];default:return new e(t.every(e=>e instanceof od)?t:t.reduce((e,t)=>e.concat(t instanceof od?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function ld(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==sd?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=md(dd(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new od(t.sort(hd),s)}function ud(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new rd(i.from+t,i.to+t,i.type))}return n}function dd(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function fd(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function pd(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function md(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=fd(e,t,o+n);if(s){a=!0;let e=md(s,t,n+o+1,r);e!=sd&&i.push(o,o+t.nodeSize,e)}});let o=ud(a?pd(e):e,-n).sort(hd);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new od(o,i):sd}function hd(e,t){return e.from-t.from||e.to-t.to}function gd(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),_d(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),_d(t,i,r.copy(a.from,r.to)));break}}}return t}function _d(e,t,n){for(;t<e.length&&hd(n,e[t])>0;)t++;e.splice(t,0,n)}function vd(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=sd&&t.push(r)}),e.cursorWrapper&&t.push(od.create(e.state.doc,[e.cursorWrapper.deco])),cd.from(t)}var yd={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bd=Js&&Ys<=11,xd=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},Sd=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new xd,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Js&&Ys<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():ec&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bd&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,yd)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(El(this.view)){if(this.suppressingSelectionUpdates)return gl(this.view);if(Js&&Ys<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&As(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Es(n))t.add(n);for(let r=e.anchorNode;r;r=Es(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&El(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(Xs&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||Od(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Rs(n)&&(c=ml(e))&&c.eq(F.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,gl(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Td(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,kd(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||gl(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Js&&Ys<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?Ts(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?Ts(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},Cd=new WeakMap,wd=!1;function Td(e){if(!Cd.has(e)&&(Cd.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Xs,wd)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),wd=!0}}function Ed(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return As(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Dd(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ed(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?Ed(e,n):null}function Od(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function kd(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function Ad(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],Rs(c)||l.push({node:c.focusNode,offset:c.focusOffset})),Qs&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||ji.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:jd,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function jd(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(ec&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||ec&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var Md=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Nd(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=ml(e,t);if(n&&!e.state.selection.eq(n)){if(Qs&&ic&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,zs(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=Ad(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=Rd(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(tc&&e.input.lastIOSEnter>Date.now()-225||ic)&&i.some(e=>e.nodeType==1&&!Md.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,zs(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof I&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Pd(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof I&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Js&&Ys<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((tc&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,zs(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&Id(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,zs(8,`Backspace`)))){ic&&Qs&&e.domObserver.suppressSelectionUpdates();return}Qs&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),ic&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,zs(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Pd(e,n.doc,l.sel);t&&!(Qs&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||Js&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){Js&&Ys<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>gl(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=Fd(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function Pd(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Tl(e,t.resolve(n.anchor),t.resolve(n.head))}function Fd(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(M.from(l).eq(e))return{mark:s,type:o}}function Id(e,t,n,r,i){if(n-t<=i.pos-r.pos||Ld(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(Ld(a,!0,!0));return!o.parent.isTextblock||o.pos>n||Ld(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Ld(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Rd(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&zd(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&zd(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function zd(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var Bd=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new mu,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(qd),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ud(this),Hd(this),this.nodeViews=Gd(this),this.docView=Jc(this.state.doc,Vd(this),vd(this),this.dom,this),this.domObserver=new Sd(this,(e,t,n,r)=>Nd(this,e,t,n,r)),this.domObserver.start(),hu(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&vu(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(qd),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(zu(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Gd(this);Kd(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&vu(this),this.editable=Ud(this),Hd(this);let o=vd(this),s=Vd(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&dc(this);if(i){this.domObserver.stop();let t=l&&(Js||Qs)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&Wd(n.selection,e.selection);if(l){let n=Qs?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Bu(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=Jc(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ol(this))?gl(this,t):(Cl(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&pc(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof L){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&uc(this,t.getBoundingClientRect(),e)}else uc(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Yu(e.slice,e.move,r<0?void 0:L.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(Js){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&gc(this.dom),gl(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return wc(this,e)}coordsAtPos(e,t=1){return Oc(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Rc(this,t||this.state,e)}pasteHTML(e,t){return qu(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return qu(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return Jl(this,e)}destroy(){this.docView&&(_u(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],vd(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ks())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xu(this,e)}domSelectionRange(){let e=this.domSelection();return e?ec&&this.root.nodeType===11&&Bs(this.dom.ownerDocument)==this.dom&&Dd(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Bd.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Vd(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[rd.node(0,e.state.doc.content.size,t)]}function Hd(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:rd.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Ud(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function Wd(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function Gd(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function Kd(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function qd(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var Jd={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},Yd={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},Xd=typeof navigator<`u`&&/Mac/.test(navigator.platform),Zd=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Qd=0;Qd<10;Qd++)Jd[48+Qd]=Jd[96+Qd]=String(Qd);for(var Qd=1;Qd<=24;Qd++)Jd[Qd+111]=`F`+Qd;for(var Qd=65;Qd<=90;Qd++)Jd[Qd]=String.fromCharCode(Qd+32),Yd[Qd]=String.fromCharCode(Qd);for(var $d in Jd)Yd.hasOwnProperty($d)||(Yd[$d]=Jd[$d]);function ef(e){var t=!(Xd&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Zd&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Yd:Jd)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var tf=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),nf=typeof navigator<`u`&&/Win/.test(navigator.platform);function rf(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))tf?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function af(e){let t=Object.create(null);for(let n in e)t[rf(n)]=e[n];return t}function of(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function sf(e){return new R({props:{handleKeyDown:cf(e)}})}function cf(e){let t=af(e);return function(e,n){let r=ef(n),i,a=t[of(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[of(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(nf&&n.ctrlKey&&n.altKey)&&(i=Jd[n.keyCode])&&i!=r){let r=t[of(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var lf=Object.defineProperty,uf=(e,t)=>{for(var n in t)lf(e,n,{get:t[n],enumerable:!0})};function df(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var ff=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:df({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},pf={};uf(pf,{blur:()=>mf,clearContent:()=>hf,clearNodes:()=>gf,command:()=>_f,createParagraphNear:()=>vf,cut:()=>yf,deleteCurrentNode:()=>bf,deleteNode:()=>Sf,deleteRange:()=>Cf,deleteSelection:()=>Df,enter:()=>Of,exitCode:()=>kf,extendMarkRange:()=>If,first:()=>Lf,focus:()=>Wf,forEach:()=>Gf,insertContent:()=>Kf,insertContentAt:()=>Qf,joinBackward:()=>tp,joinDown:()=>ep,joinForward:()=>np,joinItemBackward:()=>rp,joinItemForward:()=>ip,joinTextblockBackward:()=>ap,joinTextblockForward:()=>op,joinUp:()=>$f,keyboardShortcut:()=>lp,lift:()=>dp,liftEmptyBlock:()=>fp,liftListItem:()=>pp,newlineInCode:()=>mp,resetAttributes:()=>_p,scrollIntoView:()=>vp,selectAll:()=>yp,selectNodeBackward:()=>bp,selectNodeForward:()=>xp,selectParentNode:()=>Sp,selectTextblockEnd:()=>Cp,selectTextblockStart:()=>wp,setContent:()=>Ep,setMark:()=>Tm,setMeta:()=>Em,setNode:()=>Dm,setNodeSelection:()=>Om,setTextDirection:()=>km,setTextSelection:()=>Am,sinkListItem:()=>jm,splitBlock:()=>Nm,splitListItem:()=>Pm,toggleList:()=>Rm,toggleMark:()=>zm,toggleNode:()=>Bm,toggleWrap:()=>Vm,undoInputRule:()=>Hm,unsetAllMarks:()=>Um,unsetMark:()=>Wm,unsetTextDirection:()=>Gm,updateAttributes:()=>Km,wrapIn:()=>qm,wrapInList:()=>Jm});var mf=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),hf=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),gf=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=Ta(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},_f=e=>t=>e(t),vf=()=>({state:e,dispatch:t})=>$o(e,t),yf=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new I(r.doc.resolve(Math.max(o-1,0)))),!0},bf=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function xf(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Sf=e=>({tr:t,state:n,dispatch:r})=>{let i=xf(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Cf=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},wf=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Tf=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return wf(r)?n===`left`?e.start()-1:e.end()+1:e.pos},Ef=(e,t,n)=>({from:Tf(e,n,`left`),to:Tf(t,n,`right`)}),Df=()=>({state:e,dispatch:t})=>{let{$from:n,$to:r}=e.selection;if(e.selection.empty)return!1;let{from:i,to:a}=Ef(n,r,e.schema);return t&&(e.tr.deleteRange(i,a).scrollIntoView(),t(e.tr)),!0},Of=()=>({commands:e})=>e.keyboardShortcut(`Enter`),kf=()=>({state:e,dispatch:t})=>Qo(e,t);function Af(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function jf(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:Af(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function Mf(e,t,n={}){return e.find(e=>e.type===t&&jf(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Nf(e,t,n={}){return!!Mf(e,t,n)}function Pf(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!Mf([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&Nf([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&Nf([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function Ff(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var If=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=Ff(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=Pf(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=I.create(o,e.from,e.to);n.setSelection(t)}}return!0},Lf=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function Rf(e){return e instanceof I}function zf(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Bf(e,t=null){if(!t)return null;let n=F.atStart(e),r=F.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?I.create(e,zf(0,i,a),zf(e.content.size,i,a)):I.create(e,zf(t,i,a),zf(t,i,a))}function Vf(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function Hf(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function Uf(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Wf=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(Hf()||Vf())&&r.dom.focus(),Uf()&&!Hf()&&!Vf()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!Rf(n.state.selection))return o(),!0;let s=Bf(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Gf=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Kf=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),qf=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&qf(r)}return e};function Jf(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return qf(n)}function Yf(e,t,n){if(e instanceof ni||e instanceof M)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return M.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),Yf(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Di({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?ji.fromSchema(a).parseSlice(Jf(e),n.parseOptions):ji.fromSchema(a).parse(Jf(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=ji.fromSchema(t);return n.slice?r.parseSlice(Jf(e),n.parseOptions).content:r.parse(Jf(e),n.parseOptions)}return Yf(``,t,n)}function Xf(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof va||i instanceof ya))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(F.near(e.doc.resolve(o),n))}var Zf=e=>!(`type`in e),Qf=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Yf(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=Yf(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((Zf(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof M){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&Xf(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},$f=()=>({state:e,dispatch:t})=>qo(e,t),ep=()=>({state:e,dispatch:t})=>Jo(e,t),tp=()=>({state:e,dispatch:t})=>Io(e,t),np=()=>({state:e,dispatch:t})=>Wo(e,t),rp=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Ha(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},ip=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Ha(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},ap=()=>({state:e,dispatch:t})=>Lo(e,t),op=()=>({state:e,dispatch:t})=>Ro(e,t);function sp(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function cp(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))Hf()||sp()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var lp=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=cp(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function up(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?xf(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>jf(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var dp=(e,t={})=>({state:n,dispatch:r})=>up(n,xf(e,n.schema),t)?Yo(n,r):!1,fp=()=>({state:e,dispatch:t})=>es(e,t),pp=e=>({state:t,dispatch:n})=>xs(xf(e,t.schema))(t,n),mp=()=>({state:e,dispatch:t})=>Xo(e,t);function hp(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function gp(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var _p=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=hp(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=xf(e,r.schema)),s===`mark`&&(o=Ff(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,gp(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(gp(a.attrs,t))))})})}),c},vp=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),yp=()=>({tr:e,dispatch:t})=>{if(t){let t=new vo(e.doc);e.setSelection(t)}return!0},bp=()=>({state:e,dispatch:t})=>Vo(e,t),xp=()=>({state:e,dispatch:t})=>Go(e,t),Sp=()=>({state:e,dispatch:t})=>rs(e,t),Cp=()=>({state:e,dispatch:t})=>us(e,t),wp=()=>({state:e,dispatch:t})=>ls(e,t);function Tp(e,t,n={},r={}){return Yf(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Ep=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=Tp(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function Dp(e,t){let n=Ff(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function Op(e,t){let n=new uo(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function kp(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Ap(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function jp(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Mp(e){return t=>jp(t.$from,e)}function B(e,t,n){return e.config[t]===void 0&&e.parent?B(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?B(e.parent,t,n):null}):e.config[t]}function Np(e){return e.map(e=>{let t=B(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...Np(t())]:e}).flat(10)}function Pp(e,t){let n=Gi.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function Fp(e){return typeof e==`function`}function V(e,t=void 0,...n){return Fp(e)?t?e.bind(t)(...n):e(...n):e}function Ip(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Lp(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function Rp(e){let t=[],{nodeExtensions:n,markExtensions:r}=Lp(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=B(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=B(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function zp(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function Bp(e){let t=[],n=zp(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function H(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...Bp(n[e]),...Bp(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function Vp(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>H(e,t),{})}function Hp(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function Up(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):Hp(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function Wp(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&Ip(t)?!1:t!=null))}function Gp(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function Kp(e,t){let n=Rp(e),{nodeExtensions:r,markExtensions:i}=Lp(e);return new Di({topNode:r.find(e=>B(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Wp({...e.reduce((e,t)=>{let n=B(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:V(B(r,`content`,a)),marks:V(B(r,`marks`,a)),group:V(B(r,`group`,a)),inline:V(B(r,`inline`,a)),atom:V(B(r,`atom`,a)),selectable:V(B(r,`selectable`,a)),draggable:V(B(r,`draggable`,a)),code:V(B(r,`code`,a)),whitespace:V(B(r,`whitespace`,a)),linebreakReplacement:V(B(r,`linebreakReplacement`,a)),defining:V(B(r,`defining`,a)),isolating:V(B(r,`isolating`,a)),attrs:Object.fromEntries(i.map(Gp))}),s=V(B(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Up(e,i)));let c=B(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:Vp(e,i)}));let l=B(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Wp({...e.reduce((e,t)=>{let n=B(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:V(B(r,`inclusive`,a)),excludes:V(B(r,`excludes`,a)),group:V(B(r,`group`,a)),spanning:V(B(r,`spanning`,a)),code:V(B(r,`code`,a)),attrs:Object.fromEntries(i.map(Gp))}),s=V(B(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Up(e,i)));let c=B(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:Vp(e,i)})),[r.name,o]}))})}function qp(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function Jp(e){return e.sort((e,t)=>{let n=B(e,`priority`)||100,r=B(t,`priority`)||100;return n>r?-1:+(n<r)})}function Yp(e){let t=Jp(Np(e)),n=qp(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function Xp(e,t){return Kp(Yp(e),t)}function Zp(e,t){let n=Xp(t),r=Jf(e);return ji.fromSchema(n).parse(r).toJSON()}function Qp(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
11
-
12
- `,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function $p(e,t){return Qp(e,{from:0,to:e.content.size},t)}function em(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function tm(e,t){let n=xf(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function nm(e,t){let n=hp(typeof t==`string`?t:t.name,e.schema);return n===`node`?tm(e,t):n===`mark`?Dp(e,t):{}}function rm(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function im(e){let t=rm(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function am(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),im(r)}function om(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=Pf(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var sm=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function cm(e,t){return t.nodes[e]||t.marks[e]||null}function lm(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var um=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function dm(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?Ff(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>jf(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>jf(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function fm(e,t,n={}){if(!t)return up(e,null,n)||dm(e,null,n);let r=hp(t,e.schema);return r===`node`?up(e,t,n):r===`mark`?dm(e,t,n):!1}var pm=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=Mp(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},mm=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function hm(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function gm(e,t){let{nodeExtensions:n}=Lp(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=V(B(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function _m(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(_m(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function vm(e){return e instanceof L}function ym({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:a}=e;return!!(i<=t&&a>=t+n||r&&Rf(e)&&i>t&&a<t+n)}var bm=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function xm(e,t){let n=t.mapping.mapResult(e.position);return{position:new bm(n.pos),mapResult:n}}function Sm(e){return new bm(e)}function Cm(e,t,n){let r=e.state.doc.content.size,i=zf(t,0,r),a=zf(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return{...f,toJSON:()=>f}}function wm(e,t,n){let{selection:r}=t,i=null;if(Rf(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var Tm=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=Ff(e,r.schema);if(i)if(o){let e=Dp(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return wm(r,n,c)},Em=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Dm=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=xf(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>fs(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>fs(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},Om=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=zf(e,0,n.content.size),i=L.create(n,r);t.setSelection(i)}return!0},km=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},Am=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=I.atStart(n).from,o=I.atEnd(n).to,s=zf(r,a,o),c=zf(i,a,o),l=I.create(n,s,c);t.setSelection(l)}return!0},jm=e=>({state:t,dispatch:n})=>ws(xf(e,t.schema))(t,n);function Mm(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var Nm=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=lm(l,s.node().type.name,s.node().attrs);if(a instanceof L&&a.node.isBlock)return!s.parentOffset||!La(o,s.pos)?!1:(r&&(e&&Mm(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:kp(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=La(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&La(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof I&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&Mm(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},Pm=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=xf(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=M.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=M.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...lm(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(M.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new P(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(I.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...lm(d,u.type.name,u.attrs),...t},m={...lm(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!La(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},Fm=(e,t)=>{let n=Mp(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&za(e.doc,n.pos)&&e.join(n.pos),!0},Im=(e,t)=>{let n=Mp(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&za(e.doc,r)&&e.join(r),!0};function Lm(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return I.between(r,i)}var Rm=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=xf(e,o.schema),m=xf(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=Mp(e=>gm(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,ee=S&&w&&gm(w.type.name,d)?{node:w,pos:0,depth:0}:null,te=x??ee,T=!!x&&y.depth>=1&&y.depth-x.depth<=1,E=!!ee;if((T||E)&&te){if(te.node.type===p)return S&&E?c().command(({tr:e,dispatch:t})=>{let n=Lm(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(gm(te.node.type.name,d)&&p.validContent(te.node.content))return c().command(()=>(a.setNodeMarkup(te.pos,p),!0)).command(()=>Fm(a,p)).command(()=>Im(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>Fm(a,p)).command(()=>Im(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>Fm(a,p)).command(()=>Im(a,p)).run()},zm=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=Ff(e,r.schema);return dm(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},Bm=(e,t,n={})=>({state:r,commands:i})=>{let a=xf(e,r.schema),o=xf(t,r.schema),s=up(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},Vm=(e,t={})=>({state:n,commands:r})=>{let i=xf(e,n.schema);return up(n,i,t)?r.lift(i):r.wrapIn(i,t)},Hm=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},Um=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},Wm=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=Ff(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=Pf(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},Gm=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},Km=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=hp(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=xf(e,r.schema)),s===`mark`&&(o=Ff(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},qm=(e,t={})=>({state:n,dispatch:r})=>ds(xf(e,n.schema),t)(n,r),Jm=(e,t={})=>({state:n,dispatch:r})=>vs(xf(e,n.schema),t)(n,r),Ym=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},Xm=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},Zm=(e,t)=>{if(Af(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function Qm(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=um(c)+i;return a.forEach(e=>{if(l)return;let a=Zm(u,e.find);if(!a)return;let c=s.state.tr,d=df({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new ff({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function $m(e){let{editor:t,rules:n}=e,r=new R({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:Pp(M.from(e),a.schema);let{from:i}=s;Qm({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return Qm({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&Qm({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?Qm({editor:t,from:a.pos,to:a.pos,text:`
13
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function eh(e){return Object.prototype.toString.call(e).slice(8,-1)}function th(e){return eh(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function nh(e,t){let n={...e};return th(e)&&th(t)&&Object.keys(t).forEach(r=>{th(t[r])&&th(e[r])?n[r]=nh(e[r],t[r]):n[r]=t[r]}),n}var rh=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...V(B(this,`addOptions`,{name:this.name}))}}get storage(){return{...V(B(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>nh(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},ih=class e extends rh{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function ah(e){return typeof e==`number`}var oh=class{constructor(e){this.find=e.find,this.handler=e.handler}},sh=(e,t,n)=>{if(Af(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function ch(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new ff({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||sh(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var lh=null,uh=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function dh(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!ch({editor:t,state:df({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new R({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(lh=t)},i=()=>{lh&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=lh;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:Pp(M.from(t),r.schema);let{from:n}=d,i=n+t.length,a=uh(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!ah(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var fh=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Yp(e),this.schema=Kp(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=B(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:cm(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return Jp([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:cm(t.name,this.schema)},r=[],i=B(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&B(t,`exitable`,n)&&(a.ArrowRight=()=>ih.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=sf(a);r.push(o);let s=B(t,`addInputRules`,n);if(hm(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=$m({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=B(t,`addPasteRules`,n);if(hm(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=dh({editor:e,rules:t});r.push(...n)}}let l=B(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return Rp(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=Lp(this.extensions);return Object.fromEntries(t.filter(e=>!!B(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=B(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:xf(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:Vp(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return Jp([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:cm(n.name,this.schema)},i=B(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return Jp([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:cm(n.name,this.schema)},i=B(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=Lp(this.extensions);return Object.fromEntries(t.filter(e=>!!B(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=B(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Ff(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=Vp(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{Jh(i,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:cm(e.name,this.schema)};e.type===`mark`&&(V(B(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=B(e,`onBeforeCreate`,t),r=B(e,`onCreate`,t),i=B(e,`onUpdate`,t),a=B(e,`onSelectionUpdate`,t),o=B(e,`onTransaction`,t),s=B(e,`onFocus`,t),c=B(e,`onBlur`,t),l=B(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};fh.resolve=Yp,fh.sort=Jp,fh.flatten=Np,uf({},{ClipboardTextSerializer:()=>ph,Commands:()=>mh,Delete:()=>hh,Drop:()=>gh,Editable:()=>_h,FocusEvents:()=>yh,Keymap:()=>bh,Paste:()=>xh,Tabindex:()=>Sh,TextDirection:()=>Ch,focusEventsPluginKey:()=>vh});var U=class e extends rh{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},ph=U.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new R({key:new z(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:a}=i,o=Math.min(...a.map(e=>e.$from.pos)),s=Math.max(...a.map(e=>e.$to.pos)),c=em(n);return Qp(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),mh=U.create({name:`commands`,addCommands(){return{...pf}}}),hh=U.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=Op(e.before,[e,...t]);am(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof ha){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),gh=U.create({name:`drop`,addProseMirrorPlugins(){return[new R({key:new z(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),_h=U.create({name:`editable`,addProseMirrorPlugins(){return[new R({key:new z(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),vh=new z(`focusEvents`),yh=U.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new R({key:vh,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),bh=U.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:F.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Hf()||sp()?i:r},addProseMirrorPlugins(){return[new R({key:new z(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=F.atStart(t.doc).from,l=F.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!_m(n.doc))return;let u=n.tr,d=df({state:n,transaction:u}),{commands:f}=new ff({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),xh=U.create({name:`paste`,addProseMirrorPlugins(){return[new R({key:new z(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),Sh=U.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new R({key:new z(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),Ch=U.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=Lp(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new R({key:new z(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),wh=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Th=`.ProseMirror {
14
- position: relative;
15
- }
16
-
17
- .ProseMirror {
18
- word-wrap: break-word;
19
- white-space: pre-wrap;
20
- white-space: break-spaces;
21
- -webkit-font-variant-ligatures: none;
22
- font-variant-ligatures: none;
23
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
24
- }
25
-
26
- .ProseMirror [contenteditable="false"] {
27
- white-space: normal;
28
- }
29
-
30
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
31
- white-space: pre-wrap;
32
- }
33
-
34
- .ProseMirror pre {
35
- white-space: pre-wrap;
36
- }
37
-
38
- img.ProseMirror-separator {
39
- display: inline !important;
40
- border: none !important;
41
- margin: 0 !important;
42
- width: 0 !important;
43
- height: 0 !important;
44
- }
45
-
46
- .ProseMirror-gapcursor {
47
- display: none;
48
- pointer-events: none;
49
- position: absolute;
50
- margin: 0;
51
- }
52
-
53
- .ProseMirror-gapcursor:after {
54
- content: "";
55
- display: block;
56
- position: absolute;
57
- top: -2px;
58
- width: 20px;
59
- border-top: 1px solid black;
60
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
61
- }
62
-
63
- @keyframes ProseMirror-cursor-blink {
64
- to {
65
- visibility: hidden;
66
- }
67
- }
68
-
69
- .ProseMirror-hideselection *::selection {
70
- background: transparent;
71
- }
72
-
73
- .ProseMirror-hideselection *::-moz-selection {
74
- background: transparent;
75
- }
76
-
77
- .ProseMirror-hideselection * {
78
- caret-color: transparent;
79
- }
80
-
81
- .ProseMirror-focused .ProseMirror-gapcursor {
82
- display: block;
83
- }`;function Eh(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}var Dh=class extends Ym{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:xm,createMappablePosition:Sm},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=Bf(t,this.options.autofocus);this.editorState=Ao.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=Eh(Th,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=Fp(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?[_h,ph.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),mh,yh,bh,Sh.configure({value:this.options.coreExtensionOptions?.tabindex?.value}),gh,xh,hh,Ch.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new fh(e,this)}createCommandManager(){this.commandManager=new ff({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Tp(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=Tp(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 Bd(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 nm(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return fm(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Pp(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
84
-
85
- `,textSerializers:n={}}=e||{};return $p(this.state.doc,{blockSeparator:t,textSerializers:{...em(this.schema),...n}})}get isEmpty(){return _m(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 wh(t,this,!1,n)}get $doc(){return this.$pos(0)}};function Oh(e){return new Xm({find:e.find,handler:({state:t,range:n,match:r})=>{let i=V(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(om(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 kh(e){return new Xm({find:e.find,handler:({state:t,range:n,match:r})=>{let i=V(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 Ah(e){return new Xm({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=V(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 jh(e){return new Xm({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=V(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Da(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&&za(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var Mh=e=>`touches`in e,Nh=class{constructor(e){this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e?.options?.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,Mh(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return r<this.minSize.width&&(r=this.minSize.width,i=r/this.aspectRatio),i<this.minSize.height&&(i=this.minSize.height,r=i*this.aspectRatio),this.maxSize?.width&&r>this.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function Ph(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof L){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function Fh(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}function Ih(e){return e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&amp;/g,`&`)}function Lh(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Rh(){return typeof navigator<`u`?/Firefox/.test(navigator.userAgent):!1}uf({},{createAtomBlockMarkdownSpec:()=>Vh,createBlockMarkdownSpec:()=>Hh,createInlineMarkdownSpec:()=>Gh,parseAttributes:()=>zh,parseIndentedBlocks:()=>Kh,renderNestedMarkdownContent:()=>qh,serializeAttributes:()=>Bh});function zh(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,``).replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Bh(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function Vh(e){let{nodeName:t,name:n,parseAttributes:r=zh,serializeAttributes:i=Bh,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function Hh(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=zh,serializeAttributes:a=Bh,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
86
-
87
- ${t.renderChildren(e.content||[],`
88
-
89
- `)}
90
-
91
- :::`}}}function Uh(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function Wh(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function Gh(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=Uh,serializeAttributes:a=Wh,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function Kh(e,t,n){let r=e.split(`
92
- `),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],c=e.match(t.itemPattern);if(!c){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}
93
- `;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e}
94
- `;let f=[d];for(o+=1;o<r.length;){let e=r[o];if(e.trim()===``){let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e}
95
- `,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e}
96
- `,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(`
97
- `);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function qh(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=`${i}${t.renderChildren([a])}`;return o&&o.length>0&&o.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=r.split(`
98
- `).map(e=>e?t.indent(e):t.indent(``)).join(`
99
- `);s+=e.type===`paragraph`?`
100
-
101
- ${n}`:`
102
- ${n}`}}),s}function Jh(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var Yh=class e extends rh{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Xh=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t;let{view:n}=this.editor,r=e.target,i=r.nodeType===3?r.parentElement?.closest(`[data-drag-handle]`):r.closest(`[data-drag-handle]`);if(!this.dom||this.contentDOM?.contains(r)||!i)return;let a=0,o=0;if(this.dom!==i){let t=this.dom.getBoundingClientRect(),n=i.getBoundingClientRect(),r=e.offsetX??e.nativeEvent?.offsetX,s=e.offsetY??e.nativeEvent?.offsetY;a=n.x-t.x+r,o=n.y-t.y+s}let s=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();s.style.width=`${Math.round(e.width)}px`,s.style.height=`${Math.round(e.height)}px`,s.style.boxSizing=`border-box`,s.style.pointerEvents=`none`}catch{}let c=null;try{c=document.createElement(`div`),c.style.position=`absolute`,c.style.top=`-9999px`,c.style.left=`-9999px`,c.style.pointerEvents=`none`,c.appendChild(s),document.body.appendChild(c),(t=e.dataTransfer)==null||t.setDragImage(s,a,o)}finally{c&&setTimeout(()=>{try{c?.remove()}catch{}},0)}let l=this.getPos();if(typeof l!=`number`)return;let u=L.create(n.state.doc,l),d=n.state.tr.setSelection(u);n.dispatch(d)}stopEvent(e){if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let t=e.target;if(!(this.dom.contains(t)&&!this.contentDOM?.contains(t)))return!1;let n=e.type.startsWith(`drag`),r=e.type===`dragover`||e.type===`dragenter`,i=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(t.tagName)||t.isContentEditable)&&!i&&!n)return!0;let{isEditable:a}=this.editor,{isDragging:o}=this,s=!!this.node.type.spec.draggable,c=L.isSelectable(this.node),l=e.type===`copy`,u=e.type===`paste`,d=e.type===`cut`,f=e.type===`mousedown`;if(!s&&c&&n&&e.target===this.dom&&e.preventDefault(),s&&n&&!o&&e.target===this.dom)return e.preventDefault(),!1;if(s&&a&&!o&&f){let e=t.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(o||r||i||l||u||d||f&&c)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.dom.contains(e.target)&&e.type===`childList`&&(Hf()||Vf())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return typeof n==`number`?(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0):!1})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Zh(e){return new oh({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=V(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(om(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 Qh=/(^|[^`])`([^`]+)`(?!`)$/,$h=/(^|[^`])`([^`]+)`(?!`)/g,eg=ih.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,H(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Oh({find:Qh,type:this.type})]},addPasteRules(){return[Zh({find:$h,type:this.type})]}}),tg=eg,ng=Yh.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,H(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!Ph(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return vm(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(I.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(L.create(t.doc,n.pos)):t.setSelection(I.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(I.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[kh({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),rg=ng,ig=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,ag=Yh.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,H(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?`![${n}](${t} "${r}")`:`![${n}](${t})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);Object.entries(o).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),c.src=o.src;let l=new Nh({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),u=l.dom;return u.style.visibility=`hidden`,u.style.pointerEvents=`none`,c.onload=()=>{u.style.visibility=``,u.style.pointerEvents=``},l}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[kh({find:ig,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});function og(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=Fh(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function sg(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
103
- `);return/\s/.test(n)}):!1}var cg=new z(`suggestion`);function lg({pluginKey:e=cg,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=og,shouldShow:g,shouldResetDismissed:_}){let v,y=p?.(),b=r&&!i,x=()=>{let e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=t.view.coordsAtPos(e);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}},S=(n,r)=>r?()=>{let r=e.getState(t.state)?.decorationId;return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect()||null}:x,C=({match:e,dismissedRange:n,state:r,transaction:i})=>_?.({editor:t,state:r,range:n,match:e,transaction:i,allowSpaces:b})?!1:b?e.range.from===n.from:e.range.from===n.from&&!sg(i);function w(n,r){var i;try{let r=e.getState(n.state),a=r?.decorationId?n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`):null,o={editor:t,range:r?.range||{from:0,to:0},query:r?.query||null,text:r?.text||null,items:[],command:e=>d({editor:t,range:r?.range||{from:0,to:0},props:e}),decorationNode:a,clientRect:S(n,a)};(i=y?.onExit)==null||i.call(y,o)}catch{}let a=n.state.tr.setMeta(r,{exit:!0});n.dispatch(a)}let ee=new R({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,g=p||u&&h,_=h||u,b=m||u&&h;if(!g&&!_&&!b)return;let x=b&&!g?c:l,C=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);v={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:C,clientRect:S(e,C)},g&&((r=y?.onBeforeStart)==null||r.call(y,v)),_&&((i=y?.onBeforeUpdate)==null||i.call(y,v)),(_||g)&&(v.items=await f({editor:t,query:x.query})),b&&((a=y?.onExit)==null||a.call(y,v)),_&&((o=y?.onUpdate)==null||o.call(y,v)),g&&((s=y?.onStart)==null||s.call(y,v))},destroy:()=>{var e;v&&((e=y?.onExit)==null||e.call(y,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(s,c,l,u){let{isEditable:d}=t,{composing:f}=t.view,{selection:p}=s,{empty:_,from:v}=p,y={...c},b=s.getMeta(e);if(b&&b.exit)return y.active=!1,y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null,y.dismissedRange=c.active?{...c.range}:c.dismissedRange,y;if(y.composing=f,s.docChanged&&y.dismissedRange!==null&&(y.dismissedRange={from:s.mapping.map(y.dismissedRange.from),to:s.mapping.map(y.dismissedRange.to)}),d&&(_||t.view.composing)){(v<c.range.from||v>c.range.to)&&!f&&!c.composing&&(y.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:p.$from}),l=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:u,range:e.range,isActive:c.active})&&(!g||g({editor:t,range:e.range,query:e.query,text:e.text,transaction:s}))?(y.dismissedRange!==null&&!C({match:e,dismissedRange:y.dismissedRange,state:u,transaction:s})&&(y.dismissedRange=null),y.dismissedRange===null?(y.active=!0,y.decorationId=c.decorationId?c.decorationId:l,y.range=e.range,y.query=e.query,y.text=e.text):y.active=!1):(e||(y.dismissedRange=null),y.active=!1)}else y.active=!1;return y.active||(y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null),y}},props:{handleKeyDown(t,n){var r;let{active:i,range:a}=ee.getState(t.state);if(!i)return!1;if(n.key===`Escape`||n.key===`Esc`){let i=ee.getState(t.state);return(r=y?.onKeyDown)==null||r.call(y,{view:t,event:n,range:i.range}),w(t,e),!0}return(y?.onKeyDown)?.call(y,{view:t,event:n,range:a})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=ee.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),od.create(e.doc,[rd.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return ee}var ug=lg;function dg({editor:e,overrideSuggestionOptions:t,extensionName:n,char:r=`@`}){return{editor:e,char:r,pluginKey:new z,command:({editor:e,range:t,props:i})=>{var a;(e.view.state.selection.$to.nodeAfter?.text)?.startsWith(` `)&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:n,attrs:{...i,mentionSuggestionChar:r}},{type:`text`,text:` `}]).run(),(a=e.view.dom.ownerDocument.defaultView?.getSelection())==null||a.collapseToEnd()},allow:({state:e,range:t})=>{let r=e.doc.resolve(t.from),i=e.schema.nodes[n];return!!r.parent.type.contentMatch.matchType(i)},...t}}function fg(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>dg({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function pg(e,t){let n=fg(e);return n.find(e=>e.char===t)||(n.length?n[0]:null)}var mg=Yh.create({name:`mention`,priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){return`${t?.char??`@`}${e.attrs.label??e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:n}){return[`span`,H(this.HTMLAttributes,e.HTMLAttributes),`${n?.char??`@`}${t.attrs.label??t.attrs.id}`]},suggestions:[],suggestion:{}}},group:`inline`,inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute(`data-id`),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute(`data-label`),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:`@`,parseHTML:e=>e.getAttribute(`data-mention-suggestion-char`),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=pg(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn(`renderLabel is deprecated use renderText and renderHTML instead`),[`span`,H({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:n})];let r={...this.options};r.HTMLAttributes=H({"data-type":this.name},this.options.HTMLAttributes,t);let i=this.options.renderHTML({options:r,node:e,suggestion:n});return typeof i==`string`?[`span`,H({"data-type":this.name},this.options.HTMLAttributes,t),i]:i},...Gh({nodeName:`mention`,name:`@`,selfClosing:!0,allowedAttributes:[`id`,`label`,{name:`mentionSuggestionChar`,skipIfDefault:`@`}],parseAttributes:e=>{let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i===`char`?`mentionSuggestionChar`:i]=a??o,r=n.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e===`mentionSuggestionChar`?`char`:e}="${t}"`).join(` `)}),renderText({node:e}){let t={options:this.options,node:e,suggestion:pg(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel===void 0?this.options.renderText(t):(console.warn(`renderLabel is deprecated use renderText and renderHTML instead`),this.options.renderLabel(t))},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1,{selection:r}=t,{empty:i,anchor:a}=r;if(!i)return!1;let o=new ni,s=0;return t.doc.nodesBetween(a-1,a,(e,t)=>{if(e.type.name===this.name)return n=!0,o=e,s=t,!1}),n&&e.insertText(this.options.deleteTriggerWithBackspace?``:o.attrs.mentionSuggestionChar,s,s+o.nodeSize),n})}},addProseMirrorPlugins(){return fg(this).map(lg)}});function hg(e={}){return new R({view(t){return new gg(t,e)}})}var gg=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Ga(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},_g=class e extends F{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):F.near(r)}content(){return P.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new vg(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!bg(e)||!xg(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!L.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};_g.prototype.visible=!1,_g.findFrom=_g.findGapCursorFrom,F.jsonID(`gapcursor`,_g);var vg=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return _g.valid(t)?new _g(t):F.near(t)}};function yg(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function bg(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||yg(e.type))return!0;if(e.inlineContent)return!1}}return!0}function xg(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||yg(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Sg(){return new R({props:{decorations:Dg,createSelectionBetween(e,t,n){return t.pos==n.pos&&_g.valid(n)?new _g(n):null},handleClick:Tg,handleKeyDown:Cg,handleDOMEvents:{beforeinput:Eg}}})}var Cg=cf({ArrowLeft:wg(`horiz`,-1),ArrowRight:wg(`horiz`,1),ArrowUp:wg(`vert`,-1),ArrowDown:wg(`vert`,1)});function wg(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof I){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=_g.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new _g(c))),!0):!1}}function Tg(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!_g.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&L.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new _g(r))),!0)}function Eg(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof _g))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=M.empty;for(let e=r.length-1;e>=0;e--)i=M.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new P(i,0,0));return a.setSelection(I.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Dg(e){if(!(e.selection instanceof _g))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,od.create(e.doc,[rd.widget(e.selection.head,t,{key:`gapcursor`})])}var Og=200,kg=function(){};kg.prototype.append=function(e){return e.length?(e=kg.from(e),!this.length&&e||e.length<Og&&this.leafAppend(e)||this.length<Og&&e.leafPrepend(this)||this.appendInner(e)):this},kg.prototype.prepend=function(e){return e.length?kg.from(e).append(this):this},kg.prototype.appendInner=function(e){return new jg(this,e)},kg.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?kg.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},kg.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},kg.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},kg.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},kg.from=function(e){return e instanceof kg?e:e&&e.length?new Ag(e):kg.empty};var Ag=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Og)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Og)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(kg);kg.empty=new Ag([]);var jg=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(kg),Mg=500,Ng=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new Fg(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new Fg(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new Fg(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>Lg&&(s=Pg(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new la;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new Fg(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new Fg(i,o,l))}else r.push(new Fg(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new Fg(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>Mg&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new Fg(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(kg.from(i.reverse()),a)}};Ng.empty=new Ng(kg.empty,0);function Pg(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var Fg=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},Ig=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},Lg=20;function Rg(e,t,n,r){let i=n.getMeta(Kg),a;if(i)return i.historyState;n.getMeta(qg)&&(e=new Ig(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(Kg))return o.getMeta(Kg).redo?new Ig(e.done.addTransform(n,void 0,r,Gg(t)),e.undone,Bg(n.mapping.maps),e.prevTime,e.prevComposition):new Ig(e.done,e.undone.addTransform(n,void 0,r,Gg(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!zg(n,e.prevRanges)),s=o?Vg(e.prevRanges,n.mapping):Bg(n.mapping.maps);return new Ig(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,Gg(t)),Ng.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new Ig(e.done.rebased(n,a),e.undone.rebased(n,a),Vg(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new Ig(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Vg(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function zg(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function Bg(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function Vg(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function Hg(e,t,n){let r=Gg(t),i=Kg.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new Ig(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(Kg,{redo:n,historyState:c})}var Ug=!1,Wg=null;function Gg(e){let t=e.plugins;if(Wg!=t){Ug=!1,Wg=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Ug=!0;break}}return Ug}var Kg=new z(`history`),qg=new z(`closeHistory`);function Jg(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new R({key:Kg,state:{init(){return new Ig(Ng.empty,Ng.empty,null,0,-1)},apply(t,n,r){return Rg(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?Xg:n==`historyRedo`?Zg:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Yg(e,t){return(n,r)=>{let i=Kg.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=Hg(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var Xg=Yg(!1,!0),Zg=Yg(!0,!0);U.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new R({key:new z(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var Qg=U.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[hg(this.options)]}});U.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new R({key:new z(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return od.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(rd.node(t,t+e.nodeSize,{class:this.options.className}))}),od.create(e,a)}}})]}});var $g=U.create({name:`gapCursor`,addProseMirrorPlugins(){return[Sg()]},extendNodeSchema(e){return{allowGapCursor:V(B(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),e_=`placeholder`,t_=new z(`tiptap__placeholder`),n_=200;function r_(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),rd.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function i_({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty,c={emptyEditor:t.emptyEditorClass,emptyNode:t.emptyNodeClass};if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),l=i.depth>0?i.node(1):i.nodeAfter,u=i.depth>0?i.before(1):a;if(l&&l.type.isTextblock&&_m(l)){let r=a>=u&&a<=u+l.nodeSize;o.push(r_({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:c,node:l,pos:u}))}}else{let i=t_.getState(e.state),l=i?.topPos??0,u=i?.bottomPos??r.content.size;r.nodesBetween(l,u,(r,i)=>{let l=a>=i&&a<=i+r.nodeSize,u=!r.isLeaf&&_m(r);return r.type.isTextblock&&(l||!t.showOnlyCurrent)&&u&&o.push(r_({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:l,placeholder:t.placeholder,classes:c,node:r,pos:i})),t.includeChildren})}return od.create(r,o)}function a_(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function o_(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function s_(e){let t=e;for(;t;){if(o_(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}return window}t=e}return window}function c_(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function l_({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?c_(n):{top:0,bottom:window.innerHeight},a=Math.max(r.top,i.top)-n_,o=Math.min(r.bottom,i.bottom)+n_;if(a>=o)return{top:0,bottom:e.content.size};let s=getComputedStyle(t.dom).direction===`rtl`?Math.max(r.right-2,r.left+2):r.left+2,c=t.posAtCoords({left:s,top:a+2}),l=t.posAtCoords({left:s,top:o-2});return{top:c?c.pos:0,bottom:l?l.pos:e.content.size}}var u_={init(){return{topPos:null,bottomPos:null}},apply(e,t){let n=e.getMeta(t_);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos===null?null:e.mapping.map(t.topPos),bottomPos:t.bottomPos===null?null:e.mapping.map(t.bottomPos)}:t}};function d_(e){let t=s_(e.dom),n=()=>{let n=l_({view:e,doc:e.state.doc,scrollContainer:t}),r=t_.getState(e.state);if(r?.topPos===n.top&&r?.bottomPos===n.bottom)return;let i=e.state.tr.setMeta(t_,{positions:n});e.dispatch(i)},r=null,i=0,a=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):a()}))};return t.addEventListener(`scroll`,a,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&a()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener(`scroll`,a)}}}function f_({editor:e,options:t}){let n=t.dataAttribute?`data-${a_(t.dataAttribute)}`:`data-${e_}`;return new R({key:t_,state:u_,view:d_,props:{decorations:({doc:r,selection:i})=>i_({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}var p_=U.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:e_,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[f_({editor:this.editor,options:this.options})]}});U.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new R({key:new z(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||vm(n.selection)||e.view.dragging?null:od.create(n.doc,[rd.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function m_({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var h_=U.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new z(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new R({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!m_({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!m_({node:r,types:n})}}})]}}),g_=U.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Xg(e,t),redo:()=>({state:e,dispatch:t})=>Zg(e,t)}},addProseMirrorPlugins(){return[Jg(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),__=p_;function v_(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var y_=v_();function b_(e){y_=e}var x_={exec:()=>null};function W(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(C_.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var S_=(()=>{try{return!0}catch{return!1}})(),C_={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},w_=/^(?:[ \t]*(?:\n|$))+/,T_=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,E_=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,D_=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,O_=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,k_=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,A_=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,j_=W(A_).replace(/bull/g,k_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),M_=W(A_).replace(/bull/g,k_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),N_=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,P_=/^[^\n]+/,F_=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,I_=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,F_).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),L_=W(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,k_).getRegex(),R_=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,z_=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,B_=W(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,z_).replace(`tag`,R_).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),V_=W(N_).replace(`hr`,D_).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,R_).getRegex(),H_={blockquote:W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,V_).getRegex(),code:T_,def:I_,fences:E_,heading:O_,hr:D_,html:B_,lheading:j_,list:L_,newline:w_,paragraph:V_,table:x_,text:P_},U_=W(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,D_).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,R_).getRegex(),W_={...H_,lheading:M_,table:U_,paragraph:W(N_).replace(`hr`,D_).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,U_).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,R_).getRegex()},G_={...H_,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,z_).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:x_,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(N_).replace(`hr`,D_).replace(`heading`,` *#{1,6} *[^
104
- ]`).replace(`lheading`,j_).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},K_=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,q_=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,J_=/^( {2,}|\\)\n(?!\s*$)/,Y_=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,X_=/[\p{P}\p{S}]/u,Z_=/[\s\p{P}\p{S}]/u,Q_=/[^\s\p{P}\p{S}]/u,$_=W(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Z_).getRegex(),ev=/(?!~)[\p{P}\p{S}]/u,tv=/(?!~)[\s\p{P}\p{S}]/u,nv=/(?:[^\s\p{P}\p{S}]|~)/u,rv=W(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,S_?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),iv=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,av=W(iv,`u`).replace(/punct/g,X_).getRegex(),ov=W(iv,`u`).replace(/punct/g,ev).getRegex(),sv=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,cv=W(sv,`gu`).replace(/notPunctSpace/g,Q_).replace(/punctSpace/g,Z_).replace(/punct/g,X_).getRegex(),lv=W(sv,`gu`).replace(/notPunctSpace/g,nv).replace(/punctSpace/g,tv).replace(/punct/g,ev).getRegex(),uv=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Q_).replace(/punctSpace/g,Z_).replace(/punct/g,X_).getRegex(),dv=W(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,X_).getRegex(),fv=W(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Q_).replace(/punctSpace/g,Z_).replace(/punct/g,X_).getRegex(),pv=W(/\\(punct)/,`gu`).replace(/punct/g,X_).getRegex(),mv=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),hv=W(z_).replace(`(?:-->|$)`,`-->`).getRegex(),gv=W(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,hv).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_v=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,vv=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,_v).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),yv=W(/^!?\[(label)\]\[(ref)\]/).replace(`label`,_v).replace(`ref`,F_).getRegex(),bv=W(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,F_).getRegex(),xv=W(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,yv).replace(`nolink`,bv).getRegex(),Sv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Cv={_backpedal:x_,anyPunctuation:pv,autolink:mv,blockSkip:rv,br:J_,code:q_,del:x_,delLDelim:x_,delRDelim:x_,emStrongLDelim:av,emStrongRDelimAst:cv,emStrongRDelimUnd:uv,escape:K_,link:vv,nolink:bv,punctuation:$_,reflink:yv,reflinkSearch:xv,tag:gv,text:Y_,url:x_},wv={...Cv,link:W(/^!?\[(label)\]\((.*?)\)/).replace(`label`,_v).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,_v).getRegex()},Tv={...Cv,emStrongRDelimAst:lv,emStrongLDelim:ov,delLDelim:dv,delRDelim:fv,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Sv).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Sv).getRegex()},Ev={...Tv,br:W(J_).replace(`{2,}`,`*`).getRegex(),text:W(Tv.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Dv={normal:H_,gfm:W_,pedantic:G_},Ov={normal:Cv,gfm:Tv,breaks:Ev,pedantic:wv},kv={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Av=e=>kv[e];function jv(e,t){if(t){if(C_.escapeTest.test(e))return e.replace(C_.escapeReplace,Av)}else if(C_.escapeTestNoEncode.test(e))return e.replace(C_.escapeReplaceNoEncode,Av);return e}function Mv(e){try{e=encodeURI(e).replace(C_.percentDecode,`%`)}catch{return null}return e}function Nv(e,t){let n=e.replace(C_.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(C_.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(C_.slashPipe,`|`);return n}function Pv(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Fv(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Iv(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Lv(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Rv(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
105
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
106
- `)}var zv=class{options;rules;lexer;constructor(e){this.options=e||y_}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Pv(e,`
107
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Rv(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Pv(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Pv(t[0],`
108
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Pv(t[0],`
109
- `).split(`
110
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
111
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
112
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
113
- ${s}`:s,r=r?`${r}
114
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
115
- `+e.join(`
116
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
117
- `+e.join(`
118
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
119
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Iv(t[2].split(`
120
- `,1)[0],t[1].length),l=e.split(`
121
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
122
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
123
- `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
124
- `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
125
- `+l}u=!l.trim(),r+=p+`
126
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Nv(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
127
- `):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Nv(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
128
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Pv(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Fv(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Lv(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Lv(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Bv=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||y_,this.options.tokenizer=this.options.tokenizer||new zv,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:C_,block:Dv.normal,inline:Ov.normal};this.options.pedantic?(t.block=Dv.pedantic,t.inline=Ov.pedantic):this.options.gfm&&(t.block=Dv.gfm,this.options.breaks?t.inline=Ov.breaks:t.inline=Ov.gfm),this.tokenizer.rules=t}static get rules(){return{block:Dv,inline:Ov}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(C_.carriageReturn,`
129
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(C_.tabCharGlobal,` `).replace(C_.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
130
- `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
131
- `)?``:`
132
- `)+r.raw,n.text+=`
133
- `+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
134
- `)?``:`
135
- `)+r.raw,n.text+=`
136
- `+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
137
- `)?``:`
138
- `)+r.raw,a.text+=`
139
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
140
- `)?``:`
141
- `)+r.raw,n.text+=`
142
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},Vv=class{options;parser;constructor(e){this.options=e||y_}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(C_.notSpaceStart)?.[0],i=e.replace(C_.endingNewline,``)+`
143
- `;return r?`<pre><code class="language-`+jv(r)+`">`+(n?i:jv(i,!0))+`</code></pre>
144
- `:`<pre><code>`+(n?i:jv(i,!0))+`</code></pre>
145
- `}blockquote({tokens:e}){return`<blockquote>
146
- ${this.parser.parse(e)}</blockquote>
147
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
148
- `}hr(e){return`<hr>
149
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
150
- `+r+`</`+i+`>
151
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
152
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
153
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
154
- <thead>
155
- `+t+`</thead>
156
- `+r+`</table>
157
- `}tablerow({text:e}){return`<tr>
158
- ${e}</tr>
159
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
160
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${jv(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Mv(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+jv(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Mv(e);if(i===null)return jv(n);e=i;let a=`<img src="${e}" alt="${jv(n)}"`;return t&&(a+=` title="${jv(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:jv(e.text)}},Hv=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Uv=class e{options;renderer;textRenderer;constructor(e){this.options=e||y_,this.options.renderer=this.options.renderer||new Vv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Hv}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Wv=class{options;block;constructor(e){this.options=e||y_}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Bv.lex:Bv.lexInline}provideParser(e=this.block){return e?Uv.parse:Uv.parseInline}},Gv=new class{defaults=v_();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Uv;Renderer=Vv;TextRenderer=Hv;Lexer=Bv;Tokenizer=zv;Hooks=Wv;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Vv(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new zv(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Wv;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Wv.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Wv.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Bv.lex(e,t??this.defaults)}parser(e,t){return Uv.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Bv.lex:Bv.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Uv.parse:Uv.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Bv.lex:Bv.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Uv.parse:Uv.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
161
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+jv(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function G(e,t){return Gv.parse(e,t)}G.options=G.setOptions=function(e){return Gv.setOptions(e),G.defaults=Gv.defaults,b_(G.defaults),G},G.getDefaults=v_,G.defaults=y_,G.use=function(...e){return Gv.use(...e),G.defaults=Gv.defaults,b_(G.defaults),G},G.walkTokens=function(e,t){return Gv.walkTokens(e,t)},G.parseInline=Gv.parseInline,G.Parser=Uv,G.parser=Uv.parse,G.Renderer=Vv,G.TextRenderer=Hv,G.Lexer=Bv,G.lexer=Bv.lex,G.Tokenizer=zv,G.Hooks=Wv,G.parse=G,G.options,G.setOptions,G.use,G.walkTokens,G.parseInline,Uv.parse,Bv.lex;function Kv(e,t){let n=t.split(`
162
- `).flatMap(e=>[e,``]).map(t=>`${e}${t}`).join(`
163
- `);return n.slice(0,n.length-1)}function qv(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Object.is(e[n],t[n])):!1}function Jv(e,t){let n=[];return Array.from(e.entries()).forEach(([e,r])=>{if(!t){n.push(e);return}(t.marks||[]).find(t=>t.type===e&&qv(t.attrs,r.attrs))||n.push(e)}),n}function Yv(e,t){let n=[];return Array.from(t.entries()).forEach(([t,r])=>{let i=e.get(t);(!i||!qv(i.attrs,r.attrs))&&n.push({type:t,mark:r})}),n}function Xv(e,t,n,r){let i=!n,a=n&&(!n.marks||n.marks.length===0),o=n&&n.marks&&!r(t,new Map(n.marks.map(e=>[e.type,e]))),s=[];return(i||a||o)&&(n&&n.marks?Array.from(e.entries()).reverse().forEach(([e,t])=>{n.marks.find(n=>n.type===e&&qv(n.attrs,t.attrs))||s.push(e)}):(i||a)&&s.push(...Array.from(e.keys()).reverse())),s}function Zv(e,t){let n=``;return Array.from(e.keys()).reverse().forEach(r=>{let i=t(r,e.get(r));i&&(n=i+n)}),e.clear(),n}function Qv(e,t,n){let r=``;return Array.from(e.entries()).forEach(([e,i])=>{let a=n(e,i);a&&(r+=a),t.set(e,i)}),r}function $v(e){let t=(e.raw||e.text||``).match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return t?{isTask:!0,checked:t[2].toLowerCase()===`x`,indentLevel:t[1].length}:{isTask:!1,indentLevel:0}}function ey(e,t){return typeof e==`string`?t:`json`}var ty=e=>{let t=window.HTMLUnknownElement;return typeof t==`function`&&e instanceof t},ny=class{constructor(e){this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.lastParseResult=null,this.markedInstance=e?.marked??G,this.indentStyle=e?.indentation?.style??`space`,this.indentSize=e?.indentation?.size??2,this.baseExtensions=e?.extensions||[],e?.markedOptions&&typeof this.markedInstance.setOptions==`function`&&this.markedInstance.setOptions(e.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,e?.extensions&&(this.baseExtensions=e.extensions,Jp(Np(e.extensions)).forEach(e=>this.registerExtension(e)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle===`space`?` `:` `}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(e){this.extensions.push(e);let t=V(B(e,`code`)),n=e.name;t&&this.codeTypes.add(n),this.extensionRanks.has(n)||this.extensionRanks.set(n,this.extensionRanks.size);let r=B(e,`markdownTokenName`)||n,i=B(e,`parseMarkdown`),a=B(e,`renderMarkdown`),o=B(e,`markdownTokenizer`),s=B(e,`markdownOptions`)??null,c={tokenName:r,nodeName:n,parseMarkdown:i,renderMarkdown:a,isIndenting:s?.indentsContent??!1,htmlReopen:s?.htmlReopen,tokenizer:o};if(r&&i){let e=this.registry.get(r)||[];e.push(c),this.registry.set(r,e)}if(a){let e=this.nodeTypeRegistry.get(n)||[];e.push(c),this.nodeTypeRegistry.set(n,e)}o&&this.hasMarked()&&this.registerTokenizer(o)}createLexer(){return new this.markedInstance.Lexer}createTokenizerHelpers(e){return{inlineTokens:t=>e.inlineTokens(t),blockTokens:t=>e.blockTokens(t)}}tokenizeInline(e){return(this.activeParseLexer??this.createLexer()).inlineTokens(e)}registerTokenizer(e){if(!this.hasMarked())return;let{name:t,start:n,level:r=`inline`,tokenize:i}=e,a=this.createTokenizerHelpers.bind(this),o=this.createLexer.bind(this),s;s=n?typeof n==`function`?n:e=>e.indexOf(n):e=>{let t=i(e,[],this.createTokenizerHelpers(this.createLexer()));return t&&t.raw?e.indexOf(t.raw):-1};let c={name:t,level:r,start:s,tokenizer(e,n){let r=i(e,n,this.lexer?a(this.lexer):a(o()));if(r&&r.type)return{...r,type:r.type||t,raw:r.raw||``,tokens:r.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[c]})}getHandlersForToken(e){try{return this.registry.get(e)||[]}catch{return[]}}getHandlerForToken(e){let t=this.getHandlersForToken(e);if(t.length>0)return t[0];let n=this.getHandlersForNodeType(e);return n.length>0?n[0]:void 0}getHandlersForNodeType(e){try{return this.nodeTypeRegistry.get(e)||[]}catch{return[]}}serialize(e){if(!e)return``;let t=this.renderNodes(e,e);return this.isEmptyOutput(t)?``:t}isEmptyOutput(e){return!e||e.trim()===``?!0:e.replace(/&nbsp;/g,``).replace(/\u00A0/g,``).trim()===``}parse(e){if(!this.hasMarked())throw Error(`No marked instance available for parsing`);let t=this.activeParseLexer,n=this.createLexer();this.activeParseLexer=n;try{let t=n.lex(e);return{type:`doc`,content:this.parseTokens(t,!0)}}finally{this.activeParseLexer=t}}parseTokens(e,t=!1){let n=e.reduce((e,t,n)=>(t.type!==`space`&&e.push(n),e),[]),r=-1,i=0;return e.flatMap((e,a)=>{for(;i<n.length&&n[i]<a;)r=n[i],i+=1;if(t&&e.type===`space`){let t=n[i]??-1;return this.createImplicitEmptyParagraphsFromSpace(e,r,t)}let o=this.parseToken(e,t);return o===null?[]:Array.isArray(o)?o:[o]})}createImplicitEmptyParagraphsFromSpace(e,t,n){let r=this.countParagraphSeparators(e.raw||``);if(r===0)return[];let i=Math.max(r-(t===-1||n===-1?0:1),0);return Array.from({length:i},()=>({type:`paragraph`,content:[]}))}countParagraphSeparators(e){return(e.replace(/\r\n/g,`
164
- `).match(/\n\n/g)||[]).length}parseToken(e,t=!1){if(!e.type)return null;if(e.type===`list`)return this.parseListToken(e);let n=this.getHandlersForToken(e.type),r=this.createParseHelpers();if(n.find(t=>{if(!t.parseMarkdown)return!1;let n=t.parseMarkdown(e,r),i=this.normalizeParseResult(n);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){let e=this.lastParseResult;return this.lastParseResult=null,e}return this.parseFallbackToken(e,t)}parseListToken(e){if(!e.items||e.items.length===0)return this.parseTokenWithHandlers(e);let t=e.items.some(e=>$v(e).isTask),n=e.items.some(e=>!$v(e).isTask);if(!t||!n||this.getHandlersForToken(`taskList`).length===0)return this.parseTokenWithHandlers(e);let r=[],i=[],a=null;for(let t=0;t<e.items.length;t+=1){let n=e.items[t],{isTask:o,checked:s,indentLevel:c}=$v(n),l=n;if(o){let e=(n.raw||n.text||``).split(`
165
- `),t=e[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),r=t?t[2]:``,i=[];if(e.length>1&&e.slice(1).join(`
166
- `).trim()){let t=e.slice(1),n=t.filter(e=>e.trim());if(n.length>0){let e=Math.min(...n.map(e=>e.length-e.trimStart().length)),r=t.map(t=>t.trim()?t.slice(e):``).join(`
167
- `).trim();r&&(i=this.markedInstance.lexer(`${r}
168
- `))}}l={type:`taskItem`,raw:``,mainContent:r,indentLevel:c,checked:s??!1,text:r,tokens:this.tokenizeInline(r),nestedTokens:i}}let u=o?`taskList`:`list`;a===u?i.push(l):(i.length>0&&r.push({type:a,items:i}),i=[l],a=u)}i.length>0&&r.push({type:a,items:i});let o=[];for(let t=0;t<r.length;t+=1){let n=r[t],i={...e,type:n.type,items:n.items},a=this.parseToken(i);a&&(Array.isArray(a)?o.push(...a):o.push(a))}return o.length>0?o:null}parseTokenWithHandlers(e){if(!e.type)return null;let t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(t=>{if(!t.parseMarkdown)return!1;let r=t.parseMarkdown(e,n),i=this.normalizeParseResult(r);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){let e=this.lastParseResult;return this.lastParseResult=null,e}return this.parseFallbackToken(e)}createParseHelpers(){return{parseInline:e=>this.parseInlineTokens(e),tokenizeInline:e=>this.tokenizeInline(e),parseChildren:e=>this.parseTokens(e),parseBlockChildren:e=>this.parseTokens(e,!0),createTextNode:(e,t)=>({type:`text`,text:e,marks:t||void 0}),createNode:(e,t,n)=>{let r={type:e,attrs:t||void 0,content:n||void 0};return(!t||Object.keys(t).length===0)&&delete r.attrs,r},applyMark:(e,t,n)=>({mark:e,content:t,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}parseInlineTokens(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r.type===`text`)t.push({type:`text`,text:Ih(r.text||``)});else if(r.type===`html`){let i=(r.raw??r.text??``).toString(),a=/^<\/[\s]*[\w-]+/i.test(i),o=i.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!a&&o&&!/\/>$/.test(i)){let r=o[1],a=this.escapeRegex(r),s=RegExp(`^<\\/\\s*${a}\\b`,`i`),c=-1,l=[i];for(let t=n+1;t<e.length;t+=1){let n=e[t],r=(n.raw??n.text??``).toString();if(l.push(r),n.type===`html`&&s.test(r)){c=t;break}}if(c!==-1){let e=l.join(``),r={type:`html`,raw:e,text:e,block:!1},i=this.parseHTMLToken(r);if(i){let e=this.normalizeParseResult(i);Array.isArray(e)?t.push(...e):e&&t.push(e)}n=c;continue}}let s=this.parseHTMLToken(r);if(s){let e=this.normalizeParseResult(s);Array.isArray(e)?t.push(...e):e&&t.push(e)}}else if(r.type){let e=this.getHandlerForToken(r.type);if(e&&e.parseMarkdown){let n=this.createParseHelpers(),i=e.parseMarkdown(r,n);if(this.isMarkResult(i)){let e=this.applyMarkToContent(i.mark,i.content,i.attrs);t.push(...e)}else{let e=this.normalizeParseResult(i);Array.isArray(e)?t.push(...e):e&&t.push(e)}}else r.tokens&&t.push(...this.parseInlineTokens(r.tokens))}}return t}applyMarkToContent(e,t,n){return t.map(t=>{if(t.type===`text`){let r=t.marks||[],i=n?{type:e,attrs:n}:{type:e};return{...t,marks:[...r,i]}}return{...t,content:t.content?this.applyMarkToContent(e,t.content,n):void 0}})}isMarkResult(e){return e&&typeof e==`object`&&`mark`in e}normalizeParseResult(e){return e?this.isMarkResult(e)?e.content:e:null}parseFallbackToken(e,t=!1){switch(e.type){case`paragraph`:return{type:`paragraph`,content:e.tokens?this.parseInlineTokens(e.tokens):[]};case`heading`:return{type:`heading`,attrs:{level:e.depth||1},content:e.tokens?this.parseInlineTokens(e.tokens):[]};case`text`:return{type:`text`,text:Ih(e.text||``)};case`html`:return this.parseHTMLToken(e);case`space`:return null;default:return e.tokens?this.parseTokens(e.tokens,t):null}}parseHTMLToken(e){let t=e.text||e.raw||``;if(!t.trim())return null;if(typeof window>`u`)return e.block?{type:`paragraph`,content:[{type:`text`,text:t}]}:{type:`text`,text:t};if(this.isUnrecognizedHtml(t))return this.htmlAsLiteralText(t,!!e.block);try{let n=Zp(t,this.baseExtensions);return n.type===`doc`&&n.content?e.block?n.content:n.content.length===1&&n.content[0].type===`paragraph`&&n.content[0].content?n.content[0].content:n.content:n}catch(e){throw Error(`Failed to parse HTML in markdown: ${e}`)}}isUnrecognizedHtml(e){if(typeof window>`u`||window.DOMParser===void 0)return!1;let t=new window.DOMParser().parseFromString(`<body>${e}</body>`,`text/html`).body.querySelectorAll(`*`);if(t.length===0)return!1;let n=this.getSchemaParseDomTags();return Array.from(t).some(e=>{if(!ty(e))return!1;let t=e.tagName.toLowerCase();return!n.has(t)})}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;let e=new Set;try{let t=Xp(this.baseExtensions),n=t=>{let n=t?.parseDOM;Array.isArray(n)&&n.forEach(t=>{if(typeof t?.tag==`string`){let n=t.tag.match(/^[a-zA-Z][\w-]*/);n&&e.add(n[0].toLowerCase())}})};Object.values(t.nodes).forEach(e=>n(e.spec)),Object.values(t.marks).forEach(e=>n(e.spec))}catch{}return this.schemaParseDomTagsCache=e,e}htmlAsLiteralText(e,t){let n=e.replace(/\s+$/,``);return n?t?{type:`paragraph`,content:[{type:`text`,text:n}]}:{type:`text`,text:n}:null}encodeTextForMarkdown(e,t,n){return n?.type!=null&&this.codeTypes.has(n.type)||(t.marks||[]).some(e=>this.codeTypes.has(typeof e==`string`?e:e.type))?e:Lh(e)}renderNodeToMarkdown(e,t,n=0,r=0,i={}){if(e.type===`text`)return this.encodeTextForMarkdown(e.text||``,e,t);if(!e.type)return``;let a=this.getHandlerForToken(e.type);if(!a)return``;let o=Array.isArray(t?.content)&&n>0?t.content[n-1]:void 0,s={renderChildren:(t,i)=>{let o=a.isIndenting?r+1:r;return!Array.isArray(t)&&t.content?this.renderNodes(t.content,e,i||``,n,o):this.renderNodes(t,e,i||``,n,o)},renderChild:(t,n)=>{let i=a.isIndenting?r+1:r;return this.renderNodeToMarkdown(t,e,n,i)},indent:e=>this.indentString+e,wrapInBlock:Kv},c={index:n,level:r,parentType:t?.type,previousNode:o,meta:{parentAttrs:t?.attrs,...i}};return a.renderMarkdown?.call(a,e,s,c)||``}renderNodes(e,t,n=``,r=0,i=0){return Array.isArray(e)?this.renderNodesWithMarkBoundaries(e,t,n,i):e.type?this.renderNodeToMarkdown(e,t,r,i):``}renderNodesWithMarkBoundaries(e,t,n=``,r=0){let i=[],a=new Map,o=new Set,s=new Map;return e.forEach((n,c)=>{let l=c<e.length-1?e[c+1]:null;if(n.type)if(n.type===`text`){let e=this.encodeTextForMarkdown(n.text||``,n,t),r=new Map((n.marks||[]).map(e=>[e.type,e])),c=this.getMarksToOpenForSerialization(a,r,l),u=Jv(r,l),d=u.filter(e=>a.has(e)),f=d.length>0&&c.length>0,p=``;if(u.length>0&&!f){let t=e.match(/(\s+)$/);t&&(p=t[1],e=e.slice(0,-p.length))}f||u.slice().reverse().forEach(t=>{if(!a.has(t))return;let n=r.get(t),i=this.getMarkClosing(t,n,s.get(t));i&&(e+=i),a.has(t)&&(a.delete(t),s.delete(t))});let m=``;if(c.length>0){let t=e.match(/^(\s+)/);t&&(m=t[1],e=e.slice(m.length))}c.forEach(({type:t,mark:n})=>{let r=o.has(t)?`html`:`markdown`,i=this.getMarkOpening(t,n,r);i&&(e=i+e),s.set(t,r),o.delete(t)}),f||c.slice().reverse().forEach(({type:e,mark:t})=>{a.set(e,t)}),e=m+e;let h;if(f){let e=new Set((l?.marks||[]).map(e=>e.type));c.forEach(({type:t})=>{e.has(t)&&this.getHtmlReopenTags(t)&&o.add(t)});let t=Array.from(a.keys()),n=d.slice().sort((e,n)=>t.indexOf(n)-t.indexOf(e));h=[...c.map(e=>e.type),...n]}else h=Xv(a,r,l,this.markSetsEqual.bind(this));let g=``;if(h.length>0){let t=e.match(/(\s+)$/);t&&(g=t[1],e=e.slice(0,-g.length))}h.forEach(t=>{let n=a.get(t)??r.get(t),i=this.getMarkClosing(t,n,s.get(t));i&&(e+=i),a.delete(t),s.delete(t)}),e+=g,e+=p,i.push(e)}else{let e=new Set((n.marks||[]).map(e=>e.type)),o=new Map,l=new Map;a.forEach((t,n)=>{e.has(n)&&(o.set(n,t),l.set(n,s.get(n)??`markdown`))});let u=Zv(a,(e,t)=>this.getMarkClosing(e,t,s.get(e)));s.clear();let d=this.renderNodeToMarkdown(n,t,c,r),f=n.type===`hardBreak`?``:Qv(o,a,(e,t)=>{let n=l.get(e)??`markdown`;return s.set(e,n),this.getMarkOpening(e,t,n)});i.push(u+d+f)}}),i.join(n)}getMarkOpening(e,t,n=`markdown`){if(n===`html`)return this.getHtmlReopenTags(e)?.open||``;let r=this.getHandlersForNodeType(e),i=r.length>0?r[0]:void 0;if(!i||!i.renderMarkdown)return``;let a=`__TIPTAP_MARKDOWN_PLACEHOLDER__`,o={type:e,attrs:t.attrs||{},content:[{type:`text`,text:a}]};try{let e=i.renderMarkdown(o,{renderChildren:()=>a,renderChild:()=>a,indent:e=>e,wrapInBlock:(e,t)=>e+t},{index:0,level:0,parentType:`text`,meta:{}}),t=e.indexOf(a);return t>=0?e.substring(0,t):``}catch(t){throw Error(`Failed to get mark opening for ${e}: ${t}`)}}getMarkClosing(e,t,n=`markdown`){if(n===`html`)return this.getHtmlReopenTags(e)?.close||``;let r=this.getHandlersForNodeType(e),i=r.length>0?r[0]:void 0;if(!i||!i.renderMarkdown)return``;let a=`__TIPTAP_MARKDOWN_PLACEHOLDER__`,o={type:e,attrs:t.attrs||{},content:[{type:`text`,text:a}]};try{let e=i.renderMarkdown(o,{renderChildren:()=>a,renderChild:()=>a,indent:e=>e,wrapInBlock:(e,t)=>e+t},{index:0,level:0,parentType:`text`,meta:{}}),t=e.indexOf(a),n=t+33;return t>=0?e.substring(n):``}catch(t){throw Error(`Failed to get mark closing for ${e}: ${t}`)}}getHtmlReopenTags(e){let t=this.getHandlersForNodeType(e);return(t.length>0?t[0]:void 0)?.htmlReopen}markSetsEqual(e,t){return e.size===t.size?Array.from(e.entries()).every(([e,n])=>{let r=t.get(e);return r&&qv(n.attrs,r.attrs)}):!1}getMarksToOpenForSerialization(e,t,n){let r=Yv(e,t);if(r.length<=1)return r;let i=n?.marks||[],a=(e,t)=>i.some(n=>n.type===e&&qv(n.attrs,t)),o=(e,t)=>{let n=this.extensionRanks.get(e.type)??2**53-1,r=this.extensionRanks.get(t.type)??2**53-1;return n===r?e.type.localeCompare(t.type):r-n},s=r.filter(e=>!a(e.type,e.mark.attrs)).sort(o),c=r.filter(e=>a(e.type,e.mark.attrs)).sort(o);return[...s,...c]}},ry=U.create({name:`markdown`,addOptions(){return{indentation:{style:`space`,size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(e,t)=>{if(!t?.contentType||ey(e,t?.contentType)!==`markdown`||!this.editor.markdown)return pf.setContent(e,t);let n=this.editor.markdown.parse(e);return pf.setContent(n,t)},insertContent:(e,t)=>{if(!t?.contentType||ey(e,t?.contentType)!==`markdown`||!this.editor.markdown)return pf.insertContent(e,t);let n=this.editor.markdown.parse(e);return pf.insertContent(n,t)},insertContentAt:(e,t,n)=>{if(!n?.contentType||ey(t,n?.contentType)!==`markdown`||!this.editor.markdown)return pf.insertContentAt(e,t,n);let r=this.editor.markdown.parse(t);return pf.insertContentAt(e,r,n)}}},addStorage(){return{manager:new ny({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new ny({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||ey(this.editor.options.content,this.editor.options.contentType)!==`markdown`)return;if(!this.editor.markdown)throw Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!=`string`)throw Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');let e=this.editor.markdown.parse(this.editor.options.content);e.content?.length&&(this.editor.options.content=e)}}),iy=(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]},ay=/^\s*>\s$/,oy=Yh.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return iy(`blockquote`,{...H(this.options.HTMLAttributes,e),children:iy(`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(`
169
- `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
170
- `))}),n.join(`
171
- >
172
- `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[jh({find:ay,type:this.type})]}}),sy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,cy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ly=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,uy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,dy=ih.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return iy(`strong`,{...H(this.options.HTMLAttributes,e),children:iy(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Oh({find:sy,type:this.type}),Oh({find:ly,type:this.type})]},addPasteRules(){return[Zh({find:cy,type:this.type}),Zh({find:uy,type:this.type})]}}),fy=4,py=/^```([a-z]+)?[\s\n]$/,my=/^~~~([a-z]+)?[\s\n]$/,hy=Yh.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:fy,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,H(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
173
- `):`\`\`\`${r}
174
-
175
- \`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??fy,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
176
- `,`
177
- `).split(`
178
- `).map(e=>o+e).join(`
179
- `);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??fy,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
180
- `,`
181
- `).split(`
182
- `),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(I.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
183
- `,`
184
- `).split(`
185
- `).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
186
- `);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
187
-
188
- `);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(F.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[Ah({find:py,type:this.type,getAttributes:e=>({language:e[1]})}),Ah({find:my,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new R({key:new z(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
189
- `));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(I.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),gy=Yh.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
190
-
191
- `):``}),_y=Yh.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,H(this.options.HTMLAttributes,e)]},renderText(){return`
192
- `},renderMarkdown:()=>`
193
- `,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),vy=Yh.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,H(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Ah({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),yy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,by=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,xy=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Sy=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Cy=ih.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,H(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Oh({find:yy,type:this.type}),Oh({find:xy,type:this.type})]},addPasteRules(){return[Zh({find:by,type:this.type}),Zh({find:Sy,type:this.type})]}}),wy=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,Ty=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,Ey=`numeric`,Dy=`ascii`,Oy=`alpha`,ky=`asciinumeric`,Ay=`alphanumeric`,jy=`domain`,My=`emoji`,Ny=`scheme`,Py=`slashscheme`,Fy=`whitespace`;function Iy(e,t){return e in t||(t[e]=[]),t[e]}function Ly(e,t,n){t[Ey]&&(t[ky]=!0,t[Ay]=!0),t[Dy]&&(t[ky]=!0,t[Oy]=!0),t[ky]&&(t[Ay]=!0),t[Oy]&&(t[Ay]=!0),t[Ay]&&(t[jy]=!0),t[My]&&(t[jy]=!0);for(let r in t){let t=Iy(r,n);t.indexOf(e)<0&&t.push(e)}}function Ry(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function zy(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}zy.groups={},zy.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=zy.groups;let i;return t&&t.j?i=t:(i=new zy(t),n&&r&&Ly(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=zy.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new zy,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new zy,a&&(r&&(o.t&&typeof o.t==`string`?Ly(a,Object.assign(Ry(o.t,r),n),r):n&&Ly(a,n,r)),o.t=a),i.j[e]=o,o}};var K=(e,t,n,r,i)=>e.ta(t,n,r,i),By=(e,t,n,r,i)=>e.tr(t,n,r,i),Vy=(e,t,n,r,i)=>e.ts(t,n,r,i),q=(e,t,n,r,i)=>e.tt(t,n,r,i),Hy=`WORD`,Uy=`UWORD`,Wy=`ASCIINUMERICAL`,Gy=`ALPHANUMERICAL`,Ky=`LOCALHOST`,qy=`TLD`,Jy=`UTLD`,Yy=`SCHEME`,Xy=`SLASH_SCHEME`,Zy=`NUM`,Qy=`WS`,$y=`NL`,eb=`OPENBRACE`,tb=`CLOSEBRACE`,nb=`OPENBRACKET`,rb=`CLOSEBRACKET`,ib=`OPENPAREN`,ab=`CLOSEPAREN`,ob=`OPENANGLEBRACKET`,sb=`CLOSEANGLEBRACKET`,cb=`FULLWIDTHLEFTPAREN`,lb=`FULLWIDTHRIGHTPAREN`,ub=`LEFTCORNERBRACKET`,db=`RIGHTCORNERBRACKET`,fb=`LEFTWHITECORNERBRACKET`,pb=`RIGHTWHITECORNERBRACKET`,mb=`FULLWIDTHLESSTHAN`,hb=`FULLWIDTHGREATERTHAN`,gb=`AMPERSAND`,_b=`APOSTROPHE`,vb=`ASTERISK`,yb=`AT`,bb=`BACKSLASH`,xb=`BACKTICK`,Sb=`CARET`,Cb=`COLON`,wb=`COMMA`,Tb=`DOLLAR`,Eb=`DOT`,Db=`EQUALS`,Ob=`EXCLAMATION`,kb=`HYPHEN`,Ab=`PERCENT`,jb=`PIPE`,Mb=`PLUS`,Nb=`POUND`,Pb=`QUERY`,Fb=`QUOTE`,Ib=`FULLWIDTHMIDDLEDOT`,Lb=`SEMI`,Rb=`SLASH`,zb=`TILDE`,Bb=`UNDERSCORE`,Vb=`EMOJI`,Hb=`SYM`,Ub=Object.freeze({__proto__:null,ALPHANUMERICAL:Gy,AMPERSAND:gb,APOSTROPHE:_b,ASCIINUMERICAL:Wy,ASTERISK:vb,AT:yb,BACKSLASH:bb,BACKTICK:xb,CARET:Sb,CLOSEANGLEBRACKET:sb,CLOSEBRACE:tb,CLOSEBRACKET:rb,CLOSEPAREN:ab,COLON:Cb,COMMA:wb,DOLLAR:Tb,DOT:Eb,EMOJI:Vb,EQUALS:Db,EXCLAMATION:Ob,FULLWIDTHGREATERTHAN:hb,FULLWIDTHLEFTPAREN:cb,FULLWIDTHLESSTHAN:mb,FULLWIDTHMIDDLEDOT:Ib,FULLWIDTHRIGHTPAREN:lb,HYPHEN:kb,LEFTCORNERBRACKET:ub,LEFTWHITECORNERBRACKET:fb,LOCALHOST:Ky,NL:$y,NUM:Zy,OPENANGLEBRACKET:ob,OPENBRACE:eb,OPENBRACKET:nb,OPENPAREN:ib,PERCENT:Ab,PIPE:jb,PLUS:Mb,POUND:Nb,QUERY:Pb,QUOTE:Fb,RIGHTCORNERBRACKET:db,RIGHTWHITECORNERBRACKET:pb,SCHEME:Yy,SEMI:Lb,SLASH:Rb,SLASH_SCHEME:Xy,SYM:Hb,TILDE:zb,TLD:qy,UNDERSCORE:Bb,UTLD:Jy,UWORD:Uy,WORD:Hy,WS:Qy}),Wb=/[a-z]/,Gb=/\p{L}/u,Kb=/\p{Emoji}/u,qb=/\d/,Jb=/\s/,Yb=`\r`,Xb=`
194
- `,Zb=`️`,Qb=`‍`,$b=``,ex=null,tx=null;function nx(e=[]){let t={};zy.groups=t;let n=new zy;ex??=ox(wy),tx??=ox(Ty),q(n,`'`,_b),q(n,`{`,eb),q(n,`}`,tb),q(n,`[`,nb),q(n,`]`,rb),q(n,`(`,ib),q(n,`)`,ab),q(n,`<`,ob),q(n,`>`,sb),q(n,`(`,cb),q(n,`)`,lb),q(n,`「`,ub),q(n,`」`,db),q(n,`『`,fb),q(n,`』`,pb),q(n,`<`,mb),q(n,`>`,hb),q(n,`&`,gb),q(n,`*`,vb),q(n,`@`,yb),q(n,"`",xb),q(n,`^`,Sb),q(n,`:`,Cb),q(n,`,`,wb),q(n,`$`,Tb),q(n,`.`,Eb),q(n,`=`,Db),q(n,`!`,Ob),q(n,`-`,kb),q(n,`%`,Ab),q(n,`|`,jb),q(n,`+`,Mb),q(n,`#`,Nb),q(n,`?`,Pb),q(n,`"`,Fb),q(n,`/`,Rb),q(n,`;`,Lb),q(n,`~`,zb),q(n,`_`,Bb),q(n,`\\`,bb),q(n,`・`,Ib);let r=By(n,qb,Zy,{[Ey]:!0});By(r,qb,r);let i=By(r,Wb,Wy,{[ky]:!0}),a=By(r,Gb,Gy,{[Ay]:!0}),o=By(n,Wb,Hy,{[Dy]:!0});By(o,qb,i),By(o,Wb,o),By(i,qb,i),By(i,Wb,i);let s=By(n,Gb,Uy,{[Oy]:!0});By(s,Wb),By(s,qb,a),By(s,Gb,s),By(a,qb,a),By(a,Wb),By(a,Gb,a);let c=q(n,Xb,$y,{[Fy]:!0}),l=q(n,Yb,Qy,{[Fy]:!0}),u=By(n,Jb,Qy,{[Fy]:!0});q(n,$b,u),q(l,Xb,c),q(l,$b,u),By(l,Jb,u),q(u,Yb),q(u,Xb),By(u,Jb,u),q(u,$b,u);let d=By(n,Kb,Vb,{[My]:!0});q(d,`#`),By(d,Kb,d),q(d,Zb,d);let f=q(d,Qb);q(f,`#`),By(f,Kb,d);let p=[[Wb,o],[qb,i]],m=[[Wb,null],[Gb,s],[qb,a]];for(let e=0;e<ex.length;e++)ax(n,ex[e],qy,Hy,p);for(let e=0;e<tx.length;e++)ax(n,tx[e],Jy,Uy,m);Ly(qy,{tld:!0,ascii:!0},t),Ly(Jy,{utld:!0,alpha:!0},t),ax(n,`file`,Yy,Hy,p),ax(n,`mailto`,Yy,Hy,p),ax(n,`http`,Xy,Hy,p),ax(n,`https`,Xy,Hy,p),ax(n,`ftp`,Xy,Hy,p),ax(n,`ftps`,Xy,Hy,p),Ly(Yy,{scheme:!0,ascii:!0},t),Ly(Xy,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[Ny]:!0}:{[Py]:!0};r.indexOf(`-`)>=0?i[jy]=!0:Wb.test(r)?qb.test(r)?i[ky]=!0:i[Dy]=!0:i[Ey]=!0,Vy(n,r,r,i)}return Vy(n,`localhost`,Ky,{ascii:!0}),n.jd=new zy(Hb),{start:n,tokens:Object.assign({groups:t},Ub)}}function rx(e,t){let n=ix(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function ix(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function ax(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new zy(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new zy(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function ox(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var sx={defaultProtocol:`http`,events:null,format:lx,formatHref:lx,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function cx(e,t=null){let n=Object.assign({},sx);e&&(n=Object.assign(n,e instanceof cx?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}cx.prototype={o:sx,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:sx[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function lx(e){return e}function ux(e,t){this.t=`token`,this.v=e,this.tk=t}ux.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=sx.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function dx(e,t){class n extends ux{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var fx=dx(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),px=dx(`text`),mx=dx(`nl`),hx=dx(`url`,{isLink:!0,toHref(e=sx.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==Ky&&e[1].t===Cb}}),gx=e=>new zy(e);function _x({groups:e}){let t=e.domain.concat([gb,vb,yb,bb,xb,Sb,Tb,Db,kb,Zy,Ab,jb,Mb,Nb,Rb,Hb,zb,Bb]),n=[_b,Cb,wb,Eb,Ob,Ab,Pb,Fb,Lb,ob,sb,eb,tb,rb,nb,ib,ab,cb,lb,ub,db,fb,pb,mb,hb],r=[gb,_b,vb,bb,xb,Sb,Tb,Db,kb,eb,tb,Ab,jb,Mb,Nb,Pb,Rb,Hb,zb,Bb],i=gx(),a=q(i,zb);K(a,r,a),K(a,e.domain,a);let o=gx(),s=gx(),c=gx();K(i,e.domain,o),K(i,e.scheme,s),K(i,e.slashscheme,c),K(o,r,a),K(o,e.domain,o);let l=q(o,yb);q(a,yb,l),q(s,yb,l),q(c,yb,l);let u=q(a,Eb);K(u,r,a),K(u,e.domain,a);let d=gx();K(l,e.domain,d),K(d,e.domain,d);let f=q(d,Eb);K(f,e.domain,d);let p=gx(fx);K(f,e.tld,p),K(f,e.utld,p),q(l,Ky,p);let m=q(d,kb);q(m,kb,m),K(m,e.domain,d),K(p,e.domain,d),q(p,Eb,f),q(p,kb,m);let h=q(o,kb),g=q(o,Eb);q(h,kb,h),K(h,e.domain,o),K(g,r,a),K(g,e.domain,o);let _=gx(hx);K(g,e.tld,_),K(g,e.utld,_),K(_,e.domain,o),K(_,r,a),q(_,Eb,g),q(_,kb,h),q(_,yb,l);let v=q(_,Cb),y=gx(hx);K(v,e.numeric,y);let b=gx(hx),x=gx();K(b,t,b),K(b,n,x),K(x,t,b),K(x,n,x),q(_,Rb,b),q(y,Rb,b);let S=q(s,Cb),C=q(q(q(c,Cb),Rb),Rb);K(s,e.domain,o),q(s,Eb,g),q(s,kb,h),K(c,e.domain,o),q(c,Eb,g),q(c,kb,h),K(S,e.domain,b),q(S,Rb,b),q(S,Pb,b),K(C,e.domain,b),K(C,t,b),q(C,Rb,b);let w=[[eb,tb],[nb,rb],[ib,ab],[ob,sb],[cb,lb],[ub,db],[fb,pb],[mb,hb]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=q(b,r);q(x,r,a);let o=gx(hx);K(a,t,o);let s=gx();K(a,n,s),q(a,i,b),K(o,t,o),K(o,n,s),K(s,t,o),K(s,n,s),q(o,i,b),q(s,i,b)}return q(i,Ky,_),q(i,$y,mx),{start:i,tokens:Ub}}function vx(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(yx(px,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(yx(e,t,r))}}return o.length>0&&a.push(yx(px,t,o)),a}function yx(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var bx=typeof console<`u`&&console&&console.warn||(()=>{}),xx=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,J={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Sx(){return zy.groups={},J.scanner=null,J.parser=null,J.tokenQueue=[],J.pluginQueue=[],J.customSchemes=[],J.initialized=!1,J}function Cx(e,t=!1){if(J.initialized&&bx(`linkifyjs: already initialized - will not register custom scheme "${e}" ${xx}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
195
- 1. Must only contain digits, lowercase ASCII letters or "-"
196
- 2. Cannot start or end with "-"
197
- 3. "-" cannot repeat`);J.customSchemes.push([e,t])}function wx(){J.scanner=nx(J.customSchemes);for(let e=0;e<J.tokenQueue.length;e++)J.tokenQueue[e][1]({scanner:J.scanner});J.parser=_x(J.scanner.tokens);for(let e=0;e<J.pluginQueue.length;e++)J.pluginQueue[e][1]({scanner:J.scanner,parser:J.parser});return J.initialized=!0,J}function Tx(e){return J.initialized||wx(),vx(J.parser.start,e,rx(J.scanner.start,e))}Tx.scan=rx;function Ex(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new cx(n),i=Tx(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var Dx=`[\0- \xA0 ᠎ -\u2029  ]`,Ox=new RegExp(Dx),kx=RegExp(`${Dx}$`),Ax=new RegExp(Dx,`g`);function jx(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function Mx(e){return new R({key:new z(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(am(Op(n.doc,[...t])).forEach(({newRange:t})=>{let n=Ap(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!kx.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(Ox).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=Tx(n).map(t=>t.toObject(e.defaultProtocol));if(!jx(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{om(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function Nx(e){return new R({key:new z(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=nm(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function Px(e){return new R({key:new z(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=Ex(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function Fx(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(Ax,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var Ix=ih.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){Cx(e);return}Cx(e.scheme,e.optionalSlashes)})},onDestroy(){Sx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!Fx(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Fx(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Fx(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,H(this.options.HTMLAttributes,e),0]:[`a`,H(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!Fx(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Fx(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[Zh({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=Ex(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Fx(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Mx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Fx(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Nx({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Px({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Lx=Object.defineProperty,Rx=(e,t)=>{for(var n in t)Lx(e,n,{get:t[n],enumerable:!0})},zx=`listItem`,Bx=`textStyle`,Vx=/^\s*([-+*])\s$/,Hx=Yh.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,H(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
198
- `):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(zx,this.editor.getAttributes(Bx)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=jh({find:Vx,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=jh({find:Vx,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Bx),editor:this.editor})),[e]}});function Ux(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function Wx(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var Gx=Yh.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,H(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(Ux(e))return{type:`listItem`,content:[{type:`paragraph`,content:Wx(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>qh(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});Rx({},{findListItemPos:()=>Kx,getNextListDepth:()=>qx,handleBackspace:()=>Zx,handleDelete:()=>eS,hasListBefore:()=>Jx,hasListItemAfter:()=>tS,hasListItemBefore:()=>Yx,listItemHasSubList:()=>Xx,nextListIsDeeper:()=>Qx,nextListIsHigher:()=>$x});var Kx=(e,t)=>{let{$from:n}=t.selection,r=xf(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},qx=(e,t)=>{let n=Kx(e,t);if(!n)return!1;let[,r]=sm(t,e,n.$pos.pos+4);return r},Jx=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},Yx=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},Xx=(e,t,n)=>{if(!n)return!1;let r=xf(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},Zx=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!up(e.state,t)&&Jx(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!up(e.state,t)||!mm(e.state))return!1;let r=Kx(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=Xx(t,e.state,i);return Yx(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Qx=(e,t)=>{let n=qx(e,t),r=Kx(e,t);return!r||!n?!1:n>r.depth},$x=(e,t)=>{let n=qx(e,t),r=Kx(e,t);return!r||!n?!1:n<r.depth},eS=(e,t)=>{if(!up(e.state,t)||!pm(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:Qx(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():$x(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},tS=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},nS=U.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&eS(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&eS(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&Zx(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&Zx(e,n,r)&&(t=!0)}),t}}}}),rS=/^(\s*)(\d+)\.\s+(.*)$/,iS=/^\s/;function aS(e){let t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function oS(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&aS(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function sS(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(rS);if(!a)break;let[,o,s,c]=a,l=o.length,u=[c],d=n+1,f=[i],p=!1;for(;d<e.length;){let t=e[d];if(t.match(rS))break;if(t.trim()===``)f.push(t),u.push(``),p=!0,d+=1;else if(t.match(iS))f.push(t),u.push(t.slice(l+2)),d+=1;else{if(p)break;f.push(t),u.push(t),d+=1}}t.push({indent:l,number:parseInt(s,10),content:u.join(`
199
- `).trim(),contentLines:u,raw:f.join(`
200
- `)}),r=d,n=d}return[t,r]}function cS(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=oS(a.contentLines),c=o.join(`
201
- `).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
202
- `).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=cS(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,items:e,raw:f.map(e=>e.raw).join(`
203
- `)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function lS(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var uS=`listItem`,dS=`textStyle`,fS=/^(\d+)\.\s$/,pS=Yh.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,H(this.options.HTMLAttributes,n),0]:[`ol`,H(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?lS(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
204
- `):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
205
- `),[i,a]=sS(r);if(i.length===0)return;let o=cS(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
206
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(uS,this.editor.getAttributes(dS)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=jh({find:fS,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=jh({find:fS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(dS)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),mS=/^\s*(\[([( |x])?\])\s$/,hS=Yh.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,H(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>qh(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=Vp(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[jh({find:mS,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),gS=Yh.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,H(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
207
- `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=Kh(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=Kh(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});U.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(Hx.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(Gx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(nS.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(pS.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(hS.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(gS.configure(this.options.taskList)),e}});var _S=`&nbsp;`,vS=`\xA0`,yS=Yh.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,H(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===_S||n[0].text===_S||n[0].raw===vS||n[0].text===vS)&&r.length===1&&r[0].type===`text`&&(r[0].text===_S||r[0].text===vS)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?_S:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),bS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,xS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,SS=ih.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,H(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Oh({find:bS,type:this.type})]},addPasteRules(){return[Zh({find:xS,type:this.type})]}}),CS=Yh.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),wS=ih.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,H(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),TS=U.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(dy.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(oy.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(Hx.configure(this.options.bulletList)),this.options.code!==!1&&e.push(eg.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(hy.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(gy.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(Qg.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push($g.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(_y.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(vy.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(g_.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(ng.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Cy.configure(this.options.italic)),this.options.listItem!==!1&&e.push(Gx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(nS.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Ix.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(pS.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(yS.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(SS.configure(this.options.strike)),this.options.text!==!1&&e.push(CS.configure(this.options.text)),this.options.underline!==!1&&e.push(wS.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(h_.configure(this.options?.trailingNode)),e}});function ES(e){return se((t,n)=>({get(){return t(),e},set(t){e=t,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var DS=class extends Dh{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=ES(this.view.state),this.reactiveExtensionStorage=ES(this.extensionStorage),this.on(`beforeTransaction`,({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),le(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){let n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){let t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}},OS=S({name:`EditorContent`,props:{editor:{default:null,type:Object}},setup(e){let t=A(),n=l();return _e(()=>{let r=e.editor;r&&r.options.element&&t.value&&d(()=>{if(!t.value||!r.view.dom?.parentNode)return;let e=b(t.value);t.value.append(...r.view.dom.parentNode.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:e}),r.createNodeViews()})}),E(()=>{let t=e.editor;t&&(t.contentComponent=null,t.appContext=null)}),{rootEl:t}},render(){return h(`div`,{ref:e=>{this.rootEl=e}})}});S({name:`NodeViewContent`,props:{as:{type:String,default:`div`}},render(){return h(this.as,{style:{whiteSpace:`pre-wrap`},"data-node-view-content":``})}});var kS=S({name:`NodeViewWrapper`,props:{as:{type:String,default:`div`}},inject:[`onDragStart`,`decorationClasses`],render(){var e;return h(this.as,{class:this.decorationClasses,style:{whiteSpace:`normal`},"data-node-view-wrapper":``,onDragstart:this.onDragStart},(e=this.$slots).default?.call(e))}}),AS=(e={})=>{let t=ee();return u(()=>{t.value=new DS(e)}),E(()=>{var e;(e=t.value)==null||e.destroy()}),t},jS=class{constructor(e,{props:t={},editor:n}){this.destroyed=!1,this.editor=n,this.component=le(e),this.el=document.createElement(`div`),this.props=ae(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){return this.renderedComponent.vNode?.component?.exposed?this.renderedComponent.vNode.component.exposed:this.renderedComponent.vNode?.component?.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let e=h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<`u`&&this.el&&we(e,this.el),{vNode:e,destroy:()=>{this.el&&we(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){this.destroyed||(Object.entries(e).forEach(([e,t])=>{this.props[e]=t}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}};S({name:`MarkViewContent`,props:{as:{type:String,default:`span`}},render(){return h(this.as,{style:{whiteSpace:`inherit`},"data-mark-view-content":``})}});var MS=class extends Xh{constructor(e,t,n){super(e,t,n),this.cachedExtensionWithSyncedStorage=null,this.handlePositionUpdate=()=>{let e=this.getPos();typeof e!=`number`||e===this.currentPos||(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}))},this.options.trackNodeViewPosition&&this.editor.on(`update`,this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode()},t=e,n=this.onDragStart.bind(this);this.decorationClasses=A(this.getDecorationClasses());let r=S({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:e=>{var t;return re(`onDragStart`,n),re(`decorationClasses`,this.decorationClasses),(t=this.component).setup?.call(t,e,{expose:()=>void 0})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on(`selectionUpdate`,this.handleSelectionUpdate),this.currentPos=this.getPos(),this.renderer=new jS(r,{editor:this.editor,props:t})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector(`[data-node-view-content]`)}handleSelectionUpdate(){let e=this.getPos();if(typeof e==`number`)if(ym({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,n){let r=e=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(e)};if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e.type!==this.node.type)return!1;if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,this.decorationClasses.value=this.getDecorationClasses(),!0;this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos();let i={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(i.getPos=()=>this.getPos()),r(i),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add(`ProseMirror-selectednode`)}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove(`ProseMirror-selectednode`)}getDecorationClasses(){return this.decorations.flatMap(e=>e.type.attrs.class).join(` `)}destroy(){this.renderer.destroy(),this.editor.off(`selectionUpdate`,this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off(`update`,this.handlePositionUpdate)}};function NS(e,t){return n=>n.editor.contentComponent?new MS(typeof e==`function`&&`__vccOpts`in e?e.__vccOpts:e,n,t):{}}function PS(e,t){if(!t?.schema)return!1;let n=typeof e==`string`?e:e.name;return t.schema.spec.marks.get(n)!==void 0}function FS(e,t){if(!e)return!1;let{selection:n}=e.state,{$from:r,to:i}=n;return t.some(t=>e.state.doc.nodesBetween(r.pos,i,e=>e.type.name===t))}function IS(e,t){return e?e.extensionManager.extensions.some(e=>e.name===t):!1}function LS(e){let t=`toggle${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:e=>e.can()[t](),execute:e=>e.chain().focus()[t](),isActive:t=>t.isActive(e),isDisabled:e=>FS(e,[`image`])||e.isActive(`code`)}}function RS(e){let t=`set${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:e=>e.can()[t](),execute:e=>e.chain().focus()[t](),isActive:t=>t.isActive(e),isDisabled:e=>FS(e,[`image`])||e.isActive(`code`)}}function zS(e){return{canExecute:t=>t.can()[e](),execute:t=>t.chain()[e](),isActive:()=>!1,isDisabled:void 0}}function BS(){return{canExecute:(e,t)=>e.can().toggleMark(t.mark),execute:(e,t)=>e.chain().focus().toggleMark(t.mark),isActive:(e,t)=>e.isActive(t.mark),isDisabled:(e,t)=>!PS(t.mark,e)||FS(e,[`image`])}}function VS(){return{canExecute:(e,t)=>e.can().setTextAlign(t.align),execute:(e,t)=>e.chain().focus().setTextAlign(t.align),isActive:(e,t)=>e.isActive({textAlign:t.align}),isDisabled:e=>!IS(e,`textAlign`)||FS(e,[`image`,`horizontalRule`])}}function HS(){return{canExecute:(e,t)=>e.can().toggleHeading({level:t.level}),execute:(e,t)=>e.chain().focus().toggleHeading({level:t.level}),isActive:(e,t)=>e.isActive(`heading`,{level:t.level}),isDisabled:e=>FS(e,[`image`])||e.isActive(`code`)}}function US(){return{canExecute:e=>e.can().setLink({href:``})||e.can().unsetLink(),execute:(e,t)=>{let n=e.chain(),r=e.getAttributes(`link`).href,i=e.isActive(`code`);if(r)return n.focus().unsetLink();let a=t?.href||prompt(`Enter the URL:`);return a?i?n.focus().extendMarkRange(`code`).setLink({href:a}):n.focus().setLink({href:a}):n},isActive:e=>e.isActive(`link`),isDisabled:e=>{if(!IS(e,`link`)||FS(e,[`image`]))return!0;let{selection:t}=e.state;return t.empty&&!e.isActive(`link`)}}}function WS(){return{canExecute:e=>e.can().setImage({src:``}),execute:(e,t)=>{let n=e.chain().focus();if(t?.src)return n.setImage({src:t.src});let r=prompt(`Enter the image URL:`);return r?n.setImage({src:r}):n},isActive:e=>e.isActive(`image`),isDisabled:e=>!IS(e,`image`)}}function GS(e){let t={bulletList:`toggleBulletList`,orderedList:`toggleOrderedList`,taskList:`toggleTaskList`}[e],n=e===`taskList`?`taskItem`:`listItem`,r=[`bulletList`,`orderedList`,`taskList`];return{canExecute:e=>e.can()[t]()||e.isActive(`listItem`)||r.some(t=>IS(e,t)&&e.isActive(t)),execute:i=>{let{state:a}=i,{selection:o}=a,s=i.chain().focus();if(o.node){let e=o.node,t=e.firstChild?.firstChild,n=e.lastChild?.lastChild,r=t?o.from+t.nodeSize:o.from+1,i=n?o.to-n.nodeSize:o.to-1;s=s.setTextSelection({from:r,to:i}).clearNodes()}if(i.isActive(e)){let e=s.liftListItem(n);for(let t of r)IS(i,t)&&(e=e.lift(t));return e.selectTextblockEnd()}if(r.some(e=>IS(i,e)&&i.isActive(e))){let e=i.isActive(`taskList`)?`taskItem`:`listItem`,n=s.liftListItem(e);for(let e of r)IS(i,e)&&(n=n.lift(e));return n[t]().selectTextblockEnd()}return s[t]().selectTextblockEnd()},isActive:t=>t.isActive(e),isDisabled:t=>IS(t,e)?FS(t,[`image`])||t.isActive(`code`):!0}}function KS(e){return{canExecute:(t,n)=>{if(n?.pos==null||!t.state.doc.nodeAt(n.pos))return!1;let r=t.state.doc.resolve(n.pos),i=r.parent,a=r.index();return e===`up`?a>0:a<i.childCount-1},execute:(t,n)=>{if(n?.pos==null)return t.chain();let r=t.state.doc.nodeAt(n.pos);if(!r)return t.chain();let i=t.state.doc.resolve(n.pos),a=i.parent,o=i.index();if(e===`up`&&o>0){let e=a.child(o-1),i=n.pos-e.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+r.nodeSize}).insertContentAt(i,r.toJSON())}if(e===`down`&&o<a.childCount-1){let e=a.child(o+1),i=n.pos+e.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+r.nodeSize}).insertContentAt(i,r.toJSON())}return t.chain()},isActive:()=>!1,isDisabled:void 0}}function qS(){return{mark:BS(),textAlign:VS(),heading:HS(),link:US(),image:WS(),blockquote:LS(`blockquote`),bulletList:GS(`bulletList`),orderedList:GS(`orderedList`),taskList:GS(`taskList`),codeBlock:LS(`codeBlock`),horizontalRule:RS(`horizontalRule`),paragraph:RS(`paragraph`),undo:zS(`undo`),redo:zS(`redo`),clearFormatting:{canExecute:(e,t)=>t?.pos==null?e.can().clearNodes()||e.can().unsetAllMarks():!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos!=null){let n=e.state.doc.nodeAt(t.pos);if(!n)return e.chain();let r=t.pos+1,i=t.pos+n.nodeSize-1;return e.chain().focus().setTextSelection({from:r,to:i}).clearNodes().unsetAllMarks()}return e.chain().focus().clearNodes().unsetAllMarks()},isActive:()=>!1,isDisabled:void 0},duplicate:{canExecute:(e,t)=>t?.pos==null?!1:!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();let n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().insertContentAt(t.pos+n.nodeSize,n.toJSON()):e.chain()},isActive:()=>!1,isDisabled:void 0},delete:{canExecute:(e,t)=>t?.pos==null?!1:!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();let n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().deleteRange({from:t.pos,to:t.pos+n.nodeSize}):e.chain()},isActive:()=>!1,isDisabled:void 0},moveUp:KS(`up`),moveDown:KS(`down`),suggestion:{canExecute:()=>!0,execute:(e,t)=>{let{state:n}=e,{selection:r}=n,{$from:i}=r;if(t?.pos!==void 0){let r=n.doc.nodeAt(t.pos);if(r){let n=t.pos+r.nodeSize;return e.chain().focus().insertContentAt(n,{type:`paragraph`,content:[{type:`text`,text:`/`}]})}}let a=i.node(i.depth),o=i.before(i.depth)+a.nodeSize;return e.chain().focus().insertContentAt(o,{type:`paragraph`,content:[{type:`text`,text:`/`}]})},isActive:()=>!1,isDisabled:void 0},mention:{canExecute:()=>!0,execute:e=>{let{state:t}=e,{selection:n}=t,{$from:r}=n,i=r.parent.textBetween(Math.max(0,r.parentOffset-1),r.parentOffset,void 0,` `),a=i&&i!==` `;return e.chain().focus().insertContent(a?` @`:`@`)},isActive:()=>!1,isDisabled:void 0},emoji:{canExecute:()=>!0,execute:e=>{let{state:t}=e,{selection:n}=t,{$from:r}=n,i=r.parent.textBetween(Math.max(0,r.parentOffset-1),r.parentOffset,void 0,` `),a=i&&i!==` `;return e.chain().focus().insertContent(a?` :`:`:`)},isActive:()=>!1,isDisabled:void 0}}}function JS(e,t,n){let r={...qS(),...n};return ge(t)?t.map(t=>JS(e,t,n)):t.filter(Boolean).map(t=>{if(`type`in t)return t;let{kind:i,children:a,...o}=t,s=a?.length?JS(e,a,n):void 0;if(i){let n=r[i];return n?{...o,children:s,disabled:n.isDisabled?.(e,t)||!n.canExecute(e,t),active:n.isActive(e,t),onSelect:()=>n.execute(e,t).run()}:{...o,children:s}}return{...o,children:s}})}function YS(e){let t=[];return e.offset&&t.push(He(typeof e.offset==`boolean`?void 0:e.offset)),e.flip&&t.push(Pe(typeof e.flip==`boolean`?void 0:e.flip)),e.shift&&t.push(We(typeof e.shift==`boolean`?void 0:e.shift)),e.size&&t.push(ke(typeof e.size==`boolean`?void 0:e.size)),e.autoPlacement&&t.push(Le(typeof e.autoPlacement==`boolean`?void 0:e.autoPlacement)),e.hide&&t.push(Ne(typeof e.hide==`boolean`?void 0:e.hide)),e.inline&&t.push(Oe(typeof e.inline==`boolean`?void 0:e.inline)),t}var XS={slots:{root:``,content:`relative size-full flex-1`,base:[`w-full outline-none *:my-5 *:first:mt-0 *:last:mb-0 sm:px-8 selection:bg-primary/20`,`[&_p]:leading-7`,`[&_a]:text-primary [&_a]:border-b [&_a]:border-transparent [&_a]:hover:border-primary [&_a]:font-medium`,`[&_a]:transition-colors`,`[&_a>code]:border-dashed [&_a:hover>code]:border-primary [&_a:hover>code]:text-primary`,`[&_a>code]:transition-colors`,`[&_.mention]:text-primary [&_.mention]:font-medium`,`[&_:is(h1,h2,h3,h4,h5,h6)]:text-highlighted [&_:is(h1,h2,h3,h4,h5,h6)]:font-bold`,`[&_h1]:text-3xl`,`[&_h2]:text-2xl`,`[&_h3]:text-xl`,`[&_h4]:text-lg`,`[&_h5]:text-base`,`[&_h6]:text-base`,`[&_:is(h1,h2,h3,h4,h5,h6)>code]:border-dashed [&_:is(h1,h2,h3,h4,h5,h6)>code]:font-bold`,`[&_h2>code]:text-xl/6`,`[&_h3>code]:text-lg/5`,`[&_blockquote]:border-s-4 [&_blockquote]:border-accented [&_blockquote]:ps-4 [&_blockquote]:italic`,`[&_[data-type=horizontalRule]]:my-8 [&_[data-type=horizontalRule]]:py-2`,`[&_hr]:border-t [&_hr]:border-default`,`[&_pre]:text-sm/6 [&_pre]:border [&_pre]:border-muted [&_pre]:bg-muted [&_pre]:rounded-md [&_pre]:px-4 [&_pre]:py-3 [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:overflow-x-auto`,`[&_pre_code]:p-0 [&_pre_code]:text-inherit [&_pre_code]:font-inherit [&_pre_code]:rounded-none [&_pre_code]:inline [&_pre_code]:border-0 [&_pre_code]:bg-transparent`,`[&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-sm [&_code]:font-mono [&_code]:font-medium [&_code]:rounded-md [&_code]:inline-block [&_code]:border [&_code]:border-muted [&_code]:text-highlighted [&_code]:bg-muted`,`[&_:is(ul,ol)]:ps-6`,`[&_ul]:list-disc [&_ul]:marker:text-(--ui-border-accented)`,`[&_ol]:list-decimal [&_ol]:marker:text-muted`,`[&_li]:my-1.5 [&_li]:ps-1.5`,`[&_img]:rounded-md [&_img]:block [&_img]:max-w-full [&_img.ProseMirror-selectednode]:outline-2 [&_img.ProseMirror-selectednode]:outline-primary`,`[&_.ProseMirror-selectednode:not(img):not(pre):not([data-node-view-wrapper])]:bg-primary/20`]},variants:{placeholderMode:{firstLine:{base:`[&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:content-[attr(data-placeholder)] [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:text-dimmed [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:float-start [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:h-0 [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:pointer-events-none`},everyLine:{base:`[&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:content-[attr(data-placeholder)] [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:text-dimmed [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:float-start [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:h-0 [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:pointer-events-none`}}},defaultVariants:{placeholderMode:`everyLine`}},ZS=Object.assign({inheritAttrs:!1},{__name:`Editor`,props:{as:{type:null,required:!1},modelValue:{type:null,required:!1},contentType:{type:String,required:!1},starterKit:{type:Object,required:!1},placeholder:{type:[String,Object],required:!1},markdown:{type:Object,required:!1},image:{type:[Boolean,Object],required:!1,default:!0},mention:{type:[Boolean,Object],required:!1,default:!0},handlers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},extensions:{type:Array,required:!1},injectCSS:{type:Boolean,required:!1},injectNonce:{type:null,required:!1},autofocus:{type:[String,Number,Boolean,null],required:!1},editable:{type:Boolean,required:!1},textDirection:{type:String,required:!1},editorProps:{type:Object,required:!1},parseOptions:{type:Object,required:!1},coreExtensionOptions:{type:Object,required:!1},enableInputRules:{type:[Array,Boolean],required:!1},enablePasteRules:{type:[Array,Boolean],required:!1},enableCoreExtensions:{type:[Boolean,Object],required:!1},enableContentCheck:{type:Boolean,required:!1},emitContentError:{type:Boolean,required:!1},onBeforeCreate:{type:Function,required:!1},onCreate:{type:Function,required:!1},onMount:{type:Function,required:!1},onUnmount:{type:Function,required:!1},onContentError:{type:Function,required:!1},onUpdate:{type:Function,required:!1},onSelectionUpdate:{type:Function,required:!1},onTransaction:{type:Function,required:!1},onFocus:{type:Function,required:!1},onBlur:{type:Function,required:!1},onDestroy:{type:Function,required:!1},onPaste:{type:Function,required:!1},onDrop:{type:Function,required:!1},onDelete:{type:Function,required:!1},enableExtensionDispatchTransaction:{type:Boolean,required:!1}},emits:[`update:modelValue`],setup(e,{expose:a,emit:s}){let l=e,u=s,d=Ge(`editor`,l),f=ye(),p=t(),h=c(()=>et({extend:et(XS),...p.ui?.editor||{}})({placeholderMode:typeof d.placeholder==`object`?d.placeholder.mode:void 0})),g=qe(he(d,`starterKit`,`extensions`,`editorProps`,`contentType`,`class`,`placeholder`,`markdown`,`image`,`mention`,`handlers`)),_=c(()=>o(d.editorProps,{attributes:{autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,...f,class:h.value.base({class:d.ui?.base})}})),v=c(()=>d.contentType||(typeof d.modelValue==`string`?`html`:`json`)),S=c(()=>o(d.starterKit,{code:!1,horizontalRule:!1,dropcursor:{color:`var(--ui-primary)`,width:2},link:{openOnClick:!1}})),C=c(()=>{let{mode:e,...t}=(typeof d.placeholder==`string`?{placeholder:d.placeholder}:d.placeholder)||{};return o(t,{showOnlyWhenEditable:!1,showOnlyCurrent:!0})}),w=c(()=>o(d.markdown,{markedOptions:{gfm:!0}})),ee=c(()=>typeof d.image==`boolean`?{}:d.image),te=c(()=>o(typeof d.mention==`boolean`?{}:d.mention,{HTMLAttributes:{class:`mention`},renderText({node:e}){return`${e.attrs.mentionSuggestionChar??`@`}${e.attrs.label??e.attrs.id}`},renderHTML({options:e,node:t}){return[`span`,H({"data-type":`mention`},e.HTMLAttributes),`${t.attrs.mentionSuggestionChar??`@`}${t.attrs.label??t.attrs.id}`]}})),T=c(()=>[v.value===`markdown`&&ry.configure(w.value),TS.configure(S.value),tg.extend({excludes:`code`}),rg.extend({renderHTML(){return[`div`,H(this.options.HTMLAttributes,{"data-type":this.name}),[`hr`]]}}),d.image!==!1&&ag.configure(ee.value),d.mention!==!1&&mg.configure(te.value),d.placeholder&&__.configure(C.value),...d.extensions||[]].filter(e=>!!e)),E=AS({...g.value,content:d.modelValue,contentType:v.value,extensions:T.value,editorProps:_.value,onCreate:({editor:e})=>{d.placeholder&&e.view.dispatch(e.state.tr)},onUpdate:({editor:e})=>{let t;try{v.value===`html`?t=e.getHTML():v.value===`json`?t=e.getJSON():v.value===`markdown`&&(t=e.getMarkdown())}catch{t=e.getText()}u(`update:modelValue`,t)}});me(()=>d.modelValue,e=>{if(!(!E.value||e==null)&&(v.value===`html`?E.value.getHTML():v.value===`json`?JSON.stringify(E.value.getJSON()):v.value===`markdown`?E.value.getMarkdown():E.value.getText())!==(v.value===`json`&&typeof e==`object`?JSON.stringify(e):String(e))){let t=E.value.state.selection.from;E.value.commands.setContent(e,{contentType:v.value}),t<=E.value.state.doc.content.size&&E.value.commands.setTextSelection(t)}});let ne=c(()=>({...qS(),...d.handlers}));return re(`editorHandlers`,ne),a({editor:E}),(e,t)=>(m(),x(b($e),{as:b(d).as,"data-slot":`root`,class:n(h.value.root({class:[b(d).ui?.root,b(d).class]}))},{default:k(()=>[b(E)?(m(),r(i,{key:0},[D(e.$slots,`default`,{editor:b(E),handlers:ne.value}),y(b(OS),{role:`presentation`,editor:b(E),"data-slot":`content`,class:n(h.value.content({class:b(d).ui?.content}))},null,8,[`editor`,`class`])],64)):O(``,!0)]),_:3},8,[`as`,`class`]))}}),QS,$S;if(typeof WeakMap<`u`){let e=new WeakMap;QS=t=>e.get(t),$S=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;QS=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},$S=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var eC=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return QS(e)||$S(e,tC(e))}};function tC(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=nC(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new eC(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&rC(s,o,e),s}function nC(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function rC(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=iC(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function iC(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function aC(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}new z(`selectingCells`);function oC(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function sC(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function cC(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=oC(t.$head)||lC(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function lC(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function uC(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function dC(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function fC(e,t,n){let r=e.node(-1),i=eC.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function pC(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}var mC=class e extends F{constructor(e,t=e){let n=e.node(-1),r=eC.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new po(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(uC(r)&&uC(i)&&dC(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return I.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=eC.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=pC(e,0,l)),u>0&&(e=pC(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(M.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new P(M.from(o),1,1)}replace(e,t=P.empty){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);e.replace(s.map(a.pos),s.map(o.pos),i?P.empty:t)}let i=F.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new P(M.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=eC.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=eC.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=eC.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=eC.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new hC(this.$anchorCell.pos,this.$headCell.pos)}};mC.prototype.visible=!1,F.jsonID(`cell`,mC);var hC=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){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&dC(t,n)?new mC(t,n):F.near(n,1)}};new z(`fix-tables`);function gC(e){let t=e.selection,n=cC(e),r=n.node(-1),i=n.start(-1),a=eC.get(r);return{...t instanceof mC?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function _C(e){return function(t,n){if(!sC(t))return!1;if(n){let r=aC(t.schema),i=gC(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function vC(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function yC(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?_C(e):function(t,n){if(!sC(t))return!1;if(n){let r=aC(t.schema),i=gC(t),a=t.tr,o=vC(`row`,i,r),s=vC(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}yC(`row`,{useDeprecatedLogic:!0}),yC(`column`,{useDeprecatedLogic:!0}),yC(`cell`,{useDeprecatedLogic:!0});function bC(e,t){let n=e.selection;if(!(n instanceof mC))return!1;if(t){let r=e.tr,i=aC(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new P(i,0,0))}),r.docChanged&&t(r)}return!0}cf({ArrowLeft:SC(`horiz`,-1),ArrowRight:SC(`horiz`,1),ArrowUp:SC(`vert`,-1),ArrowDown:SC(`vert`,1),"Shift-ArrowLeft":CC(`horiz`,-1),"Shift-ArrowRight":CC(`horiz`,1),"Shift-ArrowUp":CC(`vert`,-1),"Shift-ArrowDown":CC(`vert`,1),Backspace:bC,"Mod-Backspace":bC,Delete:bC,"Mod-Delete":bC});function xC(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function SC(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof mC)return xC(n,r,F.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=wC(i,e,t);if(o==null)return!1;if(e==`horiz`)return xC(n,r,F.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=fC(i,e,t),s;return s=a?F.near(a,1):t<0?F.near(n.doc.resolve(i.before(-1)),-1):F.near(n.doc.resolve(i.after(-1)),1),xC(n,r,s)}}}function CC(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof mC)o=a;else{let r=wC(i,e,t);if(r==null)return!1;o=new mC(n.doc.resolve(r))}let s=fC(o.$headCell,e,t);return s?xC(n,r,new mC(o.$anchorCell,s)):!1}}function wC(e,t,n){if(!(e.state.selection instanceof I))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}new z(`tableColumnResizing`);function TC(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var EC=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&Rf(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Pe(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(We(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(He(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Me(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ke(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Le(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ne(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Oe(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Cm(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof L){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof mC){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():TC(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Fe(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},DC=e=>new R({key:typeof e.pluginKey==`string`?new z(e.pluginKey):e.pluginKey,view:t=>new EC({view:t,...e})}),OC=S({name:`BubbleMenu`,inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:void 0},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(e,{slots:t,attrs:n}){let r=A(null),i=e.pluginKey??new z(`bubbleMenu`);return u(()=>{let{editor:t,options:n,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}=e,u=r.value;u&&(u.style.visibility=`hidden`,u.style.position=`absolute`,u.remove(),d(()=>{t.registerPlugin(DC({editor:t,element:u,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}))}))}),E(()=>{let{editor:t}=e;t.unregisterPlugin(i)}),()=>h(`div`,{ref:r,...n},t.default?.call(t))}}),kC=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return $p(e,{textSerializers:em(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Pe(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(We(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(He(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Me(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ke(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Le(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ne(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Oe(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=Cm(this.view,e.from,e.to);Fe({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},AC=e=>new R({key:typeof e.pluginKey==`string`?new z(e.pluginKey):e.pluginKey,view:t=>new kC({view:t,...e})}),jC=S({name:`FloatingMenu`,inheritAttrs:!1,props:{pluginKey:{type:null,default:void 0},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(e,{slots:t,attrs:n}){let r=A(null),i=e.pluginKey??new z(`floatingMenu`);return u(()=>{let{editor:t,updateDelay:n,resizeDelay:a,options:o,appendTo:s,shouldShow:c}=e,l=r.value;l&&(l.style.visibility=`hidden`,l.style.position=`absolute`,l.remove(),t.registerPlugin(AC({pluginKey:i,editor:t,element:l,updateDelay:n,resizeDelay:a,options:o,appendTo:s,shouldShow:c})))}),E(()=>{let{editor:t}=e;t.unregisterPlugin(i)}),()=>h(`div`,{ref:r,...n},t.default?.call(t))}}),MC={slots:{content:`flex items-center gap-1 bg-default text-highlighted shadow-sm rounded-sm ring ring-default h-6 px-2.5 py-1 text-xs select-none data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-tooltip-content-transform-origin) pointer-events-auto`,arrow:`fill-bg stroke-default`,text:`truncate`,kbds:`hidden lg:inline-flex items-center shrink-0 gap-0.5 not-first-of-type:before:content-['·'] not-first-of-type:before:me-0.5`,kbdsSize:`sm`}},NC={__name:`Tooltip`,props:{text:{type:String,required:!1},kbds:{type:Array,required:!1},content:{type:Object,required:!1},arrow:{type:[Boolean,Object],required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},reference:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1},delayDuration:{type:Number,required:!1},disableHoverableContent:{type:Boolean,required:!1},disableClosingTrigger:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},ignoreNonKeyboardFocus:{type:Boolean,required:!1}},emits:[`update:open`],setup(e,{emit:a}){let s=e,l=a,u=ue(),d=Ge(`tooltip`,s),f=t(),h=pt(),g=qe(ve(d,`defaultOpen`,`open`,`delayDuration`,`disableHoverableContent`,`disableClosingTrigger`,`ignoreNonKeyboardFocus`),l),_=at(Se(()=>d.portal)),S=Se(()=>o(d.content,h.content.value,{side:`bottom`,sideOffset:8,collisionPadding:8})),C=Se(()=>o(d.arrow,{rounded:!0})),w=c(()=>et({extend:et(MC),...f.ui?.tooltip||{}})({side:S.value.side}));return(e,t)=>(m(),x(b(St),T(b(g),{disabled:!(b(d).text||b(d).kbds?.length||u.content)||b(d).disabled}),{default:k(({open:t})=>[u.default||b(d).reference?(m(),x(b(Dt),T({key:0},e.$attrs,{"as-child":``,reference:b(d).reference,class:b(d).class}),{default:k(()=>[D(e.$slots,`default`,{open:t})]),_:2},1040,[`reference`,`class`])):O(``,!0),y(b(Et),de(p(b(_))),{default:k(()=>[y(b(Xe),null,{default:k(()=>[y(b(Tt),T(S.value,{"data-slot":`content`,class:w.value.content({class:[!u.default&&b(d).class,b(d).ui?.content]})}),{default:k(()=>[D(e.$slots,`content`,{ui:w.value},()=>[b(d).text?(m(),r(`span`,{key:0,"data-slot":`text`,class:n(w.value.text({class:b(d).ui?.text}))},v(b(d).text),3)):O(``,!0),b(d).kbds?.length?(m(),r(`span`,{key:1,"data-slot":`kbds`,class:n(w.value.kbds({class:b(d).ui?.kbds}))},[(m(!0),r(i,null,ne(b(d).kbds,(e,t)=>(m(),x(Ie,T({key:t,size:b(d).ui?.kbdsSize||w.value.kbdsSize()},{ref_for:!0},typeof e==`string`?{value:e}:e),null,16,[`size`]))),128))],2)):O(``,!0)]),b(d).arrow?(m(),x(b(vt),T({key:0},C.value,{"data-slot":`arrow`,class:w.value.arrow({class:b(d).ui?.arrow})}),null,16,[`class`])):O(``,!0)]),_:3},16,[`class`])]),_:3})]),_:3},16)]),_:3},16,[`disabled`]))}},PC={slots:{root:`focus:outline-none`,base:`flex items-stretch gap-1.5`,group:`flex items-center gap-0.5`,separator:`w-px self-stretch bg-border`},variants:{layout:{bubble:{base:`bg-default border border-default rounded-lg p-1`},floating:{base:`bg-default border border-default rounded-lg p-1`},fixed:{base:``}}}},FC=Object.assign({inheritAttrs:!1},{__name:`EditorToolbar`,props:{as:{type:null,required:!1},color:{type:null,required:!1,default:`neutral`},variant:{type:null,required:!1,default:`ghost`},activeColor:{type:null,required:!1,default:`primary`},activeVariant:{type:null,required:!1,default:`soft`},size:{type:null,required:!1,default:`sm`},items:{type:null,required:!1},editor:{type:Object,required:!0},class:{type:null,required:!1},ui:{type:Object,required:!1},layout:{type:String,required:!1,default:`fixed`},pluginKey:{type:[Object,String],required:!1},updateDelay:{type:Number,required:!1},resizeDelay:{type:Number,required:!1},shouldShow:{type:[Function,null],required:!1},appendTo:{type:Function,required:!1,skipCheck:!0},getReferencedVirtualElement:{type:Function,required:!1},options:{type:Object,required:!1}},setup(e){let s=Ge(`editorToolbar`,e),l=t(),u=w(`editorHandlers`,c(()=>qS())),d=c(()=>({bubble:OC,floating:jC,fixed:`template`})[s.layout]),f=qe(he(s,`as`,`color`,`variant`,`activeColor`,`activeVariant`,`size`,`items`,`layout`,`editor`,`class`,`ui`)),p=c(()=>o(s.options,{offset:8,shift:{padding:8}})),h=c(()=>et({extend:et(PC),...l.ui?.editorToolbar||{}})({layout:s.layout})),g=c(()=>s.items?.length?ge(s.items)?s.items:[s.items]:[]);function _(e){return s.editor?.isEditable?`items`in e&&e.items?.length?e.items?.some(e=>_(e))||!1:`kind`in e?(u?.value?.[e.kind])?.isActive(s.editor,e)||!1:e.active??!1:!1}function v(e){if(!s.editor?.isEditable)return!0;if(`items`in e&&e.items?.length){let t=(ge(e.items)?e.items.flat():e.items).filter(e=>e.type!==`separator`&&e.type!==`label`);return t.length===0?!0:t.every(e=>v(e))}if(!(`kind`in e))return e.disabled??!1;let t=u?.value?.[e.kind];return t?t.isDisabled?.(s.editor,e)?!0:!t.canExecute(s.editor,e):!1}function S(e,t){if(!s.editor?.isEditable||v(t))return;if(`items`in t||!(`kind`in t)){if(`onClick`in t)for(let n of Array.isArray(t.onClick)?t.onClick:[t.onClick])n?.(e);return}let n=u?.value?.[t.kind];n&&n.execute(s.editor,t).run()}function C(e){if(e.items)return(ge(e.items)?e.items.flat():e.items).find(e=>`kind`in e?_(e):!1)}function ee(e){let t=ce(e,[`kind`,`mark`,`align`,`level`,`href`,`src`,`pos`,`items`,`slot`,`checkedIcon`,`loadingIcon`,`externalIcon`,`content`,`arrow`,`portal`,`modal`,`tooltip`,`onClick`]);if(`items`in e&&e.items?.length){let n=C(e);n?.icon&&(t.icon=n.icon),n?.label&&t.label!==void 0&&(t.label=n.label)}return o(t,{color:s.color,activeColor:s.activeColor,activeVariant:s.activeVariant,variant:s.variant,size:s.size})}function te(e){return o(ie(e,[`size`,`checkedIcon`,`loadingIcon`,`externalIcon`,`content`,`arrow`,`portal`,`modal`,`ui`]),{modal:!1,size:s.size})}function E(e){let t=`children`in e&&Array.isArray(e.children)?e.children.map(E):void 0;if(!(`kind`in e))return t?{...e,children:t}:e;let n=e;return{...n,...t&&{children:t},active:_(n),disabled:v(n),onSelect:e=>S(e,n)}}function re(e){return e.items?ge(e.items)?e.items.map(e=>e.map(E)):[e.items.map(E)]:[]}return(e,t)=>(m(),x(b($e),T({as:d.value},d.value===`template`?{...e.$attrs}:{editor:b(s).editor,tabindex:-1,class:h.value.root({class:b(s).ui?.root}),...b(f),options:p.value,...e.$attrs}),{default:k(()=>[y(b($e),{as:b(s).as,role:`toolbar`,"data-slot":`base`,class:n(h.value.base({class:[b(s).ui?.base,b(s).class]}))},{default:k(()=>[(m(!0),r(i,null,ne(g.value,(t,o)=>(m(),r(i,{key:`group-${o}`},[a(`div`,{role:`group`,"data-slot":`group`,class:n(h.value.group({class:b(s).ui?.group}))},[(m(!0),r(i,null,ne(t,(t,n)=>D(e.$slots,t.slot||`item`,{key:`group-${o}-${n}`,item:t,index:n,isActive:_,isDisabled:v,onClick:S},()=>[`items`in t&&t.items?.length?(m(),x(Be,T({key:0,ref_for:!0},te(t),{items:re(t)}),{default:k(()=>[t.tooltip?(m(),x(NC,T({key:0,disabled:v(t)},{ref_for:!0},{...t.tooltip||{}}),{default:k(()=>[y(Ze,T({active:_(t),disabled:v(t)},{ref_for:!0},ee(t),{onClick:e=>S(e,t)}),null,16,[`active`,`disabled`,`onClick`])]),_:2},1040,[`disabled`])):(m(),x(Ze,T({key:1,active:_(t),disabled:v(t)},{ref_for:!0},ee(t),{onClick:e=>S(e,t)}),null,16,[`active`,`disabled`,`onClick`]))]),_:2},1040,[`items`])):t.tooltip?(m(),x(NC,T({key:1,disabled:v(t)},{ref_for:!0},{...t.tooltip||{}}),{default:k(()=>[y(Ze,T({active:_(t),disabled:v(t)},{ref_for:!0},ee(t),{ui:t.ui,onClick:e=>S(e,t)}),null,16,[`active`,`disabled`,`ui`,`onClick`])]),_:2},1040,[`disabled`])):(m(),x(Ze,T({key:2,active:_(t),disabled:v(t)},{ref_for:!0},ee(t),{ui:t.ui,onClick:e=>S(e,t)}),null,16,[`active`,`disabled`,`ui`,`onClick`]))])),128))],2),o<g.value.length-1?(m(),x(b(_t),{key:0,"data-slot":`separator`,class:n(h.value.separator({class:b(s).ui?.separator})),orientation:`vertical`},null,8,[`class`])):O(``,!0)],64))),128))]),_:3},8,[`as`,`class`])]),_:3},16,[`as`]))}}),IC=()=>new Map,LC=e=>{let t=IC();return e.forEach((e,n)=>{t.set(n,e)}),t},RC=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},zC=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},BC=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1},VC=()=>new Set,HC=e=>e[e.length-1],UC=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},WC=Array.from,GC=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},KC=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},qC=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},JC=Array.isArray,YC=class{constructor(){this._observers=IC()}on(e,t){return RC(this._observers,e,VC).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return WC((this._observers.get(e)||IC()).values()).forEach(e=>e(...t))}destroy(){this._observers=IC()}},XC=Math.floor,ZC=Math.abs,QC=(e,t)=>e<t?e:t,$C=(e,t)=>e>t?e:t;Number.isNaN;var ew=e=>e===0?1/e<0:e<0,tw=1<<17,nw=1<<18,rw=1<<19,iw=1<<20,aw=1<<21,ow=1<<22,sw=1<<23,cw=1<<24,lw=1<<25,uw=1<<26,dw=1<<27,fw=1<<28,pw=1<<29;tw-1,nw-1,rw-1,iw-1,aw-1,ow-1,sw-1,cw-1,lw-1,uw-1,dw-1,fw-1,pw-1;var mw=2**53-1,hw=-(2**53-1),gw=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&XC(e)===e);Number.isNaN,Number.parseInt;var _w=String.fromCharCode;String.fromCodePoint,_w(65535);var vw=e=>e.toLowerCase(),yw=/^\s*/g,bw=e=>e.replace(yw,``),xw=/([A-Z])/g,Sw=(e,t)=>bw(e.replace(xw,e=>`${t}${vw(e)}`)),Cw=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},ww=typeof TextEncoder<`u`?new TextEncoder:null,Tw=ww?e=>ww.encode(e):Cw,Ew=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});Ew&&Ew.decode(new Uint8Array).length===1&&(Ew=null);var Dw=(e,t)=>qC(t,()=>e).join(``),Ow=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},kw=()=>new Ow,Aw=e=>{let t=kw();return e(t),Mw(t)},jw=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},Mw=e=>{let t=new Uint8Array(jw(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},Nw=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array($C(n,t)*2),e.cpos=0)},Pw=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},Fw=Pw,Y=(e,t)=>{for(;t>127;)Pw(e,128|127&t),t=XC(t/128);Pw(e,127&t)},Iw=(e,t)=>{let n=ew(t);for(n&&(t=-t),Pw(e,(t>63?128:0)|(n?64:0)|63&t),t=XC(t/64);t>0;)Pw(e,(t>127?128:0)|127&t),t=XC(t/128)},Lw=new Uint8Array(3e4),Rw=Lw.length/3,zw=ww&&ww.encodeInto?(e,t)=>{if(t.length<Rw){let n=ww.encodeInto(t,Lw).written||0;Y(e,n);for(let t=0;t<n;t++)Pw(e,Lw[t])}else Vw(e,Tw(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;Y(e,r);for(let t=0;t<r;t++)Pw(e,n.codePointAt(t))},Bw=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=QC(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array($C(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},Vw=(e,t)=>{Y(e,t.byteLength),Bw(e,t)},Hw=(e,t)=>{Nw(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},Uw=(e,t)=>Hw(e,4).setFloat32(0,t,!1),Ww=(e,t)=>Hw(e,8).setFloat64(0,t,!1),Gw=(e,t)=>Hw(e,8).setBigInt64(0,t,!1),Kw=new DataView(new ArrayBuffer(4)),qw=e=>(Kw.setFloat32(0,e),Kw.getFloat32(0)===e),Jw=(e,t)=>{switch(typeof t){case`string`:Pw(e,119),zw(e,t);break;case`number`:gw(t)&&ZC(t)<=2147483647?(Pw(e,125),Iw(e,t)):qw(t)?(Pw(e,124),Uw(e,t)):(Pw(e,123),Ww(e,t));break;case`bigint`:Pw(e,122),Gw(e,t);break;case`object`:if(t===null)Pw(e,126);else if(JC(t)){Pw(e,117),Y(e,t.length);for(let n=0;n<t.length;n++)Jw(e,t[n])}else if(t instanceof Uint8Array)Pw(e,116),Vw(e,t);else{Pw(e,118);let n=Object.keys(t);Y(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];zw(e,i),Jw(e,t[i])}}break;case`boolean`:Pw(e,t?120:121);break;default:Pw(e,127)}},Yw=class extends Ow{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Y(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},Xw=e=>{e.count>0&&(Iw(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Y(e.encoder,e.count-2))},Zw=class{constructor(){this.encoder=new Ow,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Xw(this),this.count=1,this.s=e)}toUint8Array(){return Xw(this),Mw(this.encoder)}},Qw=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);Iw(e.encoder,t),e.count>1&&Y(e.encoder,e.count-2)}},$w=class{constructor(){this.encoder=new Ow,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Qw(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Qw(this),Mw(this.encoder)}},eT=class{constructor(){this.sarr=[],this.s=``,this.lensE=new Zw}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new Ow;return this.sarr.push(this.s),this.s=``,zw(e,this.sarr.join(``)),Bw(e,this.lensE.toUint8Array()),Mw(e)}},tT=e=>Error(e),nT=()=>{throw tT(`Method unimplemented`)},rT=()=>{throw tT(`Unexpected case`)},iT=tT(`Unexpected end of array`),aT=tT(`Integer out of Range`),oT=class{constructor(e){this.arr=e,this.pos=0}},sT=e=>new oT(e),cT=e=>e.pos!==e.arr.length,lT=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},uT=e=>lT(e,X(e)),dT=e=>e.arr[e.pos++],X=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>mw)throw aT}throw iT},fT=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>mw)throw aT}throw iT},pT=Ew?e=>Ew.decode(uT(e)):e=>{let t=X(e);if(t===0)return``;{let n=String.fromCodePoint(dT(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(dT(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},mT=(e,t)=>{let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},hT=[e=>void 0,e=>null,fT,e=>mT(e,4).getFloat32(0,!1),e=>mT(e,8).getFloat64(0,!1),e=>mT(e,8).getBigInt64(0,!1),e=>!1,e=>!0,pT,e=>{let t=X(e),n={};for(let r=0;r<t;r++){let t=pT(e);n[t]=gT(e)}return n},e=>{let t=X(e),n=[];for(let r=0;r<t;r++)n.push(gT(e));return n},uT],gT=e=>hT[127-dT(e)](e),_T=class extends oT{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),cT(this)?this.count=X(this)+1:this.count=-1),this.count--,this.s}},vT=class extends oT{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=fT(this);let e=ew(this.s);this.count=1,e&&(this.s=-this.s,this.count=X(this)+2)}return this.count--,this.s}},yT=class extends oT{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=fT(this),t=e&1;this.diff=XC(e/2),this.count=1,t&&(this.count=X(this)+2)}return this.s+=this.diff,this.count--,this.s}},bT=class{constructor(e){this.decoder=new vT(e),this.str=pT(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}};crypto.subtle;var xT=crypto.getRandomValues.bind(crypto),ST=Math.random,CT=()=>xT(new Uint32Array(1))[0],wT=e=>e[XC(ST()*e.length)],TT=`10000000-1000-4000-8000-100000000000`,ET=()=>TT.replace(/[018]/g,e=>(e^CT()&15>>e/4).toString(16)),DT=Date.now,OT=e=>new Promise(e);Promise.all.bind(Promise);var kT=e=>e===void 0?null:e,AT=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}};try{typeof localStorage<`u`&&localStorage&&(AT=localStorage)}catch{}var jT=AT,MT=Symbol(`Equality`),NT=(e,t)=>e===t||!!e?.[MT]?.(t)||!1,PT=e=>typeof e==`object`,FT=Object.assign,IT=Object.keys,LT=(e,t)=>{for(let n in e)t(e[n],n)},RT=e=>IT(e).length,zT=e=>{for(let t in e)return!1;return!0},BT=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},VT=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),HT=(e,t)=>e===t||RT(e)===RT(t)&&BT(e,(e,n)=>(e!==void 0||VT(t,n))&&NT(t[n],e)),UT=Object.freeze,WT=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&WT(e[t])}return UT(e)},GT=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&GT(e,t,n+1)}},KT=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[MT]!=null)return e[MT](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!KT(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(RT(e)!==RT(t))return!1;for(let n in e)if(!VT(e,n)||!KT(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!KT(e[n],t[n]))return!1;break;default:return!1}return!0},qT=(e,t)=>t.includes(e),JT=typeof process<`u`&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`,YT=typeof window<`u`&&typeof document<`u`&&!JT;typeof navigator<`u`&&/Mac/.test(navigator.platform);var XT,ZT=[],QT=()=>{if(XT===void 0)if(JT){XT=IC();let e=process.argv,t=null;for(let n=0;n<e.length;n++){let r=e[n];r[0]===`-`?(t!==null&&XT.set(t,``),t=r):t===null?ZT.push(r):(XT.set(t,r),t=null)}t!==null&&XT.set(t,``)}else typeof location==`object`?(XT=IC(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);XT.set(`--${Sw(t,`-`)}`,n),XT.set(`-${Sw(t,`-`)}`,n)}})):XT=IC();return XT},$T=e=>QT().has(e),eE=e=>kT(JT?{}[e.toUpperCase().replaceAll(`-`,`_`)]:jT.getItem(e)),tE=e=>$T(`--`+e)||eE(e)!==null,nE=tE(`production`),rE=JT&&qT({}.FORCE_COLOR,[`true`,`1`,`2`])||!$T(`--no-colors`)&&!tE(`no-color`)&&(!JT||process.stdout.isTTY)&&(!JT||$T(`--color`)||eE(`COLORTERM`)!==null||(eE(`TERM`)||``).includes(`color`)),iE=YT?e=>{let t=``;for(let n=0;n<e.byteLength;n++)t+=_w(e[n]);return btoa(t)}:e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`),aE=e=>Aw(t=>Jw(t,e)),oE=class{constructor(e,t){this.left=e,this.right=t}},sE=(e,t)=>new oE(e,t),cE=e=>e.next()>=.5,lE=(e,t,n)=>XC(e.next()*(n+1-t)+t),uE=(e,t,n)=>XC(e.next()*(n+1-t)+t),dE=(e,t,n)=>uE(e,t,n),fE=e=>_w(dE(e,97,122)),pE=(e,t=0,n=20)=>{let r=dE(e,t,n),i=``;for(let t=0;t<r;t++)i+=fE(e);return i},mE=(e,t)=>t[dE(e,0,t.length-1)],hE=Symbol(`0schema`),gE=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push(Dw(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
208
- `)}},_E=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[MT]?NT(e,t):JC(e)?GC(e,e=>KC(t,t=>_E(e,t))):PT(e)?BT(e,(e,n)=>_E(e,t[n])):!1,vE=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),_E(t,n)}equals(e){return this.constructor===e.constructor&&KT(this.shape,e.shape)}[hE](){return!0}[MT](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){nT()}get nullable(){return ZE(this,fD)}get optional(){return new kE(this)}cast(e){return gD(e,this),e}expect(e){return gD(e,this),e}},yE=class extends vE{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},bE=(e,t=null)=>new yE(e,t);bE(yE);var xE=class extends vE{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},SE=e=>new xE(e);bE(xE);var CE=class extends vE{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}},wE=(...e)=>new CE(e),TE=bE(CE),EE=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),DE=e=>{if(sD.check(e))return[EE(e)];if(TE.check(e))return e.shape.map(e=>e+``);if(oD.check(e))return[`[+-]?\\d+.?\\d*`];if(cD.check(e))return[`.*`];if(QE.check(e))return e.shape.map(DE).flat(1);rT()};bE(class extends vE{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(DE).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});var OE=Symbol(`optional`),kE=class extends vE{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[OE](){return!0}},AE=bE(kE),jE=class extends vE{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new jE,bE(jE);var ME=class e extends vE{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):BT(this.shape,(n,r)=>{let i=this._isPartial&&!VT(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},NE=e=>new ME(e),PE=bE(ME),FE=SE(e=>e!=null&&(e.constructor===Object||e.constructor==null)),IE=class extends vE{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&BT(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i&&t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i&&this.shape.values.check(n,t)})}},LE=(e,t)=>new IE(e,t),RE=bE(IE),zE=class extends vE{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&BT(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}},BE=(...e)=>new zE(e);bE(zE);var VE=class extends vE{constructor(e){super(),this.shape=e.length===1?e[0]:new XE(e)}check(e,t){let n=JC(e)&&GC(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}},HE=(...e)=>new VE(e),UE=bE(VE),WE=SE(e=>JC(e)),GE=class extends vE{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},KE=(e,t=null)=>new GE(e,t);bE(GE);var qE=KE(vE),JE=bE(class extends vE{constructor(e){super(),this.len=e.length-1,this.args=BE(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}}),YE=SE(e=>typeof e==`function`);bE(class extends vE{constructor(e){super(),this.shape=e}check(e,t){let n=GC(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var XE=class extends vE{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=KC(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},ZE=(...e)=>e.findIndex(e=>QE.check(e))>=0?ZE(...e.map(e=>hD(e)).map(e=>QE.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new XE(e),QE=bE(XE),$E=()=>!0,eD=SE($E),tD=bE(xE,e=>e.shape===$E),nD=SE(e=>typeof e==`bigint`),rD=SE(e=>e===nD),iD=SE(e=>typeof e==`symbol`);SE(e=>e===iD);var aD=SE(e=>typeof e==`number`),oD=SE(e=>e===aD),sD=SE(e=>typeof e==`string`),cD=SE(e=>e===sD),lD=SE(e=>typeof e==`boolean`),uD=SE(e=>e===lD),dD=wE(void 0);bE(CE,e=>e.shape.length===1&&e.shape[0]===void 0),wE(void 0);var fD=wE(null),pD=bE(CE,e=>e.shape.length===1&&e.shape[0]===null);bE(Uint8Array),bE(yE,e=>e.shape===Uint8Array);var mD=ZE(aD,sD,fD,dD,nD,lD,iD);(()=>{let e=HE(eD),t=LE(sD,eD),n=ZE(aD,sD,fD,lD,e,t);return e.shape=n,t.shape.values=n,n})();var hD=e=>{if(qE.check(e))return e;if(FE.check(e)){let t={};for(let n in e)t[n]=hD(e[n]);return NE(t)}else if(WE.check(e))return ZE(...e.map(hD));else if(mD.check(e))return wE(e);else if(YE.check(e))return bE(e);rT()},gD=nE?()=>{}:(e,t)=>{let n=new gE;if(!t.check(e,n))throw tT(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`)},_D=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:hD(e),h:t}),this}else(e){return this.if(eD,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw tT(`Unhandled pattern`)}}},vD=(e=>new _D(e))(eD).if(oD,(e,t)=>lE(t,hw,mw)).if(cD,(e,t)=>pE(t)).if(uD,(e,t)=>cE(t)).if(rD,(e,t)=>BigInt(lE(t,hw,mw))).if(QE,(e,t)=>yD(t,mE(t,e.shape))).if(PE,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(AE.check(i)){if(cE(t))continue;i=i.shape}n[r]=vD(i,t)}return n}).if(UE,(e,t)=>{let n=[],r=uE(t,0,42);for(let i=0;i<r;i++)n.push(yD(t,e.shape));return n}).if(TE,(e,t)=>mE(t,e.shape)).if(pD,(e,t)=>null).if(JE,(e,t)=>{let n=yD(t,e.res);return()=>n}).if(tD,(e,t)=>yD(t,mE(t,[aD,sD,fD,dD,nD,lD,HE(aD),LE(ZE(`a`,`b`,`c`),aD)]))).if(RE,(e,t)=>{let n={},r=lE(t,0,3);for(let i=0;i<r;i++){let r=yD(t,e.shape.keys);n[r]=yD(t,e.shape.values)}return n}).done(),yD=(e,t)=>vD(hD(t),e),bD=typeof document<`u`?document:{};SE(e=>e.nodeType===TD),typeof DOMParser<`u`&&new DOMParser,SE(e=>e.nodeType===SD),SE(e=>e.nodeType===CD);var xD=e=>zC(e,(e,t)=>`${t}:${e};`).join(``),SD=bD.ELEMENT_NODE,CD=bD.TEXT_NODE;bD.CDATA_SECTION_NODE,bD.COMMENT_NODE;var wD=bD.DOCUMENT_NODE;bD.DOCUMENT_TYPE_NODE;var TD=bD.DOCUMENT_FRAGMENT_NODE;SE(e=>e.nodeType===wD);var ED=(e=>class{constructor(e){this._=e}destroy(){e(this._)}})(clearTimeout),DD=(e,t)=>new ED(setTimeout(t,e)),OD=Symbol,kD=OD(),AD=OD(),jD=OD(),MD=OD(),ND=OD(),PD=OD(),FD=OD(),ID=OD(),LD=OD(),RD=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};DT();var zD={[kD]:sE(`font-weight`,`bold`),[AD]:sE(`font-weight`,`normal`),[jD]:sE(`color`,`blue`),[ND]:sE(`color`,`green`),[MD]:sE(`color`,`grey`),[PD]:sE(`color`,`red`),[FD]:sE(`color`,`purple`),[ID]:sE(`color`,`orange`),[LD]:sE(`color`,`black`)},BD=rE?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=IC(),i=[],a=0;for(;a<e.length;a++){let i=e[a],o=zD[i];if(o!==void 0)r.set(o.left,o.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let e=xD(r);a>0||e.length>0?(t.push(`%c`+i),n.push(e)):t.push(i)}else break}}for(a>0&&(i=n,i.unshift(t.join(``)));a<e.length;a++){let t=e[a];t instanceof Symbol||i.push(t)}return i}:RD,VD=(...e)=>{console.log(...BD(e)),UD.forEach(t=>t.print(e))},HD=(...e)=>{console.warn(...BD(e)),e.unshift(ID),UD.forEach(t=>t.print(e))},UD=VC(),WD=e=>({[Symbol.iterator](){return this},next:e}),GD=(e,t)=>WD(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),KD=(e,t)=>WD(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),qD=class{constructor(e,t){this.clock=e,this.len=t}},JD=class{constructor(){this.clients=new Map}},YD=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])QO(e,i,o.clock,o.len,n)}}),XD=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=XC((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},ZD=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&XD(n,t.clock)!==null},QD=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new qD(r.clock,$C(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},$D=e=>{let t=new JD;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)UC(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return QD(t),t},eO=(e,t,n,r)=>{RC(e.clients,t,()=>[]).push(new qD(n,r))},tO=()=>new JD,nO=e=>{let t=tO();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new qD(i,a))}}r.length>0&&t.clients.set(n,r)}),t},rO=(e,t)=>{Y(e.restEncoder,t.clients.size),WC(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),Y(e.restEncoder,t);let r=n.length;Y(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},iO=e=>{let t=new JD,n=X(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();let n=X(e.restDecoder),r=X(e.restDecoder);if(r>0){let i=RC(t.clients,n,()=>[]);for(let t=0;t<r;t++)i.push(new qD(e.readDsClock(),e.readDsLen()))}}return t},aO=(e,t,n)=>{let r=new JD,i=X(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=X(e.restDecoder),a=X(e.restDecoder),o=n.clients.get(i)||[],s=WO(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&eO(r,i,s,a-s);let e=KO(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,uj(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<a);)c.deleted||(a<c.id.clock+c.length&&o.splice(e,0,uj(t,c,a-c.id.clock)),c.delete(t))}else eO(r,i,n,a-n)}}if(r.clients.size>0){let e=new pO;return Y(e.restEncoder,0),rO(e,r),e.toUint8Array()}return null},oO=CT,sO=class e extends YC{constructor({guid:e=ET(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=oO(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new HO,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=a,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=OT(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>OT(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&Q(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(WC(this.subdocs).map(e=>e.guid))}transact(e,t=null){return Q(this,e,t)}get(e,t=jk){let n=RC(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),r=n.constructor;if(t!==jk&&r!==t)if(r===jk){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}else throw Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=``){return this.get(e,Qk)}getText(e=``){return this.get(e,yA)}getMap(e=``){return this.get(e,tA)}getXmlElement(e=``){return this.get(e,wA)}getXmlFragment(e=``){return this.get(e,SA)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,WC(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,Q(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},cO=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=X(this.restDecoder),this.dsCurrVal}readDsLen(){let e=X(this.restDecoder)+1;return this.dsCurrVal+=e,e}},lO=class extends cO{constructor(e){super(e),this.keys=[],X(e),this.keyClockDecoder=new yT(uT(e)),this.clientDecoder=new vT(uT(e)),this.leftClockDecoder=new yT(uT(e)),this.rightClockDecoder=new yT(uT(e)),this.infoDecoder=new _T(uT(e),dT),this.stringDecoder=new bT(uT(e)),this.parentInfoDecoder=new _T(uT(e),dT),this.typeRefDecoder=new vT(uT(e)),this.lenDecoder=new vT(uT(e))}readLeftID(){return new EO(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new EO(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return gT(this.restDecoder)}readBuf(){return uT(this.restDecoder)}readJSON(){return gT(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},uO=class{constructor(){this.restEncoder=kw()}toUint8Array(){return Mw(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Y(this.restEncoder,e)}writeDsLen(e){Y(this.restEncoder,e)}},dO=class extends uO{writeLeftID(e){Y(this.restEncoder,e.client),Y(this.restEncoder,e.clock)}writeRightID(e){Y(this.restEncoder,e.client),Y(this.restEncoder,e.clock)}writeClient(e){Y(this.restEncoder,e)}writeInfo(e){Fw(this.restEncoder,e)}writeString(e){zw(this.restEncoder,e)}writeParentInfo(e){Y(this.restEncoder,+!!e)}writeTypeRef(e){Y(this.restEncoder,e)}writeLen(e){Y(this.restEncoder,e)}writeAny(e){Jw(this.restEncoder,e)}writeBuf(e){Vw(this.restEncoder,e)}writeJSON(e){zw(this.restEncoder,JSON.stringify(e))}writeKey(e){zw(this.restEncoder,e)}},fO=class{constructor(){this.restEncoder=kw(),this.dsCurrVal=0}toUint8Array(){return Mw(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,Y(this.restEncoder,t)}writeDsLen(e){e===0&&rT(),Y(this.restEncoder,e-1),this.dsCurrVal+=e}},pO=class extends fO{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new $w,this.clientEncoder=new Zw,this.leftClockEncoder=new $w,this.rightClockEncoder=new $w,this.infoEncoder=new Yw(Fw),this.stringEncoder=new eT,this.parentInfoEncoder=new Yw(Fw),this.typeRefEncoder=new Zw,this.lenEncoder=new Zw}toUint8Array(){let e=kw();return Y(e,0),Vw(e,this.keyClockEncoder.toUint8Array()),Vw(e,this.clientEncoder.toUint8Array()),Vw(e,this.leftClockEncoder.toUint8Array()),Vw(e,this.rightClockEncoder.toUint8Array()),Vw(e,Mw(this.infoEncoder)),Vw(e,this.stringEncoder.toUint8Array()),Vw(e,Mw(this.parentInfoEncoder)),Vw(e,this.typeRefEncoder.toUint8Array()),Vw(e,this.lenEncoder.toUint8Array()),Bw(e,Mw(this.restEncoder)),Mw(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(+!!e)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Jw(this.restEncoder,e)}writeBuf(e){Vw(this.restEncoder,e)}writeJSON(e){Jw(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},mO=(e,t,n,r)=>{r=$C(r,t[0].id.clock);let i=KO(t,r);Y(e.restEncoder,t.length-i),e.writeClient(n),Y(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},hO=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{WO(t,n)>e&&r.set(n,e)}),UO(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),Y(e.restEncoder,r.size),WC(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{mO(e,t.clients.get(n),n,r)})},gO=(e,t)=>{let n=IC(),r=X(e.restDecoder);for(let i=0;i<r;i++){let r=X(e.restDecoder),i=Array(r),a=e.readClient(),o=X(e.restDecoder);n.set(a,{i:0,refs:i});for(let n=0;n<r;n++){let r=e.readInfo();switch(31&r){case 0:{let t=e.readLen();i[n]=new NA(Z(a,o),t),o+=t;break}case 10:{let t=X(e.restDecoder);i[n]=new gj(Z(a,o),t),o+=t;break}default:{let s=(r&192)==0,c=new $(Z(a,o),null,(r&128)==128?e.readLeftID():null,null,(r&64)==64?e.readRightID():null,s?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,s&&(r&32)==32?e.readString():null,pj(e,r));i[n]=c,o+=c.length}}}}return n},_O=(e,t,n)=>{let r=[],i=WC(n.keys()).sort((e,t)=>e-t);if(i.length===0)return null;let a=()=>{if(i.length===0)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;)if(i.pop(),i.length>0)e=n.get(i[i.length-1]);else return null;return e},o=a();if(o===null)return null;let s=new HO,c=new Map,l=(e,t)=>{let n=c.get(e);(n==null||n>t)&&c.set(e,t)},u=o.refs[o.i++],d=new Map,f=()=>{for(let e of r){let t=e.id.client,r=n.get(t);r?(r.i--,s.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):s.clients.set(t,[e]),i=i.filter(e=>e!==t)}r.length=0};for(;;){if(u.constructor!==gj){let i=RC(d,u.id.client,()=>WO(t,u.id.client))-u.id.clock;if(i<0)r.push(u),l(u.id.client,u.id.clock-1),f();else{let a=u.getMissing(e,t);if(a!==null){r.push(u);let e=n.get(a)||{refs:[],i:0};if(e.refs.length===e.i)l(a,WO(t,a)),f();else{u=e.refs[e.i++];continue}}else (i===0||i<u.length)&&(u.integrate(e,i),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=a(),o===null)break;u=o.refs[o.i++]}}if(s.clients.size>0){let e=new pO;return hO(e,s,new Map),Y(e.restEncoder,0),{missing:c,update:e.toUint8Array()}}return null},vO=(e,t)=>hO(e,t.doc.store,t.beforeState),yO=(e,t,n,r=new lO(e))=>Q(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=_O(e,i,gO(r,n)),o=i.pendingStructs;if(o){for(let[e,n]of o.missing)if(n<WO(i,e)){t=!0;break}if(a){for(let[e,t]of a.missing){let n=o.missing.get(e);(n==null||n>t)&&o.missing.set(e,t)}o.update=mk([o.update,a.update])}}else i.pendingStructs=a;let s=aO(r,e,i);if(i.pendingDs){let t=new lO(sT(i.pendingDs));X(t.restDecoder);let n=aO(t,e,i);s&&n?i.pendingDs=mk([s,n]):i.pendingDs=s||n}else i.pendingDs=s;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,bO(e.doc,t)}},n,!1),bO=(e,t,n,r=lO)=>{let i=sT(t);yO(i,e,n,new r(i))},xO=class{constructor(){this.l=[]}},SO=()=>new xO,CO=(e,t)=>e.l.push(t),wO=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn't exist.`)},TO=(e,t,n)=>GT(e.l,[t,n]),EO=class{constructor(e,t){this.client=e,this.clock=t}},DO=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,Z=(e,t)=>new EO(e,t),OO=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw rT()},kO=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1},AO=class{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}},jO=class{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}},MO=(e,t,n=0)=>new jO(e,t,n),NO=(e,t,n)=>{let r=null,i=null;return e._item===null?i=OO(e):r=Z(e._item.id.client,e._item.id.clock),new AO(r,i,t,n)},PO=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return NO(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return NO(e,Z(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return NO(e,r.lastId,n);r=r.right}return NO(e,null,n)},FO=(e,t)=>{let n=qO(e,t);return{item:n,diff:t.clock-n.id.clock}},IO=(e,t,n=!0)=>{let r=t.store,i=e.item,a=e.type,o=e.tname,s=e.assoc,c=null,l=0;if(i!==null){if(WO(r,i.client)<=i.clock)return null;let e=n?cj(r,i):FO(r,i),t=e.item;if(!(t instanceof $))return null;if(c=t.parent,c._item===null||!c._item.deleted){l=t.deleted||!t.countable?0:e.diff+(s>=0?0:1);let n=t.left;for(;n!==null;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(o!==null)c=t.get(o);else if(a!==null){if(WO(r,a.client)<=a.clock)return null;let{item:e}=n?cj(r,a):{item:qO(r,a)};if(e instanceof $&&e.content instanceof oj)c=e.content.type;else return null}else throw rT();l=s>=0?c._length:0}return MO(c,l,e.assoc)},LO=class{constructor(e,t){this.ds=e,this.sv=t}},RO=(e,t)=>new LO(e,t);RO(tO(),new Map);var zO=e=>RO(nO(e.store),UO(e.store)),BO=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!ZD(t.ds,e.id),VO=(e,t)=>{let n=RC(e.meta,VO,VC),r=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<WO(r,n)&&YO(e,Z(n,t))}),YD(e,t.ds,e=>{}),n.add(t))},HO=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},UO=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},WO=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},GO=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw rT()}n.push(t)},KO=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=XC(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=XC((n+r)/2)}throw rT()},qO=(e,t)=>{let n=e.clients.get(t.client);return n[KO(n,t.clock)]},JO=(e,t,n)=>{let r=KO(t,n),i=t[r];return i.id.clock<n&&i instanceof $?(t.splice(r+1,0,uj(e,i,n-i.id.clock)),r+1):r},YO=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[JO(e,n,t.clock)]},XO=(e,t,n)=>{let r=t.clients.get(n.client),i=KO(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==NA&&r.splice(i+1,0,uj(e,a,n.clock-a.id.clock+1)),a},ZO=(e,t,n)=>{let r=e.clients.get(t.id.client);r[KO(r,t.id.clock)]=n},QO=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=JO(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&JO(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)},$O=class{constructor(e,t,n){this.doc=e,this.deleteSet=new JD,this.beforeState=UO(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},ek=(e,t)=>t.deleteSet.clients.size===0&&!BC(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(QD(t.deleteSet),vO(e,t),rO(e,t.deleteSet),!0),tk=(e,t,n)=>{let r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&RC(e.changed,t,VC).add(n)},nk=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof $&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let a=t-i;return a&&e.splice(t+1-a,a),a},rk=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=KO(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof $&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},ik=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=QC(r.length-1,1+KO(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+nk(r,e)}})},ak=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{QD(a),n.afterState=UO(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{(r._item===null||!r._item.deleted)&&r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(r._item===null||!r._item.deleted)&&(t=t.filter(e=>e.target._item===null||!e.target._item.deleted),t.forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),e.push(()=>{TO(r._dEH,t,n)}))}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&gA(n)})}),GT(e,[])}finally{r.gc&&rk(a,i,r.gcFilter),ik(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=$C(KO(e,r),1);for(let t=e.length-1;t>=n;)t-=1+nk(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=KO(r,n);a+1<r.length&&nk(r,a+1)>1||a>0&&nk(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(VD(ID,kD,`[yjs] `,AD,PD,`Changed the client-id because another client seems to be using it.`),r.clientID=oO()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new dO;ek(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new pO;ek(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):ak(e,t+1)}}},Q=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new $O(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&ak(i,0)}}return o},ok=class{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}},sk=(e,t,n)=>{YD(e,n.deletions,n=>{n instanceof $&&t.scope.some(t=>t===e.doc||kO(t,n))&&lj(n,!1)})},ck=(e,t,n)=>{let r=null,i=e.doc,a=e.scope;Q(i,n=>{for(;t.length>0&&e.currStackItem===null;){let r=i.store,o=t.pop(),s=new Set,c=[],l=!1;YD(n,o.insertions,e=>{if(e instanceof $){if(e.redone!==null){let{item:t,diff:i}=cj(r,e.id);i>0&&(t=YO(n,Z(t.id.client,t.id.clock+i))),e=t}!e.deleted&&a.some(t=>t===n.doc||kO(t,e))&&c.push(e)}}),YD(n,o.deletions,e=>{e instanceof $&&a.some(t=>t===n.doc||kO(t,e))&&!ZD(o.insertions,e.id)&&s.add(e)}),s.forEach(t=>{l=fj(n,t,s,o.insertions,e.ignoreRemoteMapChanges,e)!==null||l});for(let t=c.length-1;t>=0;t--){let r=c[t];e.deleteFilter(r)&&(r.delete(n),l=!0)}e.currStackItem=l?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(o!=null){let t=r.changedParentTypes;e.emit(`stack-item-popped`,[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o},lk=class extends YC{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:o=JC(e)?e[0].doc:e instanceof sO?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new JD;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,a=t-r;a>0&&eO(i,n,r,a)});let a=DT(),o=!1;if(this.lastChange>0&&a-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=$D([t.deletions,e.deleteSet]),t.insertions=$D([t.insertions,i])}else r.push(new ok(e.deleteSet,i)),o=!0;!t&&!n&&(this.lastChange=a),YD(e,e.deleteSet,t=>{t instanceof $&&this.scope.some(n=>n===e.doc||kO(n,t))&&lj(t,!0)});let s=[{stackItem:r[r.length-1],origin:e.origin,type:t?`redo`:`undo`,changedParentTypes:e.changedParentTypes},this];o?this.emit(`stack-item-added`,s):this.emit(`stack-item-updated`,s)},this.doc.on(`afterTransaction`,this.afterTransactionHandler),this.doc.on(`destroy`,()=>{this.destroy()})}addToScope(e){let t=new Set(this.scope);e=JC(e)?e:[e],e.forEach(e=>{t.has(e)||(t.add(e),(e instanceof jk?e.doc!==this.doc:e!==this.doc)&&HD(`[yjs#509] Not same Y.Doc`),this.scope.push(e))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(n=>{e&&(this.undoStack.forEach(e=>sk(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>sk(n,this,e)),this.redoStack=[]),this.emit(`stack-cleared`,[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=ck(this,this.undoStack,`undo`)}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=ck(this,this.redoStack,`redo`)}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off(`afterTransaction`,this.afterTransactionHandler),super.destroy()}};function*uk(e){let t=X(e.restDecoder);for(let n=0;n<t;n++){let t=X(e.restDecoder),n=e.readClient(),r=X(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=X(e.restDecoder);yield new gj(Z(n,r),t),r+=t}else if(31&t){let i=(t&192)==0,a=new $(Z(n,r),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(t&32)==32?e.readString():null,pj(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new NA(Z(n,r),t),r+=t}}}}var dk=class{constructor(e,t){this.gen=uk(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===gj);return this.curr}},fk=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},pk=(e,t)=>{if(e.constructor===NA){let{client:n,clock:r}=e.id;return new NA(Z(n,r+t),e.length-t)}else if(e.constructor===gj){let{client:n,clock:r}=e.id;return new gj(Z(n,r+t),e.length-t)}else{let n=e,{client:r,clock:i}=n.id;return new $(Z(r,i+t),null,Z(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},mk=(e,t=lO,n=pO)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(sT(e))),i=r.map(e=>new dk(e,!0)),a=null,o=new n,s=new fk(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===gj?1:-1:n}else return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;for(;n!==null&&n.id.clock+n.length<=a.struct.id.clock+a.struct.length&&n.id.client>=a.struct.id.client;)n=e.next(),r=!0;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)gk(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock)if(a.struct.constructor===gj)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{gk(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new gj(Z(t,a.struct.id.clock+a.struct.length),e),offset:0}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===gj?a.struct.length-=t:n=pk(n,t)),a.struct.mergeWith(n)||(gk(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==gj;n=e.next())gk(s,a.struct,a.offset),a={struct:n,offset:0}}return a!==null&&(gk(s,a.struct,a.offset),a=null),_k(s),rO(o,$D(r.map(e=>iO(e)))),o.toUint8Array()},hk=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:Mw(e.encoder.restEncoder)}),e.encoder.restEncoder=kw(),e.written=0)},gk=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&hk(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),Y(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},_k=e=>{hk(e);let t=e.encoder.restEncoder;Y(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];Y(t,r.written),Bw(t,r.restEncoder)}},vk=`You must not compute changes after the event-handler fired.`,yk=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||=bk(this.currentTarget,this.target)}deletes(e){return ZD(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw tT(vk);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r))if(e!==null&&this.deletes(e))i=`delete`,a=HC(e.content.getContent());else return;else e!==null&&this.deletes(e)?(i=`update`,a=HC(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=HC(r.content.getContent());else return;e.set(n,{action:i,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw tT(vk);let t=this.target,n=VC(),r=VC(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};for(let i=t._start;i!==null;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((e===null||e.delete===void 0)&&(a(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((e===null||e.insert===void 0)&&(a(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((e===null||e.retain===void 0)&&(a(),e={retain:0}),e.retain+=i.length);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}},bk=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},xk=()=>{HD(`Invalid access: Add Yjs type to a document before reading data.`)},Sk=80,Ck=0,wk=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Ck++}},Tk=e=>{e.timestamp=Ck++},Ek=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Ck++},Dk=(e,t,n)=>{if(e.length>=Sk){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return Ek(r,t,n),r}else{let r=new wk(t,n);return e.push(r),r}},Ok=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>ZC(t-e.index)<ZC(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,Tk(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&ZC(n.index-i)<r.parent.length/Sk?(Ek(n,r,i),n):Dk(e._searchMarker,r,i)},kk=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=$C(t,i.index+n))}},Ak=(e,t,n)=>{let r=e,i=t.changedParentTypes;for(;RC(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;TO(r._eH,n,t)},jk=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=SO(),this._dEH=SO(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw nT()}clone(){throw nT()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){CO(this._eH,e)}observeDeep(e){CO(this._dEH,e)}unobserve(e){wO(this._eH,e)}unobserveDeep(e){wO(this._dEH,e)}toJSON(){}},Mk=(e,t,n)=>{e.doc??xk(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},Nk=e=>{e.doc??xk();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},Pk=(e,t)=>{let n=[],r=e._start;for(;r!==null;){if(r.countable&&BO(r,t)){let e=r.content.getContent();for(let t=0;t<e.length;t++)n.push(e[t])}r=r.right}return n},Fk=(e,t)=>{let n=0,r=e._start;for(e.doc??xk();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},Ik=(e,t)=>{let n=[];return Fk(e,(r,i)=>{n.push(t(r,i,e))}),n},Lk=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},Rk=(e,t)=>{e.doc??xk();let n=Ok(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},zk=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new $(Z(o,WO(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new JA(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new $(Z(o,WO(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new PA(new Uint8Array(n))),i.integrate(e,0);break;case sO:i=new $(Z(o,WO(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new zA(n)),i.integrate(e,0);break;default:if(n instanceof jk)i=new $(Z(o,WO(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new oj(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},Bk=()=>tT(`Length exceeded!`),Vk=(e,t,n,r)=>{if(n>t._length)throw Bk();if(n===0)return t._searchMarker&&kk(t._searchMarker,n,r.length),zk(e,t,null,r);let i=n,a=Ok(t,n),o=t._start;for(a!==null&&(o=a.p,n-=a.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&YO(e,Z(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&kk(t._searchMarker,i,r.length),zk(e,t,o,r)},Hk=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return zk(e,t,r,n)},Uk=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=Ok(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&YO(e,Z(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&YO(e,Z(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw Bk();t._searchMarker&&kk(t._searchMarker,i,-a+r)},Wk=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},Gk=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new JA([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new JA([r]);break;case Uint8Array:s=new PA(r);break;case sO:s=new zA(r);break;default:if(r instanceof jk)s=new oj(r);else throw Error(`Unexpected content type`)}new $(Z(o,WO(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},Kk=(e,t)=>{e.doc??xk();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},qk=e=>{let t={};return e.doc??xk(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},Jk=(e,t)=>{e.doc??xk();let n=e._map.get(t);return n!==void 0&&!n.deleted},Yk=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&BO(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},Xk=e=>(e.doc??xk(),GD(e._map.entries(),e=>!e[1].deleted)),Zk=class extends yk{},Qk=class e extends jk{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof jk?e.clone():e)),t}get length(){return this.doc??xk(),this._length}_callObserver(e,t){super._callObserver(e,t),Ak(this,e,new Zk(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):Q(this.doc,n=>{Vk(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):Q(this.doc,t=>{Hk(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):Q(this.doc,n=>{Uk(n,this,e,t)})}get(e){return Rk(this,e)}toArray(){return Nk(this)}slice(e=0,t=this.length){return Mk(this,e,t)}toJSON(){return this.map(e=>e instanceof jk?e.toJSON():e)}map(e){return Ik(this,e)}forEach(e){Fk(this,e)}[Symbol.iterator](){return Lk(this)}_write(e){e.writeTypeRef($A)}},$k=e=>new Qk,eA=class extends yk{constructor(e,t,n){super(e,t),this.keysChanged=n}},tA=class e extends jk{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof jk?e.clone():e)}),t}_callObserver(e,t){Ak(this,e,new eA(this,e,t))}toJSON(){this.doc??xk();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof jk?r.toJSON():r}}),e}get size(){return[...Xk(this)].length}keys(){return KD(Xk(this),e=>e[0])}values(){return KD(Xk(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return KD(Xk(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??xk(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):Q(this.doc,t=>{Wk(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):Q(this.doc,n=>{Gk(n,this,e,t)}),t}get(e){return Kk(this,e)}has(e){return Jk(this,e)}clear(){this.doc===null?this._prelimContent.clear():Q(this.doc,e=>{this.forEach(function(t,n,r){Wk(e,r,n)})})}_write(e){e.writeTypeRef(ej)}},nA=e=>new tA,rA=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&HT(e,t),iA=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&rT(),this.right.content.constructor){case UA:this.right.deleted||cA(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}},aA=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case UA:t.right.deleted||cA(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&YO(e,Z(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},oA=(e,t,n,r)=>{let i=new Map,a=r?Ok(t,n):null;return a?aA(e,new iA(a.p.left,a.p,a.index,i),n-a.index):aA(e,new iA(null,t._start,0,i),n)},sA=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===UA&&rA(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new $(Z(a,WO(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new UA(o,r));l.integrate(e,0),n.right=l,n.forward()})},cA=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},lA=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===UA&&rA(t[e.right.content.key]??null,e.right.content.value));)e.forward()},uA=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!rA(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new $(Z(a,WO(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new UA(s,c)),n.right.integrate(e,0),n.forward()}}return o},dA=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;lA(n,i);let s=uA(e,t,n,i),c=r.constructor===String?new XA(r):r instanceof jk?new oj(r):new VA(r),{left:l,right:u,index:d}=n;t._searchMarker&&kk(t._searchMarker,n.index,c.getLength()),u=new $(Z(o,WO(a.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),sA(e,t,n,s)},fA=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;lA(n,i);let s=uA(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===UA));){if(!n.right.deleted)switch(n.right.content.constructor){case UA:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(rA(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&YO(e,Z(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`
209
- `;n.right=new $(Z(o,WO(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new XA(i)),n.right.integrate(e,0),n.forward()}sA(e,t,n,s)},pA=(e,t,n,r,i)=>{let a=t,o=IC();for(;a&&(!a.countable||a.deleted);){if(!a.deleted&&a.content.constructor===UA){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t&&(c=!0),!t.deleted){let n=t.content;switch(n.constructor){case UA:{let{key:a,value:l}=n,u=r.get(a)??null;(o.get(a)!==n||u===l)&&(t.delete(e),s++,!c&&(i.get(a)??null)===l&&u!==l&&(u===null?i.delete(a):i.set(a,u))),!c&&!t.deleted&&cA(i,n);break}}}t=t.right}return s},mA=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===UA){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},hA=e=>{let t=0;return Q(e.doc,n=>{let r=e._start,i=e._start,a=IC(),o=LC(a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case UA:cA(o,i.content);break;default:t+=pA(n,r,i,a,o),a=LC(o),r=i;break}i=i.right}}),t},gA=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&QO(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===UA&&e.constructor!==NA&&t.add(e.parent)})}Q(n,n=>{YD(e,e.deleteSet,e=>{if(e instanceof NA||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===UA?t.add(r):mA(n,e)});for(let e of t)hA(e)})},_A=(e,t,n)=>{let r=n,i=LC(t.currentAttributes),a=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case oj:case VA:case XA:n<t.right.length&&YO(e,Z(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}a&&pA(e,a,t.right,i,t.currentAttributes);let o=(t.left||t.right).parent;return o._searchMarker&&kk(o._searchMarker,t.index,-r+n),t},vA=class extends yk{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){if(this._changes===null){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];Q(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},zT(o)||(e.attributes=FT({},o))),c=0;break}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case oj:case VA:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1);break;case XA:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length);break;case UA:{let{key:t,value:s}=i.content;if(this.adds(i))this.deletes(i)||(rA(n.get(t)??null,s)?s!==null&&i.delete(e):(a===`retain`&&u(),rA(s,r.get(t)??null)?delete o[t]:o[t]=s));else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;rA(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(rA(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),cA(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},yA=class e extends jk{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??xk(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new vA(this,e,t);Ak(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??xk();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===XA&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):Q(this.doc,n=>{let r=new iA(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
210
- `?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&dA(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&_A(n,r,a.delete):fA(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??xk();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(BO(s,e)||t!==void 0&&BO(s,t))switch(s.content.constructor){case XA:{let r=i.get(`ychange`);e!==void 0&&!BO(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)&&(c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0&&!BO(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)&&(c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str;break}case oj:case VA:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case UA:BO(s,e)&&(c(),cA(i,s.content));break}s=s.right}c()};return e||t?Q(a,n=>{e&&VO(n,e),t&&VO(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):Q(r,r=>{let i=oA(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),dA(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):Q(r,r=>{let i=oA(r,this,e,!n);dA(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):Q(n,n=>{_A(n,oA(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):Q(r,r=>{let i=oA(r,this,e,!1);i.right!==null&&fA(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):Q(this.doc,t=>{Wk(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):Q(this.doc,n=>{Gk(n,this,e,t)})}getAttribute(e){return Kk(this,e)}getAttributes(){return qk(this)}_write(e){e.writeTypeRef(tj)}},bA=e=>new yA,xA=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??xk()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===wA||t.constructor===SA)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}else e=e.parent===this._root?null:e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},SA=class e extends jk{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof jk?e.clone():e)),t}get length(){return this.doc??xk(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new xA(this,e)}querySelector(e){e=e.toUpperCase();let t=new xA(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),WC(new xA(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){Ak(this,e,new EA(this,t,e))}toString(){return Ik(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),Fk(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):Q(this.doc,n=>{Vk(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)Q(this.doc,n=>{let r=e&&e instanceof jk?e._item:e;zk(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw tT(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):Q(this.doc,n=>{Uk(n,this,e,t)})}toArray(){return Nk(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Rk(this,e)}slice(e=0,t=this.length){return Mk(this,e,t)}forEach(e){Fk(this,e)}_write(e){e.writeTypeRef(rj)}},CA=e=>new SA,wA=class e extends SA{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName);return LT(this.getAttributes(),(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof jk?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`="`+e[r]+`"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):Q(this.doc,t=>{Wk(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):Q(this.doc,n=>{Gk(n,this,e,t)})}getAttribute(e){return Kk(this,e)}hasAttribute(e){return Jk(this,e)}getAttributes(e){return e?Yk(this,e):qk(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return Fk(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(nj),e.writeKey(this.nodeName)}},TA=e=>new wA(e.readKey()),EA=class extends yk{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},DA=class e extends tA{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;return i=r===void 0?document.createElement(this.hookName):r.createDom(this),i.setAttribute(`data-yjs-hook`,this.hookName),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(ij),e.writeKey(this.hookName)}},OA=e=>new DA(e.readKey()),kA=class e extends yA{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(aj)}},AA=e=>new kA,jA=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw nT()}mergeWith(e){return!1}write(e,t,n){throw nT()}integrate(e,t){throw nT()}},MA=0,NA=class extends jA{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),GO(e.doc.store,this)}write(e,t){e.writeInfo(MA),e.writeLen(this.length-t)}getMissing(e,t){return null}},PA=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw nT()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}},FA=e=>new PA(e.readBuf()),IA=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){eO(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}},LA=e=>new IA(e.readLen()),RA=(e,t)=>new sO({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),zA=class e{constructor(e){e._item&&console.error(`This document was already integrated as a sub-document. You should create a second instance instead with the same guid.`),this.doc=e;let t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(RA(this.doc.guid,this.opts))}splice(e){throw nT()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}},BA=e=>new zA(RA(e.readString(),e.readAny())),VA=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw nT()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}},HA=e=>new VA(e.readJSON()),UA=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw nT()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}},WA=e=>new UA(e.readKey(),e.readJSON()),GA=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}},KA=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new GA(n)},qA=eE(`node_env`)===`development`,JA=class e{constructor(e){this.arr=e,qA&&WT(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}},YA=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new JA(n)},XA=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}},ZA=e=>new XA(e.readString()),QA=[$k,nA,bA,TA,CA,OA,AA],$A=0,ej=1,tj=2,nj=3,rj=4,ij=5,aj=6,oj=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw nT()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}},sj=e=>new oj(QA[e.readTypeRef()](e)),cj=(e,t)=>{let n=t,r=0,i;do r>0&&(n=Z(n.client,n.clock+r)),i=qO(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof $);return{item:i,diff:r}},lj=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},uj=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new $(Z(r,i+n),t,Z(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=Z(t.redone.client,t.redone.clock+n)),t.right=a,a.right!==null&&(a.right.left=a),e._mergeStructs.push(a),a.parentSub!==null&&a.right===null&&a.parent._map.set(a.parentSub,a),t.length=n,a},dj=(e,t)=>KC(e,e=>ZD(e.deletions,t)),fj=(e,t,n,r,i,a)=>{let o=e.doc,s=o.store,c=o.clientID,l=t.redone;if(l!==null)return YO(e,l);let u=t.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||fj(e,u,n,r,i,a)===null))return null;for(;u.redone!==null;)u=YO(e,u.redone)}let p=u===null?t.parent:u.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let t=d;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:YO(e,t.redone);if(t!==null&&t.parent._item===u){d=t;break}d=d.left}for(;f!==null;){let t=f;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:YO(e,t.redone);if(t!==null&&t.parent._item===u){f=t;break}f=f.right}}else if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||ZD(r,d.right.id)||dj(a.undoStack,d.right.id)||dj(a.redoStack,d.right.id));)for(d=d.right;d.redone;)d=YO(e,d.redone);if(d&&d.right!==null)return null}else d=p._map.get(t.parentSub)||null;let m=Z(c,WO(s,c)),h=new $(m,d,d&&d.lastId,f,f&&f.id,p,t.parentSub,t.content.copy());return t.redone=m,lj(h,!0),h.integrate(e,0),h},$=class e extends jA{constructor(e,t,n,r,i,a,o,s){super(e,s.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=a,this.parentSub=o,this.redone=null,this.content=s,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=WO(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=WO(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===EO&&this.id.client!==this.parent.client&&this.parent.clock>=WO(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=XO(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=YO(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===NA||this.right&&this.right.constructor===NA)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===EO){let e=qO(n,this.parent);e.constructor===NA?this.parent=null:this.parent=e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=XO(e,e.doc.store,Z(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),DO(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(DO(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(qO(e.doc.store,n.origin)))r.has(qO(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null){let e=this.left.right;this.right=e,this.left.right=this}else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}this.right===null?this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)):this.right.left=this,this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),GO(e.doc.store,this),this.content.integrate(e,this),tk(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new NA(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:Z(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&DO(e.origin,this.lastId)&&this.right===e&&DO(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),eO(e.deleteSet,this.id.client,this.id.clock,this.length),tk(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw rT();this.content.gc(e),t?ZO(e,this,new NA(this.id,this.length)):this.content=new IA(this.length)}write(e,t){let n=t>0?Z(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,a=this.content.getRef()&31|(n===null?0:128)|(r===null?0:64)|(i===null?0:32);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=OO(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===EO?(e.writeParentInfo(!1),e.writeLeftID(t)):rT();i!==null&&e.writeString(i)}this.content.write(e,t)}},pj=(e,t)=>mj[t&31](e),mj=[()=>{rT()},LA,KA,FA,ZA,HA,WA,sj,YA,BA,()=>{rT()}],hj=10,gj=class extends jA{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){rT()}write(e,t){e.writeInfo(hj),Y(e.restEncoder,this.length-t)}getMissing(e,t){return null}},_j=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},vj=`__ $YJS$ __`;_j[vj]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),_j[vj]=!0;var yj=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},bj=/[\uD800-\uDBFF]/,xj=/[\uDC00-\uDFFF]/,Sj=(e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&bj.test(e[n-1])&&n--;r+n<e.length&&r+n<t.length&&e[e.length-r-1]===t[t.length-r-1];)r++;return r>0&&xj.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}},Cj=(e,t)=>e>>>t|e<<32-t,wj=e=>Cj(e,2)^Cj(e,13)^Cj(e,22),Tj=e=>Cj(e,6)^Cj(e,11)^Cj(e,25),Ej=e=>Cj(e,7)^Cj(e,18)^e>>>3,Dj=e=>Cj(e,17)^Cj(e,19)^e>>>10,Oj=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),kj=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Aj=class{constructor(){let e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(kj),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,t=this._W;for(let e=16;e<64;e++)t[e]=Dj(t[e-2])+t[e-7]+Ej(t[e-15])+t[e-16];let n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7];for(let e=0,u,d;e<64;e++)u=l+Tj(o)+(o&s^~o&c)+Oj[e]+t[e]>>>0,d=wj(n)+(n&r^n&i^r&i)>>>0,l=c,c=s,s=o,o=a+u>>>0,a=i,i=r,r=n,n=u+d>>>0;e[0]+=n,e[1]+=r,e[2]+=i,e[3]+=a,e[4]+=o,e[5]+=s,e[6]+=c,e[7]+=l}digest(e){let t=0;for(;t+56<=e.length;){let n=0;for(;n<16&&t+3<e.length;n++)this._W[n]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!=0){for(this._W.fill(0,n,16);t<e.length;)this._W[n]|=e[t]<<(3-t%4)*8,t++;this._W[n]|=128<<(3-t%4)*8}this._updateHash()}let n=t%64!=0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let n=3;n>=0&&t<e.length;n--)this._W[r]|=e[t++]<<n*8;n||(this._W[r-(t%4==0?0:1)]|=128<<(3-t%4)*8),this._W[14]=e.byteLength/pw,this._W[15]=e.byteLength*8,this._updateHash();let i=new Uint8Array(32);for(let e=0;e<this._H.length;e++)for(let t=0;t<4;t++)i[e*4+t]=this._H[e]>>>(3-t)*8;return i}},jj=e=>new Aj().digest(e),Mj=new z(`y-sync`),Nj=new z(`y-undo`);new z(`yjs-cursor`);var Pj=e=>{for(let t=6;t<e.length;t++)e[t%6]=e[t%6]^e[t];return e.slice(0,6)},Fj=e=>iE(Pj(jj(aE(e)))),Ij=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!ZD(t.ds,e.id),Lj=[{light:`#ecd44433`,dark:`#ecd444`}],Rj=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){let n=VC();e.forEach(e=>n.add(e)),t=t.filter(e=>!n.has(e))}e.set(n,wT(t))}return e.get(n)},zj=(e,{colors:t=Lj,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:a}={})=>{let o=!1,s=new Uj(e,a),c=new R({props:{editable:e=>{let t=Mj.getState(e);return t.snapshot==null&&t.prevSnapshot==null}},key:Mj,state:{init:(i,a)=>({type:e,doc:e.doc,binding:s,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(e,t)=>{let n=e.getMeta(Mj);if(n!==void 0){t=Object.assign({},t);for(let e in n)t[e]=n[e]}return t.addToHistory=e.getMeta(`addToHistory`)!==!1,t.isChangeOrigin=n!==void 0&&!!n.isChangeOrigin,t.isUndoRedoOperation=n!==void 0&&!!n.isChangeOrigin&&!!n.isUndoRedoOperation,s.prosemirrorView!==null&&n!==void 0&&(n.snapshot!=null||n.prevSnapshot!=null)&&DD(0,()=>{s.prosemirrorView!=null&&(n.restore==null?s._renderSnapshot(n.snapshot,n.prevSnapshot,t):(s._renderSnapshot(n.snapshot,n.snapshot,t),delete t.restore,delete t.snapshot,delete t.prevSnapshot,s.mux(()=>{s._prosemirrorChanged(s.prosemirrorView.state.doc)})))}),t}},view:e=>(s.initView(e),a??s._forceRerender(),i(),{update:()=>{let t=c.getState(e.state);if(t.snapshot==null&&t.prevSnapshot==null&&(o||e.state.doc.content.findDiffStart(e.state.doc.type.createAndFill().content)!==null)){if(o=!0,t.addToHistory===!1&&!t.isChangeOrigin){let t=Nj.getState(e.state),n=t&&t.undoManager;n&&n.stopCapturing()}s.mux(()=>{t.doc.transact(n=>{n.meta.set(`addToHistory`,t.addToHistory),s._prosemirrorChanged(e.state.doc)},Mj)})}},destroy:()=>{s.destroy()}})});return c},Bj=(e,t,n)=>{if(t!==null&&t.anchor!==null&&t.head!==null)if(t.type===`all`)e.setSelection(new vo(e.doc));else if(t.type===`node`){let r=pM(n.doc,n.type,t.anchor,n.mapping);e.setSelection(Vj(e,r))}else{let r=pM(n.doc,n.type,t.anchor,n.mapping),i=pM(n.doc,n.type,t.head,n.mapping);r!==null&&i!==null&&e.setSelection(I.between(e.doc.resolve(r),e.doc.resolve(i)))}},Vj=(e,t)=>{let n=e.doc.resolve(t);return n.nodeAfter?L.create(e.doc,t):I.near(n)},Hj=(e,t)=>({type:t.selection.jsonID,anchor:dM(t.selection.anchor,e.type,e.mapping),head:dM(t.selection.head,e.type,e.mapping)}),Uj=class{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=yj(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Hj(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta(`addToHistory`,!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(YT&&this._domSelectionInView===null&&(DD(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;let t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);let n=t.getBoundingClientRect(),r=bD.documentElement;return n.bottom>=0&&n.right>=0&&n.left<=(window.innerWidth||r.clientWidth||0)&&n.top<=(window.innerHeight||r.clientHeight||0)}renderSnapshot(e,t){t||=RO(tO(),new Map),this.prosemirrorView.dispatch(this._tr.setMeta(Mj,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{let e=this.type.toArray().map(e=>Gj(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(M.from(e),0,0));t.setMeta(Mj,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{let e=this.beforeTransactionSelection===null?this.prosemirrorView.state.selection:null,t=this.type.toArray().map(e=>Gj(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(M.from(t),0,0));if(e){let t=QC($C(e.anchor,0),n.doc.content.size),r=QC($C(e.head,0),n.doc.content.size);n.setSelection(I.create(n.doc,t,r))}this.prosemirrorView.dispatch(n.setMeta(Mj,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,n){let r=this.doc,i=this.type;if(e||=zO(this.doc),e instanceof Uint8Array||t instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&rT(),r=new sO({gc:!1}),bO(r,t),t=zO(r),bO(r,e),e=zO(r),i._item===null){let e=Array.from(this.doc.share.keys()).find(e=>this.doc.share.get(e)===this.type);i=r.getXmlFragment(e)}else{let e=r.store.clients.get(i._item.id.client)??[];i=e[KO(e,i._item.id.clock)].content.type}this.mapping.clear(),this.mux(()=>{r.transact(r=>{let a=n.permanentUserData;a&&a.dss.forEach(e=>{YD(r,e,e=>{})});let o=(e,t)=>{let r=e===`added`?a.getUserByClientId(t.client):a.getUserByDeletedId(t);return{user:r,type:e,color:Rj(n.colorMapping,n.colors,r)}},s=Pk(i,new LO(t.ds,e.sv)).map(n=>!n._item.deleted||Ij(n._item,e)||Ij(n._item,t)?Gj(n,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,o):null).filter(e=>e!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(M.from(s),0,0));this.prosemirrorView.dispatch(c.setMeta(Mj,{isChangeOrigin:!0}))},Mj)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;let n=Mj.getState(this.prosemirrorView.state);if(e.length===0||n.snapshot!=null||n.prevSnapshot!=null){this.renderSnapshot(n.snapshot,n.prevSnapshot);return}this.mux(()=>{let e=(e,t)=>this.mapping.delete(t);YD(t,t.deleteSet,e=>{if(e.constructor===$){let t=e.content.type;t&&this.mapping.delete(t)}}),t.changed.forEach(e),t.changedParentTypes.forEach(e);let n=this.type.toArray().map(e=>Wj(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(M.from(n),0,0));Bj(r,this.beforeTransactionSelection,this),r=r.setMeta(Mj,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof lk}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&r.scrollIntoView(),this.prosemirrorView.dispatch(r)})}_prosemirrorChanged(e){this.doc.transact(()=>{lM(this.doc,this.type,e,this),this.beforeTransactionSelection=Hj(this,this.prosemirrorView.state)},Mj)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.on(`afterAllTransactions`,this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.off(`afterAllTransactions`,this.afterAllTransactions))}},Wj=(e,t,n,r,i,a)=>{let o=n.mapping.get(e);if(o===void 0){if(e instanceof wA)return Gj(e,t,n,r,i,a);throw nT()}return o},Gj=(e,t,n,r,i,a)=>{let o=[],s=e=>{if(e instanceof wA){let s=Wj(e,t,n,r,i,a);s!==null&&o.push(s)}else{let s=e._item.right?.content?.type;s instanceof yA&&!s._item.deleted&&s._item.id.client===s.doc.clientID&&(e.applyDelta([{retain:e.length},...s.toDelta()]),s.doc.transact(e=>{s._item.delete(e)}));let c=Kj(e,t,n,r,i,a);c!==null&&c.forEach(e=>{e!==null&&o.push(e)})}};r===void 0||i===void 0?e.toArray().forEach(s):Pk(e,new LO(i.ds,r.sv)).forEach(s);try{let s=e.getAttributes(r);r!==void 0&&(Ij(e._item,r)?Ij(e._item,i)||(s.ychange=a?a(`added`,e._item.id):{type:`added`}):s.ychange=a?a(`removed`,e._item.id):{type:`removed`});let c=t.node(e.nodeName,s,o);return n.mapping.set(e,c),c}catch{return e.doc.transact(t=>{e._item.delete(t)},Mj),n.mapping.delete(e),null}},Kj=(e,t,n,r,i,a)=>{let o=[],s=e.toDelta(r,i,a);try{for(let e=0;e<s.length;e++){let n=s[e];o.push(t.text(n.insert,sM(n.attributes,t)))}}catch{return e.doc.transact(t=>{e._item.delete(t)},Mj),null}return o},qj=(e,t)=>{let n=new kA,r=e.map(e=>({insert:e.text,attributes:cM(e.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},Jj=(e,t)=>{let n=new wA(e.type.name);for(let t in e.attrs){let r=e.attrs[t];r!==null&&t!==`ychange`&&n.setAttribute(t,r)}return n.insert(0,Qj(e).map(e=>Yj(e,t))),t.mapping.set(n,e),n},Yj=(e,t)=>e instanceof Array?qj(e,t):Jj(e,t),Xj=e=>typeof e==`object`&&!!e,Zj=(e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==null),r=n.length===Object.keys(t).filter(e=>t[e]!==null).length;for(let i=0;i<n.length&&r;i++){let a=n[i],o=e[a],s=t[a];r=a===`ychange`||o===s||Xj(o)&&Xj(s)&&Zj(o,s)}return r},Qj=e=>{let t=e.content.content,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.isText){let r=[];for(let n=t[e];e<t.length&&n.isText;n=t[++e])r.push(n);e--,n.push(r)}else n.push(r)}return n},$j=(e,t)=>{let n=e.toDelta();return n.length===t.length&&n.every((e,n)=>e.insert===t[n].text&&IT(e.attributes||{}).length===t[n].marks.length&&BT(e.attributes,(e,r)=>{let i=oM(r),a=t[n].marks;return a.find(e=>e.type.name===i)?Zj(e,a.find(e=>e.type.name===i)?.attrs):!1}))},eM=(e,t)=>{if(e instanceof wA&&!(t instanceof Array)&&uM(e,t)){let n=Qj(t);return e._length===n.length&&Zj(e.getAttributes(),t.attrs)&&e.toArray().every((e,t)=>eM(e,n[t]))}return e instanceof kA&&t instanceof Array&&$j(e,t)},tM=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((e,n)=>t[n]===e),nM=(e,t,n)=>{let r=e.toArray(),i=Qj(t),a=i.length,o=r.length,s=QC(o,a),c=0,l=0,u=!1;for(;c<s;c++){let e=r[c],t=i[c];if(tM(n.mapping.get(e),t))u=!0;else if(!eM(e,t))break}for(;c+l<s;l++){let e=r[o-l-1],t=i[a-l-1];if(tM(n.mapping.get(e),t))u=!0;else if(!eM(e,t))break}return{equalityFactor:c+l,foundMappedChild:u}},rM=e=>{let t=``,n=e._start,r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof XA?t+=n.content.str:n.content instanceof UA&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},iM=(e,t,n)=>{n.mapping.set(e,t);let{nAttrs:r,str:i}=rM(e),a=t.map(e=>({insert:e.text,attributes:Object.assign({},r,cM(e.marks,n))})),{insert:o,remove:s,index:c}=Sj(i,a.map(e=>e.insert).join(``));e.delete(c,s),e.insert(c,o),e.applyDelta(a.map(e=>({retain:e.insert.length,attributes:e.attributes})))},aM=/(.*)(--[a-zA-Z0-9+/=]{8})$/,oM=e=>aM.exec(e)?.[1]??e,sM=(e,t)=>{let n=[];for(let r in e)n.push(t.mark(oM(r),e[r]));return n},cM=(e,t)=>{let n={};return e.forEach(e=>{if(e.type.name!==`ychange`){let r=RC(t.isOMark,e.type,()=>!e.type.excludes(e.type));n[r?`${e.type.name}--${Fj(e.toJSON())}`:e.type.name]=e.attrs}}),n},lM=(e,t,n,r)=>{if(t instanceof wA&&t.nodeName!==n.type.name)throw Error(`node name mismatch!`);if(r.mapping.set(t,n),t instanceof wA){let e=t.getAttributes(),r=n.attrs;for(let n in r)r[n]===null?t.removeAttribute(n):e[n]!==r[n]&&n!==`ychange`&&t.setAttribute(n,r[n]);for(let n in e)r[n]===void 0&&t.removeAttribute(n)}let i=Qj(n),a=i.length,o=t.toArray(),s=o.length,c=QC(a,s),l=0,u=0;for(;l<c;l++){let e=o[l],t=i[l];if(!tM(r.mapping.get(e),t))if(eM(e,t))r.mapping.set(e,t);else break}for(;u+l+1<c;u++){let e=o[s-u-1],t=i[a-u-1];if(!tM(r.mapping.get(e),t))if(eM(e,t))r.mapping.set(e,t);else break}e.transact(()=>{for(;s-l-u>0&&a-l-u>0;){let n=o[l],c=i[l],d=o[s-u-1],f=i[a-u-1];if(n instanceof kA&&c instanceof Array)$j(n,c)||iM(n,c,r),l+=1;else{let i=n instanceof wA&&uM(n,c),a=d instanceof wA&&uM(d,f);if(i&&a){let e=nM(n,c,r),t=nM(d,f,r);e.foundMappedChild&&!t.foundMappedChild?a=!1:!e.foundMappedChild&&t.foundMappedChild||e.equalityFactor<t.equalityFactor?i=!1:a=!1}i?(lM(e,n,c,r),l+=1):a?(lM(e,d,f,r),u+=1):(r.mapping.delete(t.get(l)),t.delete(l,1),t.insert(l,[Yj(c,r)]),l+=1)}}let n=s-l-u;if(s===1&&a===0&&o[0]instanceof kA?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):n>0&&(t.slice(l,l+n).forEach(e=>r.mapping.delete(e)),t.delete(l,n)),l+u<a){let e=[];for(let t=l;t<a-u;t++)e.push(Yj(i[t],r));t.insert(l,e)}},Mj)},uM=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name,dM=(e,t,n)=>{if(e===0)return PO(t,0,-1);let r=t._first===null?null:t._first.content.type;for(;r!==null&&t!==r;){if(r instanceof kA){if(r._length>=e)return PO(r,e,-1);if(e-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,e--;while(r!==t&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==t&&(r=r._item===null?null:r._item.next.content.type)}}else{let i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<i)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&i>1)return new AO(r._item===null?null:r._item.id,r._item===null?OO(r):null,null);if(e-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(e===0)return r=r._item===null?r:r._item.parent,new AO(r._item===null?null:r._item.id,r._item===null?OO(r):null,null);do r=r._item.parent,e--;while(r!==t&&r._item.next===null);r!==t&&(r=r._item.next.content.type)}}}if(r===null)throw rT();if(e===0&&r.constructor!==kA&&r!==t)return fM(r._item.parent,r._item)}return PO(t,t._length,-1)},fM=(e,t)=>{let n=null,r=null;return e._item===null?r=OO(e):n=Z(e._item.id.client,e._item.id.clock),new AO(n,r,t.id)},pM=(e,t,n,r)=>{let i=IO(n,e);if(i===null||i.type!==t&&!kO(t,i.type._item))return null;let a=i.type,o=0;if(a.constructor===kA)o=i.index;else if(a._item===null||!a._item.deleted){let e=a._first,t=0;for(;t<a._length&&t<i.index&&e!==null;){if(!e.deleted){let n=e.content.type;t++,n instanceof kA?o+=n._length:o+=r.get(n).nodeSize}e=e.right}o+=1}for(;a!==t&&a._item!==null;){let e=a._item.parent;if(e._item===null||!e._item.deleted){o+=1;let t=e._first;for(;t!==null;){let e=t.content.type;if(e===a)break;t.deleted||(e instanceof kA?o+=e._length:o+=r.get(e).nodeSize),t=t.right}}a=e}return o-1},mM=e=>{let t=Nj.getState(e).undoManager;if(t!=null)return t.undo(),!0},hM=e=>{let t=Nj.getState(e).undoManager;if(t!=null)return t.redo(),!0},gM=new Set([`paragraph`]),_M=(e,t)=>!(e instanceof $)||!(e.content instanceof oj)||!(e.content.type instanceof yA||e.content.type instanceof wA&&t.has(e.content.type.nodeName))||e.content.type._length===0,vM=({protectedNodes:e=gM,trackedOrigins:t=[],undoManager:n=null}={})=>new R({key:Nj,state:{init:(r,i)=>{let a=Mj.getState(i),o=n||new lk(a.type,{trackedOrigins:new Set([Mj].concat(t)),deleteFilter:t=>_M(t,e),captureTransaction:e=>e.meta.get(`addToHistory`)!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(e,t,n,r)=>{let i=Mj.getState(r).binding,a=t.undoManager,o=a.undoStack.length>0,s=a.redoStack.length>0;return i?{undoManager:a,prevSel:Hj(i,n),hasUndoOps:o,hasRedoOps:s}:o!==t.hasUndoOps||s!==t.hasRedoOps?Object.assign({},t,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):t}},view:e=>{let t=Mj.getState(e.state),n=Nj.getState(e.state).undoManager;return n.on(`stack-item-added`,({stackItem:n})=>{let r=t.binding;r&&n.meta.set(r,Nj.getState(e.state).prevSel)}),n.on(`stack-item-popped`,({stackItem:e})=>{let n=t.binding;n&&(n.beforeTransactionSelection=e.meta.get(n)||n.beforeTransactionSelection)}),{destroy:()=>{n.destroy()}}}});function yM(e){return!!e.getMeta(Mj)}function bM(e,t){let n=Mj.getState(e);return pM(n.doc,n.type,t,n.binding.mapping)||0}function xM(e,t){let n=Mj.getState(e);return dM(t,n.type,n.binding.mapping)}var SM=class e extends bm{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(t){return new e(t.position,t.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function CM(e,t){return new SM(e,xM(t,e))}function wM(e,t,n){let r=e instanceof SM?e.yRelativePosition:null;if(yM(t)&&r)return{position:new SM(bM(n,r),r),mapResult:null};let i=xm(e,t),a=i.position.position;return{position:new SM(a,r??xM(n,a)),mapResult:i.mapResult}}U.create({name:`collaboration`,priority:1e3,addOptions(){return{document:null,field:`default`,fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(e=>e.name===`undoRedo`)&&console.warn(`[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".`)},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(e,t)=>wM(e,t,this.editor.state),this.editor.utils.createMappablePosition=e=>CM(e,this.editor.state)},addCommands(){return{undo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),Nj.getState(t).undoManager.undoStack.length===0?!1:n?mM(t):!0),redo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),Nj.getState(t).undoManager.redoStack.length===0?!1:n?hM(t):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){let e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),t=vM(this.options.yUndoOptions),n=t.spec.view;return t.spec.view=e=>{let{undoManager:t}=Nj.getState(e.state);t.restore&&=(t.restore(),()=>{});let r=n?n(e):void 0;return{destroy:()=>{let e=t.trackedOrigins.has(t),n=t._observers;t.restore=()=>{e&&t.trackedOrigins.add(t),t.doc.on(`afterTransaction`,t.afterTransactionHandler),t._observers=n},r?.destroy&&r.destroy()}}},[zj(e,{...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender}),t,this.editor.options.enableContentCheck&&new R({key:new z(`filterInvalidContent`),filterTransaction:t=>{if(!yM(t))return!0;if(this.storage.isDisabled)return!1;if(!t.docChanged)return!0;try{return t.doc.check(),!0}catch(t){return this.storage.isDisabled=!0,this.editor.emit(`contentError`,{error:t,editor:this.editor,disableCollaboration:()=>{var t;(t=e.doc)==null||t.destroy()}}),!1}}})].filter(Boolean)}});function TM(e){if(!e.length)return od.empty;let t=[],n=e[0].$from.node(0);return e.forEach(e=>{let n=e.$from.pos,r=e.$from.nodeAfter;r&&t.push(rd.node(n,n+r.nodeSize,{class:`ProseMirror-selectednoderange`}))}),od.create(n,t)}function EM(e,t,n){let r=n.isText||n.isAtom?0:1;return{start:e+r,end:e+t-r}}function DM(e,t,n,r={}){let i=[],a=e.node(0),{extendOnBoundaryOverlap:o=!0}=r;typeof n==`number`&&n>=0||(n=e.sameParent(t)?Math.max(0,e.sharedDepth(t.pos)-1):e.sharedDepth(t.pos));let s=new ei(e,t,n),c=s.depth===0?0:a.resolve(s.start).posAtIndex(0);return s.parent.forEach((n,r)=>{let l=c+r,u=l+n.nodeSize,d=EM(l,n.nodeSize,n),f=o?t.pos>=d.start&&e.pos<=d.end:t.pos>d.start&&e.pos<d.end;if(l<s.start||l>=s.end||!f)return;let p=new po(a.resolve(l),a.resolve(u));i.push(p)}),i}var OM=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 new kM(e.resolve(this.anchor),e.resolve(this.head))}},kM=class e extends F{constructor(e,t,n,r=1){let{doc:i}=e,a=e===t,o=e.pos===i.content.size&&t.pos===i.content.size,s=a&&!o?i.resolve(t.pos+(r>0?1:-1)):t,c=a&&o?i.resolve(e.pos-(r>0?1:-1)):e,l=DM(c.min(s),c.max(s),n),u=s.pos>=e.pos?l[0].$from:l[l.length-1].$to,d=s.pos>=e.pos?l[l.length-1].$to:l[0].$from;super(u,d,l),this.depth=n}get $to(){return this.ranges[this.ranges.length-1].$to}eq(t){return t instanceof e&&t.$from.pos===this.$from.pos&&t.$to.pos===this.$to.pos}map(t,n){return new e(t.resolve(n.map(this.anchor)),t.resolve(n.map(this.head)))}toJSON(){return{type:`nodeRange`,anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){let{doc:t}=this.$from;if(this.isForwards&&this.ranges.length>1){let t=this.ranges.slice(0,-1),n=t[0].$from,r=t[t.length-1].$to;return new e(n,r,this.depth)}let n=this.ranges[0],r=t.resolve(Math.max(0,n.$from.pos-1));return new e(this.$anchor,r,this.depth)}extendForwards(){let{doc:t}=this.$from;if(this.isBackwards&&this.ranges.length>1){let t=this.ranges.slice(1),n=t[0].$from,r=t[t.length-1].$to;return new e(r,n,this.depth)}let n=this.ranges[this.ranges.length-1],r=t.resolve(Math.min(t.content.size,n.$to.pos+1));return new e(this.$anchor,r,this.depth)}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n,r,i=1){return new this(e.resolve(t),e.resolve(n),r,i)}getBookmark(){return new OM(this.anchor,this.head)}};kM.prototype.visible=!1;function AM(e){return e instanceof kM}U.create({name:`nodeRange`,addOptions(){return{depth:void 0,key:`Mod`}},addKeyboardShortcuts(){return{"Shift-ArrowUp":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:a,tr:o}=r,{anchor:s,head:c}=a;if(!AM(a)){let e=kM.create(i,s,c,t,-1);return o.setSelection(e),n.dispatch(o),!0}let l=a.extendBackwards();return o.setSelection(l),n.dispatch(o),!0},"Shift-ArrowDown":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:a,tr:o}=r,{anchor:s,head:c}=a;if(!AM(a)){let e=kM.create(i,s,c,t);return o.setSelection(e),n.dispatch(o),!0}let l=a.extendForwards();return o.setSelection(l),n.dispatch(o),!0},"Mod-a":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,tr:a}=r,o=kM.create(i,0,i.content.size,t);return a.setSelection(o),n.dispatch(a),!0}}},onSelectionUpdate(){let{selection:e}=this.editor.state;AM(e)&&this.editor.view.dom.classList.add(`ProseMirror-noderangeselection`)},addProseMirrorPlugins(){let e=!1,t=!1;return[new R({key:new z(`nodeRange`),props:{attributes:()=>e?{class:`ProseMirror-noderangeselection`}:{class:``},handleDOMEvents:{mousedown:(e,n)=>{let{key:r}=this.options,i=/Mac/.test(navigator.platform),a=!!n.shiftKey,o=!!n.ctrlKey,s=!!n.altKey,c=!!n.metaKey;return(r==null||r===`Shift`&&a||r===`Control`&&o||r===`Alt`&&s||r===`Meta`&&c||r===`Mod`&&(i?c:o))&&(t=!0),t&&document.addEventListener(`mouseup`,()=>{t=!1;let{state:n}=e,{doc:r,selection:i,tr:a}=n,{$anchor:o,$head:s}=i;if(o.sameParent(s))return;let c=kM.create(r,o.pos,s.pos,this.options.depth);a.setSelection(c),e.dispatch(a)},{once:!0}),!1}},decorations:n=>{let{selection:r}=n,i=AM(r);if(e=!1,!t)return i?(e=!0,TM(r.ranges)):null;let{$from:a,$to:o}=r;if(!i&&a.sameParent(o))return null;let s=DM(a,o,this.options.depth);return s.length?(e=!0,TM(s)):null}}})]}});function jM(e,t){let n=getComputedStyle(e);if(t)return t.filter(e=>e.trim().length>0).map(e=>`${e}:${n.getPropertyValue(e)};`).join(``);let r=``;for(let e=0;e<n.length;e+=1)r+=`${n[e]}:${n.getPropertyValue(n[e])};`;return r}function MM(e,t){let n=e.cloneNode(!0),r=[e,...Array.from(e.getElementsByTagName(`*`))],i=[n,...Array.from(n.getElementsByTagName(`*`))];return r.forEach((e,n)=>{i[n].style.cssText=jM(e,t)}),n}var NM=[{id:`listItemFirstChild`,evaluate:({parent:e,isFirst:t})=>t&&e&&[`listItem`,`taskItem`].includes(e.type.name)?1e3:0},{id:`listWrapperDeprioritize`,evaluate:({node:e})=>{let t=[`listItem`,`taskItem`],n=e.firstChild;return n&&t.includes(n.type.name)?1e3:0}},{id:`tableStructure`,evaluate:({node:e,parent:t})=>[`tableRow`,`tableCell`,`tableHeader`].includes(e.type.name)||t&&t.type.name===`tableHeader`?1e3:0},{id:`inlineContent`,evaluate:({node:e})=>e.isInline||e.isText?1e3:0}],PM={edges:[`left`,`top`],threshold:12,strength:500};function FM(e){return e===void 0||e===`left`?{...PM}:e===`right`?{edges:[`right`,`top`],threshold:12,strength:500}:e===`both`?{edges:[`left`,`right`,`top`],threshold:12,strength:500}:e===`none`?{edges:[],threshold:0,strength:0}:{...PM,...e}}function IM(e,t,n){if(n.edges.length===0)return!1;let r=t.getBoundingClientRect(),{threshold:i,edges:a}=n;return a.some(t=>t===`left`?e.x-r.left<i:t===`right`?r.right-e.x<i:t===`top`?e.y-r.top<i:t===`bottom`?r.bottom-e.y<i:!1)}function LM(e,t,n,r){return!t||n.edges.length===0?0:IM(e,t,n)?n.strength*r:0}var RM=1e3;function zM(e,t,n,r){let i=RM,a=!1;if(t.every(t=>{let n=t.evaluate(e);return i-=n,i<=0?(a=!0,!1):!0}),a)return-1;let o=e.view.nodeDOM(e.pos);return i-=LM(r,o,n,e.depth),i<=0?-1:i}function BM(e,t,n){return Array.from({length:t},(e,n)=>t-1-n).some(t=>n.includes(e.node(t).type.name))}function VM(e,t,n){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))return null;let r=e.posAtCoords({left:t.x,top:t.y});if(!r)return null;let{doc:i}=e.state,a=i.resolve(r.pos),o=[];n.defaultRules&&o.push(...NM),o.push(...n.rules);let s=Array.from({length:a.depth},(e,t)=>a.depth-t).map(r=>{let i=a.node(r),s=a.before(r);if(n.allowedContainers&&r>0&&!BM(a,r,n.allowedContainers))return null;let c=r>0?a.node(r-1):null,l=r>0?a.index(r-1):0,u=c?c.childCount:1,d=zM({node:i,pos:s,depth:r,parent:c,index:l,isFirst:l===0,isLast:l===u-1,$pos:a,view:e},o,n.edgeDetection,t);return d<0?null:{node:i,pos:s,depth:r,score:d,dom:e.nodeDOM(s)}}).filter(e=>e!==null),c=a.nodeAfter;if(c&&c.isAtom&&!c.isInline){let i=r.pos,l=a.depth+1,u=a.parent,d=a.index(),f=u.childCount,p=!0;if(n.allowedContainers&&(p=BM(a,l,n.allowedContainers)),p){let r=zM({node:c,pos:i,depth:l,parent:u,index:d,isFirst:d===0,isLast:d===f-1,$pos:a,view:e},o,n.edgeDetection,t);if(r>=0){let t=e.nodeDOM(i);t&&s.push({node:c,pos:i,depth:l,score:r,dom:t})}}}if(s.length===0)return null;s.sort((e,t)=>t.score===e.score?t.depth-e.depth:t.score-e.score);let l=s[0];return l.dom?{node:l.node,pos:l.pos,dom:l.dom}:null}function HM(e,t){let n=e;for(;n?.parentElement&&n.parentElement!==t.dom;)n=n.parentElement;return n?.parentElement===t.dom?n:void 0}function UM(e){return Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&e.width>0&&e.height>0}function WM(e,t,n,r=5){if(!Number.isFinite(t)||!Number.isFinite(n))return null;let i=e.dom,a=i.firstElementChild,o=i.lastElementChild;if(!a||!o)return null;let s=a.getBoundingClientRect(),c=o.getBoundingClientRect();if(!UM(s)||!UM(c))return null;let l=Math.min(Math.max(s.top+r,n),c.bottom-r),u=.5,d=Math.abs(s.left-c.left)<u,f=Math.abs(s.right-c.right)<u,p=s;d&&f&&(p=s);let m=Math.min(Math.max(p.left+r,t),p.right-r);return!Number.isFinite(m)||!Number.isFinite(l)?null:{x:m,y:l}}var GM=e=>{let{x:t,y:n,editor:r,nestedOptions:i}=e,{view:a,state:o}=r,s=WM(a,t,n,5);if(!s)return{resultElement:null,resultNode:null,pos:null};let{x:c,y:l}=s;if(i?.enabled){let e=VM(a,{x:c,y:l},i);return e?{resultElement:e.dom,resultNode:e.node,pos:e.pos}:{resultElement:null,resultNode:null,pos:null}}let u=a.root.elementsFromPoint(c,l),d;if(Array.prototype.some.call(u,e=>{if(!a.dom.contains(e))return!1;let t=HM(e,a);return t?(d=t,!0):!1}),!d){let e=a.posAtCoords({left:c,top:l});if(e){let t=o.doc.resolve(e.pos),n=Math.min(t.depth,1),r=n>0?t.before(n):t.pos,i=o.doc.nodeAt(r);if(i){let e=a.nodeDOM(r);return{resultElement:e instanceof HTMLElement?e:null,resultNode:i,pos:r}}}return{resultElement:null,resultNode:null,pos:null}}let f;try{f=a.posAtDOM(d,0)}catch{return{resultElement:null,resultNode:null,pos:null}}let p=o.doc.nodeAt(f);if(!p){let e=o.doc.resolve(f),t=e.parent;return{resultElement:d,resultNode:t,pos:e.start()}}return{resultElement:d,resultNode:p,pos:f}};function KM(e,t){let n=e.nodeDOM(t);if(n instanceof Element&&n!==e.dom)return n;let{node:r,offset:i}=e.domAtPos(t),a=r.childNodes[i];return a instanceof Element?a:r instanceof Element?r:r.nodeType===Node.TEXT_NODE&&r.parentElement?r.parentElement:null}function qM(e,t){let n=KM(e,t);return(n?getComputedStyle(n).direction:getComputedStyle(e.dom).direction)||`ltr`}function JM(e){var t;(t=e.parentNode)==null||t.removeChild(e)}function YM(e,t){return e===`rtl`?t:0}function XM(e,t,n,r){let{doc:i}=t.view.state;if(n?.enabled&&r?.node&&r.pos>=0){let e=r.pos,t=r.pos+r.node.nodeSize;return[{$from:i.resolve(e),$to:i.resolve(t)}]}let a=GM({editor:t,x:e.clientX,y:e.clientY,direction:`right`,nestedOptions:n});if(!a.resultNode||a.pos===null)return[];let o=a.resultNode.isText||a.resultNode.isAtom?0:-1;return DM(i.resolve(a.pos),i.resolve(a.pos+a.resultNode.nodeSize+o),0,{extendOnBoundaryOverlap:!1})}function ZM(e,t,n,r,i){let{view:a}=t;if(!e.dataTransfer)return;let{empty:o,$from:s,$to:c}=a.state.selection,l=XM(e,t,n,r),u=DM(s,c,0,{extendOnBoundaryOverlap:!1}),d=u.some(e=>l.find(t=>t.$from===e.$from&&t.$to===e.$to)),f=o||!d?l:u;if(!f.length)return;let{tr:p}=a.state,m=document.createElement(`div`),h=f[0].$from.pos,g=f[f.length-1].$to.pos,_=qM(a,h);m.setAttribute(`dir`,_);let v=n?.enabled&&r?.node,y,b;v?(y=a.state.doc.slice(h,g),b=L.create(a.state.doc,h)):(b=kM.create(a.state.doc,h,g),y=b.content()),f.forEach(e=>{let t=KM(a,e.$from.pos);if(!t)return;let n=MM(t,i);n.style.margin=`0`,m.append(n)}),m.style.position=`absolute`,m.style.top=`-10000px`,document.body.append(m),e.dataTransfer.clearData();let x=YM(_,m.getBoundingClientRect().width);e.dataTransfer.setDragImage(m,x,0);let S=!1,C=()=>{S||(S=!0,JM(m),document.removeEventListener(`drop`,C),document.removeEventListener(`dragend`,C))},w=b instanceof L?b:void 0;a.dragging={slice:y,move:!0,node:w},p.setSelection(b),a.dispatch(p),document.addEventListener(`drop`,C),document.addEventListener(`dragend`,C)}var QM=(e,t)=>{let n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1},$M=(e,t)=>{let n=e.nodeAt(t),r=e.resolve(t),{depth:i}=r,a=n;for(;i>0;){let e=r.node(i);--i,i===0&&(a=e)}return a},eN=(e,t)=>{let n=Mj.getState(e);return n?dM(t,n.type,n.binding.mapping):null},tN=(e,t)=>{let n=Mj.getState(e);return n?pM(n.doc,n.type,t,n.binding.mapping)||0:-1},nN=(e,t)=>{let n=t;for(;n?.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n},rN=new z(`dragHandle`),iN=({pluginKey:e=rN,element:t,editor:n,computePositionConfig:r,getReferencedVirtualElement:i,onNodeChange:a,onElementDragStart:o,onElementDragEnd:s,nestedOptions:c,dragImageProperties:l})=>{let u=document.createElement(`div`),d=!1,f=null,p=-1,m,h=null,g=null;function _(){t&&(t.style.visibility=`hidden`,t.style.pointerEvents=`none`)}function v(){if(t){if(!n.isEditable){_();return}t.style.visibility=``,t.style.pointerEvents=`auto`}}function y(e){Fe(i?.()||{getBoundingClientRect:()=>e.getBoundingClientRect()},t,r).then(e=>{Object.assign(t.style,{position:e.strategy,left:`${e.x}px`,top:`${e.y}px`})})}function b(e){o?.(e),ZM(e,n,c,{node:f,pos:p},l),t&&(t.dataset.dragging=`true`),setTimeout(()=>{t&&(t.style.pointerEvents=`none`)},0)}function x(e){s?.(e),_(),t&&(t.style.pointerEvents=`auto`,t.dataset.dragging=`false`)}function S(){if(Rh()){let e=n.view.dom;requestAnimationFrame(()=>{e.isContentEditable&&(e.contentEditable=`false`,e.contentEditable=`true`)})}}return u.appendChild(t),{unbind(){t.removeEventListener(`dragstart`,b),t.removeEventListener(`dragend`,x),document.removeEventListener(`drop`,S),h&&(cancelAnimationFrame(h),h=null,g=null)},plugin:new R({key:typeof e==`string`?new z(e):e,state:{init(){return{locked:!1}},apply(e,r,i,o){let s=e.getMeta(`lockDragHandle`),c=e.getMeta(`hideDragHandle`);if(s!==void 0&&(d=s),c)return _(),d=!1,f=null,p=-1,a?.({editor:n,node:null,pos:-1}),r;if(e.docChanged&&p!==-1&&t)if(yM(e)){let e=tN(o,m);e!==p&&(p=e)}else{let t=e.mapping.map(p);t!==p&&(p=t,m=eN(o,p))}return r}},view:e=>{var r;return t.draggable=!0,t.style.pointerEvents=`auto`,t.dataset.dragging=`false`,(r=n.view.dom.parentElement)==null||r.appendChild(u),u.style.pointerEvents=`none`,u.style.position=`absolute`,u.style.top=`0`,u.style.left=`0`,t.addEventListener(`dragstart`,b),t.addEventListener(`dragend`,x),document.addEventListener(`drop`,S),{update(r,i){if(!t)return;if(!n.isEditable){_();return}if(d?t.draggable=!1:t.draggable=!0,e.state.doc.eq(i.doc)||p===-1)return;let o=e.nodeDOM(p);if(o=nN(e,o),o===e.dom||o?.nodeType!==1)return;let s=e.posAtDOM(o,0),c=$M(n.state.doc,s),l=QM(n.state.doc,s);f=c,p=l,m=eN(e.state,p),a?.({editor:n,node:f,pos:p}),y(o)},destroy(){t.removeEventListener(`dragstart`,b),t.removeEventListener(`dragend`,x),document.removeEventListener(`drop`,S),h&&(cancelAnimationFrame(h),h=null,g=null),t&&JM(u)}}},props:{handleDOMEvents:{keydown(e){return!t||d?!1:e.hasFocus()?(_(),f=null,p=-1,a?.({editor:n,node:null,pos:-1}),!1):!1},mouseleave(e,t){return d||t.target&&!u.contains(t.relatedTarget)&&(_(),f=null,p=-1,a?.({editor:n,node:null,pos:-1})),!1},mousemove(e,r){return!t||d||(g={x:r.clientX,y:r.clientY},h)||(h=requestAnimationFrame(()=>{if(h=null,!g)return;let{x:t,y:r}=g;g=null;let i=GM({x:t,y:r,direction:`right`,editor:n,nestedOptions:c});if(!i.resultElement)return;let o=i.resultElement,s=i.resultNode,l=i.pos;if(!c?.enabled){if(o=nN(e,o),o===e.dom||o?.nodeType!==1)return;let t=e.posAtDOM(o,0);s=$M(n.state.doc,t),l=QM(n.state.doc,t)}s!==f&&(f=s,p=l??-1,m=eN(e.state,p),a?.({editor:n,node:f,pos:p}),y(o),v())})),!1}}}})}};function aN(e){return e===!1||e===void 0?{enabled:!1,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:FM(`none`)}:e===!0?{enabled:!0,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:FM(`left`)}:{enabled:!0,rules:e.rules??[],defaultRules:e.defaultRules??!0,allowedContainers:e.allowedContainers,edgeDetection:FM(e.edgeDetection)}}var oN={placement:`left-start`,strategy:`absolute`};U.create({name:`dragHandle`,addOptions(){return{render(){let e=document.createElement(`div`);return e.classList.add(`drag-handle`),e},computePositionConfig:{},locked:!1,onNodeChange:()=>null,onElementDragStart:void 0,onElementDragEnd:void 0,nested:!1,dragImageProperties:void 0}},addCommands(){return{lockDragHandle:()=>({editor:e})=>(this.options.locked=!0,e.commands.setMeta(`lockDragHandle`,this.options.locked)),unlockDragHandle:()=>({editor:e})=>(this.options.locked=!1,e.commands.setMeta(`lockDragHandle`,this.options.locked)),toggleDragHandle:()=>({editor:e})=>(this.options.locked=!this.options.locked,e.commands.setMeta(`lockDragHandle`,this.options.locked))}},addProseMirrorPlugins(){let e=this.options.render(),t=aN(this.options.nested);return[iN({computePositionConfig:{...oN,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:e,editor:this.editor,onNodeChange:this.options.onNodeChange,onElementDragStart:this.options.onElementDragStart,onElementDragEnd:this.options.onElementDragEnd,nestedOptions:t,dragImageProperties:this.options.dragImageProperties}).plugin]}});var sN=S({name:`DragHandleVue`,props:{pluginKey:{type:[String,Object],default:rN},editor:{type:Object,required:!0},computePositionConfig:{type:Object,default:()=>({})},onNodeChange:{type:Function,default:null},onElementDragStart:{type:Function,default:null},onElementDragEnd:{type:Function,default:null},class:{type:String,default:`drag-handle`},nested:{type:[Boolean,Object],default:!1}},setup(e,{slots:t}){let n=A(null),r=ee(null),i=()=>{let{editor:t,pluginKey:i,onNodeChange:a,onElementDragEnd:o,onElementDragStart:s,computePositionConfig:c,nested:l}=e;if(!n.value||!e.editor||e.editor.isDestroyed)return;n.value.style.visibility=`hidden`;let u=aN(l),d=iN({editor:t,element:n.value,pluginKey:i,computePositionConfig:{...oN,...c},onNodeChange:a,onElementDragStart:s,onElementDragEnd:o,nestedOptions:u});r.value=d,e.editor.registerPlugin(d.plugin)},a=()=>{var t,n;r.value&&=(e.editor&&!e.editor.isDestroyed&&e.editor.unregisterPlugin(e.pluginKey),(n=(t=r.value).unbind)==null||n.call(t),null)};return u(async()=>{await d(),i()}),me(()=>e.nested,()=>{a(),i()},{deep:!0}),E(()=>{a()}),()=>h(`div`,{ref:n,class:e.class,style:{position:`absolute`},"data-dragging":`false`},t.default?.call(t))}}),cN={slots:{root:`hidden sm:flex items-center justify-center transition-all duration-200 ease-out`,handle:`cursor-grab px-1`}},lN=Object.assign({inheritAttrs:!1},{__name:`EditorDragHandle`,props:{icon:{type:null,required:!1},color:{type:null,required:!1,default:`neutral`},variant:{type:null,required:!1,default:`ghost`},options:{type:Object,required:!1},editor:{type:Object,required:!0},ui:{type:Object,required:!1},pluginKey:{type:[Object,String],required:!1},nestedOptions:{type:Object,required:!1},onElementDragStart:{type:Function,required:!1},onElementDragEnd:{type:Function,required:!1},getReferencedVirtualElement:{type:Function,required:!1},dragImageProperties:{type:Array,required:!1},nested:{type:[Boolean,Object],required:!1},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1,default:`sm`},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},class:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},emits:[`nodeChange`,`hover`],setup(e,{emit:n}){let r=e,i=n,a=Ge(`editorDragHandle`,r),s=qe(ve(a,`pluginKey`,`nested`,`nestedOptions`,`onElementDragEnd`,`onElementDragStart`,`getReferencedVirtualElement`)),l=qe(he(a,`icon`,`options`,`editor`,`pluginKey`,`nested`,`nestedOptions`,`onElementDragEnd`,`onElementDragStart`,`getReferencedVirtualElement`,`class`,`ui`)),u=t(),d=c(()=>et({extend:et(cN),...u.ui?.editorDragHandle||{}})()),f=c(()=>o(a.options,{strategy:`absolute`,placement:`left-start`,offset:({rects:e})=>{let t=e.reference.height,n=e.floating.height;return t>40?{alignmentAxis:0,mainAxis:8}:{alignmentAxis:(t-n)/2,mainAxis:8}},flip:{},shift:{},size:!1,autoPlacement:!1,hide:!1,inline:!1})),p=c(()=>YS(f.value)),h=c(()=>({placement:f.value.placement,strategy:f.value.strategy,middleware:p.value})),g=A();function _({pos:e}){if(g.value=e,e==null||e<0)return;let t=a.editor.state.doc.nodeAt(e);t&&i(`hover`,{node:t.toJSON(),pos:e})}function v(){if(!a.editor)return;let e=g.value;if(e==null||e<0)return;let t=a.editor.state.doc.nodeAt(e);if(t){let n={node:t.toJSON(),pos:e};return i(`nodeChange`,n),a.editor.chain().setNodeSelection(e).run(),n}}return(e,t)=>(m(),x(b(sN),T(b(s),{"compute-position-config":h.value,editor:b(a).editor,"on-node-change":_,"data-slot":`root`,class:d.value.root({class:[b(a).ui?.root,b(a).class]}),onClick:v}),{default:k(()=>[D(e.$slots,`default`,{ui:d.value,onClick:v},()=>[y(Ze,T({...b(l),icon:b(a).icon||b(u).ui.icons.drag,...e.$attrs},{"data-slot":`handle`,class:d.value.handle({class:[b(a).ui?.handle,b(a).class]}),ui:b(be)(d.value,b(a).ui)}),null,16,[`class`,`ui`])])]),_:3},16,[`compute-position-config`,`editor`,`class`]))}});export{kt as S,Cr as _,YS as a,mr as b,kS as c,ug as d,Yh as f,Tr as g,Ar as h,ZS as i,NS as l,z as m,FC as n,qS as o,H as p,NC as r,JS as s,lN as t,jS as u,nr as v,yr as x,vr as y};